Analysis Software
Documentation for sPHENIX simulation 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 
46  if (GetParams()->get_int_param("active"))
47  {
48  std::set<std::string> nodes;
49  PHNodeIterator iter(topNode);
50  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
51  PHNodeIterator dstIter(dstNode);
52  PHCompositeNode* DetNode = dstNode;
53  if (SuperDetector() != "NONE" && !SuperDetector().empty())
54  {
55  PHNodeIterator iter_dst(dstNode);
56  DetNode = dynamic_cast<PHCompositeNode*>(iter_dst.findFirst("PHCompositeNode", SuperDetector()));
57 
58  if (!DetNode)
59  {
60  DetNode = new PHCompositeNode(SuperDetector());
61  dstNode->addNode(DetNode);
62  }
63  }
64  // create hit output nodes
65  std::string detector_suffix = SuperDetector();
66  if (detector_suffix == "NONE")
67  {
68  detector_suffix = Name();
69  }
70 
71  m_HitNodeName = "G4HIT_" + detector_suffix;
72  nodes.insert(m_HitNodeName);
73  m_SupportNodeName = "G4HIT_SUPPORT_" + detector_suffix;
74  if (GetParams()->get_int_param("supportactive"))
75  {
76  nodes.insert(m_SupportNodeName);
77  }
78 
79  for (const auto& nodename : nodes)
80  {
81  PHG4HitContainer* g4_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
82  if (!g4_hits)
83  {
84  g4_hits = new PHG4HitContainer(nodename);
85  DetNode->addNode(new PHIODataNode<PHObject>(g4_hits, nodename, "PHObject"));
86  }
87  }
88  // create stepping action
92  }
93  else if (GetParams()->get_int_param("blackhole"))
94  {
96  }
97 
98  return 0;
99 }
100 
102 {
103  if (m_SteppingAction != nullptr)
104  {
106  }
107  return 0;
108 }
109 
111 {
112  return m_Detector;
113 }
114 
116 {
117  set_default_double_param("place_z", 316.);
118 }