forked from sPHENIX-Collaboration/tutorials
/
Fun4All_AnaTutorial_sPHENIX_Jets.C
622 lines (510 loc) · 20.2 KB
/
Fun4All_AnaTutorial_sPHENIX_Jets.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
#ifndef MACRO_FUN4ALLG4SPHENIX_C
#define MACRO_FUN4ALLG4SPHENIX_C
#include <anatutorial/AnaTutorial.h>
#include <GlobalVariables.C>
#include <DisplayOn.C>
#include <G4Setup_sPHENIX.C>
#include <G4_Bbc.C>
#include <G4_CaloTrigger.C>
#include <G4_DSTReader.C>
#include <G4_Global.C>
#include <G4_HIJetReco.C>
#include <G4_Input.C>
#include <G4_Jets.C>
#include <G4_KFParticle.C>
#include <G4_ParticleFlow.C>
#include <G4_Production.C>
#include <G4_TopoClusterReco.C>
#include <G4_Tracking.C>
#include <G4_User.C>
#include <QA.C>
#include <fun4all/Fun4AllDstOutputManager.h>
#include <fun4all/Fun4AllOutputManager.h>
#include <fun4all/Fun4AllServer.h>
#include <phool/PHRandomSeed.h>
#include <phool/recoConsts.h>
R__LOAD_LIBRARY(libfun4all.so)
R__LOAD_LIBRARY(libanatutorial.so)
// For HepMC Hijing
// try inputFile = /sphenix/sim/sim01/sphnxpro/sHijing_HepMC/sHijing_0-12fm.dat
int Fun4All_AnaTutorial_sPHENIX_Jets(
const int nEvents = 1,
const string &inputFile = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root",
const string &outputFile = "G4sPHENIX.root",
const string &embed_input_file = "https://www.phenix.bnl.gov/WWW/publish/phnxbld/sPHENIX/files/sPHENIX_G4Hits_sHijing_9-11fm_00000_00010.root",
const int skip = 0,
const string &outdir = ".")
{
Fun4AllServer *se = Fun4AllServer::instance();
se->Verbosity(0);
//Opt to print all random seed used for debugging reproducibility. Comment out to reduce stdout prints.
PHRandomSeed::Verbosity(1);
// just if we set some flags somewhere in this macro
recoConsts *rc = recoConsts::instance();
// By default every random number generator uses
// PHRandomSeed() which reads /dev/urandom to get its seed
// if the RANDOMSEED flag is set its value is taken as seed
// You can either set this to a random value using PHRandomSeed()
// which will make all seeds identical (not sure what the point of
// this would be:
// rc->set_IntFlag("RANDOMSEED",PHRandomSeed());
// or set it to a fixed value so you can debug your code
// rc->set_IntFlag("RANDOMSEED", 12345);
//===============
// Input options
//===============
// verbosity setting (applies to all input managers)
Input::VERBOSITY = 0;
// First enable the input generators
// Either:
// read previously generated g4-hits files, in this case it opens a DST and skips
// the simulations step completely. The G4Setup macro is only loaded to get information
// about the number of layers used for the cell reco code
// Input::READHITS = true;
INPUTREADHITS::filename[0] = inputFile;
// if you use a filelist
// INPUTREADHITS::listfile[0] = inputFile;
// Or:
// Use particle generator
// And
// Further choose to embed newly simulated events to a previous simulation. Not compatible with `readhits = true`
// In case embedding into a production output, please double check your G4Setup_sPHENIX.C and G4_*.C consistent with those in the production macro folder
// E.g. /sphenix/sim//sim01/production/2016-07-21/single_particle/spacal2d/
// Input::EMBED = true;
INPUTEMBED::filename[0] = embed_input_file;
// if you use a filelist
//INPUTEMBED::listfile[0] = embed_input_file;
Input::SIMPLE = false;
// Input::SIMPLE_NUMBER = 2; // if you need 2 of them
// Input::SIMPLE_VERBOSITY = 1;
// Input::PYTHIA6 = true;
Input::PYTHIA8 = true;
// Input::GUN = true;
// Input::GUN_NUMBER = 3; // if you need 3 of them
// Input::GUN_VERBOSITY = 1;
//D0 generator
//Input::DZERO = false;
//Input::DZERO_VERBOSITY = 0;
//Lambda_c generator //Not ready yet
//Input::LAMBDAC = false;
//Input::LAMBDAC_VERBOSITY = 0;
// Upsilon generator
//Input::UPSILON = true;
//Input::UPSILON_NUMBER = 3; // if you need 3 of them
//Input::UPSILON_VERBOSITY = 0;
// Input::HEPMC = true;
INPUTHEPMC::filename = inputFile;
// Event pile up simulation with collision rate in Hz MB collisions.
//Input::PILEUPRATE = 100e3;
//-----------------
// Initialize the selected Input/Event generation
//-----------------
// This creates the input generator(s)
InputInit();
//--------------
// Set generator specific options
//--------------
// can only be set after InputInit() is called
// Simple Input generator:
// if you run more than one of these Input::SIMPLE_NUMBER > 1
// add the settings for other with [1], next with [2]...
if (Input::SIMPLE)
{
INPUTGENERATOR::SimpleEventGenerator[0]->add_particles("pi-", 5);
if (Input::HEPMC || Input::EMBED)
{
INPUTGENERATOR::SimpleEventGenerator[0]->set_reuse_existing_vertex(true);
INPUTGENERATOR::SimpleEventGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0);
}
else
{
INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_function(PHG4SimpleEventGenerator::Uniform,
PHG4SimpleEventGenerator::Uniform,
PHG4SimpleEventGenerator::Uniform);
INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_mean(0., 0., 0.);
INPUTGENERATOR::SimpleEventGenerator[0]->set_vertex_distribution_width(0., 0., 5.);
}
INPUTGENERATOR::SimpleEventGenerator[0]->set_eta_range(-1, 1);
INPUTGENERATOR::SimpleEventGenerator[0]->set_phi_range(-M_PI, M_PI);
INPUTGENERATOR::SimpleEventGenerator[0]->set_pt_range(0.1, 20.);
}
// Upsilons
// if you run more than one of these Input::UPSILON_NUMBER > 1
// add the settings for other with [1], next with [2]...
if (Input::UPSILON)
{
INPUTGENERATOR::VectorMesonGenerator[0]->add_decay_particles("e", 0);
INPUTGENERATOR::VectorMesonGenerator[0]->set_rapidity_range(-1, 1);
INPUTGENERATOR::VectorMesonGenerator[0]->set_pt_range(0., 10.);
// Y species - select only one, last one wins
INPUTGENERATOR::VectorMesonGenerator[0]->set_upsilon_1s();
if (Input::HEPMC || Input::EMBED)
{
INPUTGENERATOR::VectorMesonGenerator[0]->set_reuse_existing_vertex(true);
INPUTGENERATOR::VectorMesonGenerator[0]->set_existing_vertex_offset_vector(0.0, 0.0, 0.0);
}
}
// particle gun
// if you run more than one of these Input::GUN_NUMBER > 1
// add the settings for other with [1], next with [2]...
if (Input::GUN)
{
INPUTGENERATOR::Gun[0]->AddParticle("pi-", 0, 1, 0);
INPUTGENERATOR::Gun[0]->set_vtx(0, 0, 0);
}
// pythia6
if (Input::PYTHIA6)
{
//! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001
Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia6);
}
// pythia8
if (Input::PYTHIA8)
{
//! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001
Input::ApplysPHENIXBeamParameter(INPUTGENERATOR::Pythia8);
}
//--------------
// Set Input Manager specific options
//--------------
// can only be set after InputInit() is called
if (Input::HEPMC)
{
//! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001
Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCInputManager);
// optional overriding beam parameters
//INPUTMANAGER::HepMCInputManager->set_vertex_distribution_width(100e-4, 100e-4, 8, 0); //optional collision smear in space, time
// INPUTMANAGER::HepMCInputManager->set_vertex_distribution_mean(0,0,0,0);//optional collision central position shift in space, time
// //optional choice of vertex distribution function in space, time
//INPUTMANAGER::HepMCInputManager->set_vertex_distribution_function(PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus, PHHepMCGenHelper::Gaus);
//! embedding ID for the event
//! positive ID is the embedded event of interest, e.g. jetty event from pythia
//! negative IDs are backgrounds, .e.g out of time pile up collisions
//! Usually, ID = 0 means the primary Au+Au collision background
//INPUTMANAGER::HepMCInputManager->set_embedding_id(Input::EmbedID);
if (Input::PILEUPRATE > 0)
{
// Copy vertex settings from foreground hepmc input
INPUTMANAGER::HepMCPileupInputManager->CopyHelperSettings(INPUTMANAGER::HepMCInputManager);
// and then modify the ones you want to be different
// INPUTMANAGER::HepMCPileupInputManager->set_vertex_distribution_width(100e-4,100e-4,8,0);
}
}
if (Input::PILEUPRATE > 0)
{
//! apply sPHENIX nominal beam parameter with 2mrad crossing as defined in sPH-TRG-2020-001
Input::ApplysPHENIXBeamParameter(INPUTMANAGER::HepMCPileupInputManager);
}
// register all input generators with Fun4All
InputRegister();
// set up production relatedstuff
// Enable::PRODUCTION = true;
//======================
// Write the DST
//======================
//Enable::DSTOUT = true;
Enable::DSTOUT_COMPRESS = false;
DstOut::OutputDir = outdir;
DstOut::OutputFile = outputFile;
//Option to convert DST to human command readable TTree for quick poke around the outputs
// Enable::DSTREADER = true;
// turn the display on (default off)
Enable::DISPLAY = false;
//======================
// What to run
//======================
// QA, main switch
Enable::QA = true;
// Global options (enabled for all enables subsystems - if implemented)
// Enable::ABSORBER = true;
// Enable::OVERLAPCHECK = true;
// Enable::VERBOSITY = 1;
// Enable::BBC = true;
Enable::BBCFAKE = true; // Smeared vtx and t0, use if you don't want real BBC in simulation
Enable::PIPE = true;
Enable::PIPE_ABSORBER = true;
// central tracking
Enable::MVTX = true;
Enable::MVTX_CELL = Enable::MVTX && true;
Enable::MVTX_CLUSTER = Enable::MVTX_CELL && true;
Enable::MVTX_QA = Enable::MVTX_CLUSTER and Enable::QA && true;
Enable::INTT = true;
Enable::INTT_CELL = Enable::INTT && true;
Enable::INTT_CLUSTER = Enable::INTT_CELL && true;
Enable::INTT_QA = Enable::INTT_CLUSTER and Enable::QA && true;
Enable::TPC = true;
Enable::TPC_ABSORBER = true;
Enable::TPC_CELL = Enable::TPC && true;
Enable::TPC_CLUSTER = Enable::TPC_CELL && true;
Enable::TPC_QA = Enable::TPC_CLUSTER and Enable::QA && true;
//Enable::MICROMEGAS = true;
Enable::MICROMEGAS_CELL = Enable::MICROMEGAS && true;
Enable::MICROMEGAS_CLUSTER = Enable::MICROMEGAS_CELL && true;
Enable::TRACKING_TRACK = true;
Enable::TRACKING_EVAL = Enable::TRACKING_TRACK && true;
Enable::TRACKING_QA = Enable::TRACKING_TRACK and Enable::QA && true;
// cemc electronics + thin layer of W-epoxy to get albedo from cemc
// into the tracking, cannot run together with CEMC
// Enable::CEMCALBEDO = true;
Enable::CEMC = true;
Enable::CEMC_ABSORBER = true;
Enable::CEMC_CELL = Enable::CEMC && true;
Enable::CEMC_TOWER = Enable::CEMC_CELL && true;
Enable::CEMC_CLUSTER = Enable::CEMC_TOWER && true;
Enable::CEMC_EVAL = Enable::CEMC_CLUSTER && true;
Enable::CEMC_QA = Enable::CEMC_CLUSTER and Enable::QA && true;
Enable::HCALIN = true;
Enable::HCALIN_ABSORBER = true;
Enable::HCALIN_CELL = Enable::HCALIN && true;
Enable::HCALIN_TOWER = Enable::HCALIN_CELL && true;
Enable::HCALIN_CLUSTER = Enable::HCALIN_TOWER && true;
Enable::HCALIN_EVAL = Enable::HCALIN_CLUSTER && true;
Enable::HCALIN_QA = Enable::HCALIN_CLUSTER and Enable::QA && true;
Enable::MAGNET = true;
Enable::MAGNET_ABSORBER = true;
Enable::HCALOUT = true;
Enable::HCALOUT_ABSORBER = true;
Enable::HCALOUT_CELL = Enable::HCALOUT && true;
Enable::HCALOUT_TOWER = Enable::HCALOUT_CELL && true;
Enable::HCALOUT_CLUSTER = Enable::HCALOUT_TOWER && true;
Enable::HCALOUT_EVAL = Enable::HCALOUT_CLUSTER && true;
Enable::HCALOUT_QA = Enable::HCALOUT_CLUSTER and Enable::QA && true;
// forward EMC
//Enable::FEMC = true;
Enable::FEMC_ABSORBER = true;
Enable::FEMC_TOWER = Enable::FEMC && true;
Enable::FEMC_CLUSTER = Enable::FEMC_TOWER && true;
Enable::FEMC_EVAL = Enable::FEMC_CLUSTER and Enable::QA && true;
Enable::EPD = false;
//! forward flux return plug door. Out of acceptance and off by default.
//Enable::PLUGDOOR = true;
Enable::PLUGDOOR_ABSORBER = true;
Enable::GLOBAL_RECO = true;
//Enable::GLOBAL_FASTSIM = true;
//Enable::KFPARTICLE = true;
//Enable::KFPARTICLE_VERBOSITY = 1;
//Enable::KFPARTICLE_TRUTH_MATCH = true;
//Enable::KFPARTICLE_SAVE_NTUPLE = true;
Enable::CALOTRIGGER = Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER && false;
Enable::JETS = true;
Enable::JETS_EVAL = Enable::JETS && true;
Enable::JETS_QA = Enable::JETS and Enable::QA && true;
// HI Jet Reco for p+Au / Au+Au collisions (default is false for
// single particle / p+p-only simulations, or for p+Au / Au+Au
// simulations which don't particularly care about jets)
Enable::HIJETS = false && Enable::JETS && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER;
// 3-D topoCluster reconstruction, potentially in all calorimeter layers
Enable::TOPOCLUSTER = false && Enable::CEMC_TOWER && Enable::HCALIN_TOWER && Enable::HCALOUT_TOWER;
// particle flow jet reconstruction - needs topoClusters!
Enable::PARTICLEFLOW = true && Enable::TOPOCLUSTER;
// new settings using Enable namespace in GlobalVariables.C
Enable::BLACKHOLE = true;
//Enable::BLACKHOLE_SAVEHITS = false; // turn off saving of bh hits
//BlackHoleGeometry::visible = true;
// run user provided code (from local G4_User.C)
//Enable::USER = true;
//---------------
// World Settings
//---------------
// G4WORLD::PhysicsList = "FTFP_BERT"; //FTFP_BERT_HP best for calo
// G4WORLD::WorldMaterial = "G4_AIR"; // set to G4_GALACTIC for material scans
//---------------
// Magnet Settings
//---------------
// const string magfield = "1.5"; // alternatively to specify a constant magnetic field, give a float number, which will be translated to solenoidal field in T, if string use as fieldmap name (including path)
// G4MAGNET::magfield = string(getenv("CALIBRATIONROOT")) + string("/Field/Map/sPHENIX.2d.root"); // default map from the calibration database
G4MAGNET::magfield_rescale = -1.4 / 1.5; // make consistent with expected Babar field strength of 1.4T
//---------------
// Pythia Decayer
//---------------
// list of decay types in
// $OFFLINE_MAIN/include/g4decayer/EDecayType.hh
// default is All:
// G4P6DECAYER::decayType = EDecayType::kAll;
// Initialize the selected subsystems
G4Init();
//---------------------
// GEANT4 Detector description
//---------------------
if (!Input::READHITS)
{
G4Setup();
}
//------------------
// Detector Division
//------------------
if (Enable::BBC || Enable::BBCFAKE) Bbc_Reco();
if (Enable::MVTX_CELL) Mvtx_Cells();
if (Enable::INTT_CELL) Intt_Cells();
if (Enable::TPC_CELL) TPC_Cells();
if (Enable::MICROMEGAS_CELL) Micromegas_Cells();
if (Enable::CEMC_CELL) CEMC_Cells();
if (Enable::HCALIN_CELL) HCALInner_Cells();
if (Enable::HCALOUT_CELL) HCALOuter_Cells();
//-----------------------------
// CEMC towering and clustering
//-----------------------------
if (Enable::CEMC_TOWER) CEMC_Towers();
if (Enable::CEMC_CLUSTER) CEMC_Clusters();
//-----------------------------
// HCAL towering and clustering
//-----------------------------
if (Enable::HCALIN_TOWER) HCALInner_Towers();
if (Enable::HCALIN_CLUSTER) HCALInner_Clusters();
if (Enable::HCALOUT_TOWER) HCALOuter_Towers();
if (Enable::HCALOUT_CLUSTER) HCALOuter_Clusters();
// if enabled, do topoClustering early, upstream of any possible jet reconstruction
if (Enable::TOPOCLUSTER) TopoClusterReco();
if (Enable::FEMC_TOWER) FEMC_Towers();
if (Enable::FEMC_CLUSTER) FEMC_Clusters();
//--------------
// SVTX tracking
//--------------
if (Enable::MVTX_CLUSTER) Mvtx_Clustering();
if (Enable::INTT_CLUSTER) Intt_Clustering();
if (Enable::TPC_CLUSTER) TPC_Clustering();
if (Enable::MICROMEGAS_CLUSTER) Micromegas_Clustering();
if (Enable::TRACKING_TRACK)
{
TrackingInit();
Tracking_Reco();
}
//-----------------
// Global Vertexing
//-----------------
if (Enable::GLOBAL_RECO && Enable::GLOBAL_FASTSIM)
{
cout << "You can only enable Enable::GLOBAL_RECO or Enable::GLOBAL_FASTSIM, not both" << endl;
gSystem->Exit(1);
}
if (Enable::GLOBAL_RECO)
{
Global_Reco();
}
else if (Enable::GLOBAL_FASTSIM)
{
Global_FastSim();
}
//-----------------
// Calo Trigger Simulation
//-----------------
if (Enable::CALOTRIGGER)
{
CaloTrigger_Sim();
}
//---------
// Jet reco
//---------
if (Enable::JETS) Jet_Reco();
if (Enable::HIJETS) HIJetReco();
if (Enable::PARTICLEFLOW) ParticleFlow();
//----------------------
// Simulation evaluation
//----------------------
string outputroot = outputFile;
string remove_this = ".root";
size_t pos = outputroot.find(remove_this);
if (pos != string::npos)
{
outputroot.erase(pos, remove_this.length());
}
if (Enable::TRACKING_EVAL) Tracking_Eval(outputroot + "_g4svtx_eval.root");
if (Enable::CEMC_EVAL) CEMC_Eval(outputroot + "_g4cemc_eval.root");
if (Enable::HCALIN_EVAL) HCALInner_Eval(outputroot + "_g4hcalin_eval.root");
if (Enable::HCALOUT_EVAL) HCALOuter_Eval(outputroot + "_g4hcalout_eval.root");
if (Enable::FEMC_EVAL) FEMC_Eval(outputroot + "_g4femc_eval.root");
if (Enable::JETS_EVAL) Jet_Eval(outputroot + "_g4jet_eval.root");
if (Enable::DSTREADER) G4DSTreader(outputroot + "_DSTReader.root");
if (Enable::USER) UserAnalysisInit();
AnaTutorial *anaTutorial = new AnaTutorial("anaTutorial", outputroot + "_anaTutorial.root");
anaTutorial->setMinJetPt(25.);
anaTutorial->Verbosity(0);
anaTutorial->analyzeTracks(false);
anaTutorial->analyzeClusters(false);
anaTutorial->analyzeJets(true);
anaTutorial->analyzeTruth(false);
se->registerSubsystem(anaTutorial);
//======================
// Run KFParticle on evt
//======================
if (Enable::KFPARTICLE && Input::UPSILON) KFParticle_Upsilon_Reco();
if (Enable::KFPARTICLE && Input::DZERO) KFParticle_D0_Reco();
//if (Enable::KFPARTICLE && Input::LAMBDAC) KFParticle_Lambdac_Reco();
//----------------------
// Standard QAs
//----------------------
if (Enable::CEMC_QA) CEMC_QA();
if (Enable::HCALIN_QA) HCALInner_QA();
if (Enable::HCALOUT_QA) HCALOuter_QA();
if (Enable::JETS_QA) Jet_QA();
if (Enable::MVTX_QA) Mvtx_QA();
if (Enable::INTT_QA) Intt_QA();
if (Enable::TPC_QA) TPC_QA();
if (Enable::TRACKING_QA) Tracking_QA();
if (Enable::TRACKING_QA and Enable::CEMC_QA and Enable::HCALIN_QA and Enable::HCALOUT_QA) QA_G4CaloTracking();
//--------------
// Set up Input Managers
//--------------
InputManagers();
if (Enable::PRODUCTION)
{
Production_CreateOutputDir();
}
if (Enable::DSTOUT)
{
string FullOutFile = DstOut::OutputDir + "/" + DstOut::OutputFile;
Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile);
if (Enable::DSTOUT_COMPRESS)
{
ShowerCompress();
DstCompress(out);
}
se->registerOutputManager(out);
}
//-----------------
// Event processing
//-----------------
if (Enable::DISPLAY)
{
DisplayOn();
gROOT->ProcessLine("Fun4AllServer *se = Fun4AllServer::instance();");
gROOT->ProcessLine("PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");");
cout << "-------------------------------------------------" << endl;
cout << "You are in event display mode. Run one event with" << endl;
cout << "se->run(1)" << endl;
cout << "Run Geant4 command with following examples" << endl;
gROOT->ProcessLine("displaycmd()");
return 0;
}
// if we use a negative number of events we go back to the command line here
if (nEvents < 0)
{
return 0;
}
// if we run the particle generator and use 0 it'll run forever
if (nEvents == 0 && !Input::HEPMC && !Input::READHITS)
{
cout << "using 0 for number of events is a bad idea when using particle generators" << endl;
cout << "it will run forever, so I just return without running anything" << endl;
return 0;
}
se->skip(skip);
se->run(nEvents);
//-----
// QA output
//-----
if (Enable::QA) QA_Output(outputroot + "_qa.root");
//-----
// Exit
//-----
se->End();
std::cout << "All done" << std::endl;
delete se;
if (Enable::PRODUCTION)
{
Production_MoveOutput();
}
gSystem->Exit(0);
return 0;
}
#endif