Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fun4EMCal.C
Go to the documentation of this file.
1 #include <TSystem.h>
2 
3 #include "G4_EMCal.C"
4 
5 R__LOAD_LIBRARY(libfun4all)
6 R__LOAD_LIBRARY(libPHPythia8)
7 R__LOAD_LIBRARY(libg4detectors)
8 R__LOAD_LIBRARY(libg4testbench)
9 R__LOAD_LIBRARY(libg4eval)
10 R__LOAD_LIBRARY(libg4dst)
11 R__LOAD_LIBRARY(libdptrigger)
12 R__LOAD_LIBRARY(libktracker)
13 R__LOAD_LIBRARY(libevt_filter)
14 
15 R__LOAD_LIBRARY(libanamodule)
16 
17 //#include "AnaModule/AnaModule.h"
18 
19 using namespace std;
20 
21 int Fun4EMCal(const int nevent = 1)
22 {
23  GeomSvc::UseDbSvc(true);
24  GeomSvc* p_geomSvc = GeomSvc::instance();
25 
27  se->Verbosity(0);
28 
29  PHG4ParticleGun* gun = new PHG4ParticleGun("GUN");
30  gun->set_name("e-");
31  gun->set_vtx(0., 0., -300.);
32  gun->set_mom(0., 0., 2.);
33  se->registerSubsystem(gun);
34 
35  // Fun4All G4 module
36  PHG4Reco* g4Reco = new PHG4Reco();
37  g4Reco->SetWorldSizeX(1000); //unit is cm
38  g4Reco->SetWorldSizeY(1000);
39  g4Reco->SetWorldSizeZ(1000);
40  g4Reco->SetWorldShape("G4BOX"); // shape of our world - it is a box
41  g4Reco->SetWorldMaterial("G4_AIR"); // this is what our world is filled with, eg. G4_Galactic, G4_AIR
42 
43  // sub-systems
44  SetupEMCal(g4Reco);
45  se->registerSubsystem(g4Reco);
46 
47  // save truth info to the Node Tree
49  g4Reco->registerSubsystem(truth);
50 
51  SQDigitizer* digitizer = new SQDigitizer("Digitizer", 0);
52  digitizer->Verbosity(0);
53  digitizer->registerEMCal("EMCal", 100);
54  se->registerSubsystem(digitizer);
55 
56  AnaModule* ana = new AnaModule();
57  ana->set_output_filename("ana.root");
58  se->registerSubsystem(ana);
59 
60  // input - we need a dummy to drive the event loop
62  se->registerInputManager(in);
63 
65  // Output
67  // DST output manager, tunred off to save disk by default
68  Fun4AllDstOutputManager* out = new Fun4AllDstOutputManager("DSTOUT", "DST.root");
69  se->registerOutputManager(out);
70 
71  se->run(nevent);
72  PHGeomUtility::ExportGeomtry(se->topNode(), "geom.root");
73 
74  // finish job - close and save output files
75  se->End();
76  se->PrintTimer();
77  std::cout << "All done" << std::endl;
78 
79  // cleanup - delete the server and exit
80  delete se;
81  gSystem->Exit(0);
82 
83  return 0;
84 }
int registerInputManager(Fun4AllInputManager *InManager)
virtual int End()
Runs G4 as a subsystem.
Definition: PHG4Reco.h:38
void SetWorldMaterial(const std::string &s)
Definition: PHG4Reco.h:118
void SetWorldShape(const std::string &s)
Definition: PHG4Reco.h:117
int Fun4EMCal(const int nevent=1)
Definition: Fun4EMCal.C:21
static Fun4AllServer * instance()
Fun4AllServer * se
void PrintTimer(const std::string &name="")
static void ExportGeomtry(PHCompositeNode *topNode, const std::string &geometry_file)
DST node -&gt; TGeoManager -&gt; export files, like gdml, .root or .C formats.
void SetupEMCal(PHG4Reco *g4Reco, const std::string name="EMCal", const double place_x=0., const double place_y=0., const double place_z=0., const int n_super_h=6, const int n_super_v=3, const int verbose=0)
Definition: G4_EMCal.C:8
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)
int registerOutputManager(Fun4AllOutputManager *manager)
void set_output_filename(const TString &n)
Definition: AnaModule.h:32
void registerEMCal(std::string ecalName, int ecalID=100)
Register additional EMCal detector for digitizing.
Definition: SQDigitizer.h:52
PHCompositeNode * topNode() const
Definition: Fun4AllServer.h:59
void ana()
Definition: ana.C:291
void SetWorldSizeX(const double sx)
Definition: PHG4Reco.h:111
virtual void set_vtx(const double x, const double y, const double z)
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
virtual void set_name(const std::string &particle="proton")
virtual void set_mom(const double x, const double y, const double z)
void registerSubsystem(PHG4Subsystem *subsystem)
register subsystem
Definition: PHG4Reco.h:65
void SetWorldSizeZ(const double sz)
Definition: PHG4Reco.h:113
void SetWorldSizeY(const double sy)
Definition: PHG4Reco.h:112