Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_G4_sPHENIX_jobC.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_G4_sPHENIX_jobC.C
1 
2 #include <GlobalVariables.C>
3 
4 #include <G4_Magnet.C>
5 #include <G4_Micromegas.C>
6 #include <G4_Production.C>
7 #include <G4_Tracking.C>
8 
10 #include <ffamodules/XploadInterface.h>
11 
12 #include <fun4all/SubsysReco.h>
13 #include <fun4all/Fun4AllServer.h>
16 
17 #include <phool/PHRandomSeed.h>
18 #include <phool/recoConsts.h>
19 
20 
21 R__LOAD_LIBRARY(libffamodules.so)
22 R__LOAD_LIBRARY(libfun4all.so)
23 
24 //________________________________________________________________________________________________
26  const int nEvents = 0,
27  const int nSkipEvents = 0,
28  const std::string &inputFile1 = "test.root",
29  //const std::string &inputFile1 = "DST_TRACKSEEDS_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root",
30  //const std::string &inputFile2 = "DST_CALO_CLUSTER_sHijing_0_20fm_50kHz_bkg_0_20fm-0000000060-00000.root",
31  const std::string &outputFile = "DST_Refit.root",
32  const std::string &outdir = "."
33  )
34 {
35 
36  // print inputs
37  std::cout << "Fun4All_G4_sPHENIX_jobC - nEvents: " << nEvents << std::endl;
38  std::cout << "Fun4All_G4_sPHENIX_jobC - nSkipEvents: " << nSkipEvents << std::endl;
39  std::cout << "Fun4All_G4_sPHENIX_jobC - seed inputFile: " << inputFile1 << std::endl;
40 // std::cout << "Fun4All_G4_sPHENIX_jobC - cluster inputFile: " << inputFile2 << std::endl;
41  std::cout << "Fun4All_G4_sPHENIX_jobC - outputFile: " << outputFile << std::endl;
42 
44 
45  //===============
46  // conditions DB flags
47  //===============
48  Enable::XPLOAD = true;
49  // tag
50  rc->set_StringFlag("XPLOAD_TAG",XPLOAD::tag);
51  // database config
52  rc->set_StringFlag("XPLOAD_CONFIG",XPLOAD::config);
53  // 64 bit timestamp
54  rc->set_uint64Flag("TIMESTAMP",XPLOAD::timestamp);
55 
56  // set up production relatedstuff
57  Enable::PRODUCTION = false;
58  Enable::DSTOUT = true;
59  DstOut::OutputDir = outdir;
60  DstOut::OutputFile = outputFile;
61 
62  // central tracking
63  Enable::MVTX = true;
64  Enable::INTT = true;
65  Enable::TPC = true;
66  Enable::TPC_ABSORBER = true;
67  Enable::MICROMEGAS = true;
68 
69  // TPC configuration
72 
73  /* distortion corrections */
75  G4TPC::correction_filename = string(getenv("CALIBRATIONROOT")) + "/distortion_maps/distortion_corrections_empty.root";
76 
77  // tracking configuration
79 
80  // server
81  auto se = Fun4AllServer::instance();
82  se->Verbosity(1);
83 
84  // make sure to printout random seeds for reproducibility
86 
87  FlagHandler *flag = new FlagHandler();
88  se->registerSubsystem(flag);
89 
91  TrackingInit();
92 
93  // tracking
94  /* we only run the track fit, starting with seed from JobA */
96 
97  // input manager
98  auto in = new Fun4AllDstInputManager("DSTin1");
99  in->fileopen(inputFile1);
100  se->registerInputManager(in);
101 // in = new Fun4AllDstInputManager("DSTin2");
102 // in->fileopen(inputFile2);
103 // se->registerInputManager(in);
104 
105  if (Enable::PRODUCTION)
106  {
108  }
109  // output manager
110  auto out = new Fun4AllDstOutputManager("DSTOUT", outputFile);
111  /*
112  * in principle one would not need to store the clusters and cluster crossing node, as they are already in the output from Job0
113  */
114  out->AddNode("Sync");
115  out->AddNode("EventHeader");
116  // out->AddNode("TRKR_CLUSTER");
117  // out->AddNode("TRKR_CLUSTERCROSSINGASSOC");
118  out->AddNode("SvtxTrackMap");
119  out->AddNode("SvtxVertexMap");
120  se->registerOutputManager(out);
121 
122  // skip events if any specified
123  if( nSkipEvents > 0 )
124  { se->skip( nSkipEvents ); }
125 
126  // process events
127  se->run(nEvents);
128 
129  // terminate
130  XploadInterface::instance()->Print(); // print used DB files
131  se->End();
132  se->PrintTimer();
133  std::cout << "All done" << std::endl;
134  delete se;
135  if (Enable::PRODUCTION)
136  {
138  }
139  gSystem->Exit(0);
140  return 0;
141 }
142