ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4All_G4_dRICHImport.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4All_G4_dRICHImport.C
1 #ifndef FUN4ALL_G4_MOMENTUM_C
2 #define FUN4ALL_G4_MOMENTUM_C
3 
4 #include "DisplayOn.C"
5 #include <G4_Input.C>
6 
8 
11 
13 #include <g4main/PHG4Reco.h>
15 
20 #include <fun4all/Fun4AllServer.h>
21 #include <fun4all/SubsysReco.h>
23 
24 #include <phool/recoConsts.h>
25 
26 #include <cmath>
27 
28 R__LOAD_LIBRARY(libfun4all.so)
29 R__LOAD_LIBRARY(libg4testbench.so)
30 R__LOAD_LIBRARY(libg4detectors.so)
31 R__LOAD_LIBRARY(libg4trackfastsim.so)
32 
33 int Fun4All_G4_dRICHImport(const int nEvents = -1 // negative value run a Geant4 GUI for event display
34  )
35 {
37  // Make the Server
40  se->Verbosity(0);
41 
43  // if you want to use a fixed seed for reproducible results
44  // rc->set_IntFlag("RANDOMSEED", 12345);
45 
46 // // PHG4ParticleGenerator generates particle
47 // // distributions in eta/phi/mom range
48 // PHG4ParticleGenerator *gen = new PHG4ParticleGenerator("PGENERATOR");
49 // gen->set_name("pi-");
50 // gen->set_vtx(0, 0, 0);
51 // gen->set_eta_range(2, 2.5); // around midrapidity
52 // gen->set_mom_range(10, 10); // fixed 4 GeV/c
53 // gen->set_phi_range(0., 90. / 180. * M_PI); // 0-90 deg
54 // se->registerSubsystem(gen);
55 
56 
57  Input::PYTHIA6 = true;
58  //-----------------
59  // Initialize the selected Input/Event generation
60  //-----------------
61  InputInit();
62 
63  INPUTGENERATOR::Pythia6->set_config_file(string(getenv("CALIBRATIONROOT")) + "/Generators/phpythia6_ep.cfg");
64 
65  // register all input generators with Fun4All
66  InputRegister();
67 
68 
69  PHG4Reco *g4Reco = new PHG4Reco();
70  g4Reco->set_field(1.5); // 1.5 T constant solenoidal field
71 
72  PHG4GDMLSubsystem* gdml = new PHG4GDMLSubsystem("dRICH");
73 // gdml->set_string_param("GDMPath", "drich.gdml");
74  gdml->set_string_param("GDMPath", "drich_only.gdml");
75  gdml->set_string_param("TopVolName", "DRICH");
76  gdml->set_double_param("place_z", 262.);
77  gdml->OverlapCheck(true);
78  g4Reco->registerSubsystem(gdml);
79 
81  g4Reco->registerSubsystem(truth);
82 
83  se->registerSubsystem(g4Reco);
84 
85  if (nEvents >= 0)
86  {
87  se->run(nEvents);
88  // finish job - close and save output files
89  se->End();
90  std::cout << "All done" << std::endl;
91 
92  // cleanup - delete the server and exit
93  delete se;
94  gSystem->Exit(0);
95  }
96  else
97  {
98  // negative value run a Geant4 GUI for event display
99  QTGui();
100 
101  }
102  return 0;
103 }
104 
105 PHG4ParticleGenerator *get_gen(const char *name = "PGENERATOR")
106 {
109  return pgun;
110 }
111 
112 #endif