ATLAS Offline Software
NonPromptLeptonVertexingAlg.h
Go to the documentation of this file.
1 // This is -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2025 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
29 #include "GaudiKernel/ToolHandle.h"
30 
34 #include "xAODEgamma/Electron.h"
35 #include "xAODMuon/Muon.h"
36 
37 // ROOT
38 #include "TStopwatch.h"
39 
40 // C/C++
41 #include <set>
42 
43 namespace Prompt
44 {
45  class NonPromptLeptonVertexingAlg: public AthAlgorithm
46  {
47 
48  public:
49 
50  NonPromptLeptonVertexingAlg(const std::string& name, ISvcLocator* pSvcLocator);
51 
52  virtual StatusCode initialize() override;
53  virtual StatusCode execute() override;
54  virtual StatusCode finalize() override;
55 
56  private:
57 
58  std::vector<const xAOD::TrackParticle*> findNearbyTracks(
59  const xAOD::TrackParticle &tracklep,
60  const xAOD::TrackParticleContainer &inDetTracks,
61  const xAOD::Vertex &priVtx
62  ) const;
63 
64  bool passElecCand(const xAOD::Electron &elec) const;
65  bool passMuonCand(const xAOD::Muon &muon) const;
66 
67  std::vector<std::unique_ptr<xAOD::Vertex>> prepLepWithTwoTrkSVVec(
68  const FittingInput &input,
69  const xAOD::TrackParticle *tracklep,
70  const std::vector<const xAOD::TrackParticle* > &tracks
71  );
72 
73  void makeVertexCluster(
74  std::vector<std::unique_ptr<xAOD::Vertex>> &clusterVtxs,
75  std::vector<std::unique_ptr<xAOD::Vertex>> &inputVtxs
76  );
77 
79  std::vector<std::unique_ptr<xAOD::Vertex>> &vtxs,
80  std::vector<int> &indexVector,
81  std::vector<ElementLink<xAOD::VertexContainer> > &svLinks,
82  xAOD::VertexContainer &SVContainer,
83  std::set< xAOD::Vertex* >& svSet
84  );
85 
86  private:
87 
90 
91  private:
92 
93  //
94  // Tools and services:
95  //
96  ToolHandle<Prompt::IVertexMergingTool> m_vertexMerger {
97  this, "VertexMergingTool",
98  "Prompt::VertexMergingTool/PromptVertexMergingTool"
99  };
100  ToolHandle<Prompt::VertexFittingTool> m_vertexFitterTool {
101  this, "VertexFittingTool", "Prompt::VertexFittingTool/VertexFittingTool"
102  };
103 
104  //
105  // Properties:
106  //
107  Gaudi::Property<bool> m_printTime {this, "PrintTime", false};
108  Gaudi::Property<bool> m_selectTracks {this, "SelectTracks", true};
109 
110  Gaudi::Property<double> m_mergeMinVtxDist {this, "MergeMinVtxDist", 1.0};
111  Gaudi::Property<double> m_mergeChi2OverDoF {this, "MergeChi2OverDoF", 5.0};
112 
113  Gaudi::Property<std::string> m_linkNameRefittedPriVtxWithoutLepton {this, "NoLeptonPriVtxLinkName"};
114 
115  Gaudi::Property<std::string> m_refittedVertexTypeName{
116  this, "ReFitPriVtxTypeName", "refittedVertexType"
117  };
118 
119  Gaudi::Property<float> m_minTrackpT {this, "minTrackpT", 500.0};
120  Gaudi::Property<float> m_maxTrackEta {this, "maxTrackEta", 2.5};
121  Gaudi::Property<float> m_maxTrackZ0Sin {this, "maxTrackZ0Sin", 1.0};
122 
123  Gaudi::Property<float> m_minTrackLeptonDR {this, "minTrackLeptonDR", 1.0e-6};
124  Gaudi::Property<float> m_maxTrackLeptonDR {this, "maxTrackLeptonDR", 0.4};
125 
126  Gaudi::Property<unsigned> m_minTrackSiHits {this, "minTrackSiHits", 7};
127  Gaudi::Property<float> m_maxTrackSharedSiHits {this, "maxTrackSharedSiHits", 1.0};
128  Gaudi::Property<unsigned> m_maxTrackSiHoles {this, "maxTrackSiHoles", 2};
129  Gaudi::Property<unsigned> m_maxTrackPixHoles {this, "maxTrackPixHoles", 1};
130 
131  // Read/write handles
133  this, "InDetTrackParticlesKey", "InDetTrackParticles"
134  };
136  this, "LeptonContainerName", "default"
137  };
139  this, "PriVertexContainerName", "PrimaryVertices"
140  };
142  this, "ReFitPriVtxContainerName", "default"
143  };
145  this, "SVContainerName", "default"
146  };
147 
148 
149  //
150  // Variables
151  //
152  TStopwatch m_timerAll;
153  TStopwatch m_timerExec;
154 
155  unsigned m_countEvents;
156 
157  //
158  // Decorators
159  //
160 
162  { this, "SecVtxLinksName", m_leptonContainerKey, "default", };
164  { this, "DeepMergedSecVtxLinksName", m_leptonContainerKey, "default", };
166  { this, "IndexVectorName", m_leptonContainerKey, "", };
168  { this, "IndexVectorNameDeepMerge", m_leptonContainerKey, "", };
169  };
170 }
171 
172 #endif // NONPROMPTLEPTONVERTEXINGALG_H
Prompt::NonPromptLeptonVertexingAlg::m_minTrackpT
Gaudi::Property< float > m_minTrackpT
Definition: NonPromptLeptonVertexingAlg.h:139
SG::WriteDecorHandleKey
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Definition: StoreGate/StoreGate/WriteDecorHandleKey.h:89
Prompt::NonPromptLeptonVertexingAlg::m_minTrackSiHits
Gaudi::Property< unsigned > m_minTrackSiHits
Definition: NonPromptLeptonVertexingAlg.h:146
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:196
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackZ0Sin
Gaudi::Property< float > m_maxTrackZ0Sin
Definition: NonPromptLeptonVertexingAlg.h:141
Prompt
Definition: DecoratePLIT.h:29
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameSecVtxLinks
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decoratorNameSecVtxLinks
Definition: NonPromptLeptonVertexingAlg.h:182
Prompt::NonPromptLeptonVertexingAlg::m_timerAll
TStopwatch m_timerAll
Definition: NonPromptLeptonVertexingAlg.h:172
Prompt::NonPromptLeptonVertexingAlg::m_selectTracks
Gaudi::Property< bool > m_selectTracks
Definition: NonPromptLeptonVertexingAlg.h:128
Prompt::NonPromptLeptonVertexingAlg::m_mergeMinVtxDist
Gaudi::Property< double > m_mergeMinVtxDist
Definition: NonPromptLeptonVertexingAlg.h:130
Muon.h
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackSharedSiHits
Gaudi::Property< float > m_maxTrackSharedSiHits
Definition: NonPromptLeptonVertexingAlg.h:147
VertexMergingTool.h
Prompt::NonPromptLeptonVertexingAlg::m_vertexFitterTool
ToolHandle< Prompt::VertexFittingTool > m_vertexFitterTool
Definition: NonPromptLeptonVertexingAlg.h:120
VertexFittingTool.h
Prompt::NonPromptLeptonVertexingAlg::decoratorVecElemVtx_t
SG::AuxElement::Decorator< std::vector< ElementLink< xAOD::VertexContainer > > > decoratorVecElemVtx_t
Definition: NonPromptLeptonVertexingAlg.h:109
Prompt::NonPromptLeptonVertexingAlg::m_linkNameRefittedPriVtxWithoutLepton
Gaudi::Property< std::string > m_linkNameRefittedPriVtxWithoutLepton
Definition: NonPromptLeptonVertexingAlg.h:133
Prompt::NonPromptLeptonVertexingAlg::m_countEvents
unsigned m_countEvents
Definition: NonPromptLeptonVertexingAlg.h:175
Prompt::NonPromptLeptonVertexingAlg::m_leptonContainerKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_leptonContainerKey
Definition: NonPromptLeptonVertexingAlg.h:155
SG::ReadHandleKey< xAOD::TrackParticleContainer >
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackSiHoles
Gaudi::Property< unsigned > m_maxTrackSiHoles
Definition: NonPromptLeptonVertexingAlg.h:148
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:442
Prompt::NonPromptLeptonVertexingAlg::initialize
virtual StatusCode initialize() override
Definition: NonPromptLeptonVertexingAlg.cxx:30
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackEta
Gaudi::Property< float > m_maxTrackEta
Definition: NonPromptLeptonVertexingAlg.h:140
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:108
Prompt::NonPromptLeptonVertexingAlg::m_refittedPriVtxContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_refittedPriVtxContainerName
Definition: NonPromptLeptonVertexingAlg.h:161
Prompt::NonPromptLeptonVertexingAlg::m_primaryVertexContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainerName
Definition: NonPromptLeptonVertexingAlg.h:158
AthAlgorithm.h
Prompt::NonPromptLeptonVertexingAlg::m_printTime
Gaudi::Property< bool > m_printTime
Definition: NonPromptLeptonVertexingAlg.h:127
Prompt::NonPromptLeptonVertexingAlg::m_mergeChi2OverDoF
Gaudi::Property< double > m_mergeChi2OverDoF
Definition: NonPromptLeptonVertexingAlg.h:131
Prompt::NonPromptLeptonVertexingAlg::m_vertexMerger
ToolHandle< Prompt::IVertexMergingTool > m_vertexMerger
Definition: NonPromptLeptonVertexingAlg.h:116
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
WriteDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
Prompt::NonPromptLeptonVertexingAlg::passElecCand
bool passElecCand(const xAOD::Electron &elec) const
Definition: NonPromptLeptonVertexingAlg.cxx:326
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:524
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IParticleContainer.h
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackPixHoles
Gaudi::Property< unsigned > m_maxTrackPixHoles
Definition: NonPromptLeptonVertexingAlg.h:149
Prompt::NonPromptLeptonVertexingAlg::m_svContainerName
SG::WriteHandleKey< xAOD::VertexContainer > m_svContainerName
Definition: NonPromptLeptonVertexingAlg.h:164
Prompt::NonPromptLeptonVertexingAlg::m_maxTrackLeptonDR
Gaudi::Property< float > m_maxTrackLeptonDR
Definition: NonPromptLeptonVertexingAlg.h:144
Prompt::NonPromptLeptonVertexingAlg::m_refittedVertexTypeName
Gaudi::Property< std::string > m_refittedVertexTypeName
Definition: NonPromptLeptonVertexingAlg.h:135
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:365
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameDeepMergedSecVtxLinks
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decoratorNameDeepMergedSecVtxLinks
Definition: NonPromptLeptonVertexingAlg.h:184
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Prompt::NonPromptLeptonVertexingAlg::m_minTrackLeptonDR
Gaudi::Property< float > m_minTrackLeptonDR
Definition: NonPromptLeptonVertexingAlg.h:143
AthAlgorithm
Definition: AthAlgorithm.h:47
Prompt::NonPromptLeptonVertexingAlg::execute
virtual StatusCode execute() override
Definition: NonPromptLeptonVertexingAlg.cxx:107
Prompt::NonPromptLeptonVertexingAlg::m_inDetTracksKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_inDetTracksKey
Definition: NonPromptLeptonVertexingAlg.h:152
Prompt::NonPromptLeptonVertexingAlg::finalize
virtual StatusCode finalize() override
Definition: NonPromptLeptonVertexingAlg.cxx:91
Prompt::NonPromptLeptonVertexingAlg::passMuonCand
bool passMuonCand(const xAOD::Muon &muon) const
Definition: NonPromptLeptonVertexingAlg.cxx:348
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
xAOD::Electron_v1
Definition: Electron_v1.h:34
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameIndexVectorDeepMerge
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decoratorNameIndexVectorDeepMerge
Definition: NonPromptLeptonVertexingAlg.h:188
VertexContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
Prompt::NonPromptLeptonVertexingAlg::m_timerExec
TStopwatch m_timerExec
Definition: NonPromptLeptonVertexingAlg.h:173
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:481
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
TrackParticleContainer.h
Prompt::NonPromptLeptonVertexingAlg::m_decoratorNameIndexVector
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decoratorNameIndexVector
Definition: NonPromptLeptonVertexingAlg.h:186
Prompt::NonPromptLeptonVertexingAlg::NonPromptLeptonVertexingAlg
NonPromptLeptonVertexingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: NonPromptLeptonVertexingAlg.cxx:24