Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_G4_sPHENIX.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_G4_sPHENIX.C
1 #ifndef MACRO_FUN4ALLG4SPHENIX_C
2 #define MACRO_FUN4ALLG4SPHENIX_C
3 
4 #include <GlobalVariables.C>
5 
6 #include <G4Setup_sPHENIX.C>
7 #include <G4_Centrality.C>
8 #include <G4_Input.C>
9 #include <Trkr_Clustering.C>
10 #include <Trkr_RecoInit.C>
11 
14 #include <fun4all/Fun4AllServer.h>
15 
18 
19 #include <dndetaintt/dNdEtaINTT.h>
20 
21 #include <phool/recoConsts.h>
22 
23 R__LOAD_LIBRARY(libfun4all.so)
24 R__LOAD_LIBRARY(libffamodules.so)
25 R__LOAD_LIBRARY(libdNdEtaINTT.so)
26 R__LOAD_LIBRARY(libcentrality_io.so)
27 R__LOAD_LIBRARY(libg4centrality.so)
28 
29 int Fun4All_G4_sPHENIX(const bool rundata = true, const string generator = "HIJING", const int nEvents = -1, const string &outputFile = "dataNtuple.root", const int process = 0)
30 {
31  int skip;
32  if (rundata)
33  skip = nEvents * process;
34  else
35  skip = 0;
37  se->Verbosity(1);
38 
40 
41  Input::VERBOSITY = INT_MAX;
42  Input::READHITS = true;
43 
44  string infile;
45  if (rundata)
46  {
47  infile = "/sphenix/tg/tg01/bulk/dNdeta_INTT_run2023/data/data/run_00020869/ana.382/beam_intt_combined-dst-00020869-0000.root";
48  }
49  else
50  {
51  if (generator == "HIJING")
52  infile = "/sphenix/tg/tg01/bulk/dNdeta_INTT_run2023/data/simulation/ana.398/HIJING/fullSim/magOff/detectorAligned/dstSet_00000/dNdeta-sim-HIJING-000-" + std::string(TString::Format("%05d", process).Data()) + ".root";
53  else if (generator == "EPOS")
54  infile = "/sphenix/tg/tg01/bulk/dNdeta_INTT_run2023/data/simulation/ana.399/EPOS/fullSim/magOff/detectorAligned/dstSet_00000/dNdeta-sim-EPOS-000-" + std::string(TString::Format("%05d", process).Data()) + ".root";
55  else if (generator == "AMPT")
56  infile = "/sphenix/tg/tg01/bulk/dNdeta_INTT_run2023/data/simulation/new/AMPT/fullSim/magOff/detectorAligned/dstSet_00000/dNdeta-sim-AMPT-000-" + std::string(TString::Format("%05d", process).Data()) + ".root";
57  else
58  {
59  std::cout << "Generator " << generator << " is not [HIJING, EPOS, AMPT]. Exit" << std::endl;
60  return 0;
61  }
62  }
63 
65  // const vector<string> &filelist = {"/sphenix/user/hjheng/sPHENIXdNdEta/macros/list/dNdEta_INTT/dst_INTTdNdEta_data.list"};
66 
67  // for (unsigned int i = 0; i < filelist.size(); ++i)
68  // {
69  // INPUTREADHITS::listfile[i] = filelist[i];
70  // }
71 
72  // register all input generators with Fun4All
73  // InputRegister();
74 
75  Enable::MBD = true;
76  Enable::PIPE = true;
77  Enable::MVTX = true;
78  Enable::INTT = true;
79  Enable::TPC = true;
80  Enable::MICROMEGAS = true;
81 
82  //===============
83  // conditions DB flags
84  //===============
85  Enable::CDB = true;
87  // global tag
88  rc->set_StringFlag("CDB_GLOBALTAG", CDB::global_tag);
89  // 64 bit timestamp
90  rc->set_uint64Flag("TIMESTAMP", CDB::timestamp);
91 
92  G4Init();
93  G4Setup();
94 
95  // TrkrHit reconstructions
96  // Mvtx_Cells();
97  // Load ActsGeometry object
98  TrackingInit();
99  // Reco clustering
100  // Mvtx_Clustering();
101  if (rundata)
102  Intt_Clustering();
103 
104  //-----------------
105  // Centrality Determination
106  //-----------------
107  // Centrality();
109  cent->Verbosity(0);
110  cent->GetCalibrationParameters().ReadFromFile("centrality", "xml", 0, 0, string(getenv("CALIBRATIONROOT")) + string("/Centrality/"));
111  se->registerSubsystem(cent);
112 
113  auto vtxing = new PHTruthVertexing;
114  vtxing->associate_tracks(false); // This is set to false because we do not run tracking
115  se->registerSubsystem(vtxing);
116 
117  dNdEtaINTT *myAnalyzer = new dNdEtaINTT("dNdEtaAnalyzer", outputFile, rundata);
118  myAnalyzer->GetTruthPV(true);
119  myAnalyzer->GetRecoCluster(true);
120  myAnalyzer->GetCentrality(true);
121  myAnalyzer->GetTrkrHit(true);
122  se->registerSubsystem(myAnalyzer);
123 
124  //--------------
125  // Set up Input Managers
126  //--------------
127  InputManagers();
128 
129  //-----------------
130  // Event processing
131  //-----------------
132  se->skip(skip);
133  se->run(nEvents);
134 
135  //-----
136  // Exit
137  //-----
138  se->End();
139  std::cout << "All done" << std::endl;
140  delete se;
141 
142  gSystem->Exit(0);
143  return 0;
144 }
145 #endif