ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4MicromegasSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4MicromegasSubsystem.cc
1 
7 
10 
11 #include <phparameter/PHParameters.h>
12 
15 
16 #include <phool/PHCompositeNode.h>
17 #include <phool/PHIODataNode.h>
18 #include <phool/PHNode.h>
19 #include <phool/PHNodeIterator.h>
20 #include <phool/PHObject.h>
21 #include <phool/getClass.h>
22 
23 //_______________________________________________________________________
25  : PHG4DetectorSubsystem(name, layer)
26 {
27  // call base class method which will set up parameter infrastructure
28  // and call our SetDefaultParameters() method
30 
31  SuperDetector(name);
32 }
33 
34 //_______________________________________________________________________
36 {
37  PHNodeIterator iter(topNode);
38  auto dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
39  PHNodeIterator dstIter(dstNode);
40 
41  if (GetParams()->get_int_param("active"))
42  {
43  auto detNode = dynamic_cast<PHCompositeNode *>(dstIter.findFirst("PHCompositeNode", SuperDetector()));
44  if (!detNode)
45  {
46  detNode = new PHCompositeNode(SuperDetector());
47  dstNode->addNode(detNode);
48  }
49 
50  const std::string g4hitnodename = "G4HIT_" + SuperDetector();
51  auto g4_hits = findNode::getClass<PHG4HitContainer>(detNode, g4hitnodename);
52  if (!g4_hits)
53  {
54  g4_hits = new PHG4HitContainer(g4hitnodename);
55  detNode->addNode(new PHIODataNode<PHObject>(g4_hits, g4hitnodename, "PHObject"));
56  }
57  }
58 
59  // create detector
60  m_Detector = new PHG4MicromegasDetector(this, topNode, GetParams(), Name());
62 
66 
67  // create stepping action if detector is active
68  if (GetParams()->get_int_param("active"))
70  return 0;
71 }
72 
73 //_______________________________________________________________________
75 {
76  // pass top node to stepping action so that it gets
77  // relevant nodes needed internally
78  if (m_SteppingAction)
80  return 0;
81 }
82 
83 //_______________________________________________________________________
84 void PHG4MicromegasSubsystem::Print(const std::string &what) const
85 {
86  if (m_Detector) m_Detector->Print(what);
87  return;
88 }
89 
90 //_______________________________________________________________________
92 { return m_Detector; }
93 
94 //_______________________________________________________________________
96 { return m_SteppingAction; }
97 
98 //_______________________________________________________________________
100 {
101  set_default_double_param("mm_length", 220);
102  set_default_double_param("mm_radius", 82);
103 }