Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_BHG.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_BHG.C
1 #ifndef MACRO_FUN4ALLG4SPHENIX_C
2 #define MACRO_FUN4ALLG4SPHENIX_C
3 
4 #include <G4_Input.C>
5 #include <G4_Global.C>
6 #include <G4Setup_sPHENIX.C>
7 
8 #include <Trkr_RecoInit.C>
9 #include <Trkr_Clustering.C>
10 #include <Trkr_TruthTables.C>
11 #include <Trkr_Reco.C>
12 
13 #include <phpythia8/PHPy8ParticleTrigger.h>
14 
16 #include <hftrackefficiency/HFTrackEfficiency.h>
17 
18 #include <ffamodules/FlagHandler.h>
19 #include <ffamodules/HeadReco.h>
20 #include <ffamodules/SyncReco.h>
22 #include <phool/PHRandomSeed.h>
23 #include <phool/recoConsts.h>
24 
27 #include <fun4all/Fun4AllServer.h>
28 
29 R__LOAD_LIBRARY(libfun4all.so)
30 R__LOAD_LIBRARY(libffamodules.so)
31 R__LOAD_LIBRARY(libdecayfinder.so)
32 R__LOAD_LIBRARY(libhftrackefficiency.so)
33 
34 int Fun4All_BHG(std::string processID = "0")
35 {
36  int nEvents = 5e2;
37  //F4A setup
38 
40  se->Verbosity(1);
41 
44 
45  //Generator setup
46 
47  Input::PYTHIA8 = true;
48 
49  PYTHIA8::config_file = "pythia8_bs.cfg";
50  EVTGENDECAYER::DecayFile = "Bs2JpsiKS0.DEC";
51 
53 
54  InputInit();
55 
56  PHPy8ParticleTrigger * p8_hf_signal_trigger = new PHPy8ParticleTrigger();
57  p8_hf_signal_trigger->AddParticles(531);
58  p8_hf_signal_trigger->AddParticles(-531);
59  p8_hf_signal_trigger->SetPtLow(2.);
60  p8_hf_signal_trigger->SetEtaHighLow(0.9, -0.9); // sample a rapidity range higher than the sPHENIX tracking pseudorapidity
61  p8_hf_signal_trigger->SetStableParticleOnly(false); // process unstable particles that include quarks
62  p8_hf_signal_trigger->PrintConfig();
63  INPUTGENERATOR::Pythia8->register_trigger(p8_hf_signal_trigger);
65 
67 
68  InputRegister();
69 
70  //CDB flags and such
71 
72  rc->set_IntFlag("RUNNUMBER",1);
73 
74  SyncReco *sync = new SyncReco();
75  se->registerSubsystem(sync);
76 
77  HeadReco *head = new HeadReco();
78  se->registerSubsystem(head);
79 
80  FlagHandler *flag = new FlagHandler();
81  se->registerSubsystem(flag);
82 
83 
84  DecayFinder *myFinder = new DecayFinder("myFinder");
85  myFinder->Verbosity(INT_MAX);
86  myFinder->setDecayDescriptor("[B_s0 -> {J/psi -> e^+ e^-} {K_S0 -> pi^+ pi^-}]cc");
87  myFinder->saveDST(1);
88  myFinder->allowPi0(1);
89  myFinder->allowPhotons(1);
90  myFinder->triggerOnDecay(1);
91  myFinder->setPTmin(0.16); //Note: sPHENIX min pT is 0.2 GeV for tracking
92  myFinder->setEtaRange(-2,2); //Note: sPHENIX acceptance is |eta| <= 1.1
93  myFinder->useDecaySpecificEtaRange(false);
94  se->registerSubsystem(myFinder);
95 
96  //Simulation setup
97 
98  Enable::MBDFAKE = true;
99  Enable::PIPE = true;
100  Enable::PIPE_ABSORBER = true;
101  Enable::MVTX = true;
102  Enable::INTT = true;
103  Enable::TPC = true;
104  Enable::MICROMEGAS = true;
105 
106  //Tracking setup
107 
108  Enable::CDB = true;
109  rc->set_StringFlag("CDB_GLOBALTAG",CDB::global_tag);
110  rc->set_uint64Flag("TIMESTAMP",CDB::timestamp);
111 
112  MagnetInit();
113  MagnetFieldInit();
114 
115  G4Init();
116  G4Setup();
117 
118  Mbd_Reco();
119  Mvtx_Cells();
120  Intt_Cells();
121  TPC_Cells();
123 
124  TrackingInit();
125 
126  Mvtx_Clustering();
127  Intt_Clustering();
128  TPC_Clustering();
130 
131  Tracking_Reco();
132  Global_Reco();
133 
135 
136  //HF stuff
137 
138  HFTrackEfficiency *myTrackEff = new HFTrackEfficiency("myTrackEff");
139  myTrackEff->Verbosity(INT_MAX);
140  myTrackEff->setDFNodeName("myFinder");
141  myTrackEff->triggerOnDecay(1);
142  myTrackEff->writeSelectedTrackMap(true);
143  myTrackEff->writeOutputFile(false);
144  se->registerSubsystem(myTrackEff);
145 
146  //Output file handling
147 
148  string FullOutFile = "./Bs2JpsiKS0_DST_" + processID + ".root";
149  Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", FullOutFile);
150  out->StripNode("G4HIT_PIPE");
151  out->StripNode("G4HIT_SVTXSUPPORT");
152  out->StripNode("PHG4INEVENT");
153  out->StripNode("Sync");
154  out->StripNode("myFinder_DecayMap");
155  out->StripNode("G4HIT_PIPE");
156  out->StripNode("G4HIT_MVTX");
157  out->StripNode("G4HIT_INTT");
158  out->StripNode("G4HIT_TPC");
159  out->StripNode("G4HIT_MICROMEGAS");
160  out->StripNode("TRKR_HITSET");
161  out->StripNode("TRKR_HITTRUTHASSOC");
162  out->StripNode("TRKR_CLUSTER");
163  out->StripNode("TRKR_CLUSTERHITASSOC");
164  out->StripNode("TRKR_CLUSTERCROSSINGASSOC");
165  out->StripNode("TRAINING_HITSET");
166  out->StripNode("TRKR_TRUTHTRACKCONTAINER");
167  out->StripNode("TRKR_TRUTHCLUSTERCONTAINER");
168  out->StripNode("alignmentTransformationContainer");
169  out->StripNode("alignmentTransformationContainerTransient");
170  out->StripNode("SiliconTrackSeedContainer");
171  out->StripNode("TpcTrackSeedContainer");
172  out->StripNode("SvtxTrackSeedContainer");
173  out->StripNode("ActsTrajectories");
174  out->StripNode("SvtxTrackMap");
175  out->StripNode("SvtxAlignmentStateMap");
176  out->SaveRunNode(0);
177  se->registerOutputManager(out);
178 
179  se->run(nEvents);
180  se->End();
181  gSystem->Exit(0);
182 
183  return 0;
184 }
185 
186 #endif