12 #include "GaudiKernel/ITHistSvc.h"
13 #include "GaudiKernel/EventContext.h"
16 #include "CLHEP/Units/SystemOfUnits.h"
17 #include "CLHEP/Geometry/Transform3D.h"
25 #include "Acts/Surfaces/PerigeeSurface.hpp"
26 #include "Acts/Surfaces/PlaneSurface.hpp"
27 #include "Acts/Surfaces/CurvilinearSurface.hpp"
31 #include "Acts/Geometry/GeometryContext.hpp"
32 #include "Acts/Geometry/TrackingGeometry.hpp"
37 m_validationTreeName(
"G4Follower_"+
n),
38 m_validationTreeDescription(
"Output of the G4Follower_"),
39 m_validationTreeFolder(
"/val/G4Follower_"+
n),
40 m_validationTree(nullptr){}
114 SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc")};
116 ATH_MSG_ERROR(
"Could not find Hist Service -> Switching ValidationMode Off !" );
120 ATH_MSG_ERROR(
"Could not register the validation Tree -> Switching ValidationMode Off !" );
125 return StatusCode::SUCCESS;
130 return StatusCode::SUCCESS;
153 const G4ThreeVector&
mom,
155 float t,
float X0,
bool isSensitive)
158 const EventContext &ctx = Gaudi::Hive::currentContext();
169 ATH_MSG_INFO(
"Initial step ... preparing event cache.");
184 std::shared_ptr<Acts::PerigeeSurface> surface =
185 Acts::Surface::makeShared<Acts::PerigeeSurface>(
191 Acts::Vector4 actsStart(
pos.x(),
pos.y(),
pos.z(),0);
192 Acts::Vector3
dir = nmom.normalized();
195 Acts::AnyCharge{
static_cast<float>(
charge)}};
197 gctx.
context(), surface, actsStart,
dir,
charge/(
mom.mag()/1000), std::nullopt, hypothesis)
202 float tX0 =
X0 > 10
e-5 ?
t/
X0 : 0.;
236 if(eCodeSteps.code != 2 ){
237 ATH_MSG_ERROR(
"Error in the Extrapolator Engine, skip the current step");
242 auto destinationSurfaceActs = Acts::CurvilinearSurface(destinationSurface.
center(), destinationSurface.
normal()).planeSurface();
243 std::optional<Acts::BoundTrackParameters> actsParameters =
m_actsExtrapolator->propagate(ctx,
245 *destinationSurfaceActs,
246 Acts::Direction::Forward(),
251 *destinationSurfaceActs,
252 Acts::Direction::Forward(),
255 if(not actsParameters.has_value()){
256 ATH_MSG_ERROR(
"Error in the Acts extrapolation, skip the current step");
259 int volID = trackingGeometry->lowestTrackingVolume(gctx.
context(), actsParameters->position(gctx.
context()))->geometryId().volume();
300 float tATLAS = (trkParameters->
position() - previousPos).
norm();
309 m_treeData->m_acts_pt[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->transverseMomentum()*1000 : 0.;
310 m_treeData->m_acts_eta[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->momentum().eta() : 0.;
311 m_treeData->m_acts_theta[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->momentum().theta() : 0.;
312 m_treeData->m_acts_phi[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->momentum().phi() : 0.;
330 float tActs = (actsParameters->position(gctx.
context()) - previousPos).
norm();
346 destinationSurfaceActs.reset();