EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4TTLSubsystem.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4TTLSubsystem.cc
1 #include "PHG4TTLSubsystem.h"
2 #include "PHG4TTLDetector.h"
3 
4 #include <phparameter/PHParameters.h>
5 
6 #include <g4main/PHG4DisplayAction.h> // for PHG4DisplayAction
8 #include <g4main/PHG4SteppingAction.h> // for PHG4SteppingAction
9 #include <g4main/PHG4Subsystem.h> // for PHG4Subsystem
10 #include "PHG4TTLDisplayAction.h"
11 #include "PHG4TTLSteppingAction.h"
12 
13 #include <phool/PHCompositeNode.h>
14 #include <phool/PHIODataNode.h> // for PHIODataNode
15 #include <phool/PHNode.h> // for PHNode
16 #include <phool/PHNodeIterator.h> // for PHNodeIterator
17 #include <phool/PHObject.h> // for PHObject
18 #include <phool/getClass.h>
19 
20 #include <sstream>
21 
22 #include <set> // for set
23 #include <sstream>
24 class PHG4Detector;
25 
26 using namespace std;
27 
28 //_______________________________________________________________________
30  : PHG4DetectorSubsystem(name)
31  , m_Detector(nullptr)
32  , m_SteppingAction(nullptr)
33  , m_DisplayAction(nullptr)
34  , superdetector("NONE")
35 {
37 }
38 
39 //_______________________________________________________________________
41 {
42  delete m_DisplayAction;
43 }
44 
45 //_______________________________________________________________________
47 {
48  PHNodeIterator iter(topNode);
49  PHCompositeNode* dstNode = dynamic_cast<PHCompositeNode*>(iter.findFirst(
50  "PHCompositeNode", "DST"));
51 
52  // create display settings before detector
54  // create detector
55  m_Detector = new PHG4TTLDetector(this, topNode, GetParams(), Name());
56  // m_Detector->geom = geom;
59 
60  // if (geom.GetNumActiveLayers())
61  // {
62  std::ostringstream nodename;
63  if (superdetector != "NONE")
64  {
65  nodename << "G4HIT_" << superdetector;
66  }
67  else
68  {
69  nodename << "G4HIT_" << Name();
70  }
71  // create hit list
72  PHG4HitContainer* block_hits = findNode::getClass<PHG4HitContainer>(
73  topNode, nodename.str().c_str());
74  if (!block_hits)
75  {
76  dstNode->addNode(new PHIODataNode<PHObject>(new PHG4HitContainer(nodename.str()), nodename.str(), "PHObject"));
77  }
78  // create stepping action
80  m_Detector->SetSteppingAction(dynamic_cast<PHG4TTLSteppingAction*>(m_SteppingAction));
81  // }
82  return 0;
83 }
84 
85 //_______________________________________________________________________
87 {
88  // pass top node to stepping action so that it gets
89  // relevant nodes needed internally
90  if (m_SteppingAction)
91  {
93  }
94  return 0;
95 }
96 
97 //_______________________________________________________________________
100 {
101  return m_Detector;
102 }
103 
105 {
106  set_default_int_param("isForward", 1);
107  set_default_double_param("length", 100. * cm);
108  set_default_double_param("place_x", 0.);
109  set_default_double_param("place_y", 0.);
110  set_default_double_param("place_z", 375. * cm);
111  set_default_double_param("offset_x", 150. * cm);
112  set_default_double_param("rMin", 20. * cm);
113  set_default_double_param("rMax", 220. * cm);
114  set_default_double_param("etaMin", 1.);
115  set_default_double_param("etaMax", 4.);
116  set_default_double_param("polar_angle", 0.);
117  set_default_double_param("total_thickness", 1. * cm);
118  set_default_double_param("tSilicon", 1. * um);
119  set_default_double_param("resLGAD", 500e-4 / sqrt(12));
120  // set_default_double_param("wls_dw", 0.3);
121  // set_default_double_param("support_dw", 0.2);
122  set_default_double_param("rot_x", 0.);
123  set_default_double_param("rot_y", 0.);
124  set_default_double_param("rot_z", 0.);
125  // set_default_double_param("thickness_absorber", 2.);
126  // set_default_double_param("thickness_scintillator", 0.231);
127  // set_default_string_param("scintillator", "G4_POLYSTYRENE");
128  // set_default_string_param("absorber", "G4_Fe");
129  // set_default_string_param("support", "G4_Fe");
130  return;
131 }