1 #ifndef MACRO_FUN4ALLG4EICDETECTOR_C
2 #define MACRO_FUN4ALLG4EICDETECTOR_C
7 #include <G4Setup_EICDetector.C>
23 #include <RooUnblindPrecision.h>
29 const
double particlemomMin = -1,
30 const
double particlemomMax = -1,
31 const
string detectorSettings = "TTLGEO_5",
32 const TString generatorSettings = "
PYTHIA8",
33 const
string &inputFile = "https:
34 const
string &outputFile = "G4EICDetector.root",
35 const
string &embed_input_file = "https:
37 const
string &outdir = ".")
55 bool generate_seed =
false;
59 size_t findSlash = inputFile.find_last_of(
"/");
60 string inputFileName = inputFile.substr(findSlash + 1, inputFile.size());
62 RooRealVar dummyVal(
"dummy",
"", 0);
63 RooUnblindPrecision blindVal(
"blindVal",
"blindVal", inputFileName.c_str(),
nEvents, skip + 1, dummyVal, kFALSE);
99 if(particlemomMin==-1 && particlemomMax==-1){
100 if (generatorSettings.Contains(
"PYTHIA6")) {
102 }
else if (generatorSettings.Contains(
"PYTHIA8")) {
104 }
else if (generatorSettings.Contains(
"SATRE")) {
106 }
else if (generatorSettings.Contains(
"READEIC")) {
108 }
else if (generatorSettings.Contains(
"HEPMCINPUT")) {
115 if (particlemomMin>-1 && particlemomMax>-1){
118 if (generatorSettings.Contains(
"Multi"))
137 if (generatorSettings.Contains(
"Multi")){
139 if (generatorSettings.Contains(
"PiPrEl")){
143 }
else if (generatorSettings.Contains(
"Pion"))
145 else if (generatorSettings.Contains(
"Kaon"))
147 else if (generatorSettings.Contains(
"Proton"))
149 else if (generatorSettings.Contains(
"Muon"))
151 else if (generatorSettings.Contains(
"Photon"))
153 else if (generatorSettings.Contains(
"Neutron"))
155 else if (generatorSettings.Contains(
"Lambda"))
157 else if (generatorSettings.Contains(
"K0S"))
159 else if (generatorSettings.Contains(
"Electron"))
161 else if (generatorSettings.Contains(
"PiZero"))
164 std::cout <<
"You didn't specify which particle you wanted to generate, exiting" << std::endl;
173 bool strictrange =
false;
174 if(generatorSettings.Contains(
"strict")) strictrange =
true;
180 }
else if (igen==1) {
185 }
else if (igen==2) {
197 if (generatorSettings.Contains(
"SimplePion"))
199 else if (generatorSettings.Contains(
"SimpleKaon"))
201 else if (generatorSettings.Contains(
"SimpleProton"))
203 else if (generatorSettings.Contains(
"SimplePhoton"))
205 else if (generatorSettings.Contains(
"SimpleNeutron"))
207 else if (generatorSettings.Contains(
"SimpleMuon"))
209 else if (generatorSettings.Contains(
"SimpleLambda"))
211 else if (generatorSettings.Contains(
"SimpleK0S"))
213 else if (generatorSettings.Contains(
"SimpleElectron"))
215 else if (generatorSettings.Contains(
"SimplePiZero"))
218 std::cout <<
"You didn't specify which particle you wanted to generate, exiting" << std::endl;
226 if (generatorSettings.Contains(
"central"))
228 else if (generatorSettings.Contains(
"bck"))
230 else if (generatorSettings.Contains(
"fwd"))
238 if(particlemomMin>-1 && particlemomMax == -1){
244 if(particlemomMin > -1) {
326 if (detectorSettings.find(
"display") != std::string::npos) {
366 std::string ttlSettingToFind =
"TTLGEO_";
367 if (detectorSettings.find(ttlSettingToFind) != std::string::npos) {
368 auto pos = detectorSettings.find(ttlSettingToFind);
424 if (detectorSettings.find(
"EEMAPNC") != std::string::npos) {
427 if (detectorSettings.find(
"EEMAP30CM") != std::string::npos) {
430 if (detectorSettings.find(
"EEMAPCARBON") != std::string::npos) {
433 if (detectorSettings.find(
"EEMAPUPDATE") != std::string::npos) {
450 if(detectorSettings.find(
"BHH")!= std::string::npos ){
483 if(detectorSettings.find(
"STANDALONE")!= std::string::npos){
520 if(detectorSettings.find(
"PIPE")!= std::string::npos ){
524 if(detectorSettings.find(
"Magnet")!= std::string::npos )
526 if(detectorSettings.find(
"dRICH")!= std::string::npos )
530 if(detectorSettings.find(
"CEMC")!= std::string::npos )
532 if(detectorSettings.find(
"HCALOUT")!= std::string::npos ){
535 if(detectorSettings.find(
"HCALIN")!= std::string::npos ){
538 if(detectorSettings.find(
"HCALINOUT")!= std::string::npos ){
542 if(detectorSettings.find(
"DR")!= std::string::npos )
544 if(detectorSettings.find(
"FEMC")!= std::string::npos )
546 if(detectorSettings.find(
"FGEM")!= std::string::npos )
548 if((detectorSettings.find(
"FHCAL")!= std::string::npos) && !(detectorSettings.find(
"LFHCAL")!= std::string::npos) )
550 if(detectorSettings.find(
"LFHCAL")!= std::string::npos )
552 if(detectorSettings.find(
"BECAL")!= std::string::npos )
554 if(detectorSettings.find(
"EHCAL")!= std::string::npos )
556 if(detectorSettings.find(
"EEMCH")!= std::string::npos )
558 if(detectorSettings.find(
"RWELL")!= std::string::npos )
560 if(detectorSettings.find(
"CHCAL")!= std::string::npos ){
564 if(detectorSettings.find(
"DIRC")!= std::string::npos )
566 if(detectorSettings.find(
"SUPPORT")!= std::string::npos ){
570 if(detectorSettings.find(
"FWDCALO")!= std::string::npos ){
574 if(detectorSettings.find(
"FWDLCALO")!= std::string::npos ){
578 if(detectorSettings.find(
"BARCALO")!= std::string::npos ){
584 if(detectorSettings.find(
"BCKCALO")!= std::string::npos ){
588 if(detectorSettings.find(
"TTL")!= std::string::npos ){
592 if(detectorSettings.find(
"FTTL")!= std::string::npos )
594 if(detectorSettings.find(
"ETTL")!= std::string::npos ){
599 if(detectorSettings.find(
"CTTL")!= std::string::npos ){
662 if (detectorSettings.find(
"HITS") != std::string::npos) {
664 if (detectorSettings.find(
"HITSABS") != std::string::npos) {
667 if (detectorSettings.find(
"HITSC") != std::string::npos) {
686 if (detectorSettings.find(
"NOFIELD") != std::string::npos) {
801 string outputroot = outdir +
"/" + outputFile;
802 string remove_this =
".root";
803 size_t pos = outputroot.find(remove_this);
804 if (pos != string::npos)
806 outputroot.erase(pos, remove_this.length());
865 if (detectorSettings.find(
"viewer") != std::string::npos){
866 gROOT->ProcessLine(
"PHG4Reco *g4 = QTGui();");
869 gROOT->ProcessLine(
"Fun4AllServer *se = Fun4AllServer::instance();");
870 gROOT->ProcessLine(
"PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco(\"PHG4RECO\");");
872 cout <<
"-------------------------------------------------" << endl;
873 cout <<
"You are in event display mode. Run one event with" << endl;
874 cout <<
"se->run(1)" << endl;
875 cout <<
"Run Geant4 command with following examples" << endl;
876 gROOT->ProcessLine(
"displaycmd()");
888 cout <<
"using 0 for number of events is a bad idea when using particle generators" << endl;
889 cout <<
"it will run forever, so I just return without running anything" << endl;
901 std::cout <<
"All done" << std::endl;