ATLAS Offline Software
TrackParticlePerigeePairAtOOAssociationTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id$
18 #include "Particle/TrackParticle.h"
22 
23 
24 namespace D3PD {
25 
26 
34  (const std::string& type,
35  const std::string& name,
36  const IInterface* parent)
37  : Base (type, name, parent),
38  m_assocGetter (this)
39 {
40  declareProperty ("AssocGetter", m_assocGetter,
41  "Getter for the association object.");
42 }
43 
44 
49 {
51  if (!m_assocGetter.empty()) {
52  CHECK( m_assocGetter.retrieve() );
53  CHECK( m_assocGetter->configureD3PD<TrackParticleAssocs> () );
54  }
55  return StatusCode::SUCCESS;
56 }
57 
58 
65 const D3PD::PerigeePair*
67  (const Rec::TrackParticle& track)
68 {
69  const Rec::TrackParticle& oldtrack = findOldtrack (track);
70  return new D3PD::PerigeePair (track.perigee(), oldtrack.perigee());
71 }
72 
73 
80 const D3PD::PerigeePair*
82  (const xAOD::TrackParticle& track)
83 {
85  orig ("originalTrackParticle");
86  if (!orig.isAvailable(track) || !orig(track).isValid())
87  return 0;
88 
89  return new D3PD::PerigeePair (&track.perigeeParameters(),
90  &(*orig(track))->perigeeParameters());
91 }
92 
93 
99  (const D3PD::PerigeePair* p)
100 {
101  delete p;
102 }
103 
104 
108 const Rec::TrackParticle&
110  (const Rec::TrackParticle& track)
111 {
112  if (track.info().trackFitter() != Trk::TrackInfo::GaussianSumFilter)
113  return track;
114 
115  const TrackParticleAssocs* assocs = m_assocGetter->get<TrackParticleAssocs>();
116  if (!assocs) {
117  REPORT_MESSAGE (MSG::WARNING) << "Can't find GSF track association.";
118  return track;
119  }
120 
123  const Rec::TrackParticle* ret = 0;
124  if (beg != end && beg.isValid())
125  ret = dynamic_cast<const Rec::TrackParticle*> (*beg);
126  m_assocGetter->releaseObject (assocs);
127  if (!ret) {
128  REPORT_MESSAGE (MSG::WARNING)
129  << "Can't find original track for GSF refitted track.";
130  return track;
131  }
132 
133  return *ret;
134 }
135 
136 
137 } // namespace D3PD
AssociationMap::endAssociation
asso_iterator endAssociation(const object_type *objectPointer) const
end iterator for associations
Trk::TrackInfo::GaussianSumFilter
@ GaussianSumFilter
Tracks from Gaussian Sum Filter.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:53
TrackParameters.h
TrackParticle.h
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
AssociationMap::beginAssociation
asso_iterator beginAssociation(const object_type *objectPointer) const
begin iterator for associations
D3PD::TrackParticlePerigeePairAtOOAssociationTool::TrackParticlePerigeePairAtOOAssociationTool
TrackParticlePerigeePairAtOOAssociationTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard Gaudi tool constructor.
Definition: TrackParticlePerigeePairAtOOAssociationTool.cxx:34
initialize
void initialize()
Definition: run_EoverP.cxx:894
D3PD::TrackParticlePerigeePairAtOOAssociationTool::initialize
virtual StatusCode initialize()
Standard Gaudi initialize method.
Definition: TrackParticlePerigeePairAtOOAssociationTool.cxx:48
D3PD::SingleAssociationTool< Types< Rec::TrackParticle, xAOD::TrackParticle >, D3PD::PerigeePair >
D3PD::TrackParticlePerigeePairAtOOAssociationTool::findOldtrack
const Rec::TrackParticle & findOldtrack(const Rec::TrackParticle &track)
Find the original track corresponding to a possibly refitted track.
Definition: TrackParticlePerigeePairAtOOAssociationTool.cxx:110
isValid
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition: AtlasPID.h:620
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TrackParticleAssocs.h
D3PD
Block filler tool for noisy FEB information.
Definition: CaloCellDetailsFillerTool.cxx:29
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrackParticleAssocs
Definition: TrackParticleAssocs.h:28
test_pyathena.parent
parent
Definition: test_pyathena.py:15
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
WriteBchToCool.beg
beg
Definition: WriteBchToCool.py:69
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Trk::perigeeParameters
@ perigeeParameters
Definition: MeasurementType.h:19
IObjGetterTool.h
Abstract interface to get an object to put in the tuple.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
D3PD::TrackParticlePerigeePairAtOOAssociationTool::releaseObject
virtual void releaseObject(const D3PD::PerigeePair *p)
Release an object retrieved from the association.
Definition: TrackParticlePerigeePairAtOOAssociationTool.cxx:99
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
SG::ConstAccessor< T, AuxAllocator_t< T > >::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
AssociationMap< Rec::TrackParticleContainer, Rec::TrackParticleContainer >::asso_iterator
AssociationVectorIterator asso_iterator
association iterator type
Definition: AssociationMap.h:81
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Trk::TrackParticleBase::perigee
const Perigee * perigee() const
Attempts to cast the definingParameters() to Perigee.
Definition: TrackParticleBase.h:263
D3PD::TrackParticlePerigeePairAtOOAssociationTool::get
virtual const D3PD::PerigeePair * get(const Rec::TrackParticle &p)
Return the target object.
Definition: TrackParticlePerigeePairAtOOAssociationTool.cxx:67
TrackParticleContainer.h
D3PD::PerigeePair
Definition: PerigeePair.h:29
D3PD::TrackParticlePerigeePairAtOOAssociationTool::m_assocGetter
ToolHandle< IObjGetterTool > m_assocGetter
Property: Getter for the association object.
Definition: TrackParticlePerigeePairAtOOAssociationTool.h:89
TrackParticlePerigeePairAtOOAssociationTool.h
Associate from a TrackParticle to the default Perigees for both itself and the original track (if it ...