155{
156
157 const EventContext &ctx = Gaudi::Hive::currentContext();
158 const Acts::GeometryContext tgContext =
m_ctxProvider.getGeometryContext(ctx);
160
163
164
166
168 ATH_MSG_INFO(
"Initial step ... preparing event cache.");
182
183 std::shared_ptr<Acts::PerigeeSurface> surface =
184 Acts::Surface::makeShared<Acts::PerigeeSurface>(
185 npos);
186
187
189
190 Acts::Vector4 actsStart(
pos.x(),
pos.y(),
pos.z(),0);
191 Acts::Vector3
dir = nmom.normalized();
192 Acts::ParticleHypothesis hypothesis{Acts::makeAbsolutePdgParticle(static_cast<Acts::PdgParticle>(pdg)),
195 tgContext, surface, actsStart, dir,
charge/(
mom.mag()/1000), std::nullopt, hypothesis)
196 .value();
197 }
198
199
200 float tX0 =
X0 > 10e-5f ?
t/
X0 : 0.f;
203 if (!isSensitive)
204 {
205 return;
206 }
207
208
210
213 return;
214 }
215
218 return;
219 }
220
221 auto g4Parameters = std::make_unique<Trk::CurvilinearParameters>(npos, nmom,
m_treeData->m_t_charge);
222
223 const Trk::PlaneSurface& destinationSurface = g4Parameters->associatedSurface();
224
229
231 std::unique_ptr<Trk::TrackParameters> trkParameters{ecc.endParameters};
232 float X0ATLAS = ecc.materialX0;
233
234 if(eCodeSteps.code != 2 ){
235 ATH_MSG_ERROR(
"Error in the Extrapolator Engine, skip the current step");
236 return;
237 }
238
239
240 auto destinationSurfaceActs = Acts::CurvilinearSurface(destinationSurface.
center(), destinationSurface.
normal()).planeSurface();
241 Acts::Result<Acts::BoundTrackParameters> actsParameters =
m_actsExtrapolator->propagate(ctx,
243 *destinationSurfaceActs,
244 Acts::Direction::Forward(),
245 std::numeric_limits<double>::max());
246 if(not actsParameters.ok()){
247 ATH_MSG_ERROR(
"Error in the Acts extrapolation, skip the current step");
248 return;
249 }
250
253 *destinationSurfaceActs,
254 Acts::Direction::Forward(),
255 std::numeric_limits<double>::max());
256 if(not actsSteps.ok()){
257 ATH_MSG_ERROR(
"Error in the Acts extrapolation, skip the current step");
258 return;
259 }
260 float X0Acts = actsSteps->second.materialInX0;
261
262 auto lowestVolume = trackingGeometry->resolveLowestTrackingVolume(tgContext, actsParameters->position(tgContext));
263 if(not lowestVolume.ok() or *lowestVolume == nullptr){
264 ATH_MSG_ERROR(
"Could not resolve the lowest tracking volume, skip the current step");
265 return;
266 }
267 int volID = (*lowestVolume)->geometryId().volume();
268
269
277
283
286 m_treeData->m_trk_eta[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->momentum().eta() : 0.;
287 m_treeData->m_trk_theta[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->momentum().theta() : 0.;
288 m_treeData->m_trk_phi[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->momentum().phi() : 0.;
289 m_treeData->m_trk_x[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->position().x() : 0.;
290 m_treeData->m_trk_y[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->position().y() : 0.;
291 m_treeData->m_trk_z[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->position().z() : 0.;
294
295 if (trkParameters){
297 float tATLAS = (trkParameters->position() -
m_parameterCache->position()).norm();
303 }
304
305 else{
309 float tATLAS = (trkParameters->position() - previousPos).norm();
314 }
315 }
318 m_treeData->m_acts_pt[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->transverseMomentum()*1000 : 0.;
319 m_treeData->m_acts_eta[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->momentum().eta() : 0.;
320 m_treeData->m_acts_theta[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->momentum().theta() : 0.;
321 m_treeData->m_acts_phi[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->momentum().phi() : 0.;
322 m_treeData->m_acts_x[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->position(tgContext).x() : 0.;
323 m_treeData->m_acts_y[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->position(tgContext).y() : 0.;
324 m_treeData->m_acts_z[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->position(tgContext).z() : 0.;
325
327 float tActs = (actsParameters->position(tgContext) -
m_actsParameterCache->position(tgContext)).norm();
333 }
334
335 else{
339 float tActs = (actsParameters->position(tgContext) - previousPos).norm();
344 }
345
346
351 }
352
356}
#define ATH_MSG_WARNING(x)
double charge(const T &p)
Trk::PdgToParticleHypothesis m_pdgToParticleHypothesis
std::unique_ptr< Trk::TrackParameters > m_parameterCache
Gaudi::Property< bool > m_extrapolateIncrementally
virtual const Amg::Vector3D & normal() const
Returns the normal vector of the Surface (i.e.
const Amg::Vector3D & center() const
Returns the center position of the Surface.
Eigen::Matrix< double, 3, 1 > Vector3D
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.