27 declareInterface<IParticleCaloExtensionTool>(
this);
48 ATH_MSG_WARNING(
"Unsupported particle type, using strategy based on type "
59 return StatusCode::SUCCESS;
62std::unique_ptr<Trk::CaloExtension>
75 if (el->trackParticle()) {
80 if (
muon->primaryTrackParticle()) {
93 const EventContext& ctx,
98 std::unique_ptr<Trk::CaloExtension>& extension = cache[particle.index()];
99 if (extension ==
nullptr) {
102 return extension.get();
110 size_t index = particle.index();
120 const EventContext& ctx,
122 const std::vector<bool>& mask,
125 const size_t numparticles = particles.size();
127 if (mask.size() != numparticles) {
128 ATH_MSG_ERROR(
"mask does not have the same size as in input collection");
129 return StatusCode::FAILURE;
131 caloextensions.
reserve(numparticles);
135 for (
size_t i = 0; i < numparticles; ++i) {
137 std::unique_ptr<Trk::CaloExtension> extension =
139 caloextensions.
push_back(std::move(extension));
144 return StatusCode::SUCCESS;
147std::unique_ptr<Trk::CaloExtension>
149 const EventContext& ctx,
155 if (pvtx ==
nullptr) {
158 double charge = particle.charge();
160 Amg::Vector3D mom(particle.px(), particle.py(), particle.pz());
162 if (particle.isNeutral()) {
172std::unique_ptr<Trk::CaloExtension>
174 const EventContext& ctx,
191std::unique_ptr<Trk::CaloExtension>
193 const EventContext& ctx,
204 if (std::abs(particle.perigeeParameters().position().z()) > 6700.)
206 if (particle.perigeeParameters().position().perp() > 4200.)
210 ctx, particle.perigeeParameters(), propDir,
particleType);
214 const Track& track = *particle.track();
221 track.trackStateOnSurfaces()->begin();
222 for (; itTSoS != track.trackStateOnSurfaces()->end(); ++itTSoS) {
224 if (!(**itTSoS).trackParameters() ||
232 ->associatedSurface()
233 .associatedDetectorElementIdentifier();
235 idExitParamers = (**itTSoS).trackParameters();
236 if (
m_detID->is_muon(
id) && !muonEntryParamers)
237 muonEntryParamers = (**itTSoS).trackParameters();
240 if (!idExitParamers && !muonEntryParamers) {
241 idExitParamers = track.perigeeParameters();
245 idExitParamers ? idExitParamers : muonEntryParamers;
256std::unique_ptr<Trk::CaloExtension>
263 << startPars.
position().perp() <<
" z "
264 << startPars.
position().z() <<
" momentum "
270 extrapolation_timer.start();
277 std::vector<std::pair<std::unique_ptr<Trk::TrackParameters>,
int>>>
282 extrapolation_timer.stop();
284 if (!caloParameters) {
291 std::unique_ptr<TrackParameters> caloEntry =
nullptr;
292 std::unique_ptr<TrackParameters> muonEntry =
nullptr;
293 std::vector<CurvilinearParameters> caloLayers;
294 caloLayers.reserve(caloParameters->size() - 1);
295 ATH_MSG_DEBUG(
" Found calo parameters: " << caloParameters->size()
296 <<
" extrapolation exit ID="
299 for (
auto& p : *caloParameters) {
306 caloEntry = std::move(p.first);
308 caloEntry = std::move(p.first);
310 muonEntry = std::move(p.first);
312 muonEntry = std::move(p.first);
314 bool isEntry = p.second > 0;
325 caloLayers.emplace_back(p.first->position(),
331 std::optional<
AmgSymMatrix(5)> covariance(std::nullopt);
332 if (p.first->covariance()) {
335 caloLayers.emplace_back(p.first->position(),
338 std::move(covariance),
345 std::abs(startPars.
position().perp() - 4255.) < 1.) {
350 return std::make_unique<Trk::CaloExtension>(
351 std::move(caloEntry), std::move(muonEntry), std::move(caloLayers));
354std::vector<std::unique_ptr<Trk::Surface>>
356 const std::vector<CaloSampling::CaloSample>& clusterLayers,
361 std::vector<std::unique_ptr<Trk::Surface>> caloSurfaces;
362 caloSurfaces.reserve(clusterLayers.size());
364 auto* surf =
m_calosurf->CreateUserSurface(lay, 0.,
eta, &caloDD);
366 caloSurfaces.emplace_back(surf);
374 std::unique_ptr<const Trk::TrackParameters>>>
376 const EventContext& ctx,
378 const std::vector<CaloSampling::CaloSample>& clusterLayers,
379 const std::vector<std::unique_ptr<Trk::Surface>>& caloSurfaces,
382 const auto* lastImpact = &startPars;
384 size_t numSteps = caloSurfaces.size();
386 std::unique_ptr<const Trk::TrackParameters>>>
388 caloParameters.reserve(numSteps);
389 for (
size_t i = 0; i < numSteps; ++i) {
390 std::unique_ptr<const Trk::TrackParameters> nextImpact =
398 caloParameters.emplace_back(clusterLayers[i], std::move(nextImpact));
399 lastImpact = caloParameters.back().second.get();
402 return caloParameters;
406 std::unique_ptr<const Trk::TrackParameters>>>
408 const EventContext& ctx,
410 const std::vector<CaloSampling::CaloSample>& clusterLayers,
417 std::vector<std::unique_ptr<Trk::Surface>> caloSurfaces =
421 ctx, startPars, clusterLayers, caloSurfaces,
particleType);
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
double charge(const T &p)
DataVector< Trk::CaloExtension > CaloExtensionCollection
#define AmgSymMatrix(dim)
unsigned int TrackParametersIdentifier
const ServiceHandle< StoreGateSvc > & detStore() const
This class provides the client interface for accessing the detector description information common to...
DataModel_detail::const_iterator< DataVector > const_iterator
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
Group of local monitoring quantities and retain correlation when filling histograms
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
std::unordered_map< size_t, std::unique_ptr< Trk::CaloExtension > > Cache
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
std::unique_ptr< ParametersBase< DIM, T > > uniqueClone() const
clone method for polymorphic deep copy returning unique_ptr; it is not overriden, but uses the existi...
virtual std::unique_ptr< Trk::CaloExtension > caloExtension(const EventContext &ctx, const xAOD::IParticle &particle) const override final
Method returning the calo layers crossed by the IParticle track or the IParticle itself if it is neut...
Gaudi::Property< bool > m_startFromPerigee
std::vector< std::unique_ptr< Trk::Surface > > caloSurfacesFromLayers(const std::vector< CaloSampling::CaloSample > &clusterLayers, double eta, const CaloDetDescrManager &caloDD) const override final
Method returning a vector of calo surfaces give calo layers/samplings.
virtual std::vector< std::pair< CaloSampling::CaloSample, std::unique_ptr< const Trk::TrackParameters > > > surfaceCaloExtension(const EventContext &ctx, const TrackParameters &startPars, const std::vector< CaloSampling::CaloSample > &clusterLayers, const std::vector< std::unique_ptr< Trk::Surface > > &caloSurfaces, ParticleHypothesis particleType) const override final
Method returning a vector of the Track Parameters at layers/samplings.
ParticleHypothesis m_particleStrategy
ToolHandle< ICaloSurfaceBuilder > m_calosurf
Tool to build calorimeter layer surfaces.
virtual ~ParticleCaloExtensionTool()
ParticleCaloExtensionTool(const std::string &, const std::string &, const IInterface *)
virtual StatusCode caloExtensionCollection(const EventContext &ctx, const xAOD::IParticleContainer &particles, const std::vector< bool > &mask, CaloExtensionCollection &caloextensions) const override final
Method that can be used by algorithms that : A.
ToolHandle< Trk::IExtrapolator > m_extrapolator
virtual StatusCode initialize() override final
Gaudi::Property< unsigned int > m_extrapolDetectorID
Gaudi::Property< std::string > m_particleTypeName
const AtlasDetectorID * m_detID
ToolHandle< GenericMonitoringTool > m_monTool
Monitoring tool for recording histograms of the alg in action.
virtual std::vector< std::pair< CaloSampling::CaloSample, std::unique_ptr< const Trk::TrackParameters > > > layersCaloExtension(const EventContext &ctx, const TrackParameters &startPars, const std::vector< CaloSampling::CaloSample > &clusterLayers, double eta, const CaloDetDescrManager &caloDD, ParticleHypothesis particleType) const override final
Method returning a vector of the Track Parameters at layers/samplings.
helper class to encode and decode a TrackParametersIdentifier
TrackParametersIdentifier encode(AtlasDetDescr::AtlasDetTechnology, CaloSampling::CaloSample, bool isEntryToVolume) const
Encodes a TrackParametersIdentifier from AtlasDetDescr::AtlasDetTechnology and CaloSampling::CaloSamp...
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
Class providing the definition of the 4-vector interface.
float z() const
Vertex longitudinal distance along the beam line form the origin.
float y() const
Vertex y displacement.
float x() const
Vertex x displacement.
Eigen::Matrix< double, 3, 1 > Vector3D
@ fFirstAtlasCaloTechnology
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
ParametersT< NeutralParametersDim, Neutral, PerigeeSurface > NeutralPerigee
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters
@ TrackParticle
The object is a charged track particle.
@ Muon
The object is a muon.
@ TruthParticle
The object is a truth particle.
@ NeutralParticle
The object is a neutral particle.
@ Electron
The object is an electron.
NeutralParticle_v1 NeutralParticle
Reference the current persistent version:
TruthVertex_v1 TruthVertex
Typedef to implementation.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TruthParticle_v1 TruthParticle
Typedef to implementation.
Muon_v1 Muon
Reference the current persistent version:
Electron_v1 Electron
Definition of the current "egamma version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.