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)
4 #include <TSQLServer.h>
5 #include <TSQLResult.h>
6 #include <TSQLRow.h>
7 class SubsysReco;
8 R__LOAD_LIBRARY(libg4detectors)
9 #endif
10 
11 #define LogDebug(exp) std::cout<<"DEBUG: " <<__FILE__<<": "<<__LINE__<<": "<< exp << std::endl
12 
13 using namespace std;
14 
16  PHG4Reco *g4Reco,
17  const int verbosity = 0
18  ){
19 
20  GeomSvc *geom_svc = GeomSvc::instance();
21 
22  vector<string> sim_list = geom_svc->getDefaultSimList();
23 
24  for(int i=0; i<sim_list.size(); ++i){
25  string name = sim_list[i];
26 
27  double size[3];
28  double place[3];
29  double rot[3];
30 
31  int id = geom_svc->getDetectorID(name);
32  place[0] = geom_svc->getDetectorX0(name);
33  place[1] = geom_svc->getDetectorY0(name);
34  place[2] = geom_svc->getDetectorZ0(name);
35  size[0] = geom_svc->getPlaneScaleX(id);
36  size[1] = geom_svc->getPlaneScaleY(id);
37  size[2] = geom_svc->getPlaneScaleZ(id);
38  string material = geom_svc->getPlaneMaterial(id);
39 
40  if(verbosity > 2) {
41  LogDebug("");
42  cout
43  << "name: " << name
44  << ", id: " << id
45  << " {" << size[0] << ", " << size[1] << ", " << size[2] << "} "
46  << " {" << place[0] << ", " << place[1] << ", " << place[2] << "} "
47  << " {" << rot[0] << ", " << rot[1] << ", " << rot[2] << "} "
48  << material
49  << endl;
50  }
51 
52  if(!(fabs(size[0])<10000)) continue;
53  if(place[2]>680 && place[2]<700) continue;
54 
55  PHG4BlockSubsystem *box = new PHG4BlockSubsystem(name.c_str(), 0);
56  box->SuperDetector(name.c_str());
57  box->set_double_param("size_x", size[0]);
58  box->set_double_param("size_y", size[1]);
59  box->set_double_param("size_z", size[2]);
60  box->set_double_param("place_x", place[0]);
61  box->set_double_param("place_y", place[1]);
62  box->set_double_param("place_z", place[2]);
63  box->set_string_param("material", material.c_str());// G4_Si, G4_AIR, G4_Galactic
64  //box->set_string_param("material", "G4_Galactic");// G4_Si, G4_AIR, G4_Galactic
65  box->SetActive(1);
66  g4Reco->registerSubsystem(box);
67  }
68 
69  return;
70 }
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