EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AllSiliconTrackerSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AllSiliconTrackerSubsystem.cc
1 //____________________________________________________________________________..
2 //
3 // This is the interface to the framework. You only need to define the parameters
4 // you use for your detector in the SetDefaultParameters() method here
5 // The place to do this is marked by //implement your own here//
6 // The parameters have no units, they need to be converted in the
7 // AllSiliconTrackerDetector::ConstructMe() method
8 // but the convention is as mentioned cm and deg
9 //____________________________________________________________________________..
10 //
12 
16 
17 #include <phparameter/PHParameters.h>
18 
21 
22 #include <phool/PHCompositeNode.h>
23 #include <phool/PHIODataNode.h>
24 #include <phool/PHNode.h>
25 #include <phool/PHNodeIterator.h>
26 #include <phool/PHObject.h>
27 #include <phool/getClass.h>
28 
29 #include <TSystem.h>
30 
31 using namespace std;
32 
33 //_______________________________________________________________________
35  : PHG4DetectorSubsystem(name)
36  , m_Detector(nullptr)
37  , m_SteppingAction(nullptr)
38  , m_DisplayAction(nullptr)
39 {
40  // call base class method which will set up parameter infrastructure
41  // and call our SetDefaultParameters() method
43 }
44 
45 //_______________________________________________________________________
47 {
48  delete m_DisplayAction;
49 }
50 
51 //_______________________________________________________________________
53 {
54  // PHNodeIterator iter(topNode);
55  // PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
56  // create display settings before detector
58  // create detector
59  m_Detector = new AllSiliconTrackerDetector(this, topNode, GetParams(), Name());
62  /*
63  PHNodeIterator dstIter(dstNode);
64  if (GetParams()->get_int_param("active"))
65  {
66  set<string> nodes;
67  string myname;
68  if (SuperDetector() != "NONE")
69  {
70  myname = SuperDetector();
71  }
72  else
73  {
74  myname = Name();
75  }
76  PHCompositeNode *DetNode = dynamic_cast<PHCompositeNode *>(dstIter.findFirst("PHCompositeNode", myname));
77  if (!DetNode)
78  {
79  DetNode = new PHCompositeNode(myname);
80  dstNode->addNode(DetNode);
81  }
82 // This hardcoded stuff is plain ugly. The problem is that the detector
83 // ids are known in the detector::constructme method which gets called
84 // after the node tree is set up
85  ostringstream g4hitnodeactive;
86  for (int i=10; i<16;i++)
87  {
88  g4hitnodeactive.str("");
89  g4hitnodeactive << "G4HIT_" << myname << "_CENTRAL_" << i;
90  nodes.insert(g4hitnodeactive.str());
91  }
92  for (int i=20; i<25;i++)
93  {
94  g4hitnodeactive.str("");
95  g4hitnodeactive << "G4HIT_" << myname << "_FORWARD_" << i;
96  nodes.insert(g4hitnodeactive.str());
97  }
98  for (int i=30; i<35;i++)
99  {
100  g4hitnodeactive.str("");
101  g4hitnodeactive << "G4HIT_" << myname << "_BACKWARD_" << i;
102  nodes.insert(g4hitnodeactive.str());
103  }
104  if (GetParams()->get_int_param("absorberactive"))
105  {
106  string g4hitnodename = "G4HIT_ABSORBER_" + myname;
107  nodes.insert(g4hitnodename);
108  }
109  for (auto nodename : nodes)
110  {
111  PHG4HitContainer *g4_hits = findNode::getClass<PHG4HitContainer>(DetNode, nodename);
112  if (!g4_hits)
113  {
114  g4_hits = new PHG4HitContainer(nodename);
115  DetNode->addNode(new PHIODataNode<PHObject>(g4_hits, nodename, "PHObject"));
116  }
117  }
118  }
119 */
120  // create stepping action if detector is active
121  if (GetParams()->get_int_param("active"))
122  {
124  }
125  return 0;
126 }
127 //_______________________________________________________________________
129 {
130  // pass top node to stepping action so that it gets
131  // relevant nodes needed internally
132  if (m_SteppingAction)
133  {
135  }
136  return 0;
137 }
138 //_______________________________________________________________________
139 void AllSiliconTrackerSubsystem::Print(const string &what) const
140 {
141  if (m_Detector)
142  {
143  m_Detector->Print(what);
144  }
145  return;
146 }
147 
148 //_______________________________________________________________________
150 {
151  return m_Detector;
152 }
153 
154 //_______________________________________________________________________
155 void AllSiliconTrackerSubsystem::AddAssemblyVolume(const std::string &avol)
156 {
157  if (m_LogVolumeSet.empty())
158  {
159  m_AssemblyVolumeSet.insert(avol);
160  }
161  else
162  {
163  cout << "Assembly Volumes and Logical Volumes cannot coexist" << endl;
164  cout << "Existing Logical Volumes: " << endl;
165  for (auto it = m_LogVolumeSet.begin(); it != m_LogVolumeSet.end(); ++it)
166  {
167  cout << *it << endl;
168  }
169  gSystem->Exit(1);
170  }
171 }
172 
173 //_______________________________________________________________________
175 {
176  if (m_AssemblyVolumeSet.empty())
177  {
178  m_LogVolumeSet.insert(name);
179  }
180  else
181  {
182  cout << "Assembly Volumes and Logical Volumes cannot coexist" << endl;
183  cout << "Assembly Volumes: " << endl;
184  for (auto it = m_AssemblyVolumeSet.begin(); it != m_AssemblyVolumeSet.end(); ++it)
185  {
186  cout << *it << endl;
187  }
188  gSystem->Exit(1);
189  }
190 }
191 
192 //_______________________________________________________________________
194 {
195  // sizes are in cm
196  // angles are in deg
197  // units should be converted to G4 units when used
198  //implement your own here//
199  set_default_double_param("place_x", 0.);
200  set_default_double_param("place_y", 0.);
201  set_default_double_param("place_z", 0.);
202  set_default_double_param("rot_x", 0.);
203  set_default_double_param("rot_y", 0.);
204  set_default_double_param("rot_z", 0.);
205 
206  set_default_string_param("GDMPath", "DefaultParameters-InvalidPath");
207 }