Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TpcSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TpcSubsystem.cc
1 #include "PHG4TpcSubsystem.h"
2 #include "PHG4TpcDetector.h"
3 #include "PHG4TpcDisplayAction.h"
5 
6 #include <g4detectors/PHG4DetectorSubsystem.h> // for PHG4DetectorSubsystem
7 
8 #include <phparameter/PHParameters.h>
9 
10 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
12 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
13 
14 #include <phool/PHCompositeNode.h>
15 #include <phool/PHIODataNode.h> // for PHIODataNode
16 #include <phool/PHNode.h> // for PHNode
17 #include <phool/PHNodeIterator.h> // for PHNodeIterator
18 #include <phool/PHObject.h> // for PHObject
19 #include <phool/getClass.h>
20 
21 #include <iostream> // for operator<<, basic_ost...
22 #include <set>
23 
24 class PHG4Detector;
25 
26 //_______________________________________________________________________
28  : PHG4DetectorSubsystem(name, lyr)
29 {
31 }
32 
33 //_______________________________________________________________________
35 {
36  delete m_DisplayAction;
37 }
38 
39 //_______________________________________________________________________
41 {
42  PHNodeIterator iter(topNode);
43  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
44 
45  // create display settings before detector (detector adds its volumes to it)
47  // create detector
48  m_Detector = new PHG4TpcDetector(this, topNode, GetParams(), Name());
51  std::set<std::string> nodes;
52  if (GetParams()->get_int_param("active"))
53  {
54  PHNodeIterator dstIter(dstNode);
55  PHCompositeNode *DetNode = dstNode;
56  if (SuperDetector() != "NONE" && !SuperDetector().empty())
57  {
58  PHNodeIterator iter_dst(dstNode);
59  DetNode = dynamic_cast<PHCompositeNode *>(iter_dst.findFirst("PHCompositeNode", SuperDetector()));
60  if (!DetNode)
61  {
62  DetNode = new PHCompositeNode(SuperDetector());
63  dstNode->addNode(DetNode);
64  }
65  }
66  std::string detector_suffix = SuperDetector();
67  if (detector_suffix == "NONE" || detector_suffix.empty())
68  {
69  detector_suffix = Name();
70  }
71  m_HitNodeName = "G4HIT_" + detector_suffix;
72  nodes.insert(m_HitNodeName);
73  m_AbsorberNodeName = "G4HIT_ABSORBER_" + detector_suffix;
74  if (GetParams()->get_int_param("absorberactive"))
75  {
76  nodes.insert(m_AbsorberNodeName);
77  }
78  for (auto nodename : nodes)
79  {
80  PHG4HitContainer *g4_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
81  if (!g4_hits)
82  {
83  g4_hits = new PHG4HitContainer(nodename);
84  DetNode->addNode(new PHIODataNode<PHObject>(g4_hits, nodename, "PHObject"));
85  }
86  }
87 
88  // create stepping action
92  }
93  else
94  {
95  // if this is a black hole it does not have to be active
96  if (GetParams()->get_int_param("blackhole"))
97  {
99  }
100  }
101  return 0;
102 }
103 
104 //_______________________________________________________________________
106 {
107  // pass top node to stepping action so that it gets
108  // relevant nodes needed internally
109  if (m_SteppingAction)
110  {
112  }
113  return 0;
114 }
115 
116 void PHG4TpcSubsystem::Print(const std::string &what) const
117 {
118  std::cout << Name() << " Parameters: " << std::endl;
119  GetParams()->Print();
120  if (m_Detector)
121  {
122  m_Detector->Print(what);
123  }
124  if (m_SteppingAction)
125  {
126  m_SteppingAction->Print(what);
127  }
128 
129  return;
130 }
131 
132 //_______________________________________________________________________
134 {
135  return m_Detector;
136 }
137 
139 {
140  set_default_double_param("gas_inner_radius", 21.6);
141  set_default_double_param("gas_outer_radius", 76.4);
142  set_default_double_param("place_x", 0.);
143  set_default_double_param("place_y", 0.);
144  set_default_double_param("place_z", 0.);
145  set_default_double_param("rot_x", 0.);
146  set_default_double_param("rot_y", 0.);
147  set_default_double_param("rot_z", 0.);
148  set_default_double_param("tpc_length", 211.);
149 
150  set_default_double_param("steplimits", 1); // 1cm by default
151 
152  set_default_string_param("tpc_gas", "sPHENIX_TPC_Gas");
153 
154  // material budget:
155  // Cu (all layers): 0.5 oz cu per square foot, 1oz == 0.0347mm --> 0.5 oz == 0.00347cm/2.
156  // Kapton insulation 18 layers of * 5mil = 18*0.0127=0.2286
157  // 250 um FR4 (Substrate for Cu layers)
158  // HoneyComb (nomex) 1/2 inch=0.5*2.54 cm
159  set_default_string_param("cage_layer_1_material", "G4_Cu");
160  set_default_double_param("cage_layer_1_thickness", 0.00347 / 2.);
161 
162  set_default_string_param("cage_layer_2_material", "FR4");
163  set_default_double_param("cage_layer_2_thickness", 0.025);
164 
165  set_default_string_param("cage_layer_3_material", "NOMEX");
166  set_default_double_param("cage_layer_3_thickness", 0.5 * 2.54);
167 
168  set_default_string_param("cage_layer_4_material", "G4_Cu");
169  set_default_double_param("cage_layer_4_thickness", 0.00347 / 2.);
170 
171  set_default_string_param("cage_layer_5_material", "FR4");
172  set_default_double_param("cage_layer_5_thickness", 0.025);
173 
174  set_default_string_param("cage_layer_6_material", "G4_KAPTON");
175  set_default_double_param("cage_layer_6_thickness", 0.2286);
176 
177  set_default_string_param("cage_layer_7_material", "G4_Cu");
178  set_default_double_param("cage_layer_7_thickness", 0.00347 / 2.);
179 
180  set_default_string_param("cage_layer_8_material", "G4_KAPTON");
181  set_default_double_param("cage_layer_8_thickness", 0.05); // 50 um
182 
183  set_default_string_param("cage_layer_9_material", "G4_Cu");
184  set_default_double_param("cage_layer_9_thickness", 0.00347 / 2.);
185 
186  // Thomas K Hemmick <Thomas.Hemmick@stonybrook.edu>
187  // The total thickness along Zed would be 5.6 millimeters (+/- 2.8 mm around Zed=0).
188  // The outer surfaces would have 0.005 inches (125 um) FR4 coated with a negligible thickness of Al. (revised to Au as below)
189  // The interior would be some stiffener of either honeycomb or rohacell. The range of radiation lengths for this material are:
190  // Large cell honeycomb: 1450 cm (0.028 g/cm^3 density)
191  // rohacell: 760 cm (0.052 g/cm^3 density)
192  // Close cell honeycomb: 635 cm (0.064 g/cm^3 density)
193  // I think a calculation just for the rohacell would be more than sufficient.
194  set_default_string_param("window_core_material", "ROHACELL_FOAM_51");
195  set_default_double_param("window_thickness", 0.56); // overall thickness
196  //I just checked with PC manufacturers and we can get 8.9 micron thick copper in reasonably large sheets.
197  // At normal incidence, 8.9 microns is 0.06% of a radiation length.
198  set_default_string_param("window_surface1_material", "G4_Cu");
199  set_default_double_param("window_surface1_thickness", 8.9e-4); // 8.9 um outter shell thickness be default
200  // The FR4 should be either 5 or 10 mils thick. 10 mils is 254 microns and 5 mils is 0.127 microns. I think either of these is mechanically fine...
201  set_default_string_param("window_surface2_material", "FR4");
202  set_default_double_param("window_surface2_thickness", 0.0127); // 127 um 2nd shell thickness be default
203 
204  // for geonode initialization
205  set_default_double_param("drift_velocity", 8.0e-03);
206 
207  set_default_int_param("ntpc_layers_inner", 16);
208  set_default_int_param("ntpc_layers_mid", 16);
209  set_default_int_param("ntpc_layers_outer", 16);
210  set_default_int_param("tpc_minlayer_inner", 7);
211 
212  set_default_double_param("tpc_minradius_inner", 31.105);//30.0); // cm
213  set_default_double_param("tpc_minradius_mid", 41.153);//40.0);
214  set_default_double_param("tpc_minradius_outer", 58.367);//60.0);
215 
216  set_default_double_param("tpc_maxradius_inner", 40.249);//40.0); // cm
217  set_default_double_param("tpc_maxradius_mid", 57.475);//60.0);
218  set_default_double_param("tpc_maxradius_outer", 75.911);//77.0); // from Tom
219 
220  set_default_double_param("maxdriftlength", 105.5); // cm
221  set_default_double_param("extended_readout_time", 0.0); //ns
222  set_default_double_param("tpc_adc_clock", 53.0); // ns, for 18.8 MHz clock
223 
224  set_default_double_param("tpc_sector_phi_inner", 0.5024);//2 * M_PI / 12 );//sector size in phi for R1 sector
225  set_default_double_param("tpc_sector_phi_mid", 0.5087);//2 * M_PI / 12 );//sector size in phi for R2 sector
226  set_default_double_param("tpc_sector_phi_outer", 0.5097);//2 * M_PI / 12 );//sector size in phi for R3 sector
227 
228  set_default_int_param("ntpc_phibins_inner", 1152);
229  set_default_int_param("ntpc_phibins_mid", 1536);
230  set_default_int_param("ntpc_phibins_outer", 2304);
231 
232 }