ATLAS Offline Software
TrackParticleCnvAlg.h
Go to the documentation of this file.
1 // Dear emacs, this is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // $Id: TrackParticleCnvAlg.h 297747 2013-10-28 15:14:24Z krasznaa $
8 #ifndef XAODCREATORALGS_TRACKPARTICLECREATOR_H
9 #define XAODCREATORALGS_TRACKPARTICLECREATOR_H
10 
11 // System include(s):
12 #include <string>
13 
14 // Athena/Gaudi include(s):
16 #include "GaudiKernel/ToolHandle.h"
30 // Local include(s):
36 
37 
38 
39 namespace xAODMaker {
40 
55 
56  public:
58  TrackParticleCnvAlg( const std::string& name, ISvcLocator* svcLoc );
59 
61  virtual StatusCode initialize();
63  virtual StatusCode execute(const EventContext& ctx) const;
64 
65  private:
66 
68  Gaudi::Property<bool> m_addTruthLink{this,"AddTruthLink", false };
70 
71 
73  ToolHandle<Trk::ITrackParticleCreatorTool> m_particleCreator{this, "TrackParticleCreator", "Trk::TrackParticleCreatorTool/TrackParticleCreatorTool" };
75  ToolHandle<IMCTruthClassifier> m_truthClassifier{
76  this,
77  "MCTruthClassifier",
78  "MCTruthClassifier/MCTruthClassifier",
79  " MCTruthClassifier Instance to use "
80  };
81 
82  // handles to the converting tools
83  ToolHandle<xAODMaker::ITrackCollectionCnvTool> m_TrackCollectionCnvTool{this, "TrackCollectionCnvTool", "xAODMaker::TrackCollectionCnvTool/TrackCollectionCnvTool"};
84  ToolHandle<xAODMaker::IRecTrackParticleContainerCnvTool>
85  m_RecTrackParticleContainerCnvTool{this, "RecTrackParticleContainerCnvTool", "xAODMaker::RecTrackParticleContainerCnvTool/"
86  "RecTrackParticleContainerCnvTool" };
87 
88  SG::ReadHandleKey<Rec::TrackParticleContainer> m_aod{this, "AODContainerName", "TrackParticleCandidate"};
89 
90  SG::ReadHandleKey<TrackCollection> m_tracks{this, "TrackContainerName", "Tracks"};
91 
92  SG::ReadHandleKey<xAOD::VertexContainer> m_primaryVertexContainer{ this, "PrimaryVerticesName", "", "Name of primary vertex container is case the parameters should be calculated with respect to the primary vertex"};
93 
94  SG::WriteHandleKey<xAOD::TrackParticleContainer> m_xaodout{this, "xAODTrackParticlesFromTracksContainerName", "InDetTrackParticles"};
95 
96 
97  SG::WriteHandleKey<xAOD::TrackParticleContainer> m_xaodTrackParticlesout{this, "xAODContainerName", "ConvertedTrackParticleCandidate" };
98  SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_xaodTruthOriginKey{this,"truthOriginKey", "" , "Key to declare that the alg will write truthOrigin. Will be overwritten during init"};
99  SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_xaodTruthTypeKey{this, "truthTypeKey", "" , "Key to declare that the alg will write truthType. Will be overwritten during init" };
100  SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_xaodTruthLinkKey{this, "truthLinkKey", "", "Key to declare that the alg will writhe the truthParticleLink. Will be overwritten during init."};
101  SG::WriteDecorHandleKey<xAOD::TrackParticleContainer> m_xaodTruthMatchProbKey{this, "truthMatchProbKey", "", "Key to declare that the alg will writhe the truthParticleLink. Will be overwritten during init."};
102 
103 
104  SG::ReadHandleKey<xAODTruthParticleLinkVector> m_truthParticleLinkVec{this, "xAODTruthLinkVector", "xAODTruthLinks"};
105  SG::ReadHandleKey<TrackParticleTruthCollection> m_aodTruth{this, "AODTruthContainerName" , ""};
106  SG::ReadHandleKey<TrackTruthCollection> m_trackTruth{this, "TrackTruthContainerName", ""};
107 
108  // Allow monitoring of track parameters during conversion
109  Gaudi::Property<bool> m_doMonitoring{this, "DoMonitoring", false};
110  ToolHandle<ITrackParticleMonitoring> m_trackMonitoringTool{ this, "TrkMonTool", "", "Tracking Monitoring tool" };
111 
112  //for timing we need a handle to the MonTool in the alg
113  ToolHandle<GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" };
114 
115  // Augment observed tracks with information from track observer tool map
116  Gaudi::Property<bool> m_augmentObservedTracks{this, "AugmentObservedTracks", false, "augment observed tracks"};
117  SG::ReadHandleKey<ObservedTrackMap> m_tracksMap{this, "TracksMapName", "" , "name of observed tracks map saved in store"};
118 
119 
121  Gaudi::Property<bool> m_convertAODTrackParticles{this, "ConvertTrackParticles", true};
122 
124  Gaudi::Property<bool> m_convertTracks{this, "ConvertTracks", false};
125 
126  template<typename CONT, typename TRUTHCONT, typename CONVTOOL>
127  int convert(const CONT&,
128  const TRUTHCONT&,
129  CONVTOOL& tool,
132  const xAOD::Vertex* primaryVertex = nullptr,
133  const ObservedTrackMap* obs_track_map = 0) const;
134 
137  const Rec::TrackParticleContainer& container,
138  const Rec::TrackParticle& tp);
141  const TrackCollection& container,
142  const Trk::Track& tp,
143  const EventContext& ctx);
144 
145  }; // class TrackParticleCnvAlg
146 
147 } // namespace xAODMaker
148 
149 #endif // XAODCREATORALGS_TRACKPARTICLECREATOR_H
ITrkObserverTool.h
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer >
xAODMaker::TrackParticleCnvAlg::m_xaodTruthLinkKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthLinkKey
Definition: TrackParticleCnvAlg.h:100
xAODMaker::TrackParticleCnvAlg::m_xaodTruthOriginKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthOriginKey
Definition: TrackParticleCnvAlg.h:98
xAODMaker::TrackParticleCnvAlg::m_trackMonitoringTool
ToolHandle< ITrackParticleMonitoring > m_trackMonitoringTool
Definition: TrackParticleCnvAlg.h:110
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
xAODMaker::TrackParticleCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: TrackParticleCnvAlg.cxx:31
xAODMaker::TrackParticleCnvAlg::m_augmentObservedTracks
Gaudi::Property< bool > m_augmentObservedTracks
Definition: TrackParticleCnvAlg.h:116
ITrackParticleCreatorTool.h
xAODMaker::TrackParticleCnvAlg::createParticle
xAOD::TrackParticle * createParticle(xAOD::TrackParticleContainer &xaod, const Rec::TrackParticleContainer &container, const Rec::TrackParticle &tp)
Definition: TrackParticleCnvAlg.cxx:446
ParticleTest.tp
tp
Definition: ParticleTest.py:25
TrackParticleTruthCollection.h
xAODMaker::TrackParticleCnvAlg::m_truthClassifier
ToolHandle< IMCTruthClassifier > m_truthClassifier
ToolHandle to truth classifier.
Definition: TrackParticleCnvAlg.h:75
SG::ReadHandleKey< Rec::TrackParticleContainer >
xAODMaker
Definition: StoreGateSvc.h:72
xAODMaker::TrackParticleCnvAlg::m_convertAODTrackParticles
Gaudi::Property< bool > m_convertAODTrackParticles
toggle on converting AOD track particles to xAOD
Definition: TrackParticleCnvAlg.h:121
xAODMaker::TrackParticleCnvAlg::m_xaodTrackParticlesout
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodTrackParticlesout
Definition: TrackParticleCnvAlg.h:97
xAODMaker::TrackParticleCnvAlg::m_xaodTruthMatchProbKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthMatchProbKey
Definition: TrackParticleCnvAlg.h:101
xAODMaker::TrackParticleCnvAlg::m_tracksMap
SG::ReadHandleKey< ObservedTrackMap > m_tracksMap
Definition: TrackParticleCnvAlg.h:117
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
ObservedTrackMap
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
Definition: ObservedTrackMap.h:50
ITrackParticleMonitoring.h
xAODMaker::TrackParticleCnvAlg
Algorithm creating xAOD::TrackParticles from TrackParticles.
Definition: TrackParticleCnvAlg.h:54
GenericMonitoringTool.h
xAODMaker::TrackParticleCnvAlg::m_aod
SG::ReadHandleKey< Rec::TrackParticleContainer > m_aod
Definition: TrackParticleCnvAlg.h:88
IMCTruthClassifier.h
xAODMaker::TrackParticleCnvAlg::m_trackTruth
SG::ReadHandleKey< TrackTruthCollection > m_trackTruth
Definition: TrackParticleCnvAlg.h:106
SG::WriteHandleKey< xAOD::TrackParticleContainer >
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
TrackParticleAuxContainer.h
TrackTruthCollection.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAODMaker::TrackParticleCnvAlg::m_addTruthLink
Gaudi::Property< bool > m_addTruthLink
toggle on adding truth links
Definition: TrackParticleCnvAlg.h:68
TrackCollection.h
xAODMaker::TrackParticleCnvAlg::m_aodTruth
SG::ReadHandleKey< TrackParticleTruthCollection > m_aodTruth
Definition: TrackParticleCnvAlg.h:105
xAODMaker::TrackParticleCnvAlg::m_xaodTruthTypeKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthTypeKey
Definition: TrackParticleCnvAlg.h:99
xAODMaker::TrackParticleCnvAlg::execute
virtual StatusCode execute(const EventContext &ctx) const
Function executing the algorithm.
Definition: TrackParticleCnvAlg.cxx:87
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
xAODMaker::TrackParticleCnvAlg::m_TrackCollectionCnvTool
ToolHandle< xAODMaker::ITrackCollectionCnvTool > m_TrackCollectionCnvTool
Definition: TrackParticleCnvAlg.h:83
AthReentrantAlgorithm.h
xAODMaker::TrackParticleCnvAlg::m_doMonitoring
Gaudi::Property< bool > m_doMonitoring
Definition: TrackParticleCnvAlg.h:109
xAODMaker::TrackParticleCnvAlg::convert
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
Definition: TrackParticleCnvAlg.cxx:283
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
xAODMaker::TrackParticleCnvAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrackParticleCnvAlg.h:113
xAODMaker::TrackParticleCnvAlg::m_RecTrackParticleContainerCnvTool
ToolHandle< xAODMaker::IRecTrackParticleContainerCnvTool > m_RecTrackParticleContainerCnvTool
Definition: TrackParticleCnvAlg.h:85
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
xAODMaker::TrackParticleCnvAlg::m_truthParticleLinkVec
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthParticleLinkVec
Definition: TrackParticleCnvAlg.h:104
xAODMaker::TrackParticleCnvAlg::m_convertTracks
Gaudi::Property< bool > m_convertTracks
toggle on converting tracks to xAOD
Definition: TrackParticleCnvAlg.h:124
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
xAODMaker::TrackParticleCnvAlg::m_tracks
SG::ReadHandleKey< TrackCollection > m_tracks
Definition: TrackParticleCnvAlg.h:90
TrackParticle.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
IRecTrackParticleContainerCnvTool.h
xAODTruthParticleLinkVector
Definition: xAODTruthParticleLink.h:26
SlotSpecificObj.h
Maintain a set of objects, one per slot.
xAODMaker::TrackParticleCnvAlg::m_particleCreator
ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreator
The key for the input TrackParticleTruthCollection.
Definition: TrackParticleCnvAlg.h:73
xAODMaker::TrackParticleCnvAlg::m_primaryVertexContainer
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainer
Definition: TrackParticleCnvAlg.h:92
xAODMaker::TrackParticleCnvAlg::TrackParticleCnvAlg
TrackParticleCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Definition: TrackParticleCnvAlg.cxx:26
xAODMaker::TrackParticleCnvAlg::m_xaodout
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodout
Definition: TrackParticleCnvAlg.h:94
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
ITrackCollectionCnvTool.h
TrackParticleContainer.h
TrackParticleContainer.h