Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHActsTrackPropagator.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHActsTrackPropagator.cc
1 
3 
6 #include <phool/PHDataNode.h>
7 #include <phool/PHNode.h>
8 #include <phool/PHNodeIterator.h>
9 #include <phool/PHObject.h>
10 #include <phool/PHTimer.h>
11 #include <phool/getClass.h>
12 #include <phool/phool.h>
13 
14 #include <trackbase/ActsAborter.h>
16 
21 
24 
28 
29 //____________________________________________________________________________..
31  : SubsysReco(name)
32 {
33 }
34 
35 //____________________________________________________________________________..
37 {
38 }
39 
40 //____________________________________________________________________________..
42 {
44 }
45 
46 //____________________________________________________________________________..
48 {
49  int ret = getNodes(topNode);
50 
51  return ret;
52 }
53 
54 //____________________________________________________________________________..
56 {
58  for (auto &[key, track] : *m_trackMap)
59  {
60  auto params = prop.makeTrackParams(track, m_vertexMap);
61  if(!params.ok())
62  {
63  continue;
64  }
65  auto result = propagateTrack(params.value());
66  if (result.ok())
67  {
68  addTrackState(result, track);
69  }
70  }
71 
73 }
74 
76  BoundTrackParamResult &result,
77  SvtxTrack *svtxTrack)
78 {
79  float pathlength = result.value().first / Acts::UnitConstants::cm;
80  auto params = result.value().second;
81 
82  SvtxTrackState_v1 out(pathlength);
83 
84  auto projectionPos = params.position(m_tGeometry->geometry().getGeoContext());
85  const auto momentum = params.momentum();
86  out.set_x(projectionPos.x() / Acts::UnitConstants::cm);
87  out.set_y(projectionPos.y() / Acts::UnitConstants::cm);
88  out.set_z(projectionPos.z() / Acts::UnitConstants::cm);
89  out.set_px(momentum.x());
90  out.set_py(momentum.y());
91  out.set_pz(momentum.z());
92 
93  if (Verbosity() > 1)
94  {
95  std::cout << "Adding track state for layer " << m_sphenixLayer
96  << " with path length " << pathlength << " with position "
97  << projectionPos.transpose() << std::endl;
98  }
99 
100  ActsTransformations transformer;
101  const auto globalCov = transformer.rotateActsCovToSvtxTrack(params);
102  for (int i = 0; i < 6; ++i)
103  {
104  for (int j = 0; j < 6; ++j)
105  {
106  out.set_error(i, j, globalCov(i, j));
107  }
108  }
109 
110  svtxTrack->insert_state(&out);
111 }
112 
115 {
116  ActsPropagator propagator(m_tGeometry);
117  propagator.verbosity(Verbosity());
118 
119  return propagator.propagateTrack(params, m_sphenixLayer);
120 }
121 
122 //____________________________________________________________________________..
124 {
126 }
127 
128 //____________________________________________________________________________..
130 {
131  std::cout << "PHActsTrackPropagator:: " << what << std::endl;
132 }
133 
135 {
136  m_vertexMap = findNode::getClass<SvtxVertexMap>(topNode, "SvtxVertexMap");
137  if (!m_vertexMap)
138  {
139  std::cout << PHWHERE << "No vertex map on node tree, bailing."
140  << std::endl;
142  }
143 
144  m_tGeometry = findNode::getClass<ActsGeometry>(
145  topNode, "ActsGeometry");
146  if (!m_tGeometry)
147  {
148  std::cout << "ActsTrackingGeometry not on node tree. Exiting."
149  << std::endl;
150 
152  }
153 
154  m_trackMap = findNode::getClass<SvtxTrackMap>(topNode, "SvtxTrackMap");
155  if (!m_trackMap)
156  {
157  std::cout << PHWHERE << "No SvtxTrackMap on node tree. Bailing."
158  << std::endl;
160  }
161 
163 }