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 int volID = trackingGeometry->lowestTrackingVolume(tgContext, actsParameters->position(tgContext))->geometryId().volume();
263
264
272
278
281 m_treeData->m_trk_eta[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->momentum().eta() : 0.;
282 m_treeData->m_trk_theta[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->momentum().theta() : 0.;
283 m_treeData->m_trk_phi[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->momentum().phi() : 0.;
284 m_treeData->m_trk_x[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->position().x() : 0.;
285 m_treeData->m_trk_y[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->position().y() : 0.;
286 m_treeData->m_trk_z[
m_treeData->m_g4_steps] = trkParameters ? trkParameters->position().z() : 0.;
289
291 float tATLAS = (trkParameters->position() -
m_parameterCache->position()).norm();
297 }
298
299 else{
303 float tATLAS = (trkParameters->position() - previousPos).norm();
308 }
309
312 m_treeData->m_acts_pt[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->transverseMomentum()*1000 : 0.;
313 m_treeData->m_acts_eta[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->momentum().eta() : 0.;
314 m_treeData->m_acts_theta[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->momentum().theta() : 0.;
315 m_treeData->m_acts_phi[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->momentum().phi() : 0.;
316 m_treeData->m_acts_x[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->position(tgContext).x() : 0.;
317 m_treeData->m_acts_y[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->position(tgContext).y() : 0.;
318 m_treeData->m_acts_z[
m_treeData->m_g4_steps] = actsParameters.ok() ? actsParameters->position(tgContext).z() : 0.;
319
321 float tActs = (actsParameters->position(tgContext) -
m_actsParameterCache->position(tgContext)).norm();
327 }
328
329 else{
333 float tActs = (actsParameters->position(tgContext) - previousPos).norm();
338 }
339
340
345 }
346
350}
#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.