Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Fun4SRawEvent.C
Go to the documentation of this file.
1 
4 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
5 #include <TSystem.h>
7 #include "G4_Target.C"
8 R__LOAD_LIBRARY(libinterface_main)
9 R__LOAD_LIBRARY(libfun4all)
10 R__LOAD_LIBRARY(libdecoder_maindaq)
11 R__LOAD_LIBRARY(libg4testbench)
12 R__LOAD_LIBRARY(libg4detectors)
13 R__LOAD_LIBRARY(libg4eval)
14 R__LOAD_LIBRARY(libevt_filter)
15 R__LOAD_LIBRARY(libktracker)
16 R__LOAD_LIBRARY(libonlmonserver)
17 #endif
18 
19 int Fun4SRawEvent(const int nevent = 0, const int run = 28700)
20 {
21  const char* fn_in = "/data3/analysis/production/R009/02/86/digit_028692_009.root";
22  const char* fn_out = "./SRawEvent-DST.root";
23 
24  gSystem->Load("libfun4all");
25  gSystem->Load("libg4detectors");
26  gSystem->Load("libg4testbench");
27  gSystem->Load("libg4eval");
28  gSystem->Load("libktracker.so");
29 
30  const double FMAGSTR = -1.054;
31  const double KMAGSTR = -0.951;
32 
34  rc->set_DoubleFlag("FMAGSTR", FMAGSTR);
35  rc->set_DoubleFlag("KMAGSTR", KMAGSTR);
36  rc->Print();
37 
38  Fun4AllServer* se = 0;
40  se->Verbosity(100);
41 
42  JobOptsSvc *jobopt_svc = JobOptsSvc::instance();
43  jobopt_svc->init("run7_data.opts");
44 
45  GeomSvc::UseDbSvc(true);
46  GeomSvc *geom_svc = GeomSvc::instance();
47 
48  // Fun4All G4 module
49  PHG4Reco *g4Reco = new PHG4Reco();
50  //PHG4Reco::G4Seed(123);
51  //g4Reco->set_field(5.);
52  g4Reco->set_field_map(
53  jobopt_svc->m_fMagFile+" "+
54  jobopt_svc->m_kMagFile+" "+
55  Form("%f",FMAGSTR) + " " +
56  Form("%f",KMAGSTR) + " " +
57  "5.0",
59  // size of the world - every detector has to fit in here
60  g4Reco->SetWorldSizeX(1000);
61  g4Reco->SetWorldSizeY(1000);
62  g4Reco->SetWorldSizeZ(5000);
63  // shape of our world - it is a tube
64  g4Reco->SetWorldShape("G4BOX");
65  // this is what our world is filled with
66  g4Reco->SetWorldMaterial("G4_AIR"); //G4_Galactic, G4_AIR
67  // Geant4 Physics list to use
68  g4Reco->SetPhysicsList("FTFP_BERT");
69 
70  // insensitive elements of the spectrometer
71  PHG4E1039InsensSubsystem* insens = new PHG4E1039InsensSubsystem("Insens");
72  g4Reco->registerSubsystem(insens);
73 
74  // collimator, targer and shielding between target and FMag
75  gROOT->LoadMacro("G4_Target.C");
76  SetupTarget(g4Reco);
77 
78  // sensitive elements of the spectrometer
79  gROOT->LoadMacro("G4_SensitiveDetectors.C");
81 
82  se->registerSubsystem(g4Reco);
83 
84  // trakcing module
85  gSystem->Load("libktracker.so");
86  KalmanFastTrackingWrapper *ktracker = new KalmanFastTrackingWrapper();
87  ktracker->Verbosity(0);
88  ktracker->set_enable_event_reducer(true);
89  ktracker->set_DS_level(2);
90  ktracker->set_pattern_db_name(gSystem->ExpandPathName("$E1039_RESOURCE/dsearch/v1/pattern.root"));
92  se->registerSubsystem(ktracker);
93 
95  in->Verbosity(0);
96  in->set_tree_name("save");
97  in->set_branch_name("rawEvent");
98  in->fileopen(fn_in);
99  se->registerInputManager(in);
100 
101  Fun4AllDstOutputManager *out = new Fun4AllDstOutputManager("DSTOUT", fn_out);
102  se->registerOutputManager(out);
103 
104  se->run(nevent);
105  se->End();
106 
107  std::cout << KMAGSTR << std::endl;
108 
109  delete se;
110  cout << "Fun4SRawEvent Done!" << endl;
111 
112  gSystem->Exit(0);
113  return 0;
114 }
int fileopen(const std::string &filenam)
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 set_tree_name(const std::string &treeName)
void SetWorldMaterial(const std::string &s)
Definition: PHG4Reco.h:118
int Fun4SRawEvent(const int nevent=0, const int run=28700)
Definition: Fun4SRawEvent.C:19
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
int run(const int nEvents=1)
Definition: run.C:10
static int LooseMode()
Definition: PatternDBUtil.h:40
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)
int registerOutputManager(Fun4AllOutputManager *manager)
void set_field_map(const std::string &fmap, const PHFieldConfig::FieldConfigTypes dim)
Definition: PHG4Reco.h:87
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
void SetWorldSizeX(const double sx)
Definition: PHG4Reco.h:111
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 set_branch_name(const std::string &branchName)
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