ATLAS Offline Software
BPhysTrackVertexMapTool.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: $
8 #ifndef BPHYSTOOLS_BPHYSTRACKVERTEXMAPTOOL_H
9 #define BPHYSTOOLS_BPHYSTRACKVERTEXMAPTOOL_H
10 
11 // Framework includes
13 #include "AsgTools/AsgTool.h"
14 
15 // System include(s):
16 #include <memory>
17 
18 // EDM includes
21 
22 namespace xAOD {
48  public asg::AsgTool, virtual public xAOD::IBPhysTrackVertexMapTool {
49 
52 
53  public:
55  BPhysTrackVertexMapTool(const std::string& name =
56  "BPhysTrackVertexMapTool");
57 
59  virtual StatusCode initialize() override;
60 
62  virtual StatusCode logEvent() override;
63 
65  virtual StatusCode finalize() override;
66 
68  virtual bool doLog() const override;
69 
71  static std::string wrapLines(const std::string& lines, const std::string& prefix);
72 
73  protected:
77  virtual StatusCode cacheEvent() override;
78 
80  virtual std::vector<const xAOD::Vertex*>
81  pvsForIDTrack(const xAOD::TrackParticle* track) const override;
82 
85  virtual std::vector<const xAOD::Vertex*>
86  refPVsForIDTrack(const xAOD::TrackParticle* track) const override;
87 
89  virtual std::vector<const xAOD::Vertex*>
90  svsForIDTrack(const xAOD::TrackParticle* track) const override;
91 
92  // track-vertex association related
93  virtual std::string idTrackToString(const xAOD::TrackParticle* track,
94  unsigned int indent=0,
95  bool withPV=false,
96  bool withRefPV=false,
97  bool withSV=false) override;
98 
99  virtual std::string pvToString(const xAOD::Vertex* vtx,
100  unsigned int indent=0,
101  bool withTracks=false) override;
102 
103  virtual std::string refPVToString(const xAOD::Vertex* vtx,
104  unsigned int indent=0,
105  bool withTracks=false) override;
106  virtual std::string svToString(const xAOD::Vertex* vtx,
107  unsigned int indent=0,
108  bool withTracks=false,
109  bool withMasses=false) override;
110  virtual std::string idTracksToString(const xAOD::TrackParticleContainer*
111  tpc,
112  unsigned int indent=0,
113  bool withPV=false,
114  bool withRefPV=false,
115  bool withSV=false) override;
116 
117  virtual std::string pvsToString(const xAOD::VertexContainer* pvc,
118  unsigned int indent=0,
119  bool withTracks=false) override;
120  virtual std::string refPVsToString(const xAOD::VertexContainer* rpvc,
121  unsigned int indent=0,
122  bool withTracks=false) override;
123  virtual std::string svsToString(const xAOD::VertexContainer* svc,
124  unsigned int indent=0,
125  bool withTracks=false,
126  bool withMasses=false) override;
127  virtual std::string summaryToString(std::string prefix) override;
129 
130  protected:
131  virtual float getFloat(std::string name, const xAOD::Vertex* b);
132 
133  virtual std::vector<std::string> getTokens(std::string input,
134  std::string seperators);
135 
136 
137  private:
138  // track-vertex association related
139  typedef std::map<const xAOD::TrackParticle*,
140  std::vector<const xAOD::Vertex*> > TrackToVertexMap_t;
141 
142  virtual void initTrackVertexMaps(const xAOD::TrackParticleContainer* tpc,
143  const xAOD::VertexContainer* pvc,
144  const xAOD::VertexContainer* rpvc,
145  const xAOD::VertexContainer* svc);
147  const xAOD::TrackParticle* track,
148  const xAOD::Vertex* vtx);
149  virtual std::string pvName(const xAOD::Vertex* vtx);
150  virtual std::string refPVName(const xAOD::Vertex* vtx);
151  virtual std::string svName(const xAOD::Vertex* vtx);
152  virtual std::string idTrackName(const xAOD::TrackParticle* vtx);
153 
154  protected:
155  // job options
157  std::string m_refPVContainerName;
158  std::string m_pvContainerName;
161  std::string m_dumpPrefix;
162  std::string m_hypoName;
163 
164  // containers
172 
173  unsigned int m_nEvtsSeen;
174 
177 
178  private:
179  // track-vertex association related
180  typedef std::map<const xAOD::Vertex*, std::string> VertexNameMap_t;
184 
185  typedef std::map<const xAOD::TrackParticle*, std::string> TrackNameMap_t;
187 
191 
192  }; // class BPhysTrackVertexMapTool
193 
194 } // namespace xAOD
195 
196 #endif // BPHYSTOOLS_BPHYSTRACKVERTEXMAPTOOL_H
xAOD::BPhysTrackVertexMapTool::refPVToString
virtual std::string refPVToString(const xAOD::Vertex *vtx, unsigned int indent=0, bool withTracks=false) override
Definition: BPhysTrackVertexMapTool.cxx:456
xAOD::BPhysTrackVertexMapTool::m_dumpPrefix
std::string m_dumpPrefix
Definition: BPhysTrackVertexMapTool.h:161
xAOD::BPhysTrackVertexMapTool::m_debugTrkToVtxMaxEvents
int m_debugTrkToVtxMaxEvents
Definition: BPhysTrackVertexMapTool.h:160
xAOD::IBPhysTrackVertexMapTool
Interface for dual-use tool createing a track-to-vertex map from the vertex-to-track information.
Definition: IBPhysTrackVertexMapTool.h:33
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
xAOD::BPhysTrackVertexMapTool::m_hypoName
std::string m_hypoName
Definition: BPhysTrackVertexMapTool.h:162
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
xAOD::BPhysTrackVertexMapTool::finalize
virtual StatusCode finalize() override
Function finalizing the tool.
Definition: BPhysTrackVertexMapTool.cxx:96
xAOD::TrackParticleAuxContainer_v5
Temporary container used until we have I/O for AuxStoreInternal.
Definition: TrackParticleAuxContainer_v5.h:35
xAOD::VertexAuxContainer_v1
Temporary container used until we have I/O for AuxStoreInternal.
Definition: VertexAuxContainer_v1.h:32
xAOD::BPhysTrackVertexMapTool::m_tracks
const xAOD::TrackParticleContainer * m_tracks
Definition: BPhysTrackVertexMapTool.h:165
xAOD::BPhysTrackVertexMapTool::pvToString
virtual std::string pvToString(const xAOD::Vertex *vtx, unsigned int indent=0, bool withTracks=false) override
Definition: BPhysTrackVertexMapTool.cxx:434
xAOD::BPhysTrackVertexMapTool::m_tracksAux
const xAOD::TrackParticleAuxContainer * m_tracksAux
Definition: BPhysTrackVertexMapTool.h:166
xAOD::BPhysTrackVertexMapTool::refPVsToString
virtual std::string refPVsToString(const xAOD::VertexContainer *rpvc, unsigned int indent=0, bool withTracks=false) override
Definition: BPhysTrackVertexMapTool.cxx:560
xAOD::BPhysTrackVertexMapTool::wrapLines
static std::string wrapLines(const std::string &lines, const std::string &prefix)
convenience method to wrap output lines by a prefix
Definition: BPhysTrackVertexMapTool.cxx:22
xAOD::BPhysTrackVertexMapTool::logEvent
virtual StatusCode logEvent() override
Function being excuted for each event.
Definition: BPhysTrackVertexMapTool.cxx:104
xAOD::BPhysTrackVertexMapTool::m_svNameMap
VertexNameMap_t m_svNameMap
Definition: BPhysTrackVertexMapTool.h:183
xAOD::BPhysTrackVertexMapTool::m_cachedEvent
int m_cachedEvent
Definition: BPhysTrackVertexMapTool.h:176
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
IBPhysTrackVertexMapTool.h
xAOD::BPhysTrackVertexMapTool::pvsToString
virtual std::string pvsToString(const xAOD::VertexContainer *pvc, unsigned int indent=0, bool withTracks=false) override
Definition: BPhysTrackVertexMapTool.cxx:539
xAOD::BPhysTrackVertexMapTool::m_refPVContainerName
std::string m_refPVContainerName
Definition: BPhysTrackVertexMapTool.h:157
xAOD::BPhysTrackVertexMapTool::m_idTrackNameMap
TrackNameMap_t m_idTrackNameMap
Definition: BPhysTrackVertexMapTool.h:186
xAOD::BPhysTrackVertexMapTool::VertexNameMap_t
std::map< const xAOD::Vertex *, std::string > VertexNameMap_t
Definition: BPhysTrackVertexMapTool.h:180
xAOD::BPhysTrackVertexMapTool::m_cachedRun
int m_cachedRun
Definition: BPhysTrackVertexMapTool.h:175
xAOD::BPhysTrackVertexMapTool::TrackToVertexMap_t
std::map< const xAOD::TrackParticle *, std::vector< const xAOD::Vertex * > > TrackToVertexMap_t
Definition: BPhysTrackVertexMapTool.h:140
xAOD::BPhysTrackVertexMapTool::m_nEvtsSeen
unsigned int m_nEvtsSeen
Definition: BPhysTrackVertexMapTool.h:173
xAOD::BPhysTrackVertexMapTool::m_idTrackToSVMap
TrackToVertexMap_t m_idTrackToSVMap
Definition: BPhysTrackVertexMapTool.h:190
xAOD::BPhysTrackVertexMapTool::summaryToString
virtual std::string summaryToString(std::string prefix) override
Definition: BPhysTrackVertexMapTool.cxx:600
CaloCondBlobAlgs_fillNoiseFromASCII.lines
lines
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:104
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:36
xAOD::BPhysTrackVertexMapTool::m_refPVContainer
const xAOD::VertexContainer * m_refPVContainer
Definition: BPhysTrackVertexMapTool.h:170
TrackParticleAuxContainer.h
xAOD::BPhysTrackVertexMapTool::m_vertexContainerName
std::string m_vertexContainerName
Definition: BPhysTrackVertexMapTool.h:156
xAOD::BPhysTrackVertexMapTool::idTrackToString
virtual std::string idTrackToString(const xAOD::TrackParticle *track, unsigned int indent=0, bool withPV=false, bool withRefPV=false, bool withSV=false) override
Definition: BPhysTrackVertexMapTool.cxx:385
xAOD::BPhysTrackVertexMapTool::refPVName
virtual std::string refPVName(const xAOD::Vertex *vtx)
Definition: BPhysTrackVertexMapTool.cxx:350
xAOD::BPhysTrackVertexMapTool::doLog
virtual bool doLog() const override
Function indicating whether log counter allows logging of current event.
Definition: BPhysTrackVertexMapTool.cxx:127
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::BPhysTrackVertexMapTool::m_refPVAuxContainer
const xAOD::VertexAuxContainer * m_refPVAuxContainer
Definition: BPhysTrackVertexMapTool.h:171
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
xAOD::BPhysTrackVertexMapTool::initTrackVertexMaps
virtual void initTrackVertexMaps(const xAOD::TrackParticleContainer *tpc, const xAOD::VertexContainer *pvc, const xAOD::VertexContainer *rpvc, const xAOD::VertexContainer *svc)
Definition: BPhysTrackVertexMapTool.cxx:264
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
xAOD::BPhysTrackVertexMapTool::getFloat
virtual float getFloat(std::string name, const xAOD::Vertex *b)
Definition: BPhysTrackVertexMapTool.cxx:616
xAOD::BPhysTrackVertexMapTool::m_svtxAuxContainer
const xAOD::VertexAuxContainer * m_svtxAuxContainer
Definition: BPhysTrackVertexMapTool.h:169
xAOD::BPhysTrackVertexMapTool::refPVsForIDTrack
virtual std::vector< const xAOD::Vertex * > refPVsForIDTrack(const xAOD::TrackParticle *track) const override
obtain refitted primary vertices for a given ID track (may return empty vector)
Definition: BPhysTrackVertexMapTool.cxx:228
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
xAOD::BPhysTrackVertexMapTool::initialize
virtual StatusCode initialize() override
Function initialising the tool.
Definition: BPhysTrackVertexMapTool.cxx:65
xAOD::BPhysTrackVertexMapTool::getTokens
virtual std::vector< std::string > getTokens(std::string input, std::string seperators)
Definition: BPhysTrackVertexMapTool.cxx:630
xAOD::BPhysTrackVertexMapTool::m_svtxContainer
const xAOD::VertexContainer * m_svtxContainer
Definition: BPhysTrackVertexMapTool.h:168
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
xAOD::BPhysTrackVertexMapTool::m_idTrackToPVMap
TrackToVertexMap_t m_idTrackToPVMap
Definition: BPhysTrackVertexMapTool.h:188
xAOD::BPhysTrackVertexMapTool::m_idTrackToRefPVMap
TrackToVertexMap_t m_idTrackToRefPVMap
Definition: BPhysTrackVertexMapTool.h:189
xAOD::BPhysTrackVertexMapTool
Dual-use tool createing a track-to-vertex map from the vertex-to-track information.
Definition: BPhysTrackVertexMapTool.h:48
xAOD::BPhysTrackVertexMapTool::m_pvtxContainer
const xAOD::VertexContainer * m_pvtxContainer
Definition: BPhysTrackVertexMapTool.h:167
xAOD::BPhysTrackVertexMapTool::svToString
virtual std::string svToString(const xAOD::Vertex *vtx, unsigned int indent=0, bool withTracks=false, bool withMasses=false) override
Definition: BPhysTrackVertexMapTool.cxx:476
xAOD::BPhysTrackVertexMapTool::svName
virtual std::string svName(const xAOD::Vertex *vtx)
Definition: BPhysTrackVertexMapTool.cxx:361
xAOD::BPhysTrackVertexMapTool::pvName
virtual std::string pvName(const xAOD::Vertex *vtx)
Definition: BPhysTrackVertexMapTool.cxx:339
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::BPhysTrackVertexMapTool::svsToString
virtual std::string svsToString(const xAOD::VertexContainer *svc, unsigned int indent=0, bool withTracks=false, bool withMasses=false) override
Definition: BPhysTrackVertexMapTool.cxx:580
xAOD::BPhysTrackVertexMapTool::pvsForIDTrack
virtual std::vector< const xAOD::Vertex * > pvsForIDTrack(const xAOD::TrackParticle *track) const override
obtain primary vertices for a given ID track (may return empty vector)
Definition: BPhysTrackVertexMapTool.cxx:210
xAOD::BPhysTrackVertexMapTool::cacheEvent
virtual StatusCode cacheEvent() override
Definition: BPhysTrackVertexMapTool.cxx:140
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
xAOD::BPhysTrackVertexMapTool::svsForIDTrack
virtual std::vector< const xAOD::Vertex * > svsForIDTrack(const xAOD::TrackParticle *track) const override
obtain secondary vertices for a given ID track (may return empty vector)
Definition: BPhysTrackVertexMapTool.cxx:246
xAOD::BPhysTrackVertexMapTool::m_refPVNameMap
VertexNameMap_t m_refPVNameMap
Definition: BPhysTrackVertexMapTool.h:182
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::BPhysTrackVertexMapTool::m_pvContainerName
std::string m_pvContainerName
Definition: BPhysTrackVertexMapTool.h:158
xAOD::BPhysTrackVertexMapTool::TrackNameMap_t
std::map< const xAOD::TrackParticle *, std::string > TrackNameMap_t
Definition: BPhysTrackVertexMapTool.h:185
AsgTool.h
xAOD::BPhysTrackVertexMapTool::idTracksToString
virtual std::string idTracksToString(const xAOD::TrackParticleContainer *tpc, unsigned int indent=0, bool withPV=false, bool withRefPV=false, bool withSV=false) override
Definition: BPhysTrackVertexMapTool.cxx:515
xAOD::BPhysTrackVertexMapTool::idTrackName
virtual std::string idTrackName(const xAOD::TrackParticle *vtx)
Definition: BPhysTrackVertexMapTool.cxx:373
xAOD::BPhysTrackVertexMapTool::BPhysTrackVertexMapTool
BPhysTrackVertexMapTool(const std::string &name="BPhysTrackVertexMapTool")
Declare the correct constructor for Athena.
Definition: BPhysTrackVertexMapTool.cxx:37
xAOD::BPhysTrackVertexMapTool::m_trackParticleContainerName
std::string m_trackParticleContainerName
Definition: BPhysTrackVertexMapTool.h:159
VertexAuxContainer.h
xAOD::BPhysTrackVertexMapTool::addVertexToTrackVertexMap
virtual void addVertexToTrackVertexMap(TrackToVertexMap_t &map, const xAOD::TrackParticle *track, const xAOD::Vertex *vtx)
Definition: BPhysTrackVertexMapTool.cxx:325
xAOD::BPhysTrackVertexMapTool::m_pvNameMap
VertexNameMap_t m_pvNameMap
Definition: BPhysTrackVertexMapTool.h:181