Example #1
0
        public void InitiateSingleHeadQuadType()
        {
            try
            {
                IsLACCModuleInitiate = false;

                var pmtOrderInfo = new LACC_Module.ModulePMTOrderInfo {
                    IsOrderChange = false, Order = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }
                };

                double   offset  = 0.083;
                double[] xOffset = new double[] { -offset, +offset, -offset, +offset };
                double[] yOffset = new double[] { -offset, -offset, +offset, +offset };
                double   offsetZ = -(0.251 + (31.5 - 21.5) / 1000);
                Debug.WriteLine("Making Scatter Module");
                VMStatus = "Making Scatter Module";
                for (int i = 0; i < 4; ++i)
                {
                    var scatterGain     = LACC_Module.LoadGain(Path.Combine(LUTFolderDirectory, $"GainCorrectionMatrix_447278_scatter_{i + 1}.csv"));
                    var scatterMlpeGain = LACC_Module.LoadGain(Path.Combine(LUTFolderDirectory, $"GainCorrectionMatrix_447278_scatter_{i + 1}.csv"));
                    ModuleInfoViewModels[i] = new ModuleInfoViewModel(ModuleInfo.QuadSingleHead,
                                                                      new LACC_Module.ModuleOffset {
                        x = T265ToLACCOffset.X + xOffset[i], y = T265ToLACCOffset.Y + yOffset[i], z = T265ToLACCOffset.Z
                    },
                                                                      new LACC_Module.EcalVar {
                        a = 0, b = 1, c = 0
                    },
                                                                      scatterGain,
                                                                      scatterMlpeGain,
                                                                      pmtOrderInfo,
                                                                      Path.Combine(LUTFolderDirectory, $"LUT9chEXP_447278_{i + 1}_20210610_1mm_step2.csv"));
                }

                Debug.WriteLine("Making Abosrober Module");
                VMStatus = "Making Absorber Module";
                for (int i = 0; i < 4; ++i)
                {
                    var absorberGain = LACC_Module.LoadGain(Path.Combine(LUTFolderDirectory, $"EnergyGainCorrectionMatrix_absorber_{i + 1}.csv"));
                    ModuleInfoViewModels[i + 8] = new ModuleInfoViewModel(ModuleInfo.QuadSingleHead,
                                                                          new LACC_Module.ModuleOffset {
                        x = T265ToLACCOffset.X + xOffset[i], y = T265ToLACCOffset.Y + yOffset[i], z = T265ToLACCOffset.Z + offsetZ
                    },
                                                                          new LACC_Module.EcalVar {
                        a = 0, b = 1, c = 0
                    },
                                                                          absorberGain,
                                                                          absorberGain,
                                                                          pmtOrderInfo,
                                                                          Path.Combine(LUTFolderDirectory, $"LUT9chEXP_447279_{ i + 1 }_20210329_1mm_step2.csv"));
                }
                LACC_Control_Static = new LACC_Control(new LACC_Module[] { ModuleInfoViewModels[0].Module, ModuleInfoViewModels[1].Module, ModuleInfoViewModels[2].Module, ModuleInfoViewModels[3].Module },
                                                       new LACC_Module[] { ModuleInfoViewModels[8].Module, ModuleInfoViewModels[9].Module, ModuleInfoViewModels[10].Module, ModuleInfoViewModels[11].Module });
                IsLACCModuleInitiate = true;
                initiating           = false;

                VMStatus = "Initiate LAHGI Quad Single head Success!";
            }
            catch
            {
                VMStatus = "Initiate LAHGI Quad Single head Failed";
            }
        }
Example #2
0
        public void InitiateMonoType()
        {
            if (ModuleInfoViewModels[0].IsModuleSet && ModuleInfoViewModels[8].IsModuleSet)
            {
                LACC_Control_Static  = new LACC_Control(ModuleInfoViewModels[0].Module, ModuleInfoViewModels[8].Module);
                IsLACCModuleInitiate = true;
                initiating           = false;
                return;
            }

            var pmtOrderInfo = new LACC_Module.ModulePMTOrderInfo {
                IsOrderChange = true, Order = new int[] { 0, 18, 1, 19, 2, 20, 11, 29, 10, 28, 9, 27, 3, 21, 4, 22, 5, 23, 14, 32, 13, 31, 12, 30, 6, 24, 7, 25, 8, 26, 17, 35, 16, 34, 15, 33 }
            };
            var scatterGain = new double[37]  {
                0.222287552011680,
                0.208847009962622,
                0.160835530297629,
                0.350623925414967,
                0.404254384165359,
                0.173114587164014,
                0.251973705604810,
                0.287514444819041,
                0.197784900587933,
                0.113205828176507,
                0.270750509096893,
                0.324814715062910,
                0.159132032020835,
                0.179033913500545,
                0.177842115156326,
                0.108344401828327,
                0.122989511991333,
                0.333935336242705,
                0.256168970319604,
                0.115470302451087,
                0.107632624571028,
                0.343022471533058,
                0.129540635721655,
                0.184271389706723,
                0.154867557833026,
                0.183742374044755,
                0.235758007303454,
                0.183618330027555,
                0.149858076110482,
                0.404494624248347,
                0.452139539299007,
                0.304594382211978,
                0.243182810827749,
                0.343234564555548,
                0.220940431055765,
                0.370428100393800,
                -19.3920305409253
            };
            var absorberGain = new double[37] {
                0.547118426,
                0.423998687,
                0.426206901,
                0.408303161,
                0.410912616,
                0.557610406,
                0.444274915,
                0.513597437,
                0.371204235,
                0.279542663,
                0.355811448,
                0.405420482,
                0.346096898,
                0.358584417,
                0.439085018,
                0.381797553,
                0.324406816,
                0.486858039,
                0.604246889,
                0.357470801,
                0.473510762,
                0.437615232,
                0.289740831,
                0.200805523,
                0.57044647,
                0.383966989,
                0.322863322,
                0.3249445,
                0.329417575,
                0.743689349,
                0.485597352,
                0.733393991,
                0.453444903,
                0.433348959,
                0.754890154,
                0.5538563,
                -0.430917509
            };

            Debug.WriteLine("Making Scatter Module");
            VMStatus = "Making Scatter Module";
            ModuleInfoViewModels[0] = new ModuleInfoViewModel(ModuleInfo.Mono,
                                                              new LACC_Module.ModuleOffset {
                x = -T265ToLACCOffset.X, y = -T265ToLACCOffset.Y, z = -T265ToLACCOffset.Z
            },
                                                              new LACC_Module.EcalVar {
                a = 0, b = 1, c = 0
            },
                                                              scatterGain,
                                                              scatterGain,
                                                              pmtOrderInfo,
                                                              Path.Combine(LUTFolderDirectory, "MonoScatterLUT.csv"));

            Debug.WriteLine("Making Abosrober Module");
            VMStatus = "Making Absorber Module";
            ModuleInfoViewModels[8] = new ModuleInfoViewModel(ModuleInfo.Mono,
                                                              new LACC_Module.ModuleOffset {
                x = -T265ToLACCOffset.X, y = -T265ToLACCOffset.Y, z = -T265ToLACCOffset.Z - 0.25
            },
                                                              new LACC_Module.EcalVar {
                a = 0, b = 1, c = 0
            },
                                                              absorberGain,
                                                              absorberGain,
                                                              pmtOrderInfo,
                                                              Path.Combine(LUTFolderDirectory, "MonoAbsorberLUT.csv"));

            if (!ModuleInfoViewModels[0].IsModuleSet || !ModuleInfoViewModels[8].IsModuleSet)
            {
                LACC_Control_Static  = new LACC_Control(ModuleInfoViewModels[0].Module, ModuleInfoViewModels[8].Module);
                IsLACCModuleInitiate = false;
                initiating           = false;
                VMStatus             = "Mono-Type Module Setting Failed";
                return;
            }

            LACC_Control_Static  = new LACC_Control(ModuleInfoViewModels[0].Module, ModuleInfoViewModels[8].Module);
            IsLACCModuleInitiate = true;
            initiating           = false;

            VMStatus = "Initiate LACC Done";
        }