ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4EnvelopeSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4EnvelopeSubsystem.cc
2 
3 #include "PHG4EnvelopeDetector.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 <sstream>
17 
18 using namespace std;
19 
20 PHG4EnvelopeSubsystem::PHG4EnvelopeSubsystem(const std::string& name, const int /*lyr*/)
21  : PHG4Subsystem(name)
22  , detector_(nullptr)
23  , steppingAction_(nullptr)
24  , material("G4_PbWO4")
25  , // default - lead tungstate crystal
26  active(1)
27  , detector_type(name)
28 {
29 }
30 
32 {
33  PHNodeIterator iter(topNode);
34  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst("PHCompositeNode", "DST"));
35 
36  // create detector
37  detector_ = new PHG4EnvelopeDetector(this, topNode, Name());
40 
41  if (active)
42  {
43  // create hit output node
44  ostringstream nodename;
45  nodename << "G4HIT_ENVELOPE_" << detector_type;
46 
47  PHG4HitContainer* crystal_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename.str().c_str());
48  if (!crystal_hits)
49  {
50  crystal_hits = new PHG4HitContainer(nodename.str());
51  PHIODataNode<PHObject>* hitNode = new PHIODataNode<PHObject>(crystal_hits, nodename.str().c_str(), "PHObject");
52  dstNode->addNode(hitNode);
53  }
54 
55  // create stepping action
57  }
58  return 0;
59 }
60 
61 //_______________________________________________________________________
63 {
64  // pass top node to stepping action so that it gets
65  // relevant nodes needed internally
66  if (steppingAction_)
67  {
69  }
70  return 0;
71 }
72 
73 //_______________________________________________________________________
75 {
76  return detector_;
77 }
78 
79 //_______________________________________________________________________
81 {
82  return steppingAction_;
83 }