Class Reference for E1039 Core & Analysis Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4_SensitiveDetectors.C
Go to the documentation of this file.
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
5 #include <TSQLServer.h>
6 #include <TSQLResult.h>
7 #include <TSQLRow.h>
8 class SubsysReco;
9 R__LOAD_LIBRARY(libg4detectors)
10 #endif
11 
12 #define LogDebug(exp) std::cout<<"DEBUG: " <<__FILE__<<": "<<__LINE__<<": "<< exp << std::endl
13 
14 using namespace std;
15 
17  PHG4Reco *g4Reco,
18  const int verbosity = 0
19  ){
20 
21  GeomSvc *geom_svc = GeomSvc::instance();
22 
23  vector<string> sim_list = geom_svc->getDefaultSimList();
24 
25  for(int i=0; i<sim_list.size(); ++i){
26  string name = sim_list[i];
27 
28  double size[3];
29  double place[3];
30  double rot[3];
31 
32  int id = geom_svc->getDetectorID(name);
33  place[0] = geom_svc->getDetectorX0(name);
34  place[1] = geom_svc->getDetectorY0(name);
35  place[2] = geom_svc->getDetectorZ0(name);
36  size[0] = geom_svc->getPlaneScaleX(id);
37  size[1] = geom_svc->getPlaneScaleY(id);
38  size[2] = geom_svc->getPlaneScaleZ(id);
39  string material = geom_svc->getPlaneMaterial(id);
40 
41  if(verbosity > 2) {
42  LogDebug("");
43  cout
44  << "name: " << name
45  << ", id: " << id
46  << " {" << size[0] << ", " << size[1] << ", " << size[2] << "} "
47  << " {" << place[0] << ", " << place[1] << ", " << place[2] << "} "
48  << " {" << rot[0] << ", " << rot[1] << ", " << rot[2] << "} "
49  << material
50  << endl;
51  }
52 
53  PHG4BlockSubsystem *box = new PHG4BlockSubsystem(name.c_str(), 0);
54  box->SuperDetector(name.c_str());
55  box->set_double_param("size_x", size[0]);
56  box->set_double_param("size_y", size[1]);
57  box->set_double_param("size_z", size[2]);
58  box->set_double_param("place_x", place[0]);
59  box->set_double_param("place_y", place[1]);
60  box->set_double_param("place_z", place[2]);
61  box->set_string_param("material", material.c_str());// G4_Si, G4_AIR, G4_Galactic
62  //box->set_string_param("material", "G4_Galactic");// G4_Si, G4_AIR, G4_Galactic
63  box->SetActive(1);
64  g4Reco->registerSubsystem(box);
65  }
66 
67  return;
68 }
Runs G4 as a subsystem.
Definition: PHG4Reco.h:38
int verbosity
The verbosity level. 0 means not verbose at all.
Definition: Fun4AllBase.h:75
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)
double getDetectorY0(const std::string detectorName) const
Definition: GeomSvc.h:174
void SuperDetector(const std::string &name)
void set_double_param(const std::string &name, const double dval)
double getDetectorX0(const std::string detectorName) const
Definition: GeomSvc.h:170
#define LogDebug(exp)
double getPlaneScaleX(int detectorID)
Definition: GeomSvc.h:204
void set_string_param(const std::string &name, const std::string &sval)
double getPlaneScaleZ(int detectorID)
Definition: GeomSvc.h:206
double getPlaneScaleY(int detectorID)
Definition: GeomSvc.h:205
static GeomSvc * instance()
singlton instance
Definition: GeomSvc.cxx:211
int getDetectorID(const std::string &detectorName) const
Get the plane position.
Definition: GeomSvc.h:184
void SetActive(const int i=1)
void registerSubsystem(PHG4Subsystem *subsystem)
register subsystem
Definition: PHG4Reco.h:65
double getDetectorZ0(const std::string detectorName) const
Definition: GeomSvc.h:178