ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::ParticleCaloExtensionTool Class Referencefinal

#include <ParticleCaloExtensionTool.h>

Inheritance diagram for Trk::ParticleCaloExtensionTool:
Collaboration diagram for Trk::ParticleCaloExtensionTool:

Public Types

typedef std::unordered_map< size_t, std::unique_ptr< Trk::CaloExtension > > Cache

Public Member Functions

 ParticleCaloExtensionTool (const std::string &, const std::string &, const IInterface *)
virtual ~ParticleCaloExtensionTool ()
virtual StatusCode initialize () override final
virtual std::unique_ptr< Trk::CaloExtensioncaloExtension (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 neutral/TruthParticle The memory ownership is handled by the unique_ptr.
virtual const Trk::CaloExtensioncaloExtension (const EventContext &ctx, const xAOD::IParticle &particle, IParticleCaloExtensionTool::Cache &cache) const override final
 Method to return the calo layers crossed (CaloExtension) by the IParticle track or the IParticle itself if it is neutral/TruthParticle.
virtual const Trk::CaloExtensioncaloExtension (const xAOD::IParticle &particle, const CaloExtensionCollection &cache) const override final
 Method to return the calo layers crossed (CaloExtension) by the IParticle track or the IParticle itself if it is neutral/TruthParticle It returns the result stored in the CaloExtensionCollection created by the caloExtensionCollection method below.
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.
virtual std::unique_ptr< Trk::CaloExtensioncaloExtension (const EventContext &ctx, const TrackParameters &startPars, PropDirection propDir, ParticleHypothesis particleType) const override final
 Method returning a unique_ptr to the caloExtension given the relevant starting point parameters , direction and particle hypothesis.
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.
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.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

std::unique_ptr< Trk::CaloExtensioncaloExtension (const EventContext &ctx, const xAOD::TruthParticle &particle) const
std::unique_ptr< Trk::CaloExtensioncaloExtension (const EventContext &ctx, const xAOD::NeutralParticle &particle) const
std::unique_ptr< Trk::CaloExtensioncaloExtension (const EventContext &ctx, const xAOD::TrackParticle &particle) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trk::IExtrapolatorm_extrapolator { this, "Extrapolator", "" }
ToolHandle< ICaloSurfaceBuilderm_calosurf
 Tool to build calorimeter layer surfaces.
Gaudi::Property< std::string > m_particleTypeName
Gaudi::Property< bool > m_startFromPerigee
const AtlasDetectorIDm_detID
ParticleHypothesis m_particleStrategy
Gaudi::Property< unsigned int > m_extrapolDetectorID
ToolHandle< GenericMonitoringToolm_monTool {this,"MonTool","","Monitoring tool"}
 Monitoring tool for recording histograms of the alg in action.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 44 of file ParticleCaloExtensionTool.h.

Member Typedef Documentation

◆ Cache

typedef std::unordered_map<size_t, std::unique_ptr<Trk::CaloExtension> > Trk::IParticleCaloExtensionTool::Cache
inherited

Definition at line 98 of file IParticleCaloExtensionTool.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ParticleCaloExtensionTool()

Trk::ParticleCaloExtensionTool::ParticleCaloExtensionTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 20 of file ParticleCaloExtensionTool.cxx.

23 : AthAlgTool(t, n, p)
24 , m_detID(nullptr)
26{
27 declareInterface<IParticleCaloExtensionTool>(this);
28}
AthAlgTool()
Default constructor:

◆ ~ParticleCaloExtensionTool()

Trk::ParticleCaloExtensionTool::~ParticleCaloExtensionTool ( )
virtualdefault

Member Function Documentation

◆ caloExtension() [1/7]

std::unique_ptr< Trk::CaloExtension > Trk::ParticleCaloExtensionTool::caloExtension ( const EventContext & ctx,
const TrackParameters & startPars,
PropDirection propDir,
ParticleHypothesis particleType ) const
finaloverridevirtual

Method returning a unique_ptr to the caloExtension given the relevant starting point parameters , direction and particle hypothesis.

Parameters
ctxevent context needed for multithreading
startParsthe starting track parameters
propDirextrapolation direction
particleTypetype of particle

Implements Trk::IParticleCaloExtensionTool.

Definition at line 257 of file ParticleCaloExtensionTool.cxx.

261{
262 ATH_MSG_DEBUG("looking up calo states: r "
263 << startPars.position().perp() << " z "
264 << startPars.position().z() << " momentum "
265 << startPars.momentum().mag());
266
267 auto extrapolation_timer = Monitored::Timer<std::chrono::microseconds>( "TIME_extrapolation" );
268 auto group = Monitored::Group(m_monTool, extrapolation_timer);
269 // Start monitoring timer
270 extrapolation_timer.start();
271 /* The last argument to the extrapolate overload
272 * corresponds to a GeometrySignature value from
273 * TrkDetDescrUtils/GeometrySignature.h
274 * The extrapolation stop at the indicated subdetector exit
275 */
276 std::unique_ptr<
277 std::vector<std::pair<std::unique_ptr<Trk::TrackParameters>, int>>>
278 caloParameters = m_extrapolator->collectIntersections(
279 ctx, startPars, propDir, particleType, m_extrapolDetectorID);
280
281 // Stop monitoring timer
282 extrapolation_timer.stop();
283
284 if (!caloParameters) {
285 return nullptr;
286 }
287
288 TrackParametersIdHelper parsIdHelper;
289
290 // create final object
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="
298
299 for (auto& p : *caloParameters) {
300 if (!p.first) {
301 continue;
302 }
303 // assign parameters
304 // calo aentry muon entry and the crossed calo layers
305 if (p.second == 1 && propDir == Trk::alongMomentum) {
306 caloEntry = std::move(p.first);
307 } else if (p.second == 3 && propDir == Trk::oppositeMomentum) {
308 caloEntry = std::move(p.first);
309 } else if (p.second == 3 && propDir == Trk::alongMomentum) {
310 muonEntry = std::move(p.first);
311 } else if (p.second == 4 && propDir == Trk::oppositeMomentum) {
312 muonEntry = std::move(p.first);
313 } else {
314 bool isEntry = p.second > 0;
315 TrackParametersIdentifier id = parsIdHelper.encode(
317 static_cast<CaloSampling::CaloSample>(abs(p.second) % 1000),
318 isEntry);
319 /*
320 * We construct curvilinear parameters which we push
321 * back to the caloLayers.
322 * curvillinear.
323 */
324 if (p.first->type() != Trk::Curvilinear) {
325 caloLayers.emplace_back(p.first->position(),
326 p.first->momentum(),
327 p.first->charge(),
328 std::nullopt,
329 id);
330 } else {
331 std::optional<AmgSymMatrix(5)> covariance(std::nullopt);
332 if (p.first->covariance()) {
333 covariance = AmgSymMatrix(5)(*(p.first->covariance()));
334 }
335 caloLayers.emplace_back(p.first->position(),
336 p.first->momentum(),
337 p.first->charge(),
338 std::move(covariance),
339 id);
340 }
341 }
342 }
343
344 if (!muonEntry && propDir == Trk::oppositeMomentum &&
345 std::abs(startPars.position().perp() - 4255.) < 1.) {
346 // muonEntry is right at the startPars position
347 muonEntry = startPars.uniqueClone();
348 }
349
350 return std::make_unique<Trk::CaloExtension>(
351 std::move(caloEntry), std::move(muonEntry), std::move(caloLayers));
352}
#define ATH_MSG_DEBUG(x)
#define AmgSymMatrix(dim)
unsigned int TrackParametersIdentifier
ToolHandle< Trk::IExtrapolator > m_extrapolator
Gaudi::Property< unsigned int > m_extrapolDetectorID
ToolHandle< GenericMonitoringTool > m_monTool
Monitoring tool for recording histograms of the alg in action.
@ oppositeMomentum
@ alongMomentum

◆ caloExtension() [2/7]

std::unique_ptr< Trk::CaloExtension > Trk::ParticleCaloExtensionTool::caloExtension ( const EventContext & ctx,
const xAOD::IParticle & particle ) const
finaloverridevirtual

Method returning the calo layers crossed by the IParticle track or the IParticle itself if it is neutral/TruthParticle The memory ownership is handled by the unique_ptr.

Parameters
ctxevent context needed for multithreading
particlereference to the Particle
Returns
unique_ptr to a CaloExtension

Implements Trk::IParticleCaloExtensionTool.

Definition at line 63 of file ParticleCaloExtensionTool.cxx.

65{
66 if (particle.type() == xAOD::Type::TrackParticle) {
67 const xAOD::TrackParticle* trackParticle = static_cast<const xAOD::TrackParticle*>(&particle);
68 return caloExtension(ctx, *trackParticle);
69 }
70 if (particle.type() == xAOD::Type::TruthParticle) {
71 const xAOD::TruthParticle* truthParticle = static_cast<const xAOD::TruthParticle*>(&particle);
72 return caloExtension(ctx, *truthParticle);
73 } else if (particle.type() == xAOD::Type::Electron) {
74 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(&particle);
75 if (el->trackParticle()) {
76 return caloExtension(ctx, *(el->trackParticle()));
77 }
78 } else if (particle.type() == xAOD::Type::Muon) {
79 const xAOD::Muon* muon = static_cast<const xAOD::Muon*>(&particle);
80 if (muon->primaryTrackParticle()) {
81 return caloExtension(ctx, *(muon->primaryTrackParticle()));
82 }
83 } else if (particle.type() == xAOD::Type::NeutralParticle) {
84 const xAOD::NeutralParticle* neutralParticle = static_cast<const xAOD::NeutralParticle*>(&particle);
85 return caloExtension(ctx, *neutralParticle);
86 }
87 ATH_MSG_WARNING("Unsupported IParticle type");
88 return nullptr;
89}
#define ATH_MSG_WARNING(x)
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...
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ TrackParticle
The object is a charged track particle.
Definition ObjectType.h:43
@ Muon
The object is a muon.
Definition ObjectType.h:48
@ TruthParticle
The object is a truth particle.
Definition ObjectType.h:67
@ NeutralParticle
The object is a neutral particle.
Definition ObjectType.h:44
@ Electron
The object is an electron.
Definition ObjectType.h:46
NeutralParticle_v1 NeutralParticle
Reference the current persistent version:
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".

◆ caloExtension() [3/7]

const Trk::CaloExtension * Trk::ParticleCaloExtensionTool::caloExtension ( const EventContext & ctx,
const xAOD::IParticle & particle,
IParticleCaloExtensionTool::Cache & cache ) const
finaloverridevirtual

Method to return the calo layers crossed (CaloExtension) by the IParticle track or the IParticle itself if it is neutral/TruthParticle.

An alg looping over a single collection of IParticles re-using them multiple times can use a local cache of the form std::unordered_map<size_t,std::unique_ptr<Trk::CaloExtension>>. The key is the value of IParticle::index()

This method adds the relevant extension to the cache look-up table which retains ownership.

Parameters
ctxevent context needed for multithreading
particlereference to the Particle
cachethe look-up table cache
Returns
ptr to a const CaloExtension (owned by the cache)

Implements Trk::IParticleCaloExtensionTool.

Definition at line 92 of file ParticleCaloExtensionTool.cxx.

96{
97 /*if not there , default ctor for unique_ptr (nullptr)*/
98 std::unique_ptr<Trk::CaloExtension>& extension = cache[particle.index()];
99 if (extension == nullptr) {
100 extension = caloExtension(ctx, particle);
101 }
102 return extension.get();
103}

◆ caloExtension() [4/7]

std::unique_ptr< Trk::CaloExtension > Trk::ParticleCaloExtensionTool::caloExtension ( const EventContext & ctx,
const xAOD::NeutralParticle & particle ) const
private

Definition at line 173 of file ParticleCaloExtensionTool.cxx.

176{
178 // create start parameters
179 const Trk::NeutralPerigee& perigee = particle.perigeeParameters();
180 double charge = 1.;
181 const Amg::Vector3D& pos(perigee.position());
182 Amg::Vector3D mom(perigee.momentum());
183 // Aproximate neutral particles as charged with infinite momentum
184 mom.normalize();
185 mom *= 1e10;
186 Trk::CurvilinearParameters startPars(pos, mom, charge);
187 // get extension
188 return caloExtension(ctx, startPars, alongMomentum, particleType);
189}
double charge(const T &p)
Definition AtlasPID.h:997
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< NeutralParametersDim, Neutral, PerigeeSurface > NeutralPerigee
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.

◆ caloExtension() [5/7]

std::unique_ptr< Trk::CaloExtension > Trk::ParticleCaloExtensionTool::caloExtension ( const EventContext & ctx,
const xAOD::TrackParticle & particle ) const
private

Definition at line 192 of file ParticleCaloExtensionTool.cxx.

195{
196 // Start with what the user opted as strategy
198
199 // wee extrapolate either from the perigee or
200 // from the last measurement.
201 if (m_startFromPerigee || !particle.track()) {
202 bool idExit = true;
203 // Muon Entry is around z 6783 and r 4255
204 if (std::abs(particle.perigeeParameters().position().z()) > 6700.)
205 idExit = false;
206 if (particle.perigeeParameters().position().perp() > 4200.)
207 idExit = false;
208 PropDirection propDir = idExit ? alongMomentum : oppositeMomentum;
209 return caloExtension(
210 ctx, particle.perigeeParameters(), propDir, particleType);
211 }
212
213 // Extrapolation from last track parameters
214 const Track& track = *particle.track();
215 // Look-up the parameters closest to the calorimeter in
216 // ID and muon system
217 ATH_MSG_DEBUG("trying to add calo layers");
218 const TrackParameters* idExitParamers = nullptr;
219 const TrackParameters* muonEntryParamers = nullptr;
221 track.trackStateOnSurfaces()->begin();
222 for (; itTSoS != track.trackStateOnSurfaces()->end(); ++itTSoS) {
223 // select state with track parameters on a measurement
224 if (!(**itTSoS).trackParameters() ||
225 !(**itTSoS).type(TrackStateOnSurface::Measurement) ||
226 (**itTSoS).type(TrackStateOnSurface::Outlier)) {
227 continue;
228 }
229
230 const Identifier& id = (**itTSoS)
231 .trackParameters()
232 ->associatedSurface()
233 .associatedDetectorElementIdentifier();
234 if (m_detID->is_indet(id))
235 idExitParamers = (**itTSoS).trackParameters();
236 if (m_detID->is_muon(id) && !muonEntryParamers)
237 muonEntryParamers = (**itTSoS).trackParameters();
238 }
239 // require at least one of them
240 if (!idExitParamers && !muonEntryParamers) {
241 idExitParamers = track.perigeeParameters();
242 }
243 // pick start parameters, start in ID if possible
244 const TrackParameters* startPars =
245 idExitParamers ? idExitParamers : muonEntryParamers;
246
247 if (!startPars) {
248 ATH_MSG_WARNING("Failed to find start parameters");
249 return nullptr;
250 }
251 PropDirection propDir = idExitParamers ? alongMomentum : oppositeMomentum;
252
253 return caloExtension(ctx, *startPars, propDir, particleType);
254}
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
@ 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 ...
PropDirection
PropDirection, enum for direction of the propagation.
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ caloExtension() [6/7]

std::unique_ptr< Trk::CaloExtension > Trk::ParticleCaloExtensionTool::caloExtension ( const EventContext & ctx,
const xAOD::TruthParticle & particle ) const
private

Definition at line 148 of file ParticleCaloExtensionTool.cxx.

151{
153 // get start parameters
154 const xAOD::TruthVertex* pvtx = particle.prodVtx();
155 if (pvtx == nullptr) {
156 return nullptr;
157 }
158 double charge = particle.charge();
159 Amg::Vector3D pos(pvtx->x(), pvtx->y(), pvtx->z());
160 Amg::Vector3D mom(particle.px(), particle.py(), particle.pz());
161 // Aproximate neutral particles as charged with infinite momentum
162 if (particle.isNeutral()) {
163 charge = 1.;
164 mom.normalize();
165 mom *= 1e10;
166 }
167 Trk::CurvilinearParameters startPars(pos, mom, charge);
168 // get extension
169 return caloExtension(ctx, startPars, alongMomentum, particleType);
170}
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.
TruthVertex_v1 TruthVertex
Typedef to implementation.
Definition TruthVertex.h:15

◆ caloExtension() [7/7]

const Trk::CaloExtension * Trk::ParticleCaloExtensionTool::caloExtension ( const xAOD::IParticle & particle,
const CaloExtensionCollection & cache ) const
finaloverridevirtual

Method to return the calo layers crossed (CaloExtension) by the IParticle track or the IParticle itself if it is neutral/TruthParticle It returns the result stored in the CaloExtensionCollection created by the caloExtensionCollection method below.

In this case, the CaloExtensionCollection (DataVector<CaloExtension>) owns the caloExtension.

Parameters
particlereference to the Particle
cacheThe CaloExtensionCollections
Returns
ptr to a const CaloExtension (owned by the cache)

Implements Trk::IParticleCaloExtensionTool.

Definition at line 106 of file ParticleCaloExtensionTool.cxx.

109{
110 size_t index = particle.index();
111 if (index < cache.size()) {
112 return cache[index];
113 }
114 ATH_MSG_WARNING("cache size smaller than particle index");
115 return nullptr;
116}
size_type size() const noexcept
Returns the number of elements in the collection.
str index
Definition DeMoScan.py:362

◆ caloExtensionCollection()

StatusCode Trk::ParticleCaloExtensionTool::caloExtensionCollection ( const EventContext & ctx,
const xAOD::IParticleContainer & particles,
const std::vector< bool > & mask,
CaloExtensionCollection & caloextensions ) const
finaloverridevirtual

Method that can be used by algorithms that : A.

Have an IParticleCollection B. Define a mask of the size of that collection C. Want back a Calo Extension Collection alligned with the input collection i.e 1 to 1 correspondance with the input collection. The Collection can then be used as such to retrieve the extensions or manipulated and written to StoreGate.

Parameters
ctxevent context needed for multithreading
particlesThe input collection
maskcontains true for the elements for which to permorm an extension, false otherwise
Returns
caloextension Output to be filled, will contain unfilled CaloExtension where the mask was false, otherwise it contains the relevant result.

Implements Trk::IParticleCaloExtensionTool.

Definition at line 119 of file ParticleCaloExtensionTool.cxx.

124{
125 const size_t numparticles = particles.size();
126
127 if (mask.size() != numparticles) {
128 ATH_MSG_ERROR("mask does not have the same size as in input collection");
129 return StatusCode::FAILURE;
130 }
131 caloextensions.reserve(numparticles);
132 /* Either create a proper CaloExtension or otherwise a dummy one
133 * i.e one with no intersections
134 */
135 for (size_t i = 0; i < numparticles; ++i) {
136 if (mask[i]) {
137 std::unique_ptr<Trk::CaloExtension> extension =
138 caloExtension(ctx, *(particles[i]));
139 caloextensions.push_back(std::move(extension));
140 } else {
141 caloextensions.push_back(nullptr);
142 }
143 }
144 return StatusCode::SUCCESS;
145}
#define ATH_MSG_ERROR(x)
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.

◆ caloSurfacesFromLayers()

std::vector< std::unique_ptr< Trk::Surface > > Trk::ParticleCaloExtensionTool::caloSurfacesFromLayers ( const std::vector< CaloSampling::CaloSample > & clusterLayers,
double eta,
const CaloDetDescrManager & caloDD ) const
finaloverridevirtual

Method returning a vector of calo surfaces give calo layers/samplings.

Parameters
ctxevent context needed for multithreading
clusterLayersthe layers (should be ordered) we aim to
etaeta used for the depth

Implements Trk::IParticleCaloExtensionTool.

Definition at line 355 of file ParticleCaloExtensionTool.cxx.

359{
360 // Create surfaces at the layers
361 std::vector<std::unique_ptr<Trk::Surface>> caloSurfaces;
362 caloSurfaces.reserve(clusterLayers.size());
363 for (CaloSampling::CaloSample lay : clusterLayers) {
364 auto* surf = m_calosurf->CreateUserSurface(lay, 0., eta, &caloDD);
365 if (surf) {
366 caloSurfaces.emplace_back(surf);
367 }
368 }
369
370 return caloSurfaces;
371}
Scalar eta() const
pseudorapidity method
ToolHandle< ICaloSurfaceBuilder > m_calosurf
Tool to build calorimeter layer surfaces.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ initialize()

StatusCode Trk::ParticleCaloExtensionTool::initialize ( )
finaloverridevirtual

Definition at line 33 of file ParticleCaloExtensionTool.cxx.

34{
35 /* Retrieve track extrapolator from ToolService */
36 ATH_CHECK(m_extrapolator.retrieve());
37 // Retrieve the calo surface builder
38 /* Retrieve the Atlas detector ID */
39 ATH_CHECK(detStore()->retrieve(m_detID, "AtlasID"));
40 /* convert string to proper particle type enum*/
41 if (m_particleTypeName == "nonInteracting") {
43 } else if (m_particleTypeName == "muon") {
45 } else if (m_particleTypeName == "pion") {
47 } else {
48 ATH_MSG_WARNING("Unsupported particle type, using strategy based on type "
50 }
51 if (!m_calosurf.empty()) {
52 ATH_CHECK(m_calosurf.retrieve());
53 } else {
54 m_calosurf.disable();
55 }
56 if (!m_monTool.empty()) {
57 ATH_CHECK(m_monTool.retrieve());
58 }
59 return StatusCode::SUCCESS;
60}
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
Gaudi::Property< std::string > m_particleTypeName
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Trk::IParticleCaloExtensionTool::interfaceID ( )
inlinestaticinherited

Definition at line 247 of file IParticleCaloExtensionTool.h.

248{
250}
static const InterfaceID IID_IParticleCaloExtensionTool("Trk::IParticleCaloExtensionTool", 1, 0)

◆ layersCaloExtension()

std::vector< std::pair< CaloSampling::CaloSample, std::unique_ptr< const Trk::TrackParameters > > > Trk::ParticleCaloExtensionTool::layersCaloExtension ( const EventContext & ctx,
const TrackParameters & startPars,
const std::vector< CaloSampling::CaloSample > & clusterLayers,
double eta,
const CaloDetDescrManager & caloDD,
ParticleHypothesis particleType ) const
finaloverridevirtual

Method returning a vector of the Track Parameters at layers/samplings.

Parameters
ctxevent context needed for multithreading
startParsthe starting track parameters
clusterLayersthe layers (should be ordered) we aim to
etaeta used for the depth
particleTypetype of particle

Implements Trk::IParticleCaloExtensionTool.

Definition at line 407 of file ParticleCaloExtensionTool.cxx.

414{
415
416 // Create surfaces at the layers
417 std::vector<std::unique_ptr<Trk::Surface>> caloSurfaces =
418 caloSurfacesFromLayers(clusterLayers, eta, caloDD);
419
421 ctx, startPars, clusterLayers, caloSurfaces, particleType);
422}
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.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ surfaceCaloExtension()

std::vector< std::pair< CaloSampling::CaloSample, std::unique_ptr< const Trk::TrackParameters > > > Trk::ParticleCaloExtensionTool::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
finaloverridevirtual

Method returning a vector of the Track Parameters at layers/samplings.

Parameters
ctxevent context needed for multithreading
startParsthe starting track parameters
clusterLayersthe layers (should be ordered) we aim to
clusterSurfacesthe surfaces for each layer
particleTypetype of particle

The clusterLayers and clusterSurfaces need to be 1-1 this can be done via the caloSurfacesFromLayers method above.

Implements Trk::IParticleCaloExtensionTool.

Definition at line 375 of file ParticleCaloExtensionTool.cxx.

381{
382 const auto* lastImpact = &startPars;
383 // Go into steps from layer to layer
384 size_t numSteps = caloSurfaces.size();
385 std::vector<std::pair<CaloSampling::CaloSample,
386 std::unique_ptr<const Trk::TrackParameters>>>
387 caloParameters{};
388 caloParameters.reserve(numSteps);
389 for (size_t i = 0; i < numSteps; ++i) {
390 std::unique_ptr<const Trk::TrackParameters> nextImpact =
391 m_extrapolator->extrapolateDirectly(ctx,
392 *lastImpact,
393 *(caloSurfaces[i]),
395 false,
396 particleType);
397 if (nextImpact) {
398 caloParameters.emplace_back(clusterLayers[i], std::move(nextImpact));
399 lastImpact = caloParameters.back().second.get();
400 }
401 }
402 return caloParameters;
403}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_calosurf

ToolHandle<ICaloSurfaceBuilder> Trk::ParticleCaloExtensionTool::m_calosurf
private
Initial value:
{
this,
"CaloSurfaceBuilder",
"",
"Tool to build calorimeter layer surfaces"
}

Tool to build calorimeter layer surfaces.

Definition at line 127 of file ParticleCaloExtensionTool.h.

127 {
128 this,
129 "CaloSurfaceBuilder",
130 "",
131 "Tool to build calorimeter layer surfaces"
132 };

◆ m_detID

const AtlasDetectorID* Trk::ParticleCaloExtensionTool::m_detID
private

Definition at line 144 of file ParticleCaloExtensionTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extrapolator

ToolHandle<Trk::IExtrapolator> Trk::ParticleCaloExtensionTool::m_extrapolator { this, "Extrapolator", "" }
private

Definition at line 124 of file ParticleCaloExtensionTool.h.

124{ this, "Extrapolator", "" };

◆ m_extrapolDetectorID

Gaudi::Property<unsigned int> Trk::ParticleCaloExtensionTool::m_extrapolDetectorID
private
Initial value:
{
this,
"ExtrapolationDetectorID",
"The detector this tool should extrapolate through. Expects a "
"Trk::GeometrySignature enum value."
}

Definition at line 147 of file ParticleCaloExtensionTool.h.

147 {
148 this,
149 "ExtrapolationDetectorID",
150 Trk::Calo,
151 "The detector this tool should extrapolate through. Expects a "
152 "Trk::GeometrySignature enum value."
153 };

◆ m_monTool

ToolHandle<GenericMonitoringTool> Trk::ParticleCaloExtensionTool::m_monTool {this,"MonTool","","Monitoring tool"}
private

Monitoring tool for recording histograms of the alg in action.

Definition at line 156 of file ParticleCaloExtensionTool.h.

156{this,"MonTool","","Monitoring tool"};

◆ m_particleStrategy

ParticleHypothesis Trk::ParticleCaloExtensionTool::m_particleStrategy
private

Definition at line 145 of file ParticleCaloExtensionTool.h.

◆ m_particleTypeName

Gaudi::Property<std::string> Trk::ParticleCaloExtensionTool::m_particleTypeName
private
Initial value:
{
this, "ParticleType", "muon",
"The particle type used during extrapolation when not passed via the "
"method interfaces"
": muon, pion, nonInteracting"}

Definition at line 134 of file ParticleCaloExtensionTool.h.

134 {
135 this, "ParticleType", "muon",
136 "The particle type used during extrapolation when not passed via the "
137 "method interfaces"
138 ": muon, pion, nonInteracting"};

◆ m_startFromPerigee

Gaudi::Property<bool> Trk::ParticleCaloExtensionTool::m_startFromPerigee
private
Initial value:
{ this,
"StartFromPerigee",
false,
"Start from Perigee" }

Definition at line 140 of file ParticleCaloExtensionTool.h.

140 { this,
141 "StartFromPerigee",
142 false,
143 "Start from Perigee" };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: