ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4FCalSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4FCalSubsystem.cc
1 #include "PHG4FCalSubsystem.h"
2 
3 #include "PHG4FCalDetector.h"
5 
7 #include <g4main/PHG4Subsystem.h> // for PHG4Subsystem
8 
10 #include <phool/PHIODataNode.h> // for PHIODataNode
11 #include <phool/PHNode.h> // for PHNode
12 #include <phool/PHNodeIterator.h> // for PHNodeIterator
13 #include <phool/PHObject.h> // for PHObject
14 #include <phool/getClass.h>
15 
16 #include <Geant4/G4UserSteppingAction.hh> // for G4UserSteppingAction
17 
18 class PHG4Detector;
19 
20 //_______________________________________________________________________
22  : PHG4Subsystem(name)
23  , detector_(nullptr)
24 {
25 }
26 
27 //_______________________________________________________________________
29 {
30  // create hit list
31  PHG4HitContainer* fcal_hits = findNode::getClass<PHG4HitContainer>(topNode, "G4HIT_FCAL");
32  if (!fcal_hits)
33  {
34  PHNodeIterator iter(topNode);
35  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
36  dstNode->addNode(new PHIODataNode<PHObject>(fcal_hits = new PHG4HitContainer("G4HIT_FCAL"), "G4HIT_FCAL", "PHObject"));
37  }
38 
39  // create detector
40  detector_ = new PHG4FCalDetector(this, topNode, Name());
42 
43  // create stepping action
44 
45  return 9;
46 }
47 
48 //_______________________________________________________________________
50 {
51  if (PHG4FCalSteppingAction* p = dynamic_cast<PHG4FCalSteppingAction*>(detector_->GetSteppingAction()))
52  p->SetInterfacePointers(topNode);
53 
54  return 0;
55 }
56 
57 //_______________________________________________________________________
59 {
60  return detector_;
61 }