File indexing completed on 2025-08-06 08:11:52
0001 #ifndef MACRO_FUN4ALLG4SPHENIX_C
0002 #define MACRO_FUN4ALLG4SPHENIX_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_Centrality.C>
0011 #include <G4_DSTReader.C>
0012 #include <G4_Global.C>
0013 #include <G4_HIJetReco.C>
0014 #include <G4_Input.C>
0015 #include <G4_Jets.C>
0016 #include <G4_KFParticle.C>
0017 #include <G4_ParticleFlow.C>
0018 #include <G4_Production.C>
0019 #include <G4_TopoClusterReco.C>
0020
0021 #include <Trkr_RecoInit.C>
0022 #include <Trkr_Clustering.C>
0023 #include <Trkr_LaserClustering.C>
0024 #include <Trkr_Reco.C>
0025 #include <Trkr_Eval.C>
0026 #include <Trkr_QA.C>
0027
0028 #include <Trkr_Diagnostics.C>
0029 #include <G4_User.C>
0030 #include <QA.C>
0031
0032 #include <ffamodules/FlagHandler.h>
0033 #include <ffamodules/HeadReco.h>
0034 #include <ffamodules/SyncReco.h>
0035 #include <ffamodules/CDBInterface.h>
0036
0037 #include <fun4all/Fun4AllDstOutputManager.h>
0038 #include <fun4all/Fun4AllOutputManager.h>
0039 #include <fun4all/Fun4AllServer.h>
0040
0041 #include <phool/PHRandomSeed.h>
0042 #include <phool/recoConsts.h>
0043
0044 R__LOAD_LIBRARY(libfun4all.so)
0045 R__LOAD_LIBRARY(libffamodules.so)
0046
0047
0048
0049
0050 int Fun4All_RunNewTruthMatcher(
0051 const int nEvents = 1,
0052 const int skip = 0,
0053 const string &outputFile = "G4sPHENIX.root",
0054 const string &inputFile = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root",
0055 const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root",
0056 const string &outdir = ".")
0057 {
0058 Fun4AllServer *se = Fun4AllServer::instance();
0059 se->Verbosity(0);
0060
0061
0062 PHRandomSeed::Verbosity(1);
0063
0064
0065 recoConsts *rc = recoConsts::instance();
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 Input::VERBOSITY = 0;
0082
0083
0084
0085
0086
0087
0088 INPUTREADHITS::filename[0] = inputFile;
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098 INPUTEMBED::filename[0] = embed_input_file;
0099
0100
0101
0102 Input::SIMPLE = true;
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131 INPUTHEPMC::filename = inputFile;
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155 InputInit();
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167 const UInt_t nPerEvt(1);
0168 const TString sParticle("pi-");
0169 const Double_t ptParMin(10.);
0170 const Double_t ptParMax(10.);
0171
0172
0173 const Bool_t doGausVertex(false);
0174 const Double_t meanVtxXG(0.);
0175 const Double_t meanVtxYG(0.);
0176 const Double_t meanVtxZG(0.);
0177 const Double_t meanVtxXU(0.);
0178 const Double_t meanVtxYU(0.);
0179 const Double_t meanVtxZU(0.);
0180 const Double_t widthVtxXG(0.01);
0181 const Double_t widthVtxYG(0.01);
0182 const Double_t widthVtxZG(5.);
0183 const Double_t widthVtxXU(0.);
0184 const Double_t widthVtxYU(0.);
0185 const Double_t widthVtxZU(0.);
0186
0187 if (Input::SIMPLE)
0188 {
0189 INPUTGENERATOR::SimpleEventGenerator[0]->add_particles(sParticle.Data(), nPerEvt);
0190 if (Input::HEPMC || Input::EMBED)
0191 {
0192 INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true);
0193 INPUTGENERATOR::SimpleEventGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0);
0194 }
0195 else
0196 {
0197 if (doGausVertex) {
0198 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vertex_distribution_function(
0199 PHG4SimpleEventGenerator::Gaus,
0200 PHG4SimpleEventGenerator::Gaus,
0201 PHG4SimpleEventGenerator::Gaus
0202 );
0203 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vertex_distribution_mean(meanVtxXG, meanVtxYG, meanVtxZG);
0204 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vertex_distribution_width(widthVtxXG, widthVtxYG, widthVtxZG);
0205 } else {
0206 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vertex_distribution_function(
0207 PHG4SimpleEventGenerator::Uniform,
0208 PHG4SimpleEventGenerator::Uniform,
0209 PHG4SimpleEventGenerator::Uniform
0210 );
0211 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vertex_distribution_mean(meanVtxXU, meanVtxYU, meanVtxZU);
0212 INPUTGENERATOR::SimpleEventGenerator[0] -> set_vertex_distribution_width(widthVtxXU, widthVtxYU, widthVtxZU);
0213 }
0214 }
0215 INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1);
0216 INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI);
0217 INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(ptParMin, ptParMax);
0218 }
0219
0220
0221
0222 if (Input::UPSILON)
0223 {
0224 INPUTGENERATOR::VectorMesonGenerator[0]->add_decay_particles("e", 0);
0225 INPUTGENERATOR::VectorMesonGenerator[0]->set_rapidity_range(-1, 1);
0226 INPUTGENERATOR::VectorMesonGenerator[0]->set_pt_range(0., 10.);
0227
0228 INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s();
0229 if (Input::HEPMC || Input::EMBED)
0230 {
0231 INPUTGENERATOR::VectorMesonGenerator[0]->set_reuse_existing_vertex(true);
0232 INPUTGENERATOR::VectorMesonGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0);
0233 }
0234 }
0235
0236
0237
0238 if (Input::GUN)
0239 {
0240 INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0);
0241 INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0);
0242 }
0243
0244
0245 if (Input::PYTHIA6)
0246 {
0247
0248 Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia6);
0249 }
0250
0251 if (Input::PYTHIA8)
0252 {
0253
0254 Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia8);
0255 }
0256
0257
0258
0259
0260
0261
0262 if (Input::HEPMC)
0263 {
0264
0265 Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCInputManager);
0266
0267
0268
0269
0270
0271
0272
0273
0274
0275
0276
0277 if (Input::PILEUPRATE > 0)
0278 {
0279
0280 INPUTMANAGER::HepMCPileupInputManager->CopyHelperSettings(INPUTMANAGER::HepMCInputManager);
0281
0282
0283 }
0284 }
0285 if (Input::PILEUPRATE > 0)
0286 {
0287
0288 Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCPileupInputManager);
0289 }
0290
0291 InputRegister();
0292
0293 if (! Input::READHITS)
0294 {
0295 rc->set_IntFlag("RUNNUMBER",1);
0296
0297 SyncReco *sync = new SyncReco();
0298 se->registerSubsystem(sync);
0299
0300 HeadReco *head = new HeadReco();
0301 se->registerSubsystem(head);
0302 }
0303
0304
0305
0306 FlagHandler *flag = new FlagHandler();
0307 se->registerSubsystem(flag);
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317 Enable::DSTOUT_COMPRESS = false;
0318 DstOut::OutputDir = outdir;
0319 DstOut::OutputFile = outputFile;
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332 Enable::QA = false;
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342 Enable::MBDFAKE = true;
0343
0344 Enable::PIPE = true;
0345 Enable::PIPE_ABSORBER = true;
0346
0347
0348 Enable::MVTX = true;
0349 Enable::MVTX_CELL = Enable::MVTX && true;
0350 Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true;
0351 Enable::MVTX_QA = Enable::MVTX_CLUSTER && Enable::QA && true;
0352
0353 Enable::INTT = true;
0354
0355
0356 Enable::INTT_CELL = Enable::INTT && true;
0357 Enable::INTT_CLUSTER = Enable::INTT_CELL && true;
0358 Enable::INTT_QA = Enable::INTT_CLUSTER && Enable::QA && true;
0359
0360 Enable::TPC = true;
0361 Enable::TPC_ABSORBER = true;
0362 Enable::TPC_CELL = Enable::TPC && true;
0363 Enable::TPC_CLUSTER = Enable::TPC_CELL && true;
0364 Enable::TPC_QA = Enable::TPC_CLUSTER && Enable::QA && true;
0365
0366 Enable::MICROMEGAS = true;
0367 Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true;
0368 Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true;
0369 Enable::MICROMEGAS_QA = Enable::MICROMEGAS_CLUSTER && Enable::QA && true;
0370
0371 Enable::TRACKING_TRACK = (Enable::MICROMEGAS_CLUSTER && Enable::TPC_CLUSTER && Enable::INTT_CLUSTER && Enable::MVTX_CLUSTER) && true;
0372 Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && Enable::GLOBAL_RECO && true;
0373 Enable::TRACKING_QA = Enable::TRACKING_TRACK && Enable::QA && true;
0374
0375
0376 Enable::TRACK_MATCHING = Enable::TRACKING_TRACK && true;
0377 Enable::TRACK_MATCHING_TREE = Enable::TRACK_MATCHING && true;
0378 Enable::TRACK_MATCHING_TREE_CLUSTERS = Enable::TRACK_MATCHING_TREE && true;
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389 Enable::CEMC = true;
0390 Enable::CEMC_ABSORBER = true;
0391 Enable::CEMC_CELL = Enable::CEMC && true;
0392 Enable::CEMC_TOWER = Enable::CEMC_CELL && true;
0393 Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true;
0394 Enable::CEMC_EVAL = Enable::CEMC_G4Hit && Enable::CEMC_CLUSTER && false;
0395 Enable::CEMC_QA = Enable::CEMC_CLUSTER && Enable::QA && false;
0396
0397 Enable::HCALIN = true;
0398 Enable::HCALIN_ABSORBER = true;
0399 Enable::HCALIN_CELL = Enable::HCALIN && true;
0400 Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true;
0401 Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true;
0402 Enable::HCALIN_EVAL = Enable::HCALIN_G4Hit && Enable::HCALIN_CLUSTER && false;
0403 Enable::HCALIN_QA = Enable::HCALIN_CLUSTER && Enable::QA && false;
0404
0405 Enable::MAGNET = true;
0406 Enable::MAGNET_ABSORBER = true;
0407
0408 Enable::HCALOUT = true;
0409 Enable::HCALOUT_ABSORBER = true;
0410 Enable::HCALOUT_CELL = Enable::HCALOUT && true;
0411 Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true;
0412 Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true;
0413 Enable::HCALOUT_EVAL = Enable::HCALOUT_G4Hit && Enable::HCALOUT_CLUSTER && false;
0414 Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER && Enable::QA && false;
0415
0416 Enable::EPD = true;
0417 Enable::EPD_TILE = Enable::EPD && true;
0418
0419 Enable::BEAMLINE = true;
0420
0421
0422 Enable::ZDC = true;
0423
0424
0425 Enable::ZDC_TOWER = Enable::ZDC && true;
0426 Enable::ZDC_EVAL = Enable::ZDC_TOWER && true;
0427
0428
0429
0430 Enable::PLUGDOOR_ABSORBER = true;
0431
0432 Enable::GLOBAL_RECO = (Enable::MBDFAKE || Enable::TRACKING_TRACK) && true;
0433
0434
0435
0436
0437
0438
0439
0440 Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false;
0441
0442 Enable::JETS = (Enable::GLOBAL_RECO || Enable::GLOBAL_FASTSIM) && false;
0443 Enable::JETS_EVAL = Enable::JETS && false;
0444 Enable::JETS_QA = Enable::JETS && Enable::QA && false;
0445
0446
0447
0448
0449 Enable::HIJETS = Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false;
0450
0451
0452 Enable::TOPOCLUSTER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false;
0453
0454 Enable::PARTICLEFLOW = Enable::TOPOCLUSTER && false;
0455
0456 Enable::CENTRALITY = true;
0457
0458
0459 Enable::BLACKHOLE = true;
0460
0461
0462
0463
0464
0465
0466
0467
0468
0469
0470 Enable::CDB = true;
0471
0472 rc->set_StringFlag("CDB_GLOBALTAG",CDB::global_tag);
0473
0474 rc->set_uint64Flag("TIMESTAMP",CDB::timestamp);
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484
0485
0486
0487
0488
0489
0490
0491
0492
0493
0494
0495
0496
0497
0498 G4Init();
0499
0500
0501
0502
0503 if (!Input::READHITS)
0504 {
0505 G4Setup();
0506 }
0507
0508
0509
0510
0511
0512 if ((Enable::MBD && Enable::MBDRECO) || Enable::MBDFAKE) Mbd_Reco();
0513
0514 if (Enable::MVTX_CELL) Mvtx_Cells();
0515 if (Enable::INTT_CELL) Intt_Cells();
0516 if (Enable::TPC_CELL) TPC_Cells();
0517 if (Enable::MICROMEGAS_CELL) Micromegas_Cells();
0518
0519 if (Enable::CEMC_CELL) CEMC_Cells();
0520
0521 if (Enable::HCALIN_CELL) HCALInner_Cells();
0522
0523 if (Enable::HCALOUT_CELL) HCALOuter_Cells();
0524
0525
0526
0527
0528
0529 if (Enable::CEMC_TOWER) CEMC_Towers();
0530 if (Enable::CEMC_CLUSTER) CEMC_Clusters();
0531
0532
0533
0534
0535
0536 if (Enable::EPD_TILE) EPD_Tiles();
0537
0538
0539
0540
0541
0542 if (Enable::HCALIN_TOWER) HCALInner_Towers();
0543 if (Enable::HCALIN_CLUSTER) HCALInner_Clusters();
0544
0545 if (Enable::HCALOUT_TOWER) HCALOuter_Towers();
0546 if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters();
0547
0548
0549 if (Enable::TOPOCLUSTER) TopoClusterReco();
0550
0551
0552
0553
0554 if(Enable::TRACKING_TRACK)
0555 {
0556 TrackingInit();
0557 }
0558 if (Enable::MVTX_CLUSTER) Mvtx_Clustering();
0559 if (Enable::INTT_CLUSTER) Intt_Clustering();
0560 if (Enable::TPC_CLUSTER)
0561 {
0562 if(G4TPC::ENABLE_DIRECT_LASER_HITS || G4TPC::ENABLE_CENTRAL_MEMBRANE_HITS)
0563 {
0564 TPC_LaserClustering();
0565 }
0566 else
0567 {
0568 TPC_Clustering();
0569 }
0570 }
0571 if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering();
0572
0573 if (Enable::TRACKING_TRACK)
0574 {
0575 Tracking_Reco();
0576 }
0577
0578
0579
0580 if(Enable::TRACKING_DIAGNOSTICS)
0581 {
0582 const std::string kshortFile = "./kshort_" + outputFile;
0583 const std::string residualsFile = "./residuals_" + outputFile;
0584
0585 G4KshortReconstruction(kshortFile);
0586 seedResiduals(residualsFile);
0587 }
0588
0589
0590
0591
0592
0593
0594 if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM)
0595 {
0596 cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl;
0597 gSystem->Exit(1);
0598 }
0599 if (Enable::GLOBAL_RECO)
0600 {
0601 Global_Reco();
0602 }
0603 else if (Enable::GLOBAL_FASTSIM)
0604 {
0605 Global_FastSim();
0606 }
0607
0608
0609
0610
0611
0612 if (Enable::CENTRALITY)
0613 {
0614 Centrality();
0615 }
0616
0617
0618
0619
0620
0621 if (Enable::CALOTRIGGER)
0622 {
0623 CaloTrigger_Sim();
0624 }
0625
0626
0627
0628
0629
0630 if (Enable::JETS) Jet_Reco();
0631 if (Enable::HIJETS) HIJetReco();
0632
0633 if (Enable::PARTICLEFLOW) ParticleFlow();
0634
0635
0636
0637
0638 string outputroot = outputFile;
0639 string remove_this = ".root";
0640 size_t pos = outputroot.find(remove_this);
0641 if (pos != string::npos)
0642 {
0643 outputroot.erase(pos, remove_this.length());
0644 }
0645
0646
0647 if (true) {
0648
0649 build_truthreco_tables();
0650
0651 std::cout << "CHECK I am inside the svtx evaluator block!" << std::endl;
0652
0653 SvtxEvaluator* eval = new SvtxEvaluator(
0654 "SVTXEVALUATOR",
0655 outputroot + "_g4svtx_eval.root",
0656 "SvtxTrackMap",
0657 G4MVTX::n_maps_layer,
0658 G4INTT::n_intt_layer,
0659 G4TPC::n_gas_layer,
0660 G4MICROMEGAS::n_micromegas_layer
0661 );
0662 eval->do_cluster_eval(true);
0663 eval->do_g4hit_eval(false);
0664 eval->do_hit_eval(false);
0665 eval->do_gpoint_eval(true);
0666 eval->do_vtx_eval_light(true);
0667 eval->do_eval_light(true);
0668 eval->do_track_eval(true);
0669 eval->do_gtrack_eval(true);
0670 eval->do_track_match(true);
0671 eval->set_use_initial_vertex(G4TRACKING::g4eval_use_initial_vertex);
0672
0673 bool embed_scan = true;
0674 if(TRACKING::pp_mode) {
0675 embed_scan = false;
0676 }
0677 eval->scan_for_embedded(embed_scan);
0678 eval->scan_for_primaries(embed_scan);
0679 std::cout << "SvtxEvaluator: pp_mode set to " << TRACKING::pp_mode << " and scan_for_embedded set to " << embed_scan << std::endl;
0680 eval->Verbosity(Enable::TRACKING_VERBOSITY);
0681 se->registerSubsystem(eval);
0682 }
0683
0684 if (Enable::CEMC_EVAL) CEMC_Eval(outputroot + "_g4cemc_eval.root");
0685
0686 if (Enable::HCALIN_EVAL) HCALInner_Eval(outputroot + "_g4hcalin_eval.root");
0687
0688 if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root");
0689
0690 if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root");
0691
0692 if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root");
0693
0694
0695
0696 if (Enable::USER) UserAnalysisInit();
0697
0698
0699
0700 if(G4TRACKING::filter_conversion_electrons) Filter_Conversion_Electrons(outputroot + "_secvert_ntuple.root");
0701
0702
0703
0704
0705
0706 if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco();
0707 if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco();
0708
0709
0710
0711
0712
0713 if (Enable::CEMC_QA) CEMC_QA();
0714 if (Enable::HCALIN_QA) HCALInner_QA();
0715 if (Enable::HCALOUT_QA) HCALOuter_QA();
0716
0717 if (Enable::JETS_QA) Jet_QA();
0718
0719 if (Enable::MVTX_QA) Mvtx_QA();
0720 if (Enable::INTT_QA) Intt_QA();
0721 if (Enable::TPC_QA) TPC_QA();
0722 if (Enable::MICROMEGAS_QA) Micromegas_QA();
0723 if (Enable::TRACKING_QA) Tracking_QA();
0724
0725 if (Enable::TRACKING_QA && Enable::CEMC_QA && Enable::HCALIN_QA && Enable::HCALOUT_QA) QA_G4CaloTracking();
0726
0727
0728 if (true) {
0729
0730
0731 TrkrClusterIsMatcher* ismatcher = new TrkrClusterIsMatcher();
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741
0742
0743
0744
0745
0746 auto trackmatcher = new TruthRecoTrackMatching(ismatcher);
0747 trackmatcher->set_min_cl_match (5);
0748 trackmatcher->set_min_cl_ratio (0.1);
0749 trackmatcher->set_cutoff_deta (0.3);
0750 trackmatcher->set_cutoff_dphi (0.3);
0751 trackmatcher->set_smallsearch_deta (0.05);
0752 trackmatcher->set_smallsearch_dphi (0.05);
0753
0754
0755 trackmatcher->set_max_nreco_per_truth (1);
0756 trackmatcher->set_max_ntruth_per_reco (1);
0757
0758
0759 int verbosity = std::max(Enable::VERBOSITY, Enable::TRACKING_VERBOSITY);
0760 trackmatcher->Verbosity(verbosity);
0761 se->registerSubsystem(trackmatcher);
0762
0763 if (Enable::TRACK_MATCHING_TREE) {
0764 auto treefiller = new FillClusMatchTree(ismatcher, outputroot + "_g4trackmatching.root");
0765 treefiller->Verbosity(verbosity);
0766 if (Enable::TRACK_MATCHING_TREE_CLUSTERS) {
0767 treefiller->m_fill_clusters = true;
0768 treefiller->m_fill_SvUnmatched = true;
0769 } else {
0770 treefiller->m_fill_clusters = false;
0771 treefiller->m_fill_SvUnmatched = false;
0772 }
0773 treefiller->m_fill_clusverbose = false;
0774 se->registerSubsystem(treefiller);
0775 }
0776 }
0777
0778
0779
0780
0781
0782 InputManagers();
0783
0784 if (Enable::PRODUCTION)
0785 {
0786 Production_CreateOutputDir();
0787 }
0788
0789 if (Enable::DSTOUT)
0790 {
0791 string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile;
0792 Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile);
0793 if (Enable::DSTOUT_COMPRESS)
0794 {
0795 ShowerCompress();
0796 DstCompress(out);
0797 }
0798 se->registerOutputManager(out);
0799 }
0800
0801
0802
0803 if (Enable::DISPLAY)
0804 {
0805 DisplayOn();
0806
0807 gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();");
0808 gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");");
0809
0810 cout << "-------------------------------------------------" << endl;
0811 cout << "You are in event display mode. Run one event with" << endl;
0812 cout << "se->run(1)" << endl;
0813 cout << "Run Geant4 command with following examples" << endl;
0814 gROOT->ProcessLine("displaycmd()");
0815
0816 return 0;
0817 }
0818
0819
0820 if (nEvents < 0)
0821 {
0822 return 0;
0823 }
0824
0825
0826 if (nEvents == 0 && !Input::HEPMC && !Input::READHITS && INPUTEMBED::REPEAT)
0827 {
0828 cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
0829 cout << "it will run forever, so I just return without running anything" << endl;
0830 return 0;
0831 }
0832
0833 se->skip(skip);
0834 se->run(nEvents);
0835
0836
0837
0838
0839
0840 if (Enable::QA) QA_Output(outputroot + "_qa.root");
0841
0842
0843
0844
0845
0846
0847 se->End();
0848 std::cout << "All done" << std::endl;
0849 delete se;
0850 if (Enable::PRODUCTION)
0851 {
0852 Production_MoveOutput();
0853 }
0854
0855 gSystem->Exit(0);
0856 return 0;
0857 }
0858 #endif