ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4FPbScSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4FPbScSubsystem.cc
1 #include "PHG4FPbScSubsystem.h"
2 
4 #include "PHG4FPbScDetector.h"
7 
9 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
10 #include <g4main/PHG4Subsystem.h> // for PHG4Subsystem
11 
12 #include <phool/PHCompositeNode.h>
13 #include <phool/PHIODataNode.h> // for PHIODataNode
14 #include <phool/PHNode.h> // for PHNode
15 #include <phool/PHNodeIterator.h> // for PHNodeIterator
16 #include <phool/PHObject.h> // for PHObject
17 #include <phool/getClass.h>
18 
19 #include <Geant4/G4UserSteppingAction.hh> // for G4UserSteppingAction
20 
21 #include <sstream>
22 
23 class PHG4Detector;
24 
25 using namespace std;
26 
27 //_______________________________________________________________________
29  : PHG4Subsystem(name)
30  , detector_(nullptr)
31  , steppingAction_(nullptr)
32  , eventAction_(nullptr)
33  , x_position(0)
34  , y_position(0)
35  , z_position(0)
36 {
37 }
38 
39 //_______________________________________________________________________
41 {
42  std::ostringstream hitnodename;
43  hitnodename << "G4HIT_" << Name();
44 
45  // create hit list
46  PHG4HitContainer* fcal_hits = findNode::getClass<PHG4HitContainer>(topNode, ("G4HIT_" + Name()).c_str());
47  if (!fcal_hits)
48  {
49  PHNodeIterator iter(topNode);
50  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
51  dstNode->addNode(new PHIODataNode<PHObject>(fcal_hits = new PHG4HitContainer(("G4HIT_" + Name())), ("G4HIT_" + Name()), "PHObject"));
52  }
53 
54  // create detector
55  detector_ = new PHG4FPbScDetector(this, topNode, Name());
58 
59  // create stepping action
61 
62  eventAction_ = new PHG4EventActionClearZeroEdep(topNode, hitnodename.str());
63 
64  return 0;
65 }
66 
67 //_______________________________________________________________________
69 {
70  if (PHG4FPbScRegionSteppingAction* p = dynamic_cast<PHG4FPbScRegionSteppingAction*>(detector_->GetSteppingAction()))
71  p->SetInterfacePointers(topNode);
72  else
74 
75  return 0;
76 }
77 
78 //_______________________________________________________________________
80 {
81  return detector_;
82 }
83 
84 //_______________________________________________________________________
86 {
87  return steppingAction_;
88 }