EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4_AllSi.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4_AllSi.C
1 #ifndef MACRO_G4ALLSI_C
2 #define MACRO_G4ALLSI_C
3 
7 #include <g4main/PHG4Reco.h>
8 
9 #include <string>
10 
11 R__LOAD_LIBRARY(libg4detectors.so)
12 // ======================================================================================================================
13 void load_AllSi_geom(PHG4Reco *g4Reco,int det_ver=3){
14  // Loading All-Si Tracker from dgml file
16  allsili->set_string_param("GDMPath", string(getenv("CALIBRATIONROOT")) + Form("detector/genfitGeom_AllSi_v%i.gdml",det_ver));
17 
18  if(det_ver==1){
19 
20  allsili->AddAssemblyVolume("BEAMPIPE"); // Load beampipe from the gdml file
21  }
22  else{
23  PipeInit(); // Load beampipe from Fun4All rather than from gdml file
24  double pipe_radius = 0;
25  pipe_radius = Pipe(g4Reco,pipe_radius);
26  }
27 
28  allsili->AddAssemblyVolume("VST"); // Barrel
29  allsili->AddAssemblyVolume("FST"); // Forward disks
30  allsili->AddAssemblyVolume("BST"); // Backward disks
31 
32  // this is for plotting single logical volumes for debugging and geantino scanning they end up at the center, you can plot multiple
33  // but they end up on top of each other. They cannot coexist with the assembly volumes, the code will quit if you try to use both.
34  // allsili->AddLogicalVolume("BstContainerVolume04");
35  // allsili->AddLogicalVolume("FstContainerVolume00");
36  // allsili->AddLogicalVolume("FstChipAssembly37");
37  // allsili->AddLogicalVolume("VstStave00");
38 
39  allsili->SuperDetector("LBLVTX");
40  allsili->SetActive(); // this saves hits in the MimosaCore volumes
41  allsili->SetAbsorberActive(); // this saves hits in all volumes (in the absorber node)
42  g4Reco->registerSubsystem(allsili);
43 }
44 // ======================================================================================================================
45 void add_AllSi_to_kalman(PHG4TrackFastSim *kalman, double pixel_size = 10., int det_ver=3){
46  double um_to_cm = 1E-04; // Conversion factor from um to cm
47  char nodename[100];
48  int nBarrel = 6;
49  int nDisks = 5;
50 
51  if(det_ver==3){
52  nBarrel = 7;
53  nDisks = 7;
54  }
55 
56  for (int i=10; i<10+nBarrel; i++){ // CENTRAL BARREL
57  sprintf(nodename,"G4HIT_LBLVTX_CENTRAL_%d", i);
58  kalman->add_phg4hits(
59  nodename, // const std::string& phg4hitsNames
60  PHG4TrackFastSim::Cylinder, // const DETECTOR_TYPE phg4dettype
61  999., // radial-resolution [cm] (this number is not used in cylindrical geometry)
62  pixel_size*um_to_cm/sqrt(12.), // azimuthal (arc-length) resolution [cm]
63  pixel_size*um_to_cm/sqrt(12.), // longitudinal (z) resolution [cm]
64  1, // efficiency (fraction)
65  0 // hit noise
66  );
67  }
68  for (int i=20; i<20+nDisks; i++){ // FORWARD DISKS
69  sprintf(nodename,"G4HIT_LBLVTX_FORWARD_%d", i);
70  kalman->add_phg4hits(
71  nodename, // const std::string& phg4hitsNames
72  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype
73  pixel_size*um_to_cm/sqrt(12.), // radial-resolution [cm]
74  pixel_size*um_to_cm/sqrt(12.), // azimuthal (arc-length) resolution [cm]
75  999., // longitudinal (z) resolution [cm] (this number is not used in vertical plane geometry)
76  1, // efficiency (fraction)
77  0 // hit noise
78  );
79  }
80  for (int i=30; i<30+nDisks; i++){ // BACKWARD DISKS
81  sprintf(nodename,"G4HIT_LBLVTX_BACKWARD_%d", i);
82  kalman->add_phg4hits(
83  nodename, // const std::string& phg4hitsNames
84  PHG4TrackFastSim::Vertical_Plane, // const DETECTOR_TYPE phg4dettype
85  pixel_size*um_to_cm/sqrt(12.), // radial-resolution [cm]
86  pixel_size*um_to_cm/sqrt(12.), // azimuthal (arc-length) resolution [cm]
87  999., // longitudinal (z) resolution [cm] (this number is not used in vertical plane geometry)
88  1, // efficiency (fraction)
89  0 // hit noise
90  );
91  }
92 }
93 // ======================================================================================================================
94 void add_AllSi_hits(SimpleNtuple * hits, int det_ver=3){
95  char nodename[100];
96  int nBarrel = 6;
97  int nDisks = 5;
98 
99  if(det_ver==3){
100  nBarrel = 7;
101  nDisks = 7;
102  }
103 
104  // hits->AddNode("ABSORBER_LBLVTX",0); // hits in the passive volumes
105  for (int i = 10; i < 10+nBarrel; i++){sprintf(nodename, "LBLVTX_CENTRAL_%d", i); hits->AddNode(nodename, i);} // hits in the MimosaCore volumes
106  for (int i = 20; i < 20+nDisks ; i++){sprintf(nodename, "LBLVTX_FORWARD_%d", i); hits->AddNode(nodename, i);} // hits in the MimosaCore volumes
107  for (int i = 30; i < 30+nDisks ; i++){sprintf(nodename, "LBLVTX_BACKWARD_%d",i); hits->AddNode(nodename, i);} // hits in the MimosaCore volumes
108 }
109 #endif