12 #include "GaudiKernel/ITHistSvc.h"
13 #include "GaudiKernel/EventContext.h"
16 #include "CLHEP/Units/SystemOfUnits.h"
17 #include "CLHEP/Geometry/Transform3D.h"
24 #include "Acts/Surfaces/PerigeeSurface.hpp"
25 #include "Acts/Surfaces/PlaneSurface.hpp"
26 #include "Acts/Surfaces/CurvilinearSurface.hpp"
29 #include "Acts/Geometry/GeometryContext.hpp"
30 #include "Acts/Geometry/TrackingGeometry.hpp"
35 m_validationTreeName(
"G4Follower_"+
n),
36 m_validationTreeDescription(
"Output of the G4Follower_"),
37 m_validationTreeFolder(
"/val/G4Follower_"+
n),
38 m_validationTree(nullptr){}
112 SmartIF<ITHistSvc> tHistSvc{service(
"THistSvc")};
114 ATH_MSG_ERROR(
"Could not find Hist Service -> Switching ValidationMode Off !" );
118 ATH_MSG_ERROR(
"Could not register the validation Tree -> Switching ValidationMode Off !" );
123 return StatusCode::SUCCESS;
128 return StatusCode::SUCCESS;
151 const G4ThreeVector&
mom,
153 float t,
float X0,
bool isSensitive)
156 const EventContext &ctx = Gaudi::Hive::currentContext();
167 ATH_MSG_INFO(
"Initial step ... preparing event cache.");
182 std::shared_ptr<Acts::PerigeeSurface> surface =
183 Acts::Surface::makeShared<Acts::PerigeeSurface>(
189 Acts::Vector4 actsStart(
pos.x(),
pos.y(),
pos.z(),0);
190 Acts::Vector3
dir = nmom.normalized();
193 Acts::AnyCharge{
static_cast<float>(
charge)}};
195 gctx.
context(), surface, actsStart,
dir,
charge/(
mom.mag()/1000), std::nullopt, hypothesis)
200 float tX0 =
X0 > 10
e-5
f ?
t/
X0 : 0.f;
234 if(eCodeSteps.code != 2 ){
235 ATH_MSG_ERROR(
"Error in the Extrapolator Engine, skip the current step");
240 auto destinationSurfaceActs = Acts::CurvilinearSurface(destinationSurface.
center(), destinationSurface.
normal()).planeSurface();
241 std::optional<Acts::BoundTrackParameters> actsParameters =
m_actsExtrapolator->propagate(ctx,
243 *destinationSurfaceActs,
244 Acts::Direction::Forward(),
249 *destinationSurfaceActs,
250 Acts::Direction::Forward(),
253 if(not actsParameters.has_value()){
254 ATH_MSG_ERROR(
"Error in the Acts extrapolation, skip the current step");
257 int volID = trackingGeometry->lowestTrackingVolume(gctx.
context(), actsParameters->position(gctx.
context()))->geometryId().volume();
298 float tATLAS = (trkParameters->
position() - previousPos).
norm();
307 m_treeData->m_acts_pt[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->transverseMomentum()*1000 : 0.;
308 m_treeData->m_acts_eta[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->momentum().eta() : 0.;
309 m_treeData->m_acts_theta[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->momentum().theta() : 0.;
310 m_treeData->m_acts_phi[
m_treeData->m_g4_steps] = actsParameters ? actsParameters->momentum().phi() : 0.;
328 float tActs = (actsParameters->position(gctx.
context()) - previousPos).
norm();
344 destinationSurfaceActs.reset();