File indexing completed on 2025-08-05 08:20:34
0001 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
0002 #include <fun4all/Fun4AllServer.h>
0003 #include <fun4all/Fun4AllDstOutputManager.h>
0004 #include <fun4all/Fun4AllInputManager.h>
0005
0006 #include <fun4allraw/Fun4AllPrdfInputManager.h>
0007
0008 #include <phool/recoConsts.h>
0009
0010 #include <prototype2/CaloCalibration.h>
0011 #include <prototype2/CaloUnpackPRDF.h>
0012 #include <prototype2/GenericUnpackPRDF.h>
0013 #include <prototype2/PROTOTYPE2_FEM.h>
0014 #include <prototype2/Prototype2DSTReader.h>
0015 #include <prototype2/RunInfoUnpackPRDF.h>
0016 #include <prototype2/TempInfoUnpackPRDF.h>
0017
0018 R__LOAD_LIBRARY(libfun4allraw.so)
0019 R__LOAD_LIBRARY(libPrototype2.so)
0020 #endif
0021
0022 void
0023 Fun4All_TestBeam(int nEvents = 100,
0024 const char *input_file = "/sphenix/data/data01/t1044-2016a/fnal/beam/beam_00002609-0000.prdf",
0025 const char *output_file = "beam_00002609.root")
0026 {
0027 gSystem->Load("libPrototype2.so");
0028
0029 Fun4AllServer *se = Fun4AllServer::instance();
0030 se->Verbosity(Fun4AllServer::VERBOSITY_SOME);
0031
0032 recoConsts *rc = recoConsts::instance();
0033
0034
0035
0036 RunInfoUnpackPRDF *unpack_run = new RunInfoUnpackPRDF();
0037
0038
0039 int i_offset = 0;
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 i_offset = 0;
0055 unpack_run->add_channel("beam_MTNRG_GeV", 911, i_offset++, 1e-4);
0056 unpack_run->add_channel("beam_MT6SC1_Cnts", 911, i_offset++, 1e-4);
0057 unpack_run->add_channel("beam_MT6SC2_Cnts", 911, i_offset++, 1e-4);
0058 unpack_run->add_channel("beam_MT6SC3_Cnts", 911, i_offset++, 1e-4);
0059 unpack_run->add_channel("beam_MT6SC4_Cnts", 911, i_offset++, 1e-4);
0060 unpack_run->add_channel("beam_MT6SC5_Cnts", 911, i_offset++, 1e-4);
0061 unpack_run->add_channel("beam_2CH_mm", 911, i_offset++, 1e-4);
0062 unpack_run->add_channel("beam_2CV_mm", 911, i_offset++, 1e-4);
0063 unpack_run->add_channel("beam_2CMT6T_F", 911, i_offset++, 1e-4);
0064 unpack_run->add_channel("beam_2CMT6H_RH", 911, i_offset++, 1e-4);
0065 unpack_run->add_channel("beam_MT5CP2_Psia", 911, i_offset++, 1e-4);
0066 unpack_run->add_channel("beam_MT6CP2_Psia", 911, i_offset++, 1e-4);
0067
0068
0069 unpack_run->add_channel("EMCAL_A0_HighGain", 984, 0, 1);
0070
0071
0072 unpack_run->add_channel("EMCAL_GR0_BiasOffset_Tower21", 983, 21-1, 1);
0073
0074
0075 unpack_run->add_channel("EMCAL_T0_Tower21", 982, 21-1, 1e-3);
0076
0077 se->registerSubsystem(unpack_run);
0078
0079
0080 TempInfoUnpackPRDF *unpack_temp = new TempInfoUnpackPRDF();
0081 unpack_temp->Verbosity(RunInfoUnpackPRDF::VERBOSITY_SOME);
0082 se->registerSubsystem(unpack_temp);
0083
0084
0085 SubsysReco *unpack = new CaloUnpackPRDF();
0086
0087 se->registerSubsystem(unpack);
0088
0089 CaloCalibration *calib = new CaloCalibration("CEMC");
0090 calib->GetCalibrationParameters().ReadFromFile("CEMC","xml",0,0,
0091 string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/"));
0092 se->registerSubsystem(calib);
0093
0094 calib = new CaloCalibration("HCALIN");
0095 calib->set_calib_tower_node_prefix("CALIB_LG");
0096 calib->set_raw_tower_node_prefix("RAW_LG");
0097 calib->GetCalibrationParameters().set_name("hcalin_lg");
0098 calib->GetCalibrationParameters().ReadFromFile("hcalin_lg", "xml",0,0,
0099 string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/"));
0100 se->registerSubsystem(calib);
0101
0102 calib = new CaloCalibration("HCALIN");
0103 calib->set_calib_tower_node_prefix("CALIB_HG");
0104 calib->set_raw_tower_node_prefix("RAW_HG");
0105 calib->GetCalibrationParameters().set_name("hcalin_hg");
0106 calib->GetCalibrationParameters().ReadFromFile("hcalin_hg", "xml",0,0,
0107 string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/"));
0108 se->registerSubsystem(calib);
0109
0110 calib = new CaloCalibration("HCALOUT");
0111 calib->set_calib_tower_node_prefix("CALIB_LG");
0112 calib->set_raw_tower_node_prefix("RAW_LG");
0113 calib->GetCalibrationParameters().set_name("hcalout_lg");
0114 calib->GetCalibrationParameters().ReadFromFile("hcalout_lg", "xml",0,0,
0115 string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/"));
0116 se->registerSubsystem(calib);
0117
0118 calib = new CaloCalibration("HCALOUT");
0119 calib->set_calib_tower_node_prefix("CALIB_HG");
0120 calib->set_raw_tower_node_prefix("RAW_HG");
0121 calib->GetCalibrationParameters().set_name("hcalout_hg");
0122 calib->GetCalibrationParameters().ReadFromFile("hcalout_hg", "xml",0,0,
0123 string(getenv("CALIBRATIONROOT")) + string("/Prototype2/Calibration/"));
0124 se->registerSubsystem(calib);
0125
0126
0127
0128 const int first_packet_id = PROTOTYPE2_FEM::PACKET_ID;
0129 const int second_packet_id = 21102;
0130
0131 const int N_hodo = 8;
0132
0133 GenericUnpackPRDF *gunpack = new GenericUnpackPRDF("HODO_VERTICAL");
0134 for (int i = 0; i < N_hodo; ++i)
0135 gunpack->add_channel(first_packet_id, 104 + i, i);
0136 se->registerSubsystem(gunpack);
0137
0138 gunpack = new GenericUnpackPRDF("HODO_HORIZONTAL");
0139 for (int i = 0; i < N_hodo; ++i)
0140 gunpack->add_channel(first_packet_id, 96 + i, i);
0141 se->registerSubsystem(gunpack);
0142
0143 calib = new CaloCalibration("HODO_VERTICAL");
0144 calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1);
0145
0146 for (int i = 0; i < N_hodo; ++i)
0147 calib->GetCalibrationParameters().set_double_param(
0148 Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1));
0149 se->registerSubsystem(calib);
0150
0151 calib = new CaloCalibration("HODO_HORIZONTAL");
0152 calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1);
0153
0154 for (int i = 0; i < N_hodo; ++i)
0155 calib->GetCalibrationParameters().set_double_param(
0156 Form("calib_const_column0_row%d", i), ((i % 2 > 0) ? -1 : +1));
0157 se->registerSubsystem(calib);
0158
0159
0160
0161 gunpack = new GenericUnpackPRDF("C1");
0162
0163 gunpack->add_channel(second_packet_id, 24, 0);
0164 se->registerSubsystem(gunpack);
0165
0166 calib = new CaloCalibration("C1");
0167 se->registerSubsystem(calib);
0168
0169
0170 gunpack = new GenericUnpackPRDF("C2");
0171
0172 gunpack->add_channel(second_packet_id, 25, 0);
0173 gunpack->add_channel(second_packet_id, 26, 1);
0174 gunpack->add_channel(second_packet_id, 22, 10);
0175 gunpack->add_channel(second_packet_id, 23, 11);
0176 se->registerSubsystem(gunpack);
0177
0178 calib = new CaloCalibration("C2");
0179 calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1);
0180 calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1);
0181 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", +1);
0182 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", -1);
0183 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row10", -1);
0184 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row11", +1);
0185 se->registerSubsystem(calib);
0186
0187
0188 gunpack = new GenericUnpackPRDF("HCAL_SCINT");
0189
0190 gunpack->add_channel(second_packet_id, 19, 1);
0191 gunpack->add_channel(second_packet_id, 20, 2);
0192 gunpack->add_channel(second_packet_id, 21, 3);
0193 se->registerSubsystem(gunpack);
0194
0195 calib = new CaloCalibration("HCAL_SCINT");
0196 se->registerSubsystem(calib);
0197
0198 gunpack = new GenericUnpackPRDF("PbGL");
0199
0200 gunpack->add_channel(second_packet_id, 0, 0);
0201 se->registerSubsystem(gunpack);
0202
0203 calib = new CaloCalibration("PbGL");
0204 se->registerSubsystem(calib);
0205
0206 gunpack = new GenericUnpackPRDF("TRIGGER_VETO");
0207
0208 gunpack->add_channel(second_packet_id, 28, 0);
0209 gunpack->add_channel(second_packet_id, 29, 1);
0210 gunpack->add_channel(second_packet_id, 30, 2);
0211 gunpack->add_channel(second_packet_id, 31, 3);
0212 se->registerSubsystem(gunpack);
0213
0214
0215 calib = new CaloCalibration("TRIGGER_VETO");
0216 calib->GetCalibrationParameters().set_double_param("calib_const_scale", 1);
0217 calib->GetCalibrationParameters().set_int_param("use_chan_calibration", 1);
0218 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row0", -1./29.4155);
0219 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row1", +1./91);
0220 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row2", -1./31.3981);
0221 calib->GetCalibrationParameters().set_double_param("calib_const_column0_row3", +1./1.43839e+02);
0222 se->registerSubsystem(calib);
0223
0224 const int N_TileMapper = 16;
0225
0226 gunpack = new GenericUnpackPRDF("TILE_MAPPER");
0227 for (int i = 0; i < N_TileMapper; ++i)
0228 gunpack->add_channel(second_packet_id, 32 + i, i);
0229 se->registerSubsystem(gunpack);
0230
0231 calib = new CaloCalibration("TILE_MAPPER");
0232 se->registerSubsystem(calib);
0233
0234
0235
0236 Fun4AllOutputManager *out_Manager = new Fun4AllDstOutputManager("DSTOUT",output_file);
0237 se->registerOutputManager(out_Manager);
0238
0239
0240 Prototype2DSTReader *reader = new Prototype2DSTReader(
0241 string(output_file) + string("_DSTReader.root"));
0242
0243 reader->AddRunInfo("beam_MTNRG_GeV");
0244 reader->AddRunInfo("beam_2CH_mm");
0245 reader->AddRunInfo("beam_2CV_mm");
0246 reader->AddRunInfo("EMCAL_A0_HighGain");
0247 reader->AddRunInfo("EMCAL_GR0_BiasOffset_Tower21");
0248 reader->AddRunInfo("EMCAL_T0_Tower21");
0249
0250 reader->AddTower("RAW_LG_HCALIN");
0251 reader->AddTower("RAW_HG_HCALIN");
0252 reader->AddTower("RAW_LG_HCALOUT");
0253 reader->AddTower("RAW_HG_HCALOUT");
0254
0255 reader->AddTower("CALIB_LG_HCALIN");
0256 reader->AddTower("CALIB_HG_HCALIN");
0257 reader->AddTower("CALIB_LG_HCALOUT");
0258 reader->AddTower("CALIB_HG_HCALOUT");
0259
0260 reader->AddTower("RAW_CEMC");
0261 reader->AddTower("CALIB_CEMC");
0262
0263 reader->AddTower("RAW_HODO_VERTICAL");
0264 reader->AddTower("RAW_HODO_HORIZONTAL");
0265 reader->AddTower("CALIB_HODO_VERTICAL");
0266 reader->AddTower("CALIB_HODO_HORIZONTAL");
0267
0268 reader->AddTower("RAW_C1");
0269 reader->AddTower("CALIB_C1");
0270
0271 reader->AddTower("RAW_C2");
0272 reader->AddTower("CALIB_C2");
0273
0274 reader->AddTower("RAW_HCAL_SCINT");
0275 reader->AddTower("CALIB_HCAL_SCINT");
0276
0277 reader->AddTower("RAW_PbGL");
0278 reader->AddTower("CALIB_PbGL");
0279
0280 reader->AddTower("RAW_TRIGGER_VETO");
0281 reader->AddTower("CALIB_TRIGGER_VETO");
0282
0283 reader->AddTower("RAW_TILE_MAPPER");
0284 reader->AddTower("CALIB_TILE_MAPPER");
0285
0286 reader->AddTowerTemperature("HCALIN");
0287 reader->AddTowerTemperature("HCALIN");
0288 reader->AddTowerTemperature("HCALOUT");
0289
0290 se->registerSubsystem(reader);
0291
0292 Fun4AllInputManager *in = new Fun4AllPrdfInputManager("PRDFin");
0293 in->fileopen(input_file);
0294 se->registerInputManager(in);
0295
0296 se->run(nEvents);
0297
0298 se->End();
0299
0300 }