ATLAS Offline Software
NonPromptLeptonVertexingAlg.h
Go to the documentation of this file.
1 // This is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef NONPROMPTLEPTONVERTEXINGALG_H
8 #define NONPROMPTLEPTONVERTEXINGALG_H
9 
10 /**********************************************************************************
11  * @Package: LeptonTaggers
12  * @Class : NonPromptLeptonVertexingAlg
13  * @Author : Fudong He
14  * @Author : Rustem Ospanov
15  *
16  * @Brief :
17  *
18  * Decorate leptons with secondary vertex algorithm output
19  *
20  **********************************************************************************/
21 
22 // Local
23 #include "VertexMergingTool.h"
24 #include "VertexFittingTool.h"
25 
26 // Athena
28 #include "GaudiKernel/ToolHandle.h"
29 
33 #include "xAODEgamma/Electron.h"
34 #include "xAODMuon/Muon.h"
35 
36 // ROOT
37 #include "TStopwatch.h"
38 
39 // C/C++
40 #include <set>
41 
42 namespace Prompt
43 {
44  class NonPromptLeptonVertexingAlg: public AthAlgorithm
45  {
46 
47  public:
48 
49  NonPromptLeptonVertexingAlg(const std::string& name, ISvcLocator* pSvcLocator);
50 
51  virtual StatusCode initialize() override;
52  virtual StatusCode execute() override;
53  virtual StatusCode finalize() override;
54 
55  private:
56 
57  std::vector<const xAOD::TrackParticle*> findNearbyTracks(
58  const xAOD::TrackParticle &tracklep,
59  const xAOD::TrackParticleContainer &inDetTracks,
60  const xAOD::Vertex &priVtx
61  ) const;
62 
63  bool passElecCand(const xAOD::Electron &elec) const;
64  bool passMuonCand(const xAOD::Muon &muon) const;
65 
66  std::vector<std::unique_ptr<xAOD::Vertex>> prepLepWithTwoTrkSVVec(
67  const FittingInput &input,
68  const xAOD::TrackParticle *tracklep,
69  const std::vector<const xAOD::TrackParticle* > &tracks
70  );
71 
72  std::vector<std::unique_ptr<xAOD::Vertex>> prepLepWithMergedSVVec(
73  const FittingInput &input,
74  const xAOD::TrackParticle* tracklep,
75  std::vector<std::unique_ptr<xAOD::Vertex>> &twoTrkVertices
76  );
77 
78  void makeVertexCluster(
79  std::vector<std::unique_ptr<xAOD::Vertex>> &clusterVtxs,
80  std::vector<std::unique_ptr<xAOD::Vertex>> &inputVtxs
81  );
82 
84  std::vector<std::unique_ptr<xAOD::Vertex>> &vtxs,
85  std::vector<int> &indexVector,
86  std::vector<ElementLink<xAOD::VertexContainer> > &svLinks,
87  xAOD::VertexContainer &SVContainer,
88  std::set< xAOD::Vertex* >& svSet
89  );
90 
91  private:
92 
95 
96  private:
97 
98  //
99  // Tools and services:
100  //
101  ToolHandle<Prompt::IVertexMergingTool> m_vertexMerger {
102  this, "VertexMergingTool",
103  "Prompt::VertexMergingTool/PromptVertexMergingTool"
104  };
105  ToolHandle<Prompt::VertexFittingTool> m_vertexFitterTool {
106  this, "VertexFittingTool", "Prompt::VertexFittingTool/VertexFittingTool"
107  };
108 
109  //
110  // Properties:
111  //
112  Gaudi::Property<bool> m_printTime {this, "PrintTime", false};
113  Gaudi::Property<bool> m_selectTracks {this, "SelectTracks", true};
114 
115  Gaudi::Property<double> m_mergeMinVtxDist {this, "MergeMinVtxDist", 1.0};
116  Gaudi::Property<double> m_mergeChi2OverDoF {this, "MergeChi2OverDoF", 5.0};
117 
118  Gaudi::Property<std::string> m_decoratorNameSecVtxLinks {this, "SecVtxLinksName", "default"};
119  Gaudi::Property<std::string> m_decoratorNameDeepMergedSecVtxLinks {this, "DeepMergedSecVtxLinksName", "default"};
120  Gaudi::Property<std::string> m_decoratorNameIndexVector {this, "IndexVectorName"};
121  Gaudi::Property<std::string> m_linkNameRefittedPriVtxWithoutLepton {this, "NoLeptonPriVtxLinkName"};
122 
123  Gaudi::Property<std::string> m_refittedVertexTypeName{
124  this, "ReFitPriVtxTypeName", "refittedVertexType"
125  };
126 
127  Gaudi::Property<float> m_minTrackpT {this, "minTrackpT", 500.0};
128  Gaudi::Property<float> m_maxTrackEta {this, "maxTrackEta", 2.5};
129  Gaudi::Property<float> m_maxTrackZ0Sin {this, "maxTrackZ0Sin", 1.0};
130 
131  Gaudi::Property<float> m_minTrackLeptonDR {this, "minTrackLeptonDR", 1.0e-6};
132  Gaudi::Property<float> m_maxTrackLeptonDR {this, "maxTrackLeptonDR", 0.4};
133 
134  Gaudi::Property<unsigned> m_minTrackSiHits {this, "minTrackSiHits", 7};
135  Gaudi::Property<float> m_maxTrackSharedSiHits {this, "maxTrackSharedSiHits", 1.0};
136  Gaudi::Property<unsigned> m_maxTrackSiHoles {this, "maxTrackSiHoles", 2};
137  Gaudi::Property<unsigned> m_maxTrackPixHoles {this, "maxTrackPixHoles", 1};
138 
139  // Read/write handles
141  this, "InDetTrackParticlesKey", "InDetTrackParticles"
142  };
144  this, "LeptonContainerName", "default"
145  };
147  this, "PriVertexContainerName", "PrimaryVertices"
148  };
150  this, "ReFitPriVtxContainerName", "default"
151  };
153  this, "SVContainerName", "default"
154  };
155 
156 
157  //
158  // Variables
159  //
160  TStopwatch m_timerAll;
161  TStopwatch m_timerExec;
162 
163  unsigned m_countEvents;
164 
165  //
166  // Decorators
167  //
168  std::unique_ptr<decoratorVecInt_t> m_indexVectorDec;
169  std::unique_ptr<decoratorVecInt_t> m_indexVectorDecDeepMerge;
170  std::unique_ptr<decoratorVecElemVtx_t> m_lepSVElementLinksDec;
171  std::unique_ptr<decoratorVecElemVtx_t> m_lepDeepMergedSVElementLinksDec;
172  };
173 }
174 
175 #endif // NONPROMPTLEPTONVERTEXINGALG_H
Prompt::NonPromptLeptonVertexingAlg::m_minTrackpT
Gaudi::Property< float > m_minTrackpT
Definition: NonPromptLeptonVertexingAlg.h:147
Prompt::NonPromptLeptonVertexingAlg::m_minTrackSiHits
Gaudi::Property< unsigned > m_minTrackSiHits
Definition: NonPromptLeptonVertexingAlg.h:154
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameSecVtxLinks
Gaudi::Property< std::string > m_decoratorNameSecVtxLinks
Definition: NonPromptLeptonVertexingAlg.h:138
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackZ0Sin
Gaudi::Property< float > m_maxTrackZ0Sin
Definition: NonPromptLeptonVertexingAlg.h:149
Prompt
Definition: DecoratePromptLeptonImproved.h:45
Prompt::NonPromptLeptonVertexingAlg::m_timerAll
TStopwatch m_timerAll
Definition: NonPromptLeptonVertexingAlg.h:180
Prompt::NonPromptLeptonVertexingAlg::m_selectTracks
Gaudi::Property< bool > m_selectTracks
Definition: NonPromptLeptonVertexingAlg.h:133
Prompt::NonPromptLeptonVertexingAlg::m_mergeMinVtxDist
Gaudi::Property< double > m_mergeMinVtxDist
Definition: NonPromptLeptonVertexingAlg.h:135
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameDeepMergedSecVtxLinks
Gaudi::Property< std::string > m_decoratorNameDeepMergedSecVtxLinks
Definition: NonPromptLeptonVertexingAlg.h:139
Muon.h
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackSharedSiHits
Gaudi::Property< float > m_maxTrackSharedSiHits
Definition: NonPromptLeptonVertexingAlg.h:155
VertexMergingTool.h
Prompt::NonPromptLeptonVertexingAlg::m_indexVectorDec
std::unique_ptr< decoratorVecInt_t > m_indexVectorDec
Definition: NonPromptLeptonVertexingAlg.h:188
Prompt::NonPromptLeptonVertexingAlg::m_vertexFitterTool
ToolHandle< Prompt::VertexFittingTool > m_vertexFitterTool
Definition: NonPromptLeptonVertexingAlg.h:125
VertexFittingTool.h
Prompt::NonPromptLeptonVertexingAlg::decoratorVecElemVtx_t
SG::AuxElement::Decorator< std::vector< ElementLink< xAOD::VertexContainer > > > decoratorVecElemVtx_t
Definition: NonPromptLeptonVertexingAlg.h:114
Prompt::NonPromptLeptonVertexingAlg::m_linkNameRefittedPriVtxWithoutLepton
Gaudi::Property< std::string > m_linkNameRefittedPriVtxWithoutLepton
Definition: NonPromptLeptonVertexingAlg.h:141
Prompt::NonPromptLeptonVertexingAlg::m_indexVectorDecDeepMerge
std::unique_ptr< decoratorVecInt_t > m_indexVectorDecDeepMerge
Definition: NonPromptLeptonVertexingAlg.h:189
Prompt::NonPromptLeptonVertexingAlg::m_countEvents
unsigned m_countEvents
Definition: NonPromptLeptonVertexingAlg.h:183
Prompt::NonPromptLeptonVertexingAlg::m_lepSVElementLinksDec
std::unique_ptr< decoratorVecElemVtx_t > m_lepSVElementLinksDec
Definition: NonPromptLeptonVertexingAlg.h:190
Prompt::NonPromptLeptonVertexingAlg::m_leptonContainerKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_leptonContainerKey
Definition: NonPromptLeptonVertexingAlg.h:163
SG::ReadHandleKey< xAOD::TrackParticleContainer >
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackSiHoles
Gaudi::Property< unsigned > m_maxTrackSiHoles
Definition: NonPromptLeptonVertexingAlg.h:156
Prompt::FittingInput
Definition: IVertexFittingTool.h:60
Prompt::NonPromptLeptonVertexingAlg::prepLepWithTwoTrkSVVec
std::vector< std::unique_ptr< xAOD::Vertex > > prepLepWithTwoTrkSVVec(const FittingInput &input, const xAOD::TrackParticle *tracklep, const std::vector< const xAOD::TrackParticle * > &tracks)
Definition: NonPromptLeptonVertexingAlg.cxx:427
Prompt::NonPromptLeptonVertexingAlg::initialize
virtual StatusCode initialize() override
Definition: NonPromptLeptonVertexingAlg.cxx:27
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackEta
Gaudi::Property< float > m_maxTrackEta
Definition: NonPromptLeptonVertexingAlg.h:148
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
Prompt::NonPromptLeptonVertexingAlg::decoratorVecInt_t
SG::AuxElement::Decorator< std::vector< int > > decoratorVecInt_t
Definition: NonPromptLeptonVertexingAlg.h:113
Prompt::NonPromptLeptonVertexingAlg::m_refittedPriVtxContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_refittedPriVtxContainerName
Definition: NonPromptLeptonVertexingAlg.h:169
Prompt::NonPromptLeptonVertexingAlg::m_primaryVertexContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainerName
Definition: NonPromptLeptonVertexingAlg.h:166
AthAlgorithm.h
Prompt::NonPromptLeptonVertexingAlg::m_printTime
Gaudi::Property< bool > m_printTime
Definition: NonPromptLeptonVertexingAlg.h:132
Prompt::NonPromptLeptonVertexingAlg::m_lepDeepMergedSVElementLinksDec
std::unique_ptr< decoratorVecElemVtx_t > m_lepDeepMergedSVElementLinksDec
Definition: NonPromptLeptonVertexingAlg.h:191
Prompt::NonPromptLeptonVertexingAlg::m_mergeChi2OverDoF
Gaudi::Property< double > m_mergeChi2OverDoF
Definition: NonPromptLeptonVertexingAlg.h:136
Prompt::NonPromptLeptonVertexingAlg::m_vertexMerger
ToolHandle< Prompt::IVertexMergingTool > m_vertexMerger
Definition: NonPromptLeptonVertexingAlg.h:121
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:58
Prompt::NonPromptLeptonVertexingAlg::passElecCand
bool passElecCand(const xAOD::Electron &elec) const
Definition: NonPromptLeptonVertexingAlg.cxx:311
Prompt::NonPromptLeptonVertexingAlg::saveSecondaryVertices
void saveSecondaryVertices(std::vector< std::unique_ptr< xAOD::Vertex >> &vtxs, std::vector< int > &indexVector, std::vector< ElementLink< xAOD::VertexContainer > > &svLinks, xAOD::VertexContainer &SVContainer, std::set< xAOD::Vertex * > &svSet)
Definition: NonPromptLeptonVertexingAlg.cxx:618
Prompt::NonPromptLeptonVertexingAlg::prepLepWithMergedSVVec
std::vector< std::unique_ptr< xAOD::Vertex > > prepLepWithMergedSVVec(const FittingInput &input, const xAOD::TrackParticle *tracklep, std::vector< std::unique_ptr< xAOD::Vertex >> &twoTrkVertices)
Definition: NonPromptLeptonVertexingAlg.cxx:466
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackPixHoles
Gaudi::Property< unsigned > m_maxTrackPixHoles
Definition: NonPromptLeptonVertexingAlg.h:157
Prompt::NonPromptLeptonVertexingAlg::m_svContainerName
SG::WriteHandleKey< xAOD::VertexContainer > m_svContainerName
Definition: NonPromptLeptonVertexingAlg.h:172
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackLeptonDR
Gaudi::Property< float > m_maxTrackLeptonDR
Definition: NonPromptLeptonVertexingAlg.h:152
Prompt::NonPromptLeptonVertexingAlg::m_refittedVertexTypeName
Gaudi::Property< std::string > m_refittedVertexTypeName
Definition: NonPromptLeptonVertexingAlg.h:143
Prompt::NonPromptLeptonVertexingAlg::findNearbyTracks
std::vector< const xAOD::TrackParticle * > findNearbyTracks(const xAOD::TrackParticle &tracklep, const xAOD::TrackParticleContainer &inDetTracks, const xAOD::Vertex &priVtx) const
Definition: NonPromptLeptonVertexingAlg.cxx:350
DataVector< xAOD::TrackParticle_v1 >
Prompt::NonPromptLeptonVertexingAlg::m_minTrackLeptonDR
Gaudi::Property< float > m_minTrackLeptonDR
Definition: NonPromptLeptonVertexingAlg.h:151
AthAlgorithm
Definition: AthAlgorithm.h:47
Prompt::NonPromptLeptonVertexingAlg::execute
virtual StatusCode execute() override
Definition: NonPromptLeptonVertexingAlg.cxx:104
Prompt::NonPromptLeptonVertexingAlg::m_inDetTracksKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inDetTracksKey
Definition: NonPromptLeptonVertexingAlg.h:160
Prompt::NonPromptLeptonVertexingAlg::finalize
virtual StatusCode finalize() override
Definition: NonPromptLeptonVertexingAlg.cxx:88
Prompt::NonPromptLeptonVertexingAlg::passMuonCand
bool passMuonCand(const xAOD::Muon &muon) const
Definition: NonPromptLeptonVertexingAlg.cxx:333
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
xAOD::Electron_v1
Definition: Electron_v1.h:34
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Prompt::NonPromptLeptonVertexingAlg::m_timerExec
TStopwatch m_timerExec
Definition: NonPromptLeptonVertexingAlg.h:181
Electron.h
Prompt::NonPromptLeptonVertexingAlg::makeVertexCluster
void makeVertexCluster(std::vector< std::unique_ptr< xAOD::Vertex >> &clusterVtxs, std::vector< std::unique_ptr< xAOD::Vertex >> &inputVtxs)
Definition: NonPromptLeptonVertexingAlg.cxx:575
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
TrackParticleContainer.h
Prompt::NonPromptLeptonVertexingAlg::NonPromptLeptonVertexingAlg
NonPromptLeptonVertexingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: NonPromptLeptonVertexingAlg.cxx:21
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameIndexVector
Gaudi::Property< std::string > m_decoratorNameIndexVector
Definition: NonPromptLeptonVertexingAlg.h:140