ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4SectorSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4SectorSubsystem.cc
1 #include "PHG4SectorSubsystem.h"
2 #include "PHG4SectorDetector.h"
5 
6 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
8 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
9 #include <g4main/PHG4Subsystem.h> // for PHG4Subsystem
10 
11 #include <phool/PHCompositeNode.h>
12 #include <phool/PHIODataNode.h> // for PHIODataNode
13 #include <phool/PHNode.h> // for PHNode
14 #include <phool/PHNodeIterator.h> // for PHNodeIterator
15 #include <phool/PHObject.h> // for PHObject
16 #include <phool/getClass.h>
17 
18 #include <sstream>
19 
20 class PHG4Detector;
21 
22 using namespace std;
23 
24 //_______________________________________________________________________
26  : PHG4Subsystem(name)
27  , m_Detector(nullptr)
28  , m_SteppingAction(nullptr)
29  , m_DisplayAction(nullptr)
30  , superdetector("NONE")
31 {
32 }
33 
34 //_______________________________________________________________________
36 {
37  delete m_DisplayAction;
38 }
39 
40 //_______________________________________________________________________
42 {
43  PHNodeIterator iter(topNode);
44  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst(
45  "PHCompositeNode", "DST"));
46 
47  // create display settings before detector
49  // create detector
50  m_Detector = new PHG4SectorDetector(this, topNode, Name());
51  m_Detector->geom = geom;
54 
56  {
57  ostringstream nodename;
58  if (superdetector != "NONE")
59  {
60  nodename << "G4HIT_" << superdetector;
61  }
62  else
63  {
64  nodename << "G4HIT_" << Name();
65  }
66  // create hit list
67  PHG4HitContainer* block_hits = findNode::getClass<PHG4HitContainer>(
68  topNode, nodename.str().c_str());
69  if (!block_hits)
70  {
71  dstNode->addNode(new PHIODataNode<PHObject>(new PHG4HitContainer(nodename.str()), nodename.str(), "PHObject"));
72  }
73  // create stepping action
75  }
76  return 0;
77 }
78 
79 //_______________________________________________________________________
81 {
82  // pass top node to stepping action so that it gets
83  // relevant nodes needed internally
84  if (m_SteppingAction)
85  {
87  }
88  return 0;
89 }
90 
91 //_______________________________________________________________________
94 {
95  return m_Detector;
96 }