File indexing completed on 2025-12-16 09:18:07
0001
0002 #include <fun4all/Fun4AllServer.h>
0003 #include <fun4all/Fun4AllDstInputManager.h>
0004
0005 #include <GlobalVariables.C>
0006
0007
0008 #include <G4Setup_sPHENIX_macro.C>
0009
0010
0011
0012
0013
0014
0015 #include <G4_Input.C>
0016
0017
0018
0019
0020
0021
0022 #include <Trkr_RecoInit.C>
0023 #include <Trkr_Clustering.C>
0024 #include <Trkr_LaserClustering.C>
0025 #include <Trkr_Reco.C>
0026 #include <Trkr_Eval.C>
0027 #include <G4_ActsGeom.C>
0028
0029
0030
0031
0032
0033
0034 #include <ffamodules/FlagHandler.h>
0035 #include <ffamodules/HeadReco.h>
0036 #include <ffamodules/SyncReco.h>
0037 #include <ffamodules/CDBInterface.h>
0038
0039 #include <fun4all/Fun4AllDstOutputManager.h>
0040 #include <fun4all/Fun4AllOutputManager.h>
0041 #include <fun4all/Fun4AllServer.h>
0042
0043 #include <phool/PHRandomSeed.h>
0044 #include <phool/recoConsts.h>
0045
0046 #include <iostream>
0047 #include <typeinfo>
0048
0049 R__LOAD_LIBRARY(libfun4all.so)
0050
0051
0052 #include <tutorial/tutorial.h>
0053 #include <tutorial/TruthToSvtxTrack.h>
0054 R__LOAD_LIBRARY( libtutorial.so )
0055
0056 #include <caloreco/CaloGeomMappingv2.h>
0057 #include <calogeomtest/CaloGeomTest.h>
0058 R__LOAD_LIBRARY(libcalo_reco.so)
0059 R__LOAD_LIBRARY(libcalogeomtest.so)
0060
0061 void Fun4All_physiTuto(
0062 int nEvents = 3,
0063 const double particle_pT = 5.0,
0064 const double energy_range_up = 0.0,
0065 const double energy_range_down = 0.0,
0066 const string particle_species = "Electron",
0067 const string &output_directory = "/sphenix/user/jzhang1/INTT-EMCAL/InttSeedingTrackDev/ParticleGen/output/",
0068 const string &output_filename = "results_test.root"
0069 )
0070 {
0071 std::cout << "CEMC_Clusters function is located at: " << (void*) CEMC_Clusters << std::endl;
0072
0073 const int skip = 0;
0074 const bool is_pythia = false;
0075 const int Nparticle = 1;
0076
0077
0078 map<string, string> particle_map = {
0079 {"MuonPlus", "mu+"},
0080 {"Muon", "mu-"},
0081 {"PionMinus", "pi-"},
0082 {"PionPlus", "pi+"},
0083 {"Electron", "e-"},
0084 {"Positron", "e+"}
0085
0086
0087 };
0088
0089 if (particle_map.find(particle_species) == particle_map.end())
0090 {
0091 cout << "Invalid particle species: " << particle_species << endl;
0092 return;
0093 }
0094
0095 Fun4AllServer *se = Fun4AllServer::instance();
0096
0097 se->Verbosity(0);
0098
0099
0100
0101
0102
0103 recoConsts *rc = recoConsts::instance();
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117 Input::PYTHIA8 = is_pythia;
0118 Input::GUN = !( is_pythia );
0119 Input::SIMPLE = true;
0120 if( Input::PYTHIA8 == false )
0121 {
0122 Input::GUN_NUMBER = 1;
0123 Input::GUN_VERBOSITY = 1;
0124 }
0125
0126
0127 InputInit();
0128
0129
0130
0131
0132
0133
0134
0135 if (Input::PYTHIA8)
0136 {
0137
0138 Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia8);
0139 }
0140 else
0141 {
0142
0143
0144
0145
0146
0147
0148 INPUTGENERATOR::SimpleEventGenerator[0] -> add_particles(particle_map[particle_species.c_str()], Nparticle );
0149
0150 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vtx(0, 0, 0);
0151 INPUTGENERATOR::SimpleEventGenerator[0] -> set_pt_range(particle_pT - energy_range_down, particle_pT + energy_range_up);
0152
0153 INPUTGENERATOR::SimpleEventGenerator[0] -> set_eta_range(-1.1, 1.1);
0154
0155 INPUTGENERATOR::SimpleEventGenerator[0] -> set_phi_range(-M_PI, M_PI);
0156 }
0157
0158
0159
0160 InputRegister();
0161
0162
0163
0164
0165 FlagHandler *flag = new FlagHandler();
0166 se->registerSubsystem(flag);
0167
0168
0169
0170
0171
0172
0173 Enable::DSTOUT_COMPRESS = false;
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187 Enable::QA = false;
0188
0189 Enable::PIPE = true;
0190 Enable::PIPE_ABSORBER = true;
0191
0192
0193 Enable::MVTX = true;
0194 Enable::MVTX_CELL = Enable::MVTX && true;
0195 Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true;
0196 Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true;
0197
0198 Enable::INTT = true;
0199
0200
0201 Enable::INTT_CELL = Enable::INTT && true;
0202 Enable::INTT_CLUSTER = Enable::INTT_CELL && true;
0203 Enable::INTT_QA = Enable::INTT_CLUSTER && Enable::QA && true;
0204
0205 Enable::TPC = true;
0206 Enable::TPC_ABSORBER = true;
0207 Enable::TPC_CELL = Enable::TPC && true;
0208 Enable::TPC_CLUSTER = Enable::TPC_CELL &&true;
0209 Enable::TPC_QA = Enable::TPC_CLUSTER && Enable::QA && false;
0210
0211 Enable::MICROMEGAS = true;
0212 Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true;
0213 Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true;
0214 Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && false;
0215
0216 Enable::TRACKING_TRACK = true;
0217
0218 Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && false;
0219 Enable::TRACKING_QA = Enable::TRACKING_TRACK && Enable::QA && true;
0220
0221
0222
0223
0224 Enable::PLUGDOOR_ABSORBER = true;
0225
0226
0227 Enable::CEMC = true;
0228 Enable::CEMC_ABSORBER = true;
0229 Enable::CEMC_CELL = Enable::CEMC && true;
0230 Enable::CEMC_TOWER = Enable::CEMC_CELL && true;
0231 Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true;
0232 Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true;
0233 Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && false;
0234
0235 Enable::HCALIN = true;
0236 Enable::HCALIN_ABSORBER = true;
0237 Enable::HCALIN_CELL = Enable::HCALIN && true;
0238 Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true;
0239 Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true;
0240 Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true;
0241 Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && false;
0242
0243
0244 Enable::MAGNET = true;
0245 Enable::MAGNET_ABSORBER = true;
0246
0247
0248 Enable::HCALOUT = true;
0249 Enable::HCALOUT_ABSORBER = true;
0250 Enable::HCALOUT_CELL = Enable::HCALOUT && true;
0251 Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true;
0252 Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true;
0253 Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true;
0254 Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER && Enable::QA && false;
0255
0256
0257
0258 Enable::BLACKHOLE = true;
0259
0260
0261
0262
0263
0264
0265
0266 Enable::CDB = true;
0267
0268 rc->set_StringFlag("CDB_GLOBALTAG",CDB::global_tag);
0269
0270 rc->set_uint64Flag("TIMESTAMP",CDB::timestamp);
0271
0272
0273
0274
0275 G4MAGNET::magfield_rescale = 1.;
0276
0277
0278 G4Init();
0279
0280
0281
0282
0283 if (!Input::READHITS) G4Setup();
0284
0285
0286
0287
0288
0289
0290 if (Enable::MVTX_CELL) Mvtx_Cells();
0291 if (Enable::INTT_CELL) Intt_Cells();
0292
0293
0294
0295
0296 if (Enable::CEMC_CELL) CEMC_Cells();
0297 if (Enable::CEMC_TOWER) CEMC_Towers();
0298 if (Enable::CEMC_CLUSTER) CEMC_Clusters();
0299
0300 if (Enable::HCALIN_CELL) HCALInner_Cells();
0301 if (Enable::HCALOUT_CELL) HCALOuter_Cells();
0302 if (Enable::HCALIN_TOWER) HCALInner_Towers();
0303 if (Enable::HCALIN_CLUSTER) HCALInner_Clusters();
0304 if (Enable::HCALOUT_TOWER) HCALOuter_Towers();
0305 if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters();
0306
0307
0308
0309
0310
0311 if(Enable::TRACKING_TRACK) TrackingInit();
0312 if (Enable::MVTX_CLUSTER) Mvtx_Clustering();
0313 if (Enable::INTT_CLUSTER) Intt_Clustering();
0314 if (Enable::TRACKING_TRACK) Tracking_Reco();
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327 CaloGeomMappingv2 *cgm = new CaloGeomMappingv2();
0328 cgm->set_detector_name("CEMC");
0329 cgm->setTowerGeomNodeName("TOWERGEOM_CEMCv3");
0330 se->registerSubsystem(cgm);
0331
0332 TruthToSvtxTrack *t2t = new TruthToSvtxTrack();
0333 se->registerSubsystem(t2t);
0334
0335 auto truthProjection = new PHActsTrackProjection("TruthTrackProjection");
0336 bool doEMcalRadiusCorr = true;
0337 float new_cemc_rad = 99;
0338 if (doEMcalRadiusCorr)
0339 {
0340 truthProjection->setLayerRadius(SvtxTrack::CEMC, new_cemc_rad);
0341 }
0342 se->registerSubsystem(truthProjection);
0343
0344
0345 tutorial* analysis_module = new tutorial( "name", output_directory, output_filename);
0346 analysis_module->setTowerGeomNodeName("TOWERGEOM_CEMCv3");
0347
0348
0349
0350 se->registerSubsystem(analysis_module);
0351
0352
0353
0354
0355
0356
0357 se->skip(skip);
0358 se->run(nEvents);
0359 se->End();
0360
0361 std::cout << "All done!" << std::endl;
0362
0363 gSystem->Exit(0);
0364 return;
0365 }
0366
0367