File indexing completed on 2025-08-06 08:21:01
0001 #ifndef MACRO_FUN4ALLG4CALO_C
0002 #define MACRO_FUN4ALLG4CALO_C
0003
0004 #include <GlobalVariables.C>
0005
0006 #include <DisplayOn.C>
0007 #include <G4Setup_sPHENIX.C>
0008 #include <G4_Mbd.C>
0009 #include <G4_CaloTrigger.C>
0010 #include <G4_DSTReader.C>
0011 #include <G4_Global.C>
0012 #include <G4_HIJetReco.C>
0013 #include <G4_Input.C>
0014 #include <G4_Jets.C>
0015 #include <G4_ParticleFlow.C>
0016 #include <G4_Production.C>
0017 #include <G4_TopoClusterReco.C>
0018 #include <G4_Tracking.C>
0019 #include <G4_User.C>
0020
0021 #include <fun4all/Fun4AllDstOutputManager.h>
0022 #include <fun4all/Fun4AllOutputManager.h>
0023 #include <fun4all/Fun4AllServer.h>
0024
0025
0026
0027
0028 #include <phool/PHRandomSeed.h>
0029 #include <phool/recoConsts.h>
0030
0031
0032 #include <calib_emc_pi0/CaloCalibEmc_Pi0.h>
0033
0034 R__LOAD_LIBRARY(libfun4all.so)
0035 R__LOAD_LIBRARY(libcaloCalibDBFile.so)
0036 R__LOAD_LIBRARY(libcalibCaloEmc_pi0.so)
0037
0038
0039
0040
0041
0042
0043 int spiNo2(
0044 const int nEvents = 600,
0045 const string &outputFile = "oldoutput2",
0046
0047
0048 const int mdc2_4_file_num = 31,
0049
0050
0051
0052 const string &outdir = ".")
0053 {
0054 Fun4AllServer *se = Fun4AllServer::instance();
0055 se->Verbosity(0);
0056
0057
0058
0059
0060
0061
0062
0063
0064 string inputFile0 = "DST_CALO_G4HIT_single_pi0_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-";
0065
0066 string inputFile1 = "DST_VERTEX_single_pi0_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000062-";
0067
0068
0069
0070 int ynum_int = 100000+ mdc2_4_file_num;
0071 TString yn_tstr = "";
0072 yn_tstr += ynum_int;
0073 yn_tstr.Remove(0,1);
0074 inputFile0 += yn_tstr.Data();
0075 inputFile1 += yn_tstr.Data();
0076
0077 inputFile0 += ".root";
0078 inputFile1 += ".root";
0079
0080 cout << "running over these files" << endl;
0081 cout << inputFile0 << endl;
0082 cout << inputFile1 << endl;
0083
0084
0085
0086
0087
0088 PHRandomSeed::Verbosity(1);
0089
0090
0091
0092
0093
0094
0095 string outputFile2 = outputFile.c_str();
0096 outputFile2 = outputFile2 + ".root";
0097
0098
0099 recoConsts *rc = recoConsts::instance();
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114 Input::VERBOSITY = 1;
0115
0116
0117
0118
0119
0120 Input::READHITS = true;
0121 INPUTREADHITS::filename[0] = inputFile0;
0122 INPUTREADHITS::filename[1] = inputFile1;
0123
0124
0125
0126
0127
0128 InputInit();
0129
0130
0131 InputRegister();
0132
0133
0134 Enable::PRODUCTION = true;
0135
0136
0137
0138
0139
0140 Enable::DSTOUT = false;
0141 Enable::DSTOUT_COMPRESS = false;
0142 DstOut::OutputDir = outdir;
0143
0144 DstOut::OutputFile = outputFile2;
0145
0146
0147
0148
0149
0150
0151 Enable::DISPLAY = false;
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161 Enable::CEMC = true;
0162 Enable::CEMC_CELL = Enable::CEMC && true;
0163 Enable::CEMC_TOWER = Enable::CEMC_CELL && true;
0164 Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true;
0165
0166
0167 Enable::HCALIN = true;
0168 Enable::HCALIN_CELL = Enable::HCALIN && true;
0169 Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true;
0170
0171
0172
0173 Enable::HCALOUT = true;
0174 Enable::HCALOUT_CELL = Enable::HCALOUT && true;
0175 Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true;
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216
0217 G4Init();
0218
0219
0220
0221
0222 if (!Input::READHITS)
0223 {
0224 G4Setup();
0225 }
0226
0227
0228
0229
0230
0231 if (Enable::MBD || Enable::MBDFAKE) Mbd_Reco();
0232
0233 if (Enable::MVTX_CELL) Mvtx_Cells();
0234 if (Enable::INTT_CELL) Intt_Cells();
0235 if (Enable::TPC_CELL) TPC_Cells();
0236 if (Enable::MICROMEGAS_CELL) Micromegas_Cells();
0237
0238 if (Enable::CEMC_CELL) CEMC_Cells();
0239
0240 if (Enable::HCALIN_CELL) HCALInner_Cells();
0241
0242 if (Enable::HCALOUT_CELL) HCALOuter_Cells();
0243
0244
0245
0246
0247
0248 if (Enable::CEMC_TOWER) CEMC_Towers();
0249 if (Enable::CEMC_CLUSTER) CEMC_Clusters();
0250
0251
0252
0253
0254
0255 if (Enable::HCALIN_TOWER) HCALInner_Towers();
0256 if (Enable::HCALIN_CLUSTER) HCALInner_Clusters();
0257
0258 if (Enable::HCALOUT_TOWER) HCALOuter_Towers();
0259 if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters();
0260
0261
0262 if (Enable::TOPOCLUSTER) TopoClusterReco();
0263
0264 if (Enable::DSTOUT_COMPRESS) ShowerCompress();
0265
0266
0267
0268
0269 if (Enable::MVTX_CLUSTER) Mvtx_Clustering();
0270 if (Enable::INTT_CLUSTER) Intt_Clustering();
0271 if (Enable::TPC_CLUSTER) TPC_Clustering();
0272 if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering();
0273
0274 if (Enable::TRACKING_TRACK)
0275 {
0276 TrackingInit();
0277 Tracking_Reco();
0278 }
0279
0280
0281
0282
0283 if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM)
0284 {
0285 cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl;
0286 gSystem->Exit(1);
0287 }
0288 if (Enable::GLOBAL_RECO)
0289 {
0290 Global_Reco();
0291 }
0292 else if (Enable::GLOBAL_FASTSIM)
0293 {
0294 Global_FastSim();
0295 }
0296
0297
0298
0299
0300
0301 if (Enable::CALOTRIGGER)
0302 {
0303 CaloTrigger_Sim();
0304 }
0305
0306
0307
0308
0309
0310 if (Enable::JETS) Jet_Reco();
0311 if (Enable::HIJETS) HIJetReco();
0312
0313 if (Enable::PARTICLEFLOW) ParticleFlow();
0314
0315
0316
0317
0318 string outputroot = outputFile;
0319 string remove_this = ".root";
0320 size_t pos = outputroot.find(remove_this);
0321 if (pos != string::npos)
0322 {
0323 outputroot.erase(pos, remove_this.length());
0324 }
0325
0326
0327
0328
0329
0330 InputManagers();
0331
0332 if (Enable::PRODUCTION)
0333 {
0334 Production_CreateOutputDir();
0335 }
0336
0337 if (Enable::DSTOUT)
0338 {
0339 string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile;
0340 Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile);
0341 out->AddNode("Sync");
0342 out->AddNode("EventHeader");
0343 out->AddNode("TOWER_SIM_HCALIN");
0344 out->AddNode("TOWER_RAW_HCALIN");
0345 out->AddNode("TOWER_CALIB_HCALIN");
0346 out->AddNode("CLUSTER_HCALIN");
0347 out->AddNode("TOWER_SIM_HCALOUT");
0348 out->AddNode("TOWER_RAW_HCALOUT");
0349 out->AddNode("TOWER_CALIB_HCALOUT");
0350 out->AddNode("CLUSTER_HCALOUT");
0351 out->AddNode("TOWER_SIM_CEMC");
0352 out->AddNode("TOWER_RAW_CEMC");
0353 out->AddNode("TOWER_CALIB_CEMC");
0354 out->AddNode("CLUSTER_CEMC");
0355 out->AddNode("CLUSTER_POS_COR_CEMC");
0356
0357 out->AddNode("TOPOCLUSTER_ALLCALO");
0358 out->AddNode("TOPOCLUSTER_EMCAL");
0359 out->AddNode("TOPOCLUSTER_HCAL");
0360 out->AddNode("GlobalVertexMap");
0361 if (Enable::DSTOUT_COMPRESS) DstCompress(out);
0362 se->registerOutputManager(out);
0363 }
0364
0365
0366
0367 if (Enable::DISPLAY)
0368 {
0369 DisplayOn();
0370
0371 gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();");
0372 gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");");
0373
0374 cout << "-------------------------------------------------" << endl;
0375 cout << "You are in event display mode. Run one event with" << endl;
0376 cout << "se->run(1)" << endl;
0377 cout << "Run Geant4 command with following examples" << endl;
0378 gROOT->ProcessLine("displaycmd()");
0379
0380 return 0;
0381 }
0382
0383 string outputfile = outputFile2 + "_ho4ho_eval.root";
0384 string outputfile2 = outputFile2 + "_piemc.root";
0385 string outputfile3 = outputFile2 + "_towinfo_pi.root";
0386 string outputfile4 = outputFile2 + "_hcalin.root";
0387 string outputfile5 = outputFile2 + "_hcalin_mod.root";
0388 string outputfile6 = outputFile2 + "_emcal.root";
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417 CaloCalibEmc_Pi0 *eval_pi1 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI0", outputfile2);
0418
0419
0420 se->registerSubsystem(eval_pi1);
0421
0422 CaloCalibEmc_Pi0 *eval_pi2 = new CaloCalibEmc_Pi0("CEMC_CALIB_PI02", outputfile3);
0423
0424
0425 eval_pi2->set_UseTowerInfo(1);
0426 se->registerSubsystem(eval_pi2);
0427 cout << "successful registration of pi0 2" << endl;
0428
0429
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444 if (nEvents < 0)
0445 {
0446 return 0;
0447 }
0448
0449 if (nEvents == 0 && !Input::HEPMC && !Input::READHITS)
0450 {
0451 cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0452 cout << "it will run forever, so I just return without running anything" << endl;
0453 return 0;
0454 }
0455
0456 se->run(nEvents);
0457
0458
0459
0460
0461
0462 se->End();
0463
0464
0465 std::cout << "All done" << std::endl;
0466 gSystem->Exit(0);
0467 delete se;
0468
0469
0470
0471
0472
0473
0474
0475 return 0;
0476 }
0477 #endif