ATLAS Offline Software
Loading...
Searching...
No Matches
EMExtrapolationTools Class Referencefinal

Tools for track extrapolation to the calorimeter. More...

#include <EMExtrapolationTools.h>

Inheritance diagram for EMExtrapolationTools:
Collaboration diagram for EMExtrapolationTools:

Public Types

enum  TrkExtrapDef { fromLastMeasurement , fromPerigee , fromPerigeeRescaled , fromCaloToPerigee }
 Enum for track extrapolation to calo. More...

Public Member Functions

 EMExtrapolationTools (const std::string &type, const std::string &name, const IInterface *parent)
 Constructor with parameters.
virtual ~EMExtrapolationTools ()=default
 Destructor.
virtual StatusCode initialize () override final
 initialize method
virtual std::pair< std::vector< CaloSampling::CaloSample >, std::vector< std::unique_ptr< Trk::Surface > > > getClusterLayerSurfaces (const xAOD::CaloCluster &cluster, const CaloDetDescrManager &caloDD) const override final
virtual StatusCode getMatchAtCalo (const EventContext &ctx, const xAOD::CaloCluster &cluster, const xAOD::TrackParticle &trkPB, const std::vector< CaloSampling::CaloSample > &samples, const std::vector< std::unique_ptr< Trk::Surface > > &surfaces, std::array< double, 4 > &eta, std::array< double, 4 > &phi, std::array< double, 4 > &deltaEta, std::array< double, 4 > &deltaPhi, unsigned int extrapFrom=fromPerigee) const override final
 get eta, phi, deltaEta, and deltaPhi at the four calorimeter layers given the Trk::ParametersBase.
virtual bool matchesAtCalo (const xAOD::CaloCluster *cluster, const xAOD::Vertex *vertex, float etaAtCalo, float phiAtCalo) const override final
 test for vertex-to-cluster match given also the positions at the calorimeter from the vertex extrapolation
virtual bool getEtaPhiAtCalo (const EventContext &ctx, const xAOD::Vertex *vertex, float *etaAtCalo, float *phiAtCalo) const override final
 get eta, phi at EM2 given a vertex which is converted to NeutralParameters.
virtual bool getEtaPhiAtCalo (const EventContext &ctx, const Trk::TrackParameters *trkPar, float *etaAtCalo, float *phiAtCalo) const override final
 get eta, phi at EM2 given NeutralParameters.
Amg::Vector3D getMomentumAtVertex (const EventContext &ctx, const xAOD::Vertex &, unsigned int) const override final
 get the momentum of the i-th trackParticle assiciated to the vertex at vertex (designed for conversions)
Amg::Vector3D getMomentumAtVertex (const EventContext &ctx, const xAOD::Vertex &, bool reuse=true) const override final
 get sum of the momenta at the vertex (designed for conversions).
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 ()
 AlgTool interface methods.

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

int getTRTsection (const xAOD::TrackParticle *trkPB) const
 Return +/- 1 (2) if track is in positive/negative TRT barrel (endcap)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< Trk::IParticleCaloExtensionToolm_ParticleCaloExtensionTool
 Used for extrapolation to the calo.
ToolHandle< Trk::IExtrapolatorm_extrapolator
 Used for extrapolation to the conversion vertex.
Gaudi::Property< double > m_narrowDeltaPhi { this, "NarrowDeltaPhi", 0.05 }
Gaudi::Property< double > m_narrowDeltaPhiTRTbarrel
Gaudi::Property< double > m_narrowDeltaPhiTRTendcap
Gaudi::Property< double > m_narrowDeltaEta { this, "NarrowDeltaEta", 0.05 }
Gaudi::Property< double > m_TRTbarrelDeltaEta
Gaudi::Property< double > m_TRTendcapDeltaEta { this, "TRTendcapDeltaEta", 0.2 }
const TRT_IDm_trtId
Gaudi::Property< bool > m_enableTRT { this, "EnableTRT", true }
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

Tools for track extrapolation to the calorimeter.

Author
Thomas Koffas, Christos Anastopoulos

Definition at line 44 of file EMExtrapolationTools.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Enumeration Documentation

◆ TrkExtrapDef

Enum for track extrapolation to calo.

Enumerator
fromLastMeasurement 

from the last measurement of TrackParticle

fromPerigee 

from the perigee of TrackParticle

fromPerigeeRescaled 

from the perigee of TrackParticle recaled by Ecluster

fromCaloToPerigee 

from the calo to the perigee - fast extrapolation

Definition at line 32 of file IEMExtrapolationTools.h.

33 {
42 };
@ fromPerigee
from the perigee of TrackParticle
@ fromLastMeasurement
from the last measurement of TrackParticle
@ fromCaloToPerigee
from the calo to the perigee - fast extrapolation
@ fromPerigeeRescaled
from the perigee of TrackParticle recaled by Ecluster

Constructor & Destructor Documentation

◆ EMExtrapolationTools()

EMExtrapolationTools::EMExtrapolationTools ( const std::string & type,
const std::string & name,
const IInterface * parent )

Constructor with parameters.

Definition at line 61 of file EMExtrapolationTools.cxx.

64 : AthAlgTool(type, name, parent)
65 , m_trtId(nullptr)
66{
67 declareInterface<IEMExtrapolationTools>(this);
68}
AthAlgTool()
Default constructor:

◆ ~EMExtrapolationTools()

virtual EMExtrapolationTools::~EMExtrapolationTools ( )
virtualdefault

Destructor.

Member Function Documentation

◆ 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

◆ getClusterLayerSurfaces()

std::pair< std::vector< CaloSampling::CaloSample >, std::vector< std::unique_ptr< Trk::Surface > > > EMExtrapolationTools::getClusterLayerSurfaces ( const xAOD::CaloCluster & cluster,
const CaloDetDescrManager & caloDD ) const
finaloverridevirtual

Implements IEMExtrapolationTools.

Definition at line 96 of file EMExtrapolationTools.cxx.

99{
100 // figure which layer we need
101 // based on the where most of the energy of the cluster
102 // is we might want to do EM barrel, EM endCap
103 // or forward calo layers/samplings
104 constexpr std::array<CaloSampling::CaloSample, 4> barrelLayers = {
105 CaloSampling::PreSamplerB,
106 CaloSampling::EMB1,
107 CaloSampling::EMB2,
108 CaloSampling::EMB3
109 };
110 constexpr std::array<CaloSampling::CaloSample, 4> endcapLayers = {
111 CaloSampling::PreSamplerE,
112 CaloSampling::EME1,
113 CaloSampling::EME2,
114 CaloSampling::EME3
115 };
116 constexpr std::array<CaloSampling::CaloSample, 4> endcapLayersAboveEta2p5 = {
117 CaloSampling::EME2,
118 CaloSampling::EME3
119 };
120 constexpr std::array<CaloSampling::CaloSample, 1> forwardLayers = {
121 CaloSampling::FCAL0,
122 };
123
124 std::vector<CaloSampling::CaloSample> clusterLayers;
125 clusterLayers.reserve(4);
126
127 if (cluster.inBarrel() && (!cluster.inEndcap() ||
128 cluster.eSample(CaloSampling::EMB2) >=
129 cluster.eSample(CaloSampling::EME2))) {
130 getClusterLayers(barrelLayers, clusterLayers, cluster);
131 }
132 else if (cluster.eSample(CaloSampling::EME2) >
133 cluster.eSample(CaloSampling::FCAL0)) {
134 if(std::abs(cluster.eta()) < 2.5){
135 getClusterLayers(endcapLayers, clusterLayers, cluster);
136 }
137 else {
138 getClusterLayers(endcapLayersAboveEta2p5, clusterLayers, cluster);
139 }
140 }
141 else {
142 getClusterLayers(forwardLayers, clusterLayers, cluster);
143 }
144
145 std::vector<std::unique_ptr<Trk::Surface>> caloSurfaces =
146 m_ParticleCaloExtensionTool->caloSurfacesFromLayers(
147 clusterLayers, cluster.eta(), caloDD);
148
149 return { std::move(clusterLayers), std::move(caloSurfaces) };
150}
ToolHandle< Trk::IParticleCaloExtensionTool > m_ParticleCaloExtensionTool
Used for extrapolation to the calo.
virtual double eta() const
The pseudorapidity ( ) of the particle.
bool inBarrel() const
Returns true if at least one clustered cell in the barrel.
float eSample(const CaloSample sampling) const
bool inEndcap() const
Returns true if at least one clustered cell in the endcap.

◆ getEtaPhiAtCalo() [1/2]

bool EMExtrapolationTools::getEtaPhiAtCalo ( const EventContext & ctx,
const Trk::TrackParameters * trkPar,
float * etaAtCalo,
float * phiAtCalo ) const
finaloverridevirtual

get eta, phi at EM2 given NeutralParameters.

Return false if the extrapolation fails

Implements IEMExtrapolationTools.

Definition at line 357 of file EMExtrapolationTools.cxx.

361{
362 if (!trkPar)
363 return false;
365 if (fabs(trkPar->eta()) < 1.425) {
366 // Barrel
367 layersToSelect.insert(CaloSampling::EMB2);
368 } else {
369 // Endcap
370 layersToSelect.insert(CaloSampling::EME2);
371 }
372
373 std::unique_ptr<Trk::CaloExtension> extension = nullptr;
374 extension = m_ParticleCaloExtensionTool->caloExtension(
375 ctx, *trkPar, Trk::alongMomentum, Trk::muon);
376 if (!extension) {
377 ATH_MSG_WARNING("Could not create an extension from getEtaPhiAtCalo ");
378 return false;
379 }
382 *extension, intersections, &layersToSelect);
383 bool hitEM2(false);
384 for (const auto& p : intersections) {
385 int i(0);
386 auto sample = std::get<0>(p);
387 if ((sample == CaloSampling::EME2 || sample == CaloSampling::EMB2)) {
388 *etaAtCalo = std::get<1>(p);
389 *phiAtCalo = std::get<2>(p);
390 hitEM2 = true;
391 ++i;
392 ATH_MSG_DEBUG("getMatchAtCalo: i, eta, phi : "
393 << i << " " << std::get<1>(p) << " " << std::get<2>(p));
394 }
395 }
396 return hitEM2;
397}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double eta() const
Access method for pseudorapidity - from momentum.
std::set< CaloSampling::CaloSample > LayersToSelect
void midPointEtaPhiPerLayerVector(const Trk::CaloExtension &extension, EtaPhiPerLayerVector &result, const LayersToSelect *selection=nullptr)
std::vector< std::tuple< CaloSampling::CaloSample, double, double > > EtaPhiPerLayerVector
@ alongMomentum

◆ getEtaPhiAtCalo() [2/2]

bool EMExtrapolationTools::getEtaPhiAtCalo ( const EventContext & ctx,
const xAOD::Vertex * vertex,
float * etaAtCalo,
float * phiAtCalo ) const
finaloverridevirtual

get eta, phi at EM2 given a vertex which is converted to NeutralParameters.

Return false if the extrapolation fails

Implements IEMExtrapolationTools.

Definition at line 332 of file EMExtrapolationTools.cxx.

336{
337 if (!vertex) {
338 return false;
339 }
341 if (momentum.mag() < 1e-5) {
342 ATH_MSG_DEBUG("Intersection failed");
343 return false;
344 }
345 /*
346 * Create high pt track parameters to mimic a neutral particle.
347 * This in principle is an approximation
348 */
349 Trk::PerigeeSurface surface(vertex->position());
350 Trk::Perigee trkPar(
351 vertex->position(), momentum.unit() * 1.e10, +1, surface, std::nullopt);
352 bool success = getEtaPhiAtCalo(ctx, &trkPar, etaAtCalo, phiAtCalo);
353 return success;
354}
Amg::Vector3D getMomentumAtVertex(const EventContext &ctx, const xAOD::Vertex &, unsigned int) const override final
get the momentum of the i-th trackParticle assiciated to the vertex at vertex (designed for conversio...
virtual bool getEtaPhiAtCalo(const EventContext &ctx, const xAOD::Vertex *vertex, float *etaAtCalo, float *phiAtCalo) const override final
get eta, phi at EM2 given a vertex which is converted to NeutralParameters.
Eigen::Matrix< double, 3, 1 > Vector3D
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee

◆ getMatchAtCalo()

StatusCode EMExtrapolationTools::getMatchAtCalo ( const EventContext & ctx,
const xAOD::CaloCluster & cluster,
const xAOD::TrackParticle & trkPB,
const std::vector< CaloSampling::CaloSample > & samples,
const std::vector< std::unique_ptr< Trk::Surface > > & surfaces,
std::array< double, 4 > & eta,
std::array< double, 4 > & phi,
std::array< double, 4 > & deltaEta,
std::array< double, 4 > & deltaPhi,
unsigned int extrapFrom = fromPerigee ) const
finaloverridevirtual

get eta, phi, deltaEta, and deltaPhi at the four calorimeter layers given the Trk::ParametersBase.

Implements IEMExtrapolationTools.

Definition at line 157 of file EMExtrapolationTools.cxx.

168{
169 /* Extrapolate track to calo and return
170 * the extrapolated eta/phi and
171 * the deta/dphi between cluster and track
172 * We allow different ways to extrapolate:
173 * 1) from the last measurement track parameters (this is always the case for
174 * TRT standalone)
175 * 2) from the perigee track parameters
176 * 3) from the perigee
177 * with the track momentum rescaled by the cluster energy
178 */
179 if (cluster.e() < 10 && trkPB.pt() < 10) { // This is 10 MeV
180 ATH_MSG_WARNING("Too small cluster E :"
181 << cluster.e() << " , or too small track pt" << trkPB.pt());
182 return StatusCode::FAILURE;
183 }
184
185 bool didExtension = false;
187 intersections.reserve(samples.size());
188
189 switch (extrapFrom) {
190 case fromPerigeeRescaled: {
191 Trk::Perigee trkPar = getRescaledPerigee(trkPB, cluster);
192 const auto extension = m_ParticleCaloExtensionTool->surfaceCaloExtension(
193 ctx, trkPar, samples, surfaces, Trk::nonInteracting);
194 didExtension = !extension.empty();
195 for (const auto& i : extension) {
196 intersections.emplace_back(
197 i.first, i.second->position().eta(), i.second->position().phi());
198 }
199 } break;
200
201 case fromPerigee: {
202 const auto extension = m_ParticleCaloExtensionTool->surfaceCaloExtension(
203 ctx, trkPB.perigeeParameters(), samples, surfaces, Trk::nonInteracting);
204 didExtension = !extension.empty();
205 for (const auto& i : extension) {
206 intersections.emplace_back(
207 i.first, i.second->position().eta(), i.second->position().phi());
208 }
209 } break;
210
211 case fromLastMeasurement: {
212 unsigned int index(0);
214 const Trk::CurvilinearParameters& lastParams =
215 trkPB.curvilinearParameters(index);
216 const Amg::Vector3D& position = lastParams.position();
217 // Calo entry around z EME1 3750 and r EMB1 1550
218 if (position.perp() > 1550. || std::abs(position.z()) > 3750.) {
219 ATH_MSG_WARNING("Probematic last parameters : " << lastParams);
220 didExtension = false;
221 } else {
222 const auto extension =
223 m_ParticleCaloExtensionTool->surfaceCaloExtension(
224 ctx, lastParams, samples, surfaces, Trk::nonInteracting);
225 didExtension = !extension.empty();
226 for (const auto& i : extension) {
227 intersections.emplace_back(
228 i.first, i.second->position().eta(), i.second->position().phi());
229 }
230 }
231 }
232 } break;
233
234 default: {
235 ATH_MSG_ERROR("Invalid ExtrapolateFrom " << extrapFrom);
236 }
237 }
238 /*
239 * Given the extension calculate the deta/dphi for the layers
240 */
241 if (!didExtension) {
242 ATH_MSG_DEBUG("Could not create an extension from "
243 << extrapFrom << " for a track with : "
244 << " Track Pt " << trkPB.pt() << " Track Eta " << trkPB.eta()
245 << " Track Phi " << trkPB.phi() << " Track Fitter "
246 << trkPB.trackFitter());
247 return StatusCode::FAILURE;
248 }
249 // Negative tracks bend to the positive direction.
250 // flip sign for positive ones
251 const bool flipSign = trkPB.charge() > 0;
252
253 for (const auto& p : intersections) {
254 int i(0);
255 CaloSampling::CaloSample sample = std::get<0>(p);
256 if (sample == CaloSampling::PreSamplerE ||
257 sample == CaloSampling::PreSamplerB) {
258 i = 0;
259 } else if (sample == CaloSampling::EME1 || sample == CaloSampling::EMB1) {
260 i = 1;
261 } else if (sample == CaloSampling::EME2 || sample == CaloSampling::EMB2 || sample == CaloSampling::FCAL0) {
262 i = 2;
263 } else if (sample == CaloSampling::EME3 || sample == CaloSampling::EMB3) {
264 i = 3;
265 } else {
266 continue;
267 }
268 eta[i] = std::get<1>(p);
269 phi[i] = std::get<2>(p);
270 deltaEta[i] = cluster.etaSample(sample) - std::get<1>(p);
271 deltaPhi[i] =
272 P4Helpers::deltaPhi(cluster.phiSample(sample), std::get<2>(p));
273 // Should we flip the sign for deltaPhi?
274 if (flipSign) {
275 deltaPhi[i] = -deltaPhi[i];
276 }
277 ATH_MSG_DEBUG("getMatchAtCalo: i, eta, phi, deta, dphi: "
278 << i << " " << eta[i] << " " << phi[i] << " " << deltaEta[i]
279 << " " << deltaPhi[i]);
280 }
281 return StatusCode::SUCCESS;
282}
Scalar eta() const
pseudorapidity method
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
#define ATH_MSG_ERROR(x)
const Amg::Vector3D & position() const
Access method for the position.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
virtual double e() const
The total energy of the particle.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
bool indexOfParameterAtPosition(unsigned int &index, ParameterPosition position) const
Function to determine if this TrackParticle contains track parameters at a certain position,...
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
const Trk::CurvilinearParameters curvilinearParameters(unsigned int index) const
Returns a curvilinear representation of the parameters at 'index'.
virtual double phi() const override final
The azimuthal angle ( ) of the particle (has range to .)
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float charge() const
Returns the charge.
TrackFitter trackFitter() const
Returns the fitter.
str index
Definition DeMoScan.py:362
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition P4Helpers.h:66
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition P4Helpers.h:34
CurvilinearParametersT< TrackParametersDim, Charged, PlaneSurface > CurvilinearParameters
@ LastMeasurement
Parameter defined at the position of the last measurement.

◆ getMomentumAtVertex() [1/2]

Amg::Vector3D EMExtrapolationTools::getMomentumAtVertex ( const EventContext & ctx,
const xAOD::Vertex & vertex,
bool reuse = true ) const
finaloverridevirtual

get sum of the momenta at the vertex (designed for conversions).

Retrieve from auxdata if available and <reuse> is true

Implements IEMExtrapolationTools.

Definition at line 454 of file EMExtrapolationTools.cxx.

457{
458 Amg::Vector3D momentum(0., 0., 0.);
459 const static SG::AuxElement::Accessor<float> accPx("px");
460 const static SG::AuxElement::Accessor<float> accPy("py");
461 const static SG::AuxElement::Accessor<float> accPz("pz");
462 if (vertex.nTrackParticles() == 0) {
463 ATH_MSG_WARNING("getMomentumAtVertex : vertex has no track particles!");
464 return momentum;
465 }
466 if (reuse && accPx.isAvailable(vertex) && accPy.isAvailable(vertex) &&
467 accPz.isAvailable(vertex)) {
468 // Already decorated with parameters at vertex
469 ATH_MSG_DEBUG("getMomentumAtVertex : getting from auxdata");
470 return { accPx(vertex), accPy(vertex), accPz(vertex) };
471 }
472 for (unsigned int i = 0; i < vertex.nTrackParticles(); ++i) {
473 momentum += getMomentumAtVertex(ctx, vertex, i);
474 }
475
476 return momentum;
477}

◆ getMomentumAtVertex() [2/2]

Amg::Vector3D EMExtrapolationTools::getMomentumAtVertex ( const EventContext & ctx,
const xAOD::Vertex & vertex,
unsigned int index ) const
finaloverridevirtual

get the momentum of the i-th trackParticle assiciated to the vertex at vertex (designed for conversions)

Implements IEMExtrapolationTools.

Definition at line 401 of file EMExtrapolationTools.cxx.

404{
405 Amg::Vector3D momentum(0., 0., 0.);
406 if (vertex.nTrackParticles() <= index) {
407 ATH_MSG_WARNING("Invalid track index");
408 } else if (vertex.vxTrackAtVertexAvailable() &&
409 !vertex.vxTrackAtVertex().empty()) {
410 // Use the parameters at the vertex
411 // (the tracks should be parallel but we will do the sum anyway)
412 ATH_MSG_DEBUG("getMomentumAtVertex : getting from vxTrackAtVertex");
413 const auto& trkAtVertex = vertex.vxTrackAtVertex()[index];
414 const Trk::TrackParameters* paramAtVertex = trkAtVertex.perigeeAtVertex();
415 if (!paramAtVertex) {
416 ATH_MSG_WARNING("VxTrackAtVertex does not have perigee at vertex");
417 } else {
418 return paramAtVertex->momentum();
419 }
420 } else if (vertex.nTrackParticles() == 1) {
421 // Use the first measurement
423 "getMomentumAtVertex : 1 track only, getting from first measurement");
424 const xAOD::TrackParticle* tp = vertex.trackParticle(0);
425 unsigned int paramindex(0);
426 if (!tp ||
427 !tp->indexOfParameterAtPosition(paramindex, xAOD::FirstMeasurement)) {
428 ATH_MSG_WARNING("No TrackParticle or no have first measurement");
429 } else {
430 momentum += tp->curvilinearParameters(paramindex).momentum();
431 }
432 } else {
433 // Extrapolate track particle to vertex
434 ATH_MSG_DEBUG("getMomentumAtVertex : extrapolating to perigee surface");
435 const xAOD::TrackParticle* tp = vertex.trackParticle(index);
436 if (!tp) {
437 ATH_MSG_WARNING("NULL pointer to TrackParticle in vertex");
438 } else {
439 Trk::PerigeeSurface surface(vertex.position());
440 std::unique_ptr<const Trk::TrackParameters> params =
441 m_extrapolator->extrapolate(ctx, tp->perigeeParameters(), surface,
443 if (!params) {
444 ATH_MSG_DEBUG("Extrapolation to vertex (perigee) failed");
445 } else {
446 momentum += params->momentum();
447 }
448 }
449 }
450 return momentum;
451}
ToolHandle< Trk::IExtrapolator > m_extrapolator
Used for extrapolation to the conversion vertex.
const Amg::Vector3D & momentum() const
Access method for the momentum.
ParametersBase< TrackParametersDim, Charged > TrackParameters
TrackParticle_v1 TrackParticle
Reference the current persistent version:
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.

◆ getTRTsection()

int EMExtrapolationTools::getTRTsection ( const xAOD::TrackParticle * trkPB) const
private

Return +/- 1 (2) if track is in positive/negative TRT barrel (endcap)

Definition at line 482 of file EMExtrapolationTools.cxx.

483{
484 if (!trkPB) {
485 ATH_MSG_DEBUG("Null pointer to TrackParticle");
486 return 0;
487 }
488 if (!m_trtId) {
490 "No trt ID guessing TRT section based on eta: " << trkPB->eta());
491 return (trkPB->eta() > 0 ? 1 : -1) * (fabs(trkPB->eta()) < 0.6 ? 1 : 2);
492 }
493 const Trk::MeasurementBase* trkPar = nullptr;
494 if (trkPB->trackLink().isValid() && trkPB->track() != nullptr) {
495 ATH_MSG_DEBUG("Will get TrackParameters from Trk::Track");
496 const Trk::TrackStates* trackStates =
497 trkPB->track()->trackStateOnSurfaces();
498 if (!trackStates) {
499 ATH_MSG_WARNING("NULL pointer to trackStateOnSurfaces");
500 return 0;
501 }
502 // Loop over the TrkStateOnSurfaces search last valid TSOS first
504 rItTSoS = trackStates->rbegin();
505 rItTSoS != trackStates->rend();
506 ++rItTSoS) {
507 if ((*rItTSoS)->type(Trk::TrackStateOnSurface::Measurement) &&
508 !((*rItTSoS)->type(Trk::TrackStateOnSurface::Outlier)) &&
509 (*rItTSoS)->measurementOnTrack() != nullptr &&
510 !((*rItTSoS)->measurementOnTrack()->type(
512 trkPar = (*rItTSoS)->measurementOnTrack();
513 break;
514 }
515 }
516 } else {
517 ATH_MSG_WARNING("Track particle without Trk::Track");
518 }
519 if (!trkPar) {
520 return 0;
521 }
522 const Trk::Surface& sf = trkPar->associatedSurface();
523 const Identifier tid = sf.associatedDetectorElementIdentifier();
524 return m_trtId->barrel_ec(tid);
525}
const_reverse_iterator rend() const noexcept
Return a const_reverse_iterator pointing at the beginning of the collection.
const_reverse_iterator rbegin() const noexcept
Return a const_reverse_iterator pointing past the end of the collection.
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition DataVector.h:847
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
@ 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 ...
const Trk::TrackStates * trackStateOnSurfaces() const
return a pointer to a const DataVector of const TrackStateOnSurfaces.
const ElementLink< TrackCollection > & trackLink() const
Returns a link (which can be invalid) to the Trk::Track which was used to make this TrackParticle.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
DataVector< const Trk::TrackStateOnSurface > TrackStates

◆ initialize()

StatusCode EMExtrapolationTools::initialize ( )
finaloverridevirtual

initialize method

Implements IEMExtrapolationTools.

Definition at line 71 of file EMExtrapolationTools.cxx.

72{
73
74 ATH_MSG_DEBUG("Initializing " << name() << "...");
75 // Retrieve tools
77 ATH_CHECK(m_extrapolator.retrieve());
78
79 // retrieve TRT-ID helper
80 if (m_enableTRT && detStore()->contains<TRT_ID>("TRT_ID")) {
81 StatusCode sc = detStore()->retrieve(m_trtId, "TRT_ID");
82 if (sc.isFailure() || !m_trtId->is_valid()) {
83 // TRT is not present for sLHC
84 ATH_MSG_DEBUG("Could not get TRT_ID helper !");
85 m_trtId = nullptr;
86 }
87 ATH_MSG_DEBUG("m_trtId initialization successful");
88 } else {
89 ATH_MSG_DEBUG("Could not get TRT_ID helper !");
90 }
91 return StatusCode::SUCCESS;
92}
#define ATH_CHECK
Evaluate an expression and check for errors.
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
Gaudi::Property< bool > m_enableTRT
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ 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 & IEMExtrapolationTools::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 108 of file IEMExtrapolationTools.h.

109{
111}
static const InterfaceID IID_IEMExtrapolationTools("IEMExtrapolationTools", 1, 0)

◆ matchesAtCalo()

bool EMExtrapolationTools::matchesAtCalo ( const xAOD::CaloCluster * cluster,
const xAOD::Vertex * vertex,
float etaAtCalo,
float phiAtCalo ) const
finaloverridevirtual

test for vertex-to-cluster match given also the positions at the calorimeter from the vertex extrapolation

Implements IEMExtrapolationTools.

Definition at line 290 of file EMExtrapolationTools.cxx.

294{
295 if (!cluster || !vertex) {
296 return false;
297 }
298 float deltaEta = fabs(etaAtCalo - cluster->etaBE(2));
299 float deltaPhi = fabs(P4Helpers::deltaPhi(cluster->phi(), phiAtCalo));
300
301 int TRTsection = 0;
303 TRTsection = getTRTsection(vertex->trackParticle(0));
304
305 // First pass on TRT tracks, skip barrel tracks matching endcap clusters and
306 // vice-versa
307 if ((TRTsection == 2 && (cluster->eta() <= 0.6 || cluster->eta() >= 2.4)) ||
308 (TRTsection == -2 &&
309 (cluster->eta() >= -0.6 || cluster->eta() <= -2.4)) ||
310 (TRTsection == 1 && (cluster->eta() <= -0.1 || cluster->eta() >= 1.3)) ||
311 (TRTsection == -1 && (cluster->eta() >= 0.1 || cluster->eta() <= -1.3))) {
312 return false;
313 }
314
315 // The maximum deltaEta/deltaPhi for Si, TRT barrel, TRT endcap
316 static const std::vector<double> dEtaV{ m_narrowDeltaEta,
319 static const std::vector<double> dPhiV{ m_narrowDeltaPhi,
322
323 return (deltaEta < dEtaV[abs(TRTsection)] &&
324 deltaPhi < dPhiV[abs(TRTsection)]);
325}
Gaudi::Property< double > m_narrowDeltaPhi
Gaudi::Property< double > m_TRTendcapDeltaEta
Gaudi::Property< double > m_TRTbarrelDeltaEta
Gaudi::Property< double > m_narrowDeltaPhiTRTendcap
Gaudi::Property< double > m_narrowDeltaEta
int getTRTsection(const xAOD::TrackParticle *trkPB) const
Return +/- 1 (2) if track is in positive/negative TRT barrel (endcap)
Gaudi::Property< double > m_narrowDeltaPhiTRTbarrel
virtual double phi() const
The azimuthal angle ( ) of the particle.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
std::size_t numberOfSiTracks(const xAOD::Photon *eg)
return the number of Si tracks in the conversion

◆ 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 }

◆ 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_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_enableTRT

Gaudi::Property<bool> EMExtrapolationTools::m_enableTRT { this, "EnableTRT", true }
private

Definition at line 147 of file EMExtrapolationTools.h.

147{ this, "EnableTRT", true };

◆ 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> EMExtrapolationTools::m_extrapolator
private
Initial value:
{
this,
"Extrapolator",
"Trk::Extrapolator/AtlasExtrapolator"
}

Used for extrapolation to the conversion vertex.

Definition at line 125 of file EMExtrapolationTools.h.

125 {
126 this,
127 "Extrapolator",
128 "Trk::Extrapolator/AtlasExtrapolator"
129 };

◆ m_narrowDeltaEta

Gaudi::Property<double> EMExtrapolationTools::m_narrowDeltaEta { this, "NarrowDeltaEta", 0.05 }
private

Definition at line 139 of file EMExtrapolationTools.h.

139{ this, "NarrowDeltaEta", 0.05 };

◆ m_narrowDeltaPhi

Gaudi::Property<double> EMExtrapolationTools::m_narrowDeltaPhi { this, "NarrowDeltaPhi", 0.05 }
private

Definition at line 132 of file EMExtrapolationTools.h.

132{ this, "NarrowDeltaPhi", 0.05 };

◆ m_narrowDeltaPhiTRTbarrel

Gaudi::Property<double> EMExtrapolationTools::m_narrowDeltaPhiTRTbarrel
private
Initial value:
{ this,
"NarrowDeltaPhiTRTbarrel",
0.02 }

Definition at line 133 of file EMExtrapolationTools.h.

133 { this,
134 "NarrowDeltaPhiTRTbarrel",
135 0.02 };

◆ m_narrowDeltaPhiTRTendcap

Gaudi::Property<double> EMExtrapolationTools::m_narrowDeltaPhiTRTendcap
private
Initial value:
{ this,
"NarrowDeltaPhiTRTendcap",
0.02 }

Definition at line 136 of file EMExtrapolationTools.h.

136 { this,
137 "NarrowDeltaPhiTRTendcap",
138 0.02 };

◆ m_ParticleCaloExtensionTool

ToolHandle<Trk::IParticleCaloExtensionTool> EMExtrapolationTools::m_ParticleCaloExtensionTool
private
Initial value:
{
this,
"CaloExtensionTool",
"Trk::ParticleCaloExtensionTool/EMParticleCaloExtensionTool"
}

Used for extrapolation to the calo.

Definition at line 118 of file EMExtrapolationTools.h.

118 {
119 this,
120 "CaloExtensionTool",
121 "Trk::ParticleCaloExtensionTool/EMParticleCaloExtensionTool"
122 };

◆ m_TRTbarrelDeltaEta

Gaudi::Property<double> EMExtrapolationTools::m_TRTbarrelDeltaEta
private
Initial value:
{ this,
"TRTbarrelDeltaEta",
0.35 }

Definition at line 140 of file EMExtrapolationTools.h.

140 { this,
141 "TRTbarrelDeltaEta",
142 0.35 };

◆ m_TRTendcapDeltaEta

Gaudi::Property<double> EMExtrapolationTools::m_TRTendcapDeltaEta { this, "TRTendcapDeltaEta", 0.2 }
private

Definition at line 143 of file EMExtrapolationTools.h.

143{ this, "TRTendcapDeltaEta", 0.2 };

◆ m_trtId

const TRT_ID* EMExtrapolationTools::m_trtId
private

Definition at line 146 of file EMExtrapolationTools.h.

◆ 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: