Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fun4DST.C
Go to the documentation of this file.
1 
3 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
4 
5 #include <TSystem.h>
6 
8 #include "G4_Target.C"
9 
10 R__LOAD_LIBRARY(libinterface_main)
11 R__LOAD_LIBRARY(libfun4all)
12 R__LOAD_LIBRARY(libdecoder_maindaq)
13 R__LOAD_LIBRARY(libg4testbench)
14 R__LOAD_LIBRARY(libg4detectors)
15 R__LOAD_LIBRARY(libg4eval)
16 R__LOAD_LIBRARY(libevt_filter)
17 R__LOAD_LIBRARY(libktracker)
18 R__LOAD_LIBRARY(libonlmonserver)
19 #endif
20 
21 int Fun4DST(
22 const int nevent = 0,
23 const int run = 195
24 )
25 {
26  gSystem->Load("libinterface_main.so");
27  gSystem->Load("libfun4all");
28  gSystem->Load("libdecoder_maindaq");
29  gSystem->Load("libg4testbench");
30  gSystem->Load("libg4detectors");
31  gSystem->Load("libg4eval");
32  gSystem->Load("libktracker.so");
33  gSystem->Load("libonlmonserver.so");
34 
35  const char* dst_dir = "./"; // "/data2/e1039/dst";
36  const char* out_dir = "./";
37 
38  ostringstream oss;
39  oss << setfill('0')
40  << dst_dir << "/run_" << setw(6) << run << "_spin.root";
41  string in_file = oss.str();
42  oss.str("");
43  oss << out_dir << "/run_" << setw(6) << run << ".root";
44  string out_dst = oss.str();
45 
47  se->Verbosity(0);
48 
49  const double FMAGSTR = -1.044;//-1.054;
50  const double KMAGSTR = -1.025;//-0.951;
51 
53  rc->set_DoubleFlag("FMAGSTR", FMAGSTR);
54  rc->set_DoubleFlag("KMAGSTR", KMAGSTR);
55  rc->Print();
56 
57  JobOptsSvc *jobopt_svc = JobOptsSvc::instance();
58  jobopt_svc->init("run7_data.opts");
59 
60  GeomSvc::UseDbSvc(true);
61  GeomSvc *geom_svc = GeomSvc::instance();
62 
63  // Fun4All G4 module
64  PHG4Reco *g4Reco = new PHG4Reco();
65  //PHG4Reco::G4Seed(123);
66  //g4Reco->set_field(5.);
67  g4Reco->set_field_map(
68  jobopt_svc->m_fMagFile+" "+
69  jobopt_svc->m_kMagFile+" "+
70  Form("%f",FMAGSTR) + " " +
71  Form("%f",KMAGSTR) + " " +
72  "5.0",
74  // size of the world - every detector has to fit in here
75  g4Reco->SetWorldSizeX(1000);
76  g4Reco->SetWorldSizeY(1000);
77  g4Reco->SetWorldSizeZ(5000);
78  // shape of our world - it is a tube
79  g4Reco->SetWorldShape("G4BOX");
80  // this is what our world is filled with
81  g4Reco->SetWorldMaterial("G4_AIR"); //G4_Galactic, G4_AIR
82  // Geant4 Physics list to use
83  g4Reco->SetPhysicsList("FTFP_BERT");
84 
85  // insensitive elements of the spectrometer
86  PHG4E1039InsensSubsystem* insens = new PHG4E1039InsensSubsystem("Insens");
87  g4Reco->registerSubsystem(insens);
88 
89  // collimator, targer and shielding between target and FMag
90  gROOT->LoadMacro("G4_Target.C");
91  SetupTarget(g4Reco);
92 
93  // sensitive elements of the spectrometer
94  gROOT->LoadMacro("G4_SensitiveDetectors.C");
96 
97  se->registerSubsystem(g4Reco);
98 
99  // calib: in time
100  CalibInTime* cali_intime = new CalibInTime();
101  se->registerSubsystem(cali_intime);
102 
103  // calib: TDC to drift time
104  CalibXT* cali_xt = new CalibXT();
105  se->registerSubsystem(cali_xt);
106 
107  // Event Filter
108  EvtFilter *evt_filter = new EvtFilter();
109  se->registerSubsystem(evt_filter);
110 
111  // trakcing module
112  KalmanFastTrackingWrapper *ktracker = new KalmanFastTrackingWrapper();
113  ktracker->Verbosity(10);
114  ktracker->set_enable_event_reducer(true);
115  ktracker->set_DS_level(0);
116  se->registerSubsystem(ktracker);
117 
118  // input manager for DST file
119  Fun4AllInputManager *in = new Fun4AllDstInputManager("RealDst");
120  in->fileopen(in_file);
121  se->registerInputManager(in);
122 
123 
124  // output manager for DST files
125  //Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", out_dst);
126  //se->registerOutputManager(out);
127 
128  se->run(nevent);
129 
130  PHGeomUtility::ExportGeomtry(se->topNode(),"geom.root");
131 
132  // finish job - close and save output files
133  se->End();
134  se->PrintTimer();
135  std::cout << "All done" << std::endl;
136 
137  // cleanup - delete the server and exit
138  delete se;
139  return 0;
140 }
int registerInputManager(Fun4AllInputManager *InManager)
virtual int End()
virtual void set_DoubleFlag(const std::string &name, const double flag)
Definition: PHFlag.cc:77
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 Print() const
print all the parameters
Definition: recoConsts.cc:185
void SetWorldShape(const std::string &s)
Definition: PHG4Reco.h:117
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.
int run(const int nEvents=1)
Definition: run.C:10
static recoConsts * instance()
Definition: recoConsts.cc:7
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 set_field_map(const std::string &fmap, const PHFieldConfig::FieldConfigTypes dim)
Definition: PHG4Reco.h:87
Definition: CalibXT.h:7
EvtFilter * evt_filter
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
int Fun4DST(const int nevent=0, const int run=195)
Definition: Fun4DST.C:21
void SetPhysicsList(const std::string &s)
Definition: PHG4Reco.h:119
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 registerSubsystem(PHG4Subsystem *subsystem)
register subsystem
Definition: PHG4Reco.h:65
virtual int fileopen(const std::string &)
void SetWorldSizeZ(const double sz)
Definition: PHG4Reco.h:113
void SetWorldSizeY(const double sy)
Definition: PHG4Reco.h:112