ATLAS Offline Software
Loading...
Searching...
No Matches
xAODMaker::TrackParticleCnvAlg Class Reference

Algorithm creating xAOD::TrackParticles from TrackParticles. More...

#include <TrackParticleCnvAlg.h>

Inheritance diagram for xAODMaker::TrackParticleCnvAlg:
Collaboration diagram for xAODMaker::TrackParticleCnvAlg:

Public Member Functions

 TrackParticleCnvAlg (const std::string &name, ISvcLocator *svcLoc)
 Regular algorithm constructor.
virtual StatusCode initialize ()
 Function initialising the algorithm.
virtual StatusCode execute (const EventContext &ctx) const
 Function executing the algorithm.
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
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 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

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

template<typename CONT, typename TRUTHCONT, typename CONVTOOL>
int convert (const CONT &, const TRUTHCONT &, CONVTOOL &tool, SG::WriteHandle< xAOD::TrackParticleContainer > &, const xAODTruthParticleLinkVector *, const xAOD::Vertex *primaryVertex=nullptr, const ObservedTrackMap *obs_track_map=0) const
xAOD::TrackParticlecreateParticle (xAOD::TrackParticleContainer &xaod, const Rec::TrackParticleContainer &container, const Rec::TrackParticle &tp)
xAOD::TrackParticlecreateParticle (xAOD::TrackParticleContainer &xaod, const TrackCollection &container, const Trk::Track &tp, const EventContext &ctx)
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

Gaudi::Property< bool > m_addTruthLink {this,"AddTruthLink", false }
 toggle on adding truth links
ToolHandle< Trk::ITrackParticleCreatorToolm_particleCreator {this, "TrackParticleCreator", "Trk::TrackParticleCreatorTool/TrackParticleCreatorTool" }
 The key for the input TrackParticleTruthCollection.
ToolHandle< IMCTruthClassifierm_truthClassifier
 ToolHandle to truth classifier.
ToolHandle< xAODMaker::ITrackCollectionCnvToolm_TrackCollectionCnvTool {this, "TrackCollectionCnvTool", "xAODMaker::TrackCollectionCnvTool/TrackCollectionCnvTool"}
ToolHandle< xAODMaker::IRecTrackParticleContainerCnvToolm_RecTrackParticleContainerCnvTool
SG::ReadHandleKey< Rec::TrackParticleContainerm_aod {this, "AODContainerName", "TrackParticleCandidate"}
SG::ReadHandleKey< TrackCollectionm_tracks {this, "TrackContainerName", "Tracks"}
SG::ReadHandleKey< xAOD::VertexContainerm_primaryVertexContainer { this, "PrimaryVerticesName", "", "Name of primary vertex container is case the parameters should be calculated with respect to the primary vertex"}
SG::WriteHandleKey< xAOD::TrackParticleContainerm_xaodout {this, "xAODTrackParticlesFromTracksContainerName", "InDetTrackParticles"}
SG::WriteHandleKey< xAOD::TrackParticleContainerm_xaodTrackParticlesout {this, "xAODContainerName", "ConvertedTrackParticleCandidate" }
SG::ReadHandleKey< xAODTruthParticleLinkVectorm_truthParticleLinkVec {this, "xAODTruthLinkVector", "xAODTruthLinks"}
SG::ReadHandleKey< TrackParticleTruthCollectionm_aodTruth {this, "AODTruthContainerName" , ""}
SG::ReadHandleKey< TrackTruthCollectionm_trackTruth {this, "TrackTruthContainerName", ""}
Gaudi::Property< bool > m_doMonitoring {this, "DoMonitoring", false}
ToolHandle< ITrackParticleMonitoringm_trackMonitoringTool { this, "TrkMonTool", "", "Tracking Monitoring tool" }
ToolHandle< GenericMonitoringToolm_monTool { this, "MonTool", "", "Monitoring tool" }
Gaudi::Property< bool > m_augmentObservedTracks {this, "AugmentObservedTracks", false, "augment observed tracks"}
SG::ReadHandleKey< ObservedTrackMapm_tracksMap {this, "TracksMapName", "" , "name of observed tracks map saved in store"}
Gaudi::Property< bool > m_convertAODTrackParticles {this, "ConvertTrackParticles", true}
 toggle on converting AOD track particles to xAOD
Gaudi::Property< bool > m_convertTracks {this, "ConvertTracks", false}
 toggle on converting tracks to xAOD
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

Algorithm creating xAOD::TrackParticles from TrackParticles.

   This algorithm can be used to translate the TrackParticles coming
   from an AOD, and create xAOD::TrackParticle objects out of them
   for an output xAOD.
Author
Edward Moyse Edwar.nosp@m.d.Mo.nosp@m.yse@c.nosp@m.ern..nosp@m.ch
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
297747
Date
2013-10-28 16:14:24 +0100 (Mon, 28 Oct 2013)

Definition at line 54 of file TrackParticleCnvAlg.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrackParticleCnvAlg()

xAODMaker::TrackParticleCnvAlg::TrackParticleCnvAlg ( const std::string & name,
ISvcLocator * svcLoc )

Regular algorithm constructor.

Definition at line 23 of file TrackParticleCnvAlg.cxx.

25 : AthReentrantAlgorithm(name, svcLoc) {}

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ convert()

template<typename CONT, typename TRUTHCONT, typename CONVTOOL>
int xAODMaker::TrackParticleCnvAlg::convert ( const CONT & container,
const TRUTHCONT & truth,
CONVTOOL & tool,
SG::WriteHandle< xAOD::TrackParticleContainer > & xaod,
const xAODTruthParticleLinkVector * truthLinkVec,
const xAOD::Vertex * primaryVertex = nullptr,
const ObservedTrackMap * obs_track_map = 0 ) const
private

Definition at line 265 of file TrackParticleCnvAlg.cxx.

273{
274 // Create the xAOD container and its auxiliary store:
275
276 // convert the track containers separately with the converting tools that are
277 // also used by TrigHLTtoxAODTool
278 ATH_MSG_DEBUG("calling the converting tool for " << xaod.name());
279 // Augment track particles using track map if available
280 if (obs_track_map){
281 if (conv_tool->convertAndAugment(&container, xaod.ptr(), obs_track_map, primaryVertex).isFailure()) {
282 ATH_MSG_ERROR("Couldn't convert and augment aod to xaod ("
283 << xaod.name() << ") with the converting tool");
284 return -1;
285 }
286 }
287 else{
288 if (conv_tool->convert(&container, xaod.ptr(), primaryVertex).isFailure()) {
289 ATH_MSG_ERROR("Couldn't convert aod to xaod ("
290 << xaod.name() << ") with the converting tool");
291 return -1;
292 }
293 }
294 // Create the xAOD objects:
295 xAOD::TrackParticleContainer::iterator itr_xaod = xaod->begin();
296 xAOD::TrackParticleContainer::iterator end_xaod = xaod->end();
297
298 AssociationHelper<CONT> association_to_src(container, xaod.ptr());
299 unsigned int trackCounter(0);
300 // loop over AOD and converted xAOD for summary info and truth links
301 for (; itr_xaod != end_xaod; ++itr_xaod) {
302 // protect if something went wrong and there is no converted xaod equivalent
303
304 if (!(*itr_xaod)) {
305 ATH_MSG_WARNING("Empty element in xAOD container!");
306 continue;
307 }
308
309 xAOD::TrackParticle* particle = *itr_xaod;
310
311 if (!particle) {
312 ATH_MSG_WARNING("Failed to get an xAOD::TrackParticle");
313 continue;
314 }
315
316 trackCounter++;
317 if(msgLvl(MSG::DEBUG)){
318 int npix, nsct, ntrt, npixh, nscth, npixshim, npixsplit;
319 npix = nsct = ntrt = npixh = nscth = npixshim = npixsplit = -1;
320 const Trk::Track *tr = particle->track();
321 if (tr){
322 const Trk::TrackSummary* ts = tr->trackSummary();
323 if (ts) {
324 npix = ts->get(Trk::numberOfPixelHits);
325 nsct = ts->get(Trk::numberOfSCTHits);
326 ntrt = ts->get(Trk::numberOfTRTHits);
327 nscth = ts->get(Trk::numberOfSCTHoles);
328 npixh = ts->get(Trk::numberOfPixelHoles);
329 }
330 }
331 msg() << MSG::DEBUG << "REGTEST: " << std::setw(5) << trackCounter
332 << " pT: " << std::setw(10) << particle->pt()
333 << " eta: " << particle->eta()
334 << " phi: " << particle->phi()
335 << " d0: " << particle->d0()
336 << " z0: " << particle->z0()
337 << "\t" << npix << "/" << nsct << "/" << ntrt << "/holes/" << npixh << "/" << nscth
338 << endmsg;
339 }
340 //
341 // --------- statistics
342 //
343 if (m_addTruthLink) {
347 float probability = -1.0;
348 ElementLink<xAOD::TruthParticleContainer> link;
349
350 ElementLink<CONT> tpLink(
351 association_to_src(*itr_xaod, itr_xaod - xaod->begin()), container);
352 if (!tpLink.isValid()) {
353 ATH_MSG_WARNING("Failed to create ElementLink to Track/TrackParticle");
354 } else if(truth->empty()){
355 // This can happen if there is no HS track
356 ATH_MSG_DEBUG("No truth available");
357 } else {
358 auto result = truth->find(tpLink);
359 if (result == truth->end()) {
361 "Failed find truth associated with Track/TrackParticle");
362 } else {
363 // setTruthLink(link,result->second, type, origin);
364 ATH_MSG_VERBOSE("Found track Truth: uniqueID "
365 << HepMC::uniqueID(result->second.particleLink()) << " evt "
366 << result->second.particleLink().eventIndex());
367 probability = result->second.probability();
368 link = truthLinkVec->find(result->second.particleLink());
369 if (link.isValid()) {
370 ATH_MSG_DEBUG("Found matching xAOD Truth: uniqueID "
371 << HepMC::uniqueID(*link) << " pt " << (*link)->pt()
372 << " eta " << (*link)->eta() << " phi "
373 << (*link)->phi());
374 // if configured also get truth classification
375 if (result->second.particleLink().cptr() &&
376 !m_truthClassifier.empty()) {
377 auto truthClass = m_truthClassifier->particleHepMCTruthClassifier(
378 result->second.particleLink());
379 type = truthClass.first;
380 origin = truthClass.second;
381 ATH_MSG_VERBOSE("Got truth type " << static_cast<int>(type)
382 << " origin "
383 << static_cast<int>(origin));
384 }
385 } else {
386 if (HepMC::uniqueID(result->second.particleLink()) > 0) {
387 ATH_MSG_WARNING("No associated xAOD truth for valid truth link "
388 << result->second.particleLink());
389 }
390 }
391 }
392 }
393 //This is the Algorithm creating TrackParticles
394 //
395 static const SG::AuxElement::Accessor<
396 ElementLink<xAOD::TruthParticleContainer>>
397 theLink("truthParticleLink");
398 static const SG::AuxElement::Accessor<float> theProbability(
399 "truthMatchProbability");
400 theLink(*particle) = link;
401 theProbability(*particle) = probability;
402 if (!m_truthClassifier.empty()) {
403 static const SG::AuxElement::Accessor<int> theType("truthType");
404 static const SG::AuxElement::Accessor<int> theOrigin("truthOrigin");
405 theType(*particle) = static_cast<int>(type);
406 theOrigin(*particle) = static_cast<int>(origin);
407 }
408 }
409 } // loop over aod tracks
410
411 ATH_MSG_DEBUG("Converted [" << container.size() << " -> " << xaod->size()
412 << "] TrackParticles and stored in "
413 << xaod.name());
414 if (container.size() != xaod->size()) {
415 ATH_MSG_WARNING("number of items in the AOD container: "
416 << container.size()
417 << " is not equal to the number of items in its converted "
418 "xAOD equivalent: "
419 << xaod->size());
420 }
421
422 return 1;
423}
#define endmsg
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
bool msgLvl(const MSG::Level lvl) const
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
const std::string & name() const
Return the StoreGate ID for the referenced object.
pointer_type ptr()
Dereference the pointer.
const Trk::TrackSummary * trackSummary() const
Returns a pointer to the const Trk::TrackSummary owned by this const track (could be nullptr)
Gaudi::Property< bool > m_addTruthLink
toggle on adding truth links
ToolHandle< IMCTruthClassifier > m_truthClassifier
ToolHandle to truth classifier.
ElementLink< xAOD::TruthParticleContainer > find(const HepMcParticleLink &hepMCLink) const
int ts
Definition globals.cxx:24
int uniqueID(const T &p)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ createParticle() [1/2]

xAOD::TrackParticle * xAODMaker::TrackParticleCnvAlg::createParticle ( xAOD::TrackParticleContainer & xaod,
const Rec::TrackParticleContainer & container,
const Rec::TrackParticle & tp )
inlineprivate
Parameters
containercontainer

Definition at line 426 of file TrackParticleCnvAlg.cxx.

430{
431 // create the xAOD::TrackParticle, the pointer is added to the container in
432 // the function
433 xAOD::TrackParticle* xp = m_particleCreator->createParticle(tp, &xaod);
434 return xp;
435} // createParticleAndTruth
ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreator
The key for the input TrackParticleTruthCollection.

◆ createParticle() [2/2]

xAOD::TrackParticle * xAODMaker::TrackParticleCnvAlg::createParticle ( xAOD::TrackParticleContainer & xaod,
const TrackCollection & container,
const Trk::Track & tp,
const EventContext & ctx )
inlineprivate

Definition at line 438 of file TrackParticleCnvAlg.cxx.

442{
443 // create the xAOD::TrackParticle, the pointer is added to the container in
444 // the function
445 ElementLink<TrackCollection> trackLink(&tp, container,ctx);
446 return m_particleCreator->createParticle(trackLink, &xaod);
447}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode xAODMaker::TrackParticleCnvAlg::execute ( const EventContext & ctx) const
virtual

Function executing the algorithm.

Definition at line 72 of file TrackParticleCnvAlg.cxx.

73{
74
75 const Rec::TrackParticleContainer* aod = nullptr;
76 const TrackCollection* tracks = nullptr;
77 const xAODTruthParticleLinkVector* truthLinks = nullptr;
78 const TrackParticleTruthCollection* aodTruth = nullptr;
79 const TrackTruthCollection* trackTruth = nullptr;
80 const ObservedTrackMap* tracksMap = nullptr;
81 const xAOD::Vertex* primaryVertex = nullptr;
82
83 //timer object for total execution time
84 auto mnt_timer_Total = Monitored::Timer<std::chrono::milliseconds>("TIME_Total");
85
86 // Retrieve the AOD particles:
88 SG::ReadHandle<Rec::TrackParticleContainer> rh_aod(m_aod, ctx);
89 if (!rh_aod.isValid()) {
90 ATH_MSG_ERROR(m_aod.key() << " not found");
91 return StatusCode::FAILURE;
92 } else {
93 aod = rh_aod.cptr();
94 ATH_MSG_VERBOSE("Got TrackParticleContainer with key " << m_aod.key()
95 << " found.");
96 }
97 }
98 // Retrieve the Tracks:
99 if (m_convertTracks) {
100 SG::ReadHandle<TrackCollection> rh_tracks(m_tracks, ctx);
101 if (!rh_tracks.isValid()) {
102 ATH_MSG_ERROR(m_tracks.key() << " not found");
103 return StatusCode::SUCCESS;
104 } else {
105 tracks = rh_tracks.cptr();
106 ATH_MSG_VERBOSE("Got TrackCollection with key " << m_tracks.key()
107 << " found.");
108
109 }
110 }
111 if (m_addTruthLink) {
113 SG::ReadHandle<TrackParticleTruthCollection> rh_aodTruth(m_aodTruth, ctx);
114 if (!rh_aodTruth.isValid()) {
115 ATH_MSG_WARNING("No TrackParticleTruthCollection with key "
116 << m_aodTruth.key() << " found. Do nothing.");
117 return StatusCode::SUCCESS;
118 } else
119 aodTruth = rh_aodTruth.cptr();
120 }
121 if (m_convertTracks) {
122 SG::ReadHandle<TrackTruthCollection> rh_trackTruth(m_trackTruth, ctx);
123 if (!rh_trackTruth.isValid()) {
124 ATH_MSG_WARNING("No DetailedTrackTruthCollection with key "
125 << m_trackTruth.key() << " found. Do nothing.");
126 return StatusCode::SUCCESS;
127 } else
128 trackTruth = rh_trackTruth.cptr();
129 }
130
131 SG::ReadHandle<xAODTruthParticleLinkVector> rh_truthParticleLinkVec(
133 if (!rh_truthParticleLinkVec.isValid()) {
134 ATH_MSG_WARNING("No xAODTruthParticleLinkVector with key "
135 << m_truthParticleLinkVec.key() << " found. Do nothing.");
136 return StatusCode::SUCCESS;
137 } else
138 truthLinks = rh_truthParticleLinkVec.cptr();
139 }
140
141 if(!m_primaryVertexContainer.key().empty())
142 {
143 SG::ReadHandle<xAOD::VertexContainer> vtx_container(m_primaryVertexContainer, ctx);
144 if (!vtx_container.isValid()) {
145 ATH_MSG_WARNING("No xAOD::VertexContainer with key "<< m_primaryVertexContainer.key() << " found. Do nothing.");
146 return StatusCode::SUCCESS;
147 }
148 const xAOD::Vertex* dummyVertex = nullptr;
149 for(auto vtx : *vtx_container) {
150 if(vtx->vertexType()==xAOD::VxType::PriVtx) {
151 primaryVertex = vtx;
152 break;
153 }
154 if(vtx->vertexType()==xAOD::VxType::NoVtx) {
155 // in case of no primary vertex
156 dummyVertex = vtx;
157 }
158 }
159 if(!primaryVertex)
160 {
161 if(dummyVertex)
162 {
163 ATH_MSG_INFO("No primary vertex found, will use dummy vertex at "
164 << dummyVertex->x() << "," << dummyVertex->y() << ","
165 << dummyVertex->z());
166 primaryVertex = dummyVertex;
167 }
168 else
169 {
170 ATH_MSG_WARNING("Neither primary nor dummy vertex found. Do Nothing.");
171 return StatusCode::SUCCESS;
172 }
173 }
174 }
175
176 if (m_convertTracks) {
177 SG::WriteHandle<xAOD::TrackParticleContainer> wh_xaodout(m_xaodout, ctx);
178 ATH_CHECK(
179 wh_xaodout.record(std::make_unique<xAOD::TrackParticleContainer>(),
180 std::make_unique<xAOD::TrackParticleAuxContainer>()));
181
182 // Augment track particles with information from observer tool
184 SG::ReadHandle<ObservedTrackMap> rh_tracksMap(m_tracksMap, ctx);
185 if (!rh_tracksMap.isValid()) {
186 ATH_MSG_ERROR(m_tracksMap.key() << " not found");
187 return StatusCode::FAILURE;
188 }
189 else {
190 tracksMap = rh_tracksMap.cptr();
191 ATH_MSG_VERBOSE("Got ObservedTrackMap with key " << m_tracksMap.key()
192 << " found.");
193 }
194 convert((*tracks), trackTruth, m_TrackCollectionCnvTool, wh_xaodout,
195 truthLinks, primaryVertex, tracksMap);
196 } else {
197 convert((*tracks), trackTruth, m_TrackCollectionCnvTool, wh_xaodout,
198 truthLinks, primaryVertex);
199 }
200 // Monitor track parameters
201 if (m_doMonitoring)
202 m_trackMonitoringTool->monitor_tracks("Track", "Pass", *wh_xaodout);
203 }
205 SG::WriteHandle<xAOD::TrackParticleContainer> wh_xaodTrackParticlesout(
207 ATH_CHECK(wh_xaodTrackParticlesout.record(
208 std::make_unique<xAOD::TrackParticleContainer>(),
209 std::make_unique<xAOD::TrackParticleAuxContainer>()));
211 wh_xaodTrackParticlesout, truthLinks);
212 }
213
214 //extra scope needed to trigger the monitoring
215 {auto monTime = Monitored::Group(m_monTool, mnt_timer_Total);}
216
217 return StatusCode::SUCCESS;
218}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
std::map< int, std::tuple< Trk::Track *, double, xAOD::RejectionStep, xAOD::RejectionReason, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, float, float, int, std::vector< xAOD::RejectionStep >, std::vector< xAOD::RejectionReason > > > ObservedTrackMap
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Athena::TPCnvVers::Old TrackParticleTruthCollection
ToolHandle< xAODMaker::IRecTrackParticleContainerCnvTool > m_RecTrackParticleContainerCnvTool
Gaudi::Property< bool > m_convertAODTrackParticles
toggle on converting AOD track particles to xAOD
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthParticleLinkVec
ToolHandle< GenericMonitoringTool > m_monTool
ToolHandle< ITrackParticleMonitoring > m_trackMonitoringTool
ToolHandle< xAODMaker::ITrackCollectionCnvTool > m_TrackCollectionCnvTool
SG::ReadHandleKey< Rec::TrackParticleContainer > m_aod
int convert(const CONT &, const TRUTHCONT &, CONVTOOL &tool, SG::WriteHandle< xAOD::TrackParticleContainer > &, const xAODTruthParticleLinkVector *, const xAOD::Vertex *primaryVertex=nullptr, const ObservedTrackMap *obs_track_map=0) const
SG::ReadHandleKey< TrackParticleTruthCollection > m_aodTruth
SG::ReadHandleKey< TrackTruthCollection > m_trackTruth
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodTrackParticlesout
SG::ReadHandleKey< ObservedTrackMap > m_tracksMap
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodout
Gaudi::Property< bool > m_augmentObservedTracks
SG::ReadHandleKey< TrackCollection > m_tracks
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainer
Gaudi::Property< bool > m_convertTracks
toggle on converting tracks to xAOD
Gaudi::Property< bool > m_doMonitoring
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
@ PriVtx
Primary vertex.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ initialize()

StatusCode xAODMaker::TrackParticleCnvAlg::initialize ( )
virtual

Function initialising the algorithm.

Definition at line 28 of file TrackParticleCnvAlg.cxx.

29{
30
31 ATH_MSG_DEBUG("Initializing TrackParticleCnvAlg");
32 ATH_MSG_DEBUG("AODContainerName = " << m_aod.key());
33 ATH_MSG_DEBUG("xAODContainerName = " << m_xaodTrackParticlesout.key());
34 ATH_CHECK(m_particleCreator.retrieve());
36 ATH_CHECK(m_truthClassifier.retrieve());
37 else
38 m_truthClassifier.disable();
39 ATH_CHECK(m_TrackCollectionCnvTool.retrieve(DisableTool{ !m_convertTracks }));
41 DisableTool{ !m_convertAODTrackParticles }));
42 // to preserve the inisialised parameters of the ParticleCreatorTool:
43 ATH_MSG_DEBUG("Overriding particle creator tool settings.");
46 m_TrackCollectionCnvTool->setParticleCreatorTool(&m_particleCreator));
48 ATH_CHECK(m_RecTrackParticleContainerCnvTool->setParticleCreatorTool(
50
60
61 // Retrieve monitoring tools if provided
62 ATH_CHECK(m_trackMonitoringTool.retrieve(DisableTool{ !m_doMonitoring }));
63 ATH_CHECK(m_monTool.retrieve(DisableTool{ !m_doMonitoring }));
64
66
67 // Return gracefully:
68 return StatusCode::SUCCESS;
69}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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.

◆ isClonable()

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::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< Gaudi::Algorithm > >::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 }

Member Data Documentation

◆ m_addTruthLink

Gaudi::Property<bool> xAODMaker::TrackParticleCnvAlg::m_addTruthLink {this,"AddTruthLink", false }
private

toggle on adding truth links

Definition at line 68 of file TrackParticleCnvAlg.h.

68{this,"AddTruthLink", false };

◆ m_aod

SG::ReadHandleKey<Rec::TrackParticleContainer> xAODMaker::TrackParticleCnvAlg::m_aod {this, "AODContainerName", "TrackParticleCandidate"}
private

Definition at line 88 of file TrackParticleCnvAlg.h.

88{this, "AODContainerName", "TrackParticleCandidate"};

◆ m_aodTruth

SG::ReadHandleKey<TrackParticleTruthCollection> xAODMaker::TrackParticleCnvAlg::m_aodTruth {this, "AODTruthContainerName" , ""}
private

Definition at line 101 of file TrackParticleCnvAlg.h.

101{this, "AODTruthContainerName" , ""};

◆ m_augmentObservedTracks

Gaudi::Property<bool> xAODMaker::TrackParticleCnvAlg::m_augmentObservedTracks {this, "AugmentObservedTracks", false, "augment observed tracks"}
private

Definition at line 112 of file TrackParticleCnvAlg.h.

112{this, "AugmentObservedTracks", false, "augment observed tracks"};

◆ m_convertAODTrackParticles

Gaudi::Property<bool> xAODMaker::TrackParticleCnvAlg::m_convertAODTrackParticles {this, "ConvertTrackParticles", true}
private

toggle on converting AOD track particles to xAOD

Definition at line 117 of file TrackParticleCnvAlg.h.

117{this, "ConvertTrackParticles", true};

◆ m_convertTracks

Gaudi::Property<bool> xAODMaker::TrackParticleCnvAlg::m_convertTracks {this, "ConvertTracks", false}
private

toggle on converting tracks to xAOD

Definition at line 120 of file TrackParticleCnvAlg.h.

120{this, "ConvertTracks", false};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doMonitoring

Gaudi::Property<bool> xAODMaker::TrackParticleCnvAlg::m_doMonitoring {this, "DoMonitoring", false}
private

Definition at line 105 of file TrackParticleCnvAlg.h.

105{this, "DoMonitoring", false};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool > xAODMaker::TrackParticleCnvAlg::m_monTool { this, "MonTool", "", "Monitoring tool" }
private

Definition at line 109 of file TrackParticleCnvAlg.h.

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

◆ m_particleCreator

ToolHandle<Trk::ITrackParticleCreatorTool> xAODMaker::TrackParticleCnvAlg::m_particleCreator {this, "TrackParticleCreator", "Trk::TrackParticleCreatorTool/TrackParticleCreatorTool" }
private

The key for the input TrackParticleTruthCollection.

ToolHandle to particle creator

Definition at line 73 of file TrackParticleCnvAlg.h.

73{this, "TrackParticleCreator", "Trk::TrackParticleCreatorTool/TrackParticleCreatorTool" };

◆ m_primaryVertexContainer

SG::ReadHandleKey<xAOD::VertexContainer> xAODMaker::TrackParticleCnvAlg::m_primaryVertexContainer { this, "PrimaryVerticesName", "", "Name of primary vertex container is case the parameters should be calculated with respect to the primary vertex"}
private

Definition at line 92 of file TrackParticleCnvAlg.h.

92{ this, "PrimaryVerticesName", "", "Name of primary vertex container is case the parameters should be calculated with respect to the primary vertex"};

◆ m_RecTrackParticleContainerCnvTool

ToolHandle<xAODMaker::IRecTrackParticleContainerCnvTool> xAODMaker::TrackParticleCnvAlg::m_RecTrackParticleContainerCnvTool
private
Initial value:
{this, "RecTrackParticleContainerCnvTool", "xAODMaker::RecTrackParticleContainerCnvTool/"
"RecTrackParticleContainerCnvTool" }

Definition at line 85 of file TrackParticleCnvAlg.h.

85 {this, "RecTrackParticleContainerCnvTool", "xAODMaker::RecTrackParticleContainerCnvTool/"
86 "RecTrackParticleContainerCnvTool" };

◆ m_TrackCollectionCnvTool

ToolHandle<xAODMaker::ITrackCollectionCnvTool> xAODMaker::TrackParticleCnvAlg::m_TrackCollectionCnvTool {this, "TrackCollectionCnvTool", "xAODMaker::TrackCollectionCnvTool/TrackCollectionCnvTool"}
private

Definition at line 83 of file TrackParticleCnvAlg.h.

83{this, "TrackCollectionCnvTool", "xAODMaker::TrackCollectionCnvTool/TrackCollectionCnvTool"};

◆ m_trackMonitoringTool

ToolHandle<ITrackParticleMonitoring> xAODMaker::TrackParticleCnvAlg::m_trackMonitoringTool { this, "TrkMonTool", "", "Tracking Monitoring tool" }
private

Definition at line 106 of file TrackParticleCnvAlg.h.

106{ this, "TrkMonTool", "", "Tracking Monitoring tool" };

◆ m_tracks

SG::ReadHandleKey<TrackCollection> xAODMaker::TrackParticleCnvAlg::m_tracks {this, "TrackContainerName", "Tracks"}
private

Definition at line 90 of file TrackParticleCnvAlg.h.

90{this, "TrackContainerName", "Tracks"};

◆ m_tracksMap

SG::ReadHandleKey<ObservedTrackMap> xAODMaker::TrackParticleCnvAlg::m_tracksMap {this, "TracksMapName", "" , "name of observed tracks map saved in store"}
private

Definition at line 113 of file TrackParticleCnvAlg.h.

113{this, "TracksMapName", "" , "name of observed tracks map saved in store"};

◆ m_trackTruth

SG::ReadHandleKey<TrackTruthCollection> xAODMaker::TrackParticleCnvAlg::m_trackTruth {this, "TrackTruthContainerName", ""}
private

Definition at line 102 of file TrackParticleCnvAlg.h.

102{this, "TrackTruthContainerName", ""};

◆ m_truthClassifier

ToolHandle<IMCTruthClassifier> xAODMaker::TrackParticleCnvAlg::m_truthClassifier
private
Initial value:
{
this,
"MCTruthClassifier",
"MCTruthClassifier/MCTruthClassifier",
" MCTruthClassifier Instance to use "
}

ToolHandle to truth classifier.

Definition at line 75 of file TrackParticleCnvAlg.h.

75 {
76 this,
77 "MCTruthClassifier",
78 "MCTruthClassifier/MCTruthClassifier",
79 " MCTruthClassifier Instance to use "
80 };

◆ m_truthParticleLinkVec

SG::ReadHandleKey<xAODTruthParticleLinkVector> xAODMaker::TrackParticleCnvAlg::m_truthParticleLinkVec {this, "xAODTruthLinkVector", "xAODTruthLinks"}
private

Definition at line 100 of file TrackParticleCnvAlg.h.

100{this, "xAODTruthLinkVector", "xAODTruthLinks"};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.

◆ m_xaodout

SG::WriteHandleKey<xAOD::TrackParticleContainer> xAODMaker::TrackParticleCnvAlg::m_xaodout {this, "xAODTrackParticlesFromTracksContainerName", "InDetTrackParticles"}
private

Definition at line 94 of file TrackParticleCnvAlg.h.

94{this, "xAODTrackParticlesFromTracksContainerName", "InDetTrackParticles"};

◆ m_xaodTrackParticlesout

SG::WriteHandleKey<xAOD::TrackParticleContainer> xAODMaker::TrackParticleCnvAlg::m_xaodTrackParticlesout {this, "xAODContainerName", "ConvertedTrackParticleCandidate" }
private

Definition at line 97 of file TrackParticleCnvAlg.h.

97{this, "xAODContainerName", "ConvertedTrackParticleCandidate" };

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