ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4EPDSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4EPDSubsystem.cc
1 /* vim: set sw=2 ft=cpp: */
2 
3 #include "PHG4EPDSubsystem.h"
4 
5 #include "PHG4EPDDetector.h"
6 #include "PHG4EPDDisplayAction.h"
8 
9 #include <phparameter/PHParameters.h>
10 
11 #include <g4detectors/PHG4DetectorSubsystem.h> // for PHG4DetectorSubsystem
12 
13 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
15 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
16 
17 #include <phool/PHCompositeNode.h>
18 #include <phool/PHIODataNode.h>
19 #include <phool/PHNode.h>
20 #include <phool/PHNodeIterator.h>
21 #include <phool/PHObject.h>
22 #include <phool/getClass.h>
23 
24 #include <set>
25 #include <string>
26 
28  : PHG4DetectorSubsystem(name)
29 {
31 }
32 
34 {
35  delete m_DisplayAction;
36 }
37 
39 {
41 
42  m_Detector = new PHG4EPDDetector(this, topNode, GetParams(), Name());
45 
47 
48  if (GetParams()->get_int_param("active"))
49  {
50  std::set<std::string> nodes;
51  PHNodeIterator iter(topNode);
52  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
53  PHNodeIterator dstIter(dstNode);
54  PHCompositeNode* DetNode = dstNode;
55  if (SuperDetector() != "NONE" && !SuperDetector().empty())
56  {
57  PHNodeIterator iter_dst(dstNode);
58  DetNode = dynamic_cast<PHCompositeNode*>(iter_dst.findFirst("PHCompositeNode", SuperDetector()));
59 
60  if (!DetNode)
61  {
62  DetNode = new PHCompositeNode(SuperDetector());
63  dstNode->addNode(DetNode);
64  }
65  }
66  // create hit output nodes
67  std::string detector_suffix = SuperDetector();
68  if (detector_suffix == "NONE")
69  {
70  detector_suffix = Name();
71  }
72 
73  m_HitNodeName = "G4HIT_" + detector_suffix;
74  nodes.insert(m_HitNodeName);
75  m_SupportNodeName = "G4HIT_SUPPORT_" + detector_suffix;
76  if (GetParams()->get_int_param("supportactive"))
77  {
78  nodes.insert(m_SupportNodeName);
79  }
80 
81  for (auto nodename : nodes)
82  {
83  PHG4HitContainer* g4_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
84  if (!g4_hits)
85  {
86  g4_hits = new PHG4HitContainer(nodename);
87  DetNode->addNode(new PHIODataNode<PHObject>(g4_hits, nodename, "PHObject"));
88  }
89  }
90  // create stepping action
94  }
95  else if (GetParams()->get_int_param("blackhole"))
96  {
98  }
99 
100  return 0;
101 }
102 
104 {
105  if (m_SteppingAction != nullptr)
106  {
108  }
109  return 0;
110 }
111 
113 {
114  return m_Detector;
115 }
116 
118 {
119  set_default_double_param("place_z", 300.);
120 }