ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EICG4ZDCSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EICG4ZDCSubsystem.cc
1 //____________________________________________________________________________..
2 //
3 // This is the interface to the framework. You only need to define the parameters
4 // you use for your detector in the SetDefaultParameters() method here
5 // The place to do this is marked by //implement your own here//
6 // The parameters have no units, they need to be converted in the
7 // EICG4ZDCDetector::ConstructMe() method
8 // but the convention is as mentioned cm and deg
9 //____________________________________________________________________________..
10 //
11 #include "EICG4ZDCSubsystem.h"
12 
13 #include "EICG4ZDCDetector.h"
14 #include "EICG4ZDCSteppingAction.h"
15 
16 #include <phparameter/PHParameters.h>
17 
20 
21 #include <phool/PHCompositeNode.h>
22 #include <phool/PHIODataNode.h>
23 #include <phool/PHNode.h>
24 #include <phool/PHNodeIterator.h>
25 #include <phool/PHObject.h>
26 #include <phool/getClass.h>
27 
28 using namespace std;
29 
30 //_______________________________________________________________________
32  : PHG4DetectorSubsystem(name)
33  , m_Detector(nullptr)
34  , m_SteppingAction(nullptr)
35 {
36  // call base class method which will set up parameter infrastructure
37  // and call our SetDefaultParameters() method
39 }
40 //_______________________________________________________________________
42 {
43  PHNodeIterator iter(topNode);
44  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
45  PHNodeIterator dstIter(dstNode);
46  if (GetParams()->get_int_param("active"))
47  {
48  PHCompositeNode *DetNode = dynamic_cast<PHCompositeNode *>(dstIter.findFirst("PHCompositeNode", Name()));
49  if (!DetNode)
50  {
51  DetNode = new PHCompositeNode(Name());
52  dstNode->addNode(DetNode);
53  }
54  std::string g4hitnodename = "G4HIT_" + Name();
55  PHG4HitContainer *g4_hits = findNode::getClass<PHG4HitContainer>(DetNode, g4hitnodename);
56  if (!g4_hits)
57  {
58  g4_hits = new PHG4HitContainer(g4hitnodename);
59  DetNode->addNode(new PHIODataNode<PHObject>(g4_hits, g4hitnodename, "PHObject"));
60  }
61  }
62  // create detector
63  m_Detector = new EICG4ZDCDetector(this, topNode, GetParams(), Name());
65  // create stepping action if detector is active
66  if (GetParams()->get_int_param("active"))
67  {
69  }
70  return 0;
71 }
72 //_______________________________________________________________________
74 {
75  // pass top node to stepping action so that it gets
76  // relevant nodes needed internally
77  if (m_SteppingAction)
78  {
80  }
81  return 0;
82 }
83 //_______________________________________________________________________
84 void EICG4ZDCSubsystem::Print(const string &what) const
85 {
86  if (m_Detector)
87  {
88  m_Detector->Print(what);
89  }
90  return;
91 }
92 
93 //_______________________________________________________________________
95 {
96  return m_Detector;
97 }
98 
99 //_______________________________________________________________________
101 {
102  // sizes are in cm
103  // angles are in rad
104  // units should be converted to G4 units when used
105  //implement your own here//
106  set_default_double_param("place_x", 96);
107  set_default_double_param("place_y", 0.);
108  set_default_double_param("place_z", 3750.);
109  set_default_double_param("rot_x", 0.);
110  set_default_double_param("rot_y", 0.0256);
111  set_default_double_param("rot_z", 0.);
112  set_default_double_param("size_x", 60.);
113  set_default_double_param("size_y", 60.);
114  set_default_double_param("size_z", 200.);
115 
116 }