ATLAS Offline Software
Loading...
Searching...
No Matches
MuidMaterialEffectsOnTrackProvider.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6// MuidMaterialEffectsOnTrackProvider.cxx, (c) ATLAS Detector software
8
10
14// #include "TrkGeometry/HomogenousLayerMaterial.h"
25
26// constructor
28 const IInterface* p) :
29 AthAlgTool(t, n, p) {
30 m_cosmics = false;
31 declareProperty("Cosmics", m_cosmics);
32 declareInterface<IMaterialEffectsOnTrackProvider>(this);
33}
34
35// destructor
37
38// Athena standard methods
39// initialize
41 if (!m_cosmics) {
42 ATH_CHECK(m_calotsos.retrieve());
43 ATH_MSG_INFO("Retrieved tool " << m_calotsos.name());
44
45 if (!m_calotsosparam.empty()) {
46 ATH_CHECK(m_calotsosparam.retrieve());
47 ATH_MSG_INFO("Retrieved tool " << m_calotsosparam.name());
48 }
49
50 ATH_CHECK(m_scattool.retrieve());
51 }
52 return StatusCode::SUCCESS;
53}
54
55// finalize
57 ATH_MSG_DEBUG(name() << " finalize() successful");
58 return StatusCode::SUCCESS;
59}
60
62 const Trk::TrackingVolume& /*vol*/, const Trk::IPropagator& /*prop*/, const Trk::TrackParameters& parm, const Trk::Surface& /*surf*/,
63 Trk::PropDirection /*dir*/, Trk::ParticleHypothesis /*mateffects*/) const {
64 const EventContext& ctx = Gaudi::Hive::currentContext();
65 std::vector<Trk::MaterialEffectsOnTrack> meots;
66 if (m_cosmics) {
67 static const Trk::CylinderSurface outersurf(3700, 5000);
68 static const Trk::CylinderSurface innersurf(2000, 5000);
69 static const Trk::CylinderSurface middlesurf(2850, 5000);
70
71 Amg::Vector3D position(0, -3700, 0);
72 double X0outer{60}, X0inner{60};
73
75 std::pair<double, double> energy{-3000, 500};
76 ATH_MSG_DEBUG("first x0: " << X0inner << " second x0: " << X0outer << " eloss: " << energy.first << " sigma: " << energy.second);
77
78 Trk::MaterialProperties matprop(X0outer, 1., 0., 0., 0., 0.);
79 double sigmascat = std::sqrt(m_scattool->sigmaSquare(matprop, std::abs(1. / parm.parameters()[Trk::qOverP]), 1., Trk::muon));
80
81 Trk::ScatteringAngles newsa {0, 0, sigmascat / std::sin(parm.parameters()[Trk::theta]), sigmascat};
82 Trk::ScatteringAngles newsa2 {0, 0, sigmascat / std::sin(parm.parameters()[Trk::theta]), sigmascat};
83
84 meots.emplace_back(X0inner, newsa, innersurf);
85 meots.emplace_back(
86 0,
87 std::make_unique<Trk::EnergyLoss>(energy.first, energy.second),
88 middlesurf,
90 meots.emplace_back(X0outer, newsa2, outersurf);
91
92 } else {
93 std::vector<std::unique_ptr<const Trk::TrackStateOnSurface>> tsosvec = m_calotsos->caloTSOS(ctx, parm);
94 if (tsosvec.size() != 3 && !m_calotsosparam.empty()) { tsosvec = m_calotsosparam->caloTSOS(ctx, parm); }
95 for (const std::unique_ptr<const Trk::TrackStateOnSurface>& c_tsos : tsosvec) {
96 const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(c_tsos->materialEffectsOnTrack());
97 if (!meot) continue;
98 double sintheta = std::sin(c_tsos->trackParameters()->parameters()[Trk::theta]);
99 double qoverp = c_tsos->trackParameters()->parameters()[Trk::qOverP];
100 const CaloEnergy* eloss = meot ? dynamic_cast<const CaloEnergy*>(meot->energyLoss()) : nullptr;
101
102 std::unique_ptr<Trk::EnergyLoss> neweloss = nullptr;
103 std::optional<Trk::ScatteringAngles> newsa = std::nullopt;
104 if (eloss)
105 neweloss = std::make_unique<CaloEnergy>(*eloss);
106 else {
107 Trk::MaterialProperties matprop(meot->thicknessInX0(), 1., 0., 0., 0., 0.);
108 double sigmascat = std::sqrt(m_scattool->sigmaSquare(matprop, std::abs(1. / qoverp), 1., Trk::muon));
109 newsa = Trk::ScatteringAngles(0, 0, sigmascat / sintheta, sigmascat);
110 }
111 meots.emplace_back(meot->thicknessInX0(), newsa, std::move(neweloss), c_tsos->trackParameters()->associatedSurface());
112 }
113 }
114 if (meots.size() < 3) meots.clear();
115 return meots;
116}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
class extending the basic Trk::EnergyLoss to describe the measured or parameterised muon energy loss ...
Definition CaloEnergy.h:28
MuidMaterialEffectsOnTrackProvider(const std::string &, const std::string &, const IInterface *)
AlgTool like constructor.
ToolHandle< Rec::IMuidCaloTrackStateOnSurface > m_calotsos
ToolHandle< Trk::IMultipleScatteringUpdator > m_scattool
std::vector< Trk::MaterialEffectsOnTrack > extrapolationSurfacesAndEffects(const Trk::TrackingVolume &, const Trk::IPropagator &, const Trk::TrackParameters &, const Trk::Surface &, Trk::PropDirection, Trk::ParticleHypothesis) const
return all MaterialLayers associated to this track
ToolHandle< Rec::IMuidCaloTrackStateOnSurface > m_calotsosparam
Class for a CylinderSurface in the ATLAS detector.
Interface class IPropagators It inherits from IAlgTool.
Definition IPropagator.h:55
@ EnergyLossEffects
contains energy loss corrections
double thicknessInX0() const
returns the actually traversed material .
represents the full description of deflection and e-loss of a track in material.
const EnergyLoss * energyLoss() const
returns the energy loss object.
Material with information about thickness of material.
represents a deflection of the track caused through multiple scattering in material.
Abstract Base Class for tracking surfaces.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Eigen::Matrix< double, 3, 1 > Vector3D
PropDirection
PropDirection, enum for direction of the propagation.
@ theta
Definition ParamDefs.h:66
@ qOverP
perigee
Definition ParamDefs.h:67
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters