ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4RICHSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4RICHSubsystem.cc
1 // $$Id: PHG4RICHSubsystem.cc,v 1.1 2013/10/01 00:33:01 jinhuang Exp $$
2 
11 #include "PHG4RICHSubsystem.h"
12 #include "PHG4RICHDetector.h"
13 #include "PHG4RICHDisplayAction.h"
14 #include "PHG4RICHSteppingAction.h"
15 
16 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
18 #include <g4main/PHG4Subsystem.h> // for PHG4Subsystem
19 
20 #include <phool/PHCompositeNode.h>
21 #include <phool/PHIODataNode.h> // for PHIODataNode
22 #include <phool/PHNode.h> // for PHNode
23 #include <phool/PHNodeIterator.h> // for PHNodeIterator
24 #include <phool/PHObject.h> // for PHObject
25 #include <phool/getClass.h>
26 
27 #include <Geant4/G4UserSteppingAction.hh> // for G4UserSteppingAction
28 
29 class PHG4Detector;
30 
31 using namespace ePHENIXRICH;
32 using namespace std;
33 
34 //_______________________________________________________________________
36  : PHG4Subsystem(name)
37  , m_Detector(nullptr)
38  , m_DisplayAction(nullptr)
39 {
40 }
41 
42 //_______________________________________________________________________
44 {
45  delete m_DisplayAction;
46 }
47 
48 //_______________________________________________________________________
50 {
51  // create hit list
52  PHG4HitContainer* rich_hits = findNode::getClass<PHG4HitContainer>(topNode, "G4HIT_RICH");
53  if (!rich_hits)
54  {
55  PHNodeIterator iter(topNode);
56  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
57  dstNode->addNode(new PHIODataNode<PHObject>(new PHG4HitContainer("G4HIT_RICH"), "G4HIT_RICH", "PHObject"));
58  }
59 
60  // create display settings before detector
62  // create detector
63  m_Detector = new PHG4RICHDetector(this, topNode, Name(), geom);
66 
67  // create stepping action
68 
69  return 0;
70 }
71 
72 //_______________________________________________________________________
74 {
75  if (PHG4RICHSteppingAction* p = dynamic_cast<PHG4RICHSteppingAction*>(m_Detector->GetSteppingAction()))
76  p->SetInterfacePointers(topNode);
77 
78  return 0;
79 }
80 
81 //_______________________________________________________________________
83 {
84  return m_Detector;
85 }