Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fun4DumpGeom.C
Go to the documentation of this file.
1 #include <TSystem.h>
2 
3 #include "G4_Beamline.C"
4 #include "G4_Target.C"
7 
8 R__LOAD_LIBRARY(libfun4all)
9 R__LOAD_LIBRARY(libgeom_svc)
10 R__LOAD_LIBRARY(libg4detectors)
11 R__LOAD_LIBRARY(libg4dst)
12 
13 using namespace std;
14 
15 int Fun4DumpGeom(const bool display = true)
16 {
17  // geometry setup
18  const bool do_collimator = true;
19  const bool do_target = true;
20  const bool do_shielding = true;
21  const bool do_fmag = true;
22  const bool do_kmag = true;
23  const bool do_absorber = true;
24  const bool do_st1DC = false;
25  const bool do_dphodo = true;
26 
27  const double collimator_pos_z = -602.36;
28  const double target_coil_pos_z = -300.;
29  const double target_l = 7.9; //cm
30  const double target_z = (7.9-target_l)/2.; //cm
31 
32  const string chamberGas = "SQ_ArCO2";
33  const string hodoMat = "SQ_Scintillator";
34 
35  GeomSvc::UseDbSvc(true);
36  GeomSvc* geom_svc = GeomSvc::instance();
37 
38  //Fun4AllServer - intialize before all other subsystems
40  se->Verbosity(99);
41 
42  // Fun4All G4 module
43  PHG4Reco* g4Reco = new PHG4Reco();
44  g4Reco->SetWorldSizeX(1000);
45  g4Reco->SetWorldSizeY(1000);
46  g4Reco->SetWorldSizeZ(5000);
47  // shape of our world - it is a tube
48  g4Reco->SetWorldShape("G4BOX");
49  // this is what our world is filled with
50  g4Reco->SetWorldMaterial("G4_AIR"); //G4_Galactic, G4_AIR
51 
52  // sub-systems
53  SetupBeamline(g4Reco, do_collimator, collimator_pos_z);
54  SetupTarget(g4Reco, target_coil_pos_z, target_l, target_z, 1, 0);
55  SetupInsensitiveVolumes(g4Reco, do_shielding, do_fmag, do_kmag, do_absorber);
56  SetupSensitiveDetectors(g4Reco, do_dphodo, do_st1DC, chamberGas, hodoMat);
57  se->registerSubsystem(g4Reco);
58 
59  // dummy input mananger
61  se->registerInputManager(in);
62 
63  se->run(1);
64  PHGeomUtility::ExportGeomtry(se->topNode(), "geom.root");
65 
66  se->End();
67  delete se;
68 
69  // draw the ROOT geometry
70  if(!display) return 0;
71  gGeoManager = TGeoManager::Import("geom.root");
72  gGeoManager->GetCurrentNode()->GetVolume()->Draw("ogl");
73 
74  return 0;
75 }
int registerInputManager(Fun4AllInputManager *InManager)
virtual int End()
Runs G4 as a subsystem.
Definition: PHG4Reco.h:38
void SetupSensitiveDetectors(PHG4Reco *g4Reco, bool toggle_dphodo=true, bool toggle_dc1=false, std::string chamberGas="SQ_ArCO2", std::string hodoMat="SQ_Scintillator", const int verbosity=0)
void SetWorldMaterial(const std::string &s)
Definition: PHG4Reco.h:118
void SetWorldShape(const std::string &s)
Definition: PHG4Reco.h:117
static Fun4AllServer * instance()
Fun4AllServer * se
static void ExportGeomtry(PHCompositeNode *topNode, const std::string &geometry_file)
DST node -&gt; TGeoManager -&gt; export files, like gdml, .root or .C formats.
int registerSubsystem(SubsysReco *subsystem, const std::string &topnodename="TOP")
static bool UseDbSvc()
Definition: GeomSvc.h:304
int run(const int nevnts=0, const bool require_nevents=false)
run n events (0 means up to end of file)
void SetupInsensitiveVolumes(PHG4Reco *g4Reco, const bool toggle_shielding=true, const bool toggle_fmag=true, const bool toggle_kmag=true, const bool toggle_absorber=true, const int enable_fmag_filter=0, const double filter_max_slope=0.25, const double filter_min_energy=5.)
void SetupTarget(PHG4Reco *g4Reco, const double target_coil_pos_z=-300, const double target_l=7.9, const double target_z=0., const int use_g4steps=1, const int register_hits=0)
Definition: G4_Target.C:10
PHCompositeNode * topNode() const
Definition: Fun4AllServer.h:59
void SetWorldSizeX(const double sx)
Definition: PHG4Reco.h:111
virtual void Verbosity(const int ival)
Sets the verbosity of this module (0 by default=quiet).
Definition: Fun4AllBase.h:58
static GeomSvc * instance()
singlton instance
Definition: GeomSvc.cxx:211
void SetupBeamline(PHG4Reco *g4Reco, const bool toggle_collimator=true, const double collimator_pos_z=-300, const int register_hits=0)
Definition: G4_Beamline.C:8
int Fun4DumpGeom(const bool display=true)
Definition: Fun4DumpGeom.C:15
void SetWorldSizeZ(const double sz)
Definition: PHG4Reco.h:113
void SetWorldSizeY(const double sy)
Definition: PHG4Reco.h:112