ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4HybridHomogeneousCalorimeterSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4HybridHomogeneousCalorimeterSubsystem.cc
6 
7 #include <phparameter/PHParameters.h>
8 
9 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
11 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
12 #include <g4main/PHG4Subsystem.h> // for PHG4Subsystem
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<<, ostrin...
22 #include <sstream>
23 
24 class PHG4Detector;
25 
26 using namespace std;
27 
28 //_______________________________________________________________________
30  : PHG4DetectorSubsystem(name, lyr)
31 {
33 }
34 
35 //_______________________________________________________________________
37 {
38  delete m_DisplayAction;
39 }
40 
41 //_______________________________________________________________________
43 {
44  // create display settings before detector
46  // create detector
47  if (Verbosity() > 1)
48  {
49  cout << "PHG4HybridHomogeneousCalorimeterSubsystem::InitRun - use PHG4HybridHomogeneousCalorimeterDetector" << endl;
50  }
52 
57 
58  if (GetParams()->get_int_param("active"))
59  {
60  PHNodeIterator iter(topNode);
61  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
62 
63  // create hit output node
64  string nodename = "G4HIT_";
65  if (SuperDetector() != "NONE")
66  {
67  PHNodeIterator iter_dst(dstNode);
68  PHCompositeNode* superSubNode = dynamic_cast<PHCompositeNode*>(iter_dst.findFirst("PHCompositeNode", SuperDetector()));
69  if (!superSubNode)
70  {
71  superSubNode = new PHCompositeNode(SuperDetector());
72  dstNode->addNode(superSubNode);
73  }
74  dstNode = superSubNode;
75  nodename += SuperDetector();
76  }
77  else
78  {
79  nodename += Name();
80  }
81 
82  PHG4HitContainer* crystal_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
83  if (!crystal_hits)
84  {
85  crystal_hits = new PHG4HitContainer(nodename);
86  PHIODataNode<PHObject>* hitNode = new PHIODataNode<PHObject>(crystal_hits, nodename, "PHObject");
87  dstNode->addNode(hitNode);
88  }
89 
90  if (GetParams()->get_int_param("absorberactive"))
91  {
92  string absnodename = "G4HIT_ABSORBER_";
93  if (SuperDetector() != "NONE")
94  {
95  absnodename += SuperDetector();
96  }
97  else
98  {
99  absnodename += Name();
100  }
101 
102  PHG4HitContainer* absorber_hits = findNode::getClass<PHG4HitContainer>(topNode, absnodename);
103  if (!absorber_hits)
104  {
105  absorber_hits = new PHG4HitContainer(absnodename);
106  PHIODataNode<PHObject>* abshitNode = new PHIODataNode<PHObject>(absorber_hits, absnodename, "PHObject");
107  dstNode->addNode(abshitNode);
108  }
109  }
110  // create stepping action
112  }
113  return 0;
114 }
115 
116 //_______________________________________________________________________
118 {
119  // pass top node to stepping action so that it gets
120  // relevant nodes needed internally
121  if (m_SteppingAction)
122  {
124  }
125  return 0;
126 }
127 
128 //_______________________________________________________________________
130 {
131  return m_Detector;
132 }
133 
135 {
136  // values in cm and degrees
137  set_default_int_param("projective", 0);
138  set_default_int_param("carbon_frame_style", 0);
139  set_default_double_param("carbon_frame_depth", 1.0);
140  set_default_double_param("carbon_face_lip", 0.1);
141  set_default_double_param("reflective_foil_thickness", 0.0);
142  set_default_double_param("tedlar_thickness", 0.0);
143  set_default_double_param("sensor_thickness", 0.0);
144  set_default_double_param("sensor_dimension", 0.0);
145  set_default_int_param("sensor_count", 0);
146 
147  set_default_double_param("crystal_dx", 2.);
148  set_default_double_param("crystal_dy", 2.);
149  set_default_double_param("crystal_dz", 18.);
150  set_default_double_param("dz", 18.);
151  set_default_double_param("place_x", 0.);
152  set_default_double_param("place_y", 0.);
153  set_default_double_param("place_z", -108.);
154  set_default_double_param("rMin1", 2.2);
155  set_default_double_param("rMax1", 65.6);
156  set_default_double_param("rMin2", 2.6);
157  set_default_double_param("rMax2", 77.5);
158  set_default_double_param("rot_x", 0.);
159  set_default_double_param("rot_y", 180.);
160  set_default_double_param("rot_z", 0.);
161 
162  set_default_string_param("material", "G4_PbWO4");
163  set_default_string_param("mappingtower", "");
164  set_default_string_param("mapping4x4", "");
165  return;
166 }
167 
169 {
170  set_string_param("mappingtower", filename);
171 }
172 
173 void PHG4HybridHomogeneousCalorimeterSubsystem::SetProjectiveGeometry(const std::string& filename1, const std::string& filename2)
174 {
175  set_string_param("mappingtower", filename1);
176  set_string_param("mapping4x4", filename2);
177  set_int_param("projective", 1);
178 }