ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4JLeicDIRCSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4JLeicDIRCSubsystem.cc
1 #include "G4JLeicDIRCSubsystem.h"
2 #include "G4JLeicDIRCDetector.h"
4 
5 #include <phparameter/PHParameters.h>
6 
8 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
9 
10 #include <phool/PHCompositeNode.h>
11 #include <phool/PHIODataNode.h> // for PHIODataNode
12 #include <phool/PHNode.h> // for PHNode
13 #include <phool/PHNodeIterator.h> // for PHNodeIterator
14 #include <phool/PHObject.h> // for PHObject
15 #include <phool/getClass.h>
16 
17 #include <boost/foreach.hpp>
18 
19 #include <set> // for set
20 #include <sstream>
21 
22 using namespace std;
23 
24 //_______________________________________________________________________
26  : PHG4DetectorSubsystem(name, 0)
27  , detector_(nullptr)
28  , steppingAction_(nullptr)
29 {
31  Name(name);
32  SuperDetector(name);
33 }
34 
35 //_______________________________________________________________________
37 {
38  PHNodeIterator iter(topNode);
39  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
40 
41  // create detector
42  detector_ = new G4JLeicDIRCDetector(this, topNode, GetParams(), Name());
45 
46  set<string> nodes;
47  if (GetParams()->get_int_param("active"))
48  {
49  PHNodeIterator dstIter(dstNode);
50  PHCompositeNode *DetNode = dynamic_cast<PHCompositeNode *>(dstIter.findFirst("PHCompositeNode", SuperDetector()));
51  if (!DetNode)
52  {
53  DetNode = new PHCompositeNode(SuperDetector());
54  dstNode->addNode(DetNode);
55  }
56  ostringstream nodename;
57  if (SuperDetector() != "NONE")
58  {
59  nodename << "G4HIT_" << SuperDetector();
60  }
61  else
62  {
63  nodename << "G4HIT_" << Name();
64  }
65  nodes.insert(nodename.str());
66  BOOST_FOREACH (string node, nodes)
67  {
68  PHG4HitContainer *g4_hits = findNode::getClass<PHG4HitContainer>(topNode, node.c_str());
69  if (!g4_hits)
70  {
71  g4_hits = new PHG4HitContainer(node);
72  DetNode->addNode(new PHIODataNode<PHObject>(g4_hits, node.c_str(), "PHObject"));
73  }
74  }
75  // create stepping action
77  }
78 
79  return 0;
80 }
81 
82 //_______________________________________________________________________
84 {
85  // pass top node to stepping action so that it gets
86  // relevant nodes needed internally
87  if (steppingAction_)
88  {
90  }
91  return 0;
92 }
93 
94 void G4JLeicDIRCSubsystem::Print(const string &what) const
95 {
96  //cout << "PSTOF Parameters: " << endl;
97  if (detector_)
98  {
99  detector_->Print(what);
100  }
101  return;
102 }
103 
104 //_______________________________________________________________________
106 {
107  return detector_;
108 }
109 
110 //_______________________________________________________________________
112 {
113  return steppingAction_;
114 }
115 
117 {
118  // all units are in cm
119  set_default_double_param("PixelDy", 4. / 10.); // dy/10
120 
121  set_default_int_param("layers", 6);
122 }