ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EICG4B0ECALSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EICG4B0ECALSubsystem.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 // EICG4B0Detector::ConstructMe() method
8 // but the convention is as mentioned cm and deg
9 //____________________________________________________________________________..
10 //
11 #include "EICG4B0ECALSubsystem.h"
12 
13 #include "EICG4B0ECALDetector.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 //_______________________________________________________________________
29 EICG4B0ECALSubsystem::EICG4B0ECALSubsystem(const std::string &name, const int lyr)
30  : PHG4DetectorSubsystem(name, lyr)
31  , m_Detector(nullptr)
32  , m_SteppingAction(nullptr)
33  , mappingfile_("")
34 {
35  // call base class method which will set up parameter infrastructure
36  // and call our SetDefaultParameters() method
38 }
39 //_______________________________________________________________________
41 {
42  // create detector
43  m_Detector = new EICG4B0ECALDetector(this, topNode, GetParams(), Name(), GetLayer());
47 
48  if (GetParams()->get_int_param("active"))
49  {
50  PHNodeIterator iter(topNode);
51  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
52 
53  std::string nodename;
54  // std::cout<<"B0ECAL: "<<SuperDetector()<<std::endl;
55  if (SuperDetector() != "NONE")
56  {
57  // create super detector subnodes
58  PHNodeIterator iter_dst(dstNode);
59  PHCompositeNode *superSubNode = dynamic_cast<PHCompositeNode *>(iter_dst.findFirst("PHCompositeNode", SuperDetector()));
60  if (!superSubNode)
61  {
62  superSubNode = new PHCompositeNode(SuperDetector());
63  dstNode->addNode(superSubNode);
64  }
65  dstNode = superSubNode;
66 
67  nodename = "G4HIT_" + SuperDetector();
68  }
69 
70  else
71  {
72  nodename = "G4HIT_" + Name();
73  }
74  PHG4HitContainer *b0_hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
75  if (!b0_hits)
76  {
77  dstNode->addNode(new PHIODataNode<PHObject>(b0_hits = new PHG4HitContainer(nodename), nodename, "PHObject"));
78  }
79  b0_hits->AddLayer(GetLayer());
80  auto *tmp = new EICG4B0ECALSteppingAction(this, m_Detector, GetParams());
81  tmp->HitNodeName(nodename);
83  }
84  else if (GetParams()->get_int_param("blackhole"))
85  {
87  }
88  if (m_SteppingAction)
89  {
90  (dynamic_cast<EICG4B0ECALSteppingAction *>(m_SteppingAction))->SaveAllHits(m_SaveAllHitsFlag);
91  }
92  return 0;
93 }
94 //_______________________________________________________________________
96 {
97  // pass top node to stepping action so that it gets
98  // relevant nodes needed internally
99  if (m_SteppingAction)
100  {
102  }
103  return 0;
104 }
105 //_______________________________________________________________________
106 void EICG4B0ECALSubsystem::Print(const std::string &what) const
107 {
108  if (m_Detector)
109  {
110  m_Detector->Print(what);
111  }
112  return;
113 }
114 
115 //_______________________________________________________________________
117 {
118  return m_Detector;
119 }
120 
121 //_______________________________________________________________________
123 {
124  // sizes are in cm
125  // angles are in deg
126  // units should be converted to G4 units when used
127  //implement your own here//
128  set_default_double_param("place_x", 0.); //subdetector position
129  set_default_double_param("place_y", 0.); //subdetector position
130  set_default_double_param("place_z", 0.); //subdetector position
131  set_default_double_param("pipe_ir", 2.8); //beam pipe inner radius (for future implementation)
132  set_default_double_param("pipe_or", 3.05); //beam pipe outer raidus (for future implementation)
133  set_default_double_param("pipe_hole_r", 3.5); //beam pipe cut off radius in the detector volume
134  set_default_double_param("pipe_hole", 1.0); //beam pipe cut off rectangle in the detector volume
135  set_default_double_param("cable_hole", 2.0); //beam pipe cut off radius in the detector volume
136  set_default_double_param("cable_x", -17.0); //cable hole position
137  set_default_double_param("cable_y", 0.); // position
138  set_default_double_param("cable_z", 0.); // position
139  set_default_double_param("pipe_x", -3.4); //beam pipe position
140  set_default_double_param("pipe_y", 0.); //beam pipe position
141  set_default_double_param("pipe_z", 0.); //beam pipe position
142  set_default_double_param("rot_y", 0.); //subdetector rotation
143  set_default_double_param("outer_radius", 2.); //detector outer radiues
144  set_default_double_param("d_radius", 5.); //packman cutoff size
145  set_default_double_param("length", 10.); //detector length
146  set_default_double_param("startAngle", 0.); //start Angle for packman cutoff
147  set_default_double_param("spanningAngle", 360.); //spanning Angle of the detector (for packman cutoff)
148  set_default_double_param("detid", 0.); //detector id
149  set_default_int_param("ispipe", 0); //pipe or detector (for future implementation)
150  set_default_int_param("lightyield", 1);
151  set_default_int_param("use_g4steps", 0);
152  set_default_double_param("tower_size", 2.);
153  set_default_double_param("global_x", 0);
154  set_default_double_param("global_y", 0);
155  set_default_double_param("global_z", 640);
156  set_default_double_param("readout_size", 2.);
157  set_default_double_param("tmin", NAN);
158  set_default_double_param("tmax", NAN);
159  set_default_string_param("material", "G4_PbWO4"); //detector material
160 }
161 
163 {
165 }