ATLAS Offline Software
Loading...
Searching...
No Matches
InDetV0FinderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5/***************************************************************************
6 InDetV0FinderTool.h - Description
7 -------------------
8 begin : 30-11-2014
9 authors : Evelina Bouhova-Thacker (Lancater University)
10 email : e.bouhova@cern.ch
11 changes :
12
13 ***************************************************************************/
14
15#ifndef INDETV0FINDERTOOL_H
16#define INDETV0FINDERTOOL_H
17
19#include "GaudiKernel/ToolHandle.h"
28#include "GeoPrimitives/GeoPrimitives.h" //Needed for Amg::Vector3D
29#include <atomic>
30
36#include "MVAUtils/BDT.h"
37#include <TTree.h>
38#include <TFile.h>
40
83
84
85/* Forward declarations */
86
87namespace Trk
88{
90 class V0Tools;
91}
92
93namespace InDet
94{
95 static const InterfaceID IID_InDetV0FinderTool("InDetV0FinderTool", 1, 0);
96
98 {
99 public:
100 InDetV0FinderTool(const std::string& t, const std::string& n, const IInterface* p);
102 StatusCode initialize();
103 StatusCode finalize();
104
105 static const InterfaceID& interfaceID() { return IID_InDetV0FinderTool;}
106
107 StatusCode performSearch(xAOD::VertexContainer* v0Container,
108 xAOD::VertexContainer* ksContainer,
109 xAOD::VertexContainer* laContainer,
110 xAOD::VertexContainer* lbContainer,
111 const xAOD::Vertex* vertex,
112 const xAOD::VertexContainer* vertColl, const EventContext& ctx
113 ) const;
114
115 //protected:
116 private:
117 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleKey { this, "TrackParticleCollection", "InDetTrackParticles",
118 "key for retrieval of TrackParticles" };
119
120 PublicToolHandle<Trk::IVertexFitter> m_iVertexFitter {
121 this, "VertexFitterTool", "Trk::V0VertexFitter"};
122 PublicToolHandle<Trk::IVertexFitter> m_iVKVertexFitter{
123 this, "VKVertexFitterTool", "Trk::TrkVKalVrtFitter"};
124 PublicToolHandle<Trk::IVertexFitter> m_iKshortFitter{
125 this, "KshortFitterTool", "Trk::TrkVKalVrtFitter"};
126 PublicToolHandle<Trk::IVertexFitter> m_iLambdaFitter{
127 this, "LambdaFitterTool", "Trk::TrkVKalVrtFitter"};
128 PublicToolHandle<Trk::IVertexFitter> m_iLambdabarFitter{
129 this, "LambdabarFitterTool", "Trk::TrkVKalVrtFitter"};
130 PublicToolHandle<Trk::IVertexFitter> m_iGammaFitter{
131 this, "GammaFitterTool", "Trk::TrkVKalVrtFitter"};
132 PublicToolHandle<Trk::V0Tools> m_V0Tools{
133 this, "V0Tools", "Trk::V0Tools"};
134 PublicToolHandle<Reco::ITrackToVertex> m_trackToVertexTool{
135 this, "TrackToVertexTool", "Reco::TrackToVertex"};
136 PublicToolHandle<Trk::ITrackSelectorTool> m_trkSelector{
137 this, "TrackSelectorTool", "InDet::TrackSelectorTool"};
138 PublicToolHandle<InDet::VertexPointEstimator> m_vertexEstimator{
139 this, "VertexPointEstimator", "InDet::VertexPointEstimator"};
140 PublicToolHandle<Trk::IExtrapolator> m_extrapolator{
141 this, "Extrapolator", "Trk::Extrapolator"};
142
143
144 BooleanProperty m_doSimpleV0{this, "doSimpleV0", false};
145 BooleanProperty m_useorigin{this, "useorigin", true};
146 BooleanProperty m_samesign{this, "AddSameSign", false};
147 BooleanProperty m_pv{this, "trkSelPV", false};
148 BooleanProperty m_use_vertColl{this, "useVertexCollection", false};
149 BooleanProperty m_useTRTplusTRT{this, "useTRTplusTRT", false};
150 BooleanProperty m_useTRTplusSi{this, "useTRTplusSi", false};
151 BooleanProperty m_useV0Fitter{this, "useV0Fitter", false};
152 BooleanProperty m_use_innerPixHits{this, "use_innerPixHits", false};
153 BooleanProperty m_useBDT{this, "useBDT", false};
154 BooleanProperty m_useTrkSel{this, "use_TrackSelector", true};
155
156 IntegerProperty m_masses{this, "masses", 1};
157 DoubleProperty m_masspi{this, "masspi", ParticleConstants::chargedPionMassInMeV};
158 DoubleProperty m_massp{this, "massp", ParticleConstants::protonMassInMeV};
159 DoubleProperty m_masse{this, "masse", ParticleConstants::electronMassInMeV};
160 DoubleProperty m_massK0S{this, "massK0S", ParticleConstants::KZeroMassInMeV};
161 DoubleProperty m_massLambda{this, "massLambda", ParticleConstants::lambdaMassInMeV};
162 DoubleProperty m_ptTRT{this, "ptTRT", 700.};
163 DoubleProperty m_maxsxy{this, "maxsxy", 1000.};
164 DoubleProperty m_uksmin{this, "uksmin", 400.};
165 DoubleProperty m_uksmax{this, "uksmax", 600.};
166 DoubleProperty m_ulamin{this, "ulamin", 1000.};
167 DoubleProperty m_ulamax{this, "ulamax", 1200.};
168 DoubleProperty m_ksmin{this, "ksmin", 400.};
169 DoubleProperty m_ksmax{this, "ksmax", 600.};
170 DoubleProperty m_lamin{this, "lamin", 1000.};
171 DoubleProperty m_lamax{this, "lamax", 1200.};
172 DoubleProperty m_errmass{this, "errmass", 100.};
173 DoubleProperty m_minVertProb{this, "minVertProb", 0.0001};
174 DoubleProperty m_minConstrVertProb{this, "minConstrVertProb", 0.0001};
175 DoubleProperty m_d0_cut{this, "d0_cut", 2.};
176 DoubleProperty m_max_d0_cut{this, "max_d0_cut", 999999.};
177 DoubleProperty m_max_z0_cut{this, "max_z0_cut", 999999.};
178 DoubleProperty m_vert_lxy_sig{this, "vert_lxy_sig", 2.};
179 DoubleProperty m_vert_lxy_cut{this, "vert_lxy_cut", 500.};
180 DoubleProperty m_vert_a0xy_cut{this, "vert_a0xy_cut", 3.};
181 DoubleProperty m_vert_a0z_cut{this, "vert_a0z_cut", 15.};
182 DoubleProperty m_vert_cos_cut{this, "vert_cos_cut", 0.};
183 DoubleProperty m_BDTCut{this, "BDTCut", -1};
184
185 StringProperty m_BDTFile{this, "BDTFile", "XGBModelBetterVertex.root"};
186
187
188 mutable std::atomic<unsigned int> m_events_processed{};
189 mutable std::atomic<unsigned int> m_V0s_stored{};
190 mutable std::atomic<unsigned int> m_Kshort_stored{};
191 mutable std::atomic<unsigned int> m_Lambda_stored{};
192 mutable std::atomic<unsigned int> m_Lambdabar_stored{};
193 mutable std::atomic<unsigned int> m_Gamma_stored{};
194
195
196 void SGError(const std::string& errService) const;
197
198 static double invariantMass(const Trk::TrackParameters* per1, const Trk::TrackParameters* per2, double m1, double m2) ;
199
200 bool doFit(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, Amg::Vector3D &startingPoint, const EventContext& ctx) const;
201
202 bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, const xAOD::VertexContainer * vertColl, const EventContext& ctx) const;
203 bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::VertexContainer * vertColl, const EventContext& ctx) const;
204 bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::Vertex * vertex, const EventContext& ctx) const;
205 bool d0Pass(const xAOD::TrackParticle* track1, const Amg::Vector3D& vertex, const EventContext& ctx) const;
206
207 bool pointAtVertex(const xAOD::Vertex* v0, const xAOD::Vertex* PV, float &score) const;
208 bool pointAtVertexColl(xAOD::Vertex* v0, const xAOD::VertexContainer * vertColl, float &score) const;
209
210 bool doMassFit(xAOD::Vertex* vxCandidate, int pdgID) const;
211
212 std::unique_ptr<xAOD::Vertex> massFit(const EventContext& ctx, int pdgID, const std::vector<const xAOD::TrackParticle*> &pairV0, const Amg::Vector3D &vertex) const;
213
215
216 SG::ReadHandleKey<xAOD::VertexContainer> m_vertexKey { this, "VertexContainer", "PrimaryVertices",
217 "primary vertex container" };
224
229
231
232 std::unique_ptr<MVAUtils::BDT> m_BDT;
233
234 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo_key{this, "EventInfo", "EventInfo", "Input event information"};
235 SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
236 SG::ReadDecorHandleKeyArray<xAOD::EventInfo> m_beamSpotDecoKey{this, "BeamSpotDecoKeys", m_eventInfo_key, {"beamPosX", "beamPosY", "beamPosZ"}, "Add the scheduler dependencies on the beamspot information"};
237 Gaudi::Property<bool> m_useBeamSpotCond { this, "UseBeamSpotCond", false };
238 // V0 candidate output container name (same calling alg)
239 Gaudi::Property<std::string> m_v0Key { this, "V0ContainerName", "V0Candidates", "V0 container name (same calling alg)" };
240 Gaudi::Property<std::string> m_ksKey { this, "KshortContainerName", "KshortCandidates", "Ks container name (same calling alg)" };
241 Gaudi::Property<std::string> m_laKey { this, "LambdaContainerName", "LambdaCandidates",
242 "Lambda container name (same calling alg)" };
243 Gaudi::Property<std::string> m_lbKey { this, "LambdabarContainerName", "LambdabarCandidates",
244 "Lambdabar container name (same calling alg)" };
245 Gaudi::Property<int> m_maxPV { this, "MaxPV", 999999 };
246 SG::ReadHandleKeyArray<xAOD::TrackParticleContainer> m_RelinkContainers{this, "RelinkTracks", {}, "Track Containers if they need to be relinked through indirect use" };
247 ElementLink<xAOD::TrackParticleContainer> makeLink(const xAOD::TrackParticle*, const std::vector<const xAOD::TrackParticleContainer*>&) const;
248
249 };
250
251}//end of namespace InDet
252
253#endif
254
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
bool doMassFit(xAOD::Vertex *vxCandidate, int pdgID) const
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0LinksDecorkeyks
BooleanProperty m_useTRTplusSi
= use TRT+Si pairs (true)
BooleanProperty m_useorigin
= true only using tracks that have no vertex association (true)
DoubleProperty m_masspi
pion mass (139.57 MeV)
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0_lbLinksDecorkey
const Trk::TrkV0VertexFitter * m_concreteVertexFitter
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_gfit
std::atomic< unsigned int > m_events_processed
void SGError(const std::string &errService) const
std::atomic< unsigned int > m_Kshort_stored
DoubleProperty m_vert_cos_cut
V0 cos(theta) angle between displacement and momentum (>0.).
DoubleProperty m_d0_cut
track d0 significance wrt a vertex (>2.)
DoubleProperty m_ksmin
min Kshort mass (400.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_gprob
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0LinksDecorkeylbb
SG::ReadHandleKeyArray< xAOD::TrackParticleContainer > m_RelinkContainers
DoubleProperty m_ulamax
max Lambda mass, unconstrained fit (1200.
DoubleProperty m_ksmax
max Kshort mass (600.
DoubleProperty m_vert_a0z_cut
V0 |a0z| wrt a vertex (<15.).
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Gaudi::Property< int > m_maxPV
DoubleProperty m_lamax
max Lambda mass (1200.
bool pointAtVertex(const xAOD::Vertex *v0, const xAOD::Vertex *PV, float &score) const
PublicToolHandle< Trk::IVertexFitter > m_iLambdabarFitter
bool pointAtVertexColl(xAOD::Vertex *v0, const xAOD::VertexContainer *vertColl, float &score) const
DoubleProperty m_vert_a0xy_cut
V0 |a0xy| wrt a vertex (<3.).
std::atomic< unsigned int > m_Lambda_stored
PublicToolHandle< Trk::ITrackSelectorTool > m_trkSelector
BooleanProperty m_doSimpleV0
= true equivalent to the old InDetSimpleV0Finder (false)
DoubleProperty m_max_z0_cut
track |z0| wrt a vertex (<999999.)
DoubleProperty m_minVertProb
Minimum vertex probability (0.0001).
BooleanProperty m_use_innerPixHits
= true select allows tracks with no innermost pixel layer hits to always pass d0 significance cut (fa...
PublicToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
PublicToolHandle< Trk::IVertexFitter > m_iKshortFitter
BooleanProperty m_samesign
= true select tracks with same sign (false)
static const InterfaceID & interfaceID()
DoubleProperty m_massLambda
Lambda mass (1115.68 MeV).
DoubleProperty m_ulamin
min Lambda mass, unconstrained fit (1000.
PublicToolHandle< Trk::IVertexFitter > m_iVKVertexFitter
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_gmass
static double invariantMass(const Trk::TrackParameters *per1, const Trk::TrackParameters *per2, double m1, double m2)
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
DoubleProperty m_uksmax
max Kshort mass, unconstrained fit (600.
std::unique_ptr< xAOD::Vertex > massFit(const EventContext &ctx, int pdgID, const std::vector< const xAOD::TrackParticle * > &pairV0, const Amg::Vector3D &vertex) const
BooleanProperty m_useBDT
= true uses BDT selections in place of rectangular pointAtVertex + minVertProb
Gaudi::Property< std::string > m_lbKey
PublicToolHandle< Trk::IVertexFitter > m_iGammaFitter
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0_ksLinksDecorkey
IntegerProperty m_masses
= 1 if using PDG values, = 2 if user set (1)
std::atomic< unsigned int > m_Gamma_stored
SG::ReadDecorHandleKeyArray< xAOD::EventInfo > m_beamSpotDecoKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticleKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0LinksDecorkeylb
BooleanProperty m_pv
= true select tracks wrt primary vertex (false)
Gaudi::Property< std::string > m_ksKey
PublicToolHandle< InDet::VertexPointEstimator > m_vertexEstimator
DoubleProperty m_maxsxy
Maximum Rxy of starting point (1000.
std::unique_ptr< MVAUtils::BDT > m_BDT
PublicToolHandle< Trk::IVertexFitter > m_iLambdaFitter
DoubleProperty m_BDTCut
BDT Score threshold.
std::atomic< unsigned int > m_V0s_stored
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
DoubleProperty m_uksmin
min Kshort mass, unconstrained fit (400.
BooleanProperty m_useTRTplusTRT
= use TRT+TRT pairs (true)
PublicToolHandle< Trk::V0Tools > m_V0Tools
Gaudi::Property< std::string > m_v0Key
DoubleProperty m_vert_lxy_sig
V0 lxy significance wrt a vertex (>2.).
StatusCode performSearch(xAOD::VertexContainer *v0Container, xAOD::VertexContainer *ksContainer, xAOD::VertexContainer *laContainer, xAOD::VertexContainer *lbContainer, const xAOD::Vertex *vertex, const xAOD::VertexContainer *vertColl, const EventContext &ctx) const
DoubleProperty m_masse
electron mass (0.510999 MeV)
ElementLink< xAOD::TrackParticleContainer > makeLink(const xAOD::TrackParticle *, const std::vector< const xAOD::TrackParticleContainer * > &) const
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0_BDTScore
DoubleProperty m_vert_lxy_cut
V0 lxy V0 lxy (<500.).
BooleanProperty m_use_vertColl
= true select tracks wrt a vertex collection (false)
DoubleProperty m_minConstrVertProb
Minimum vertex probability for constrained fit (0.0001).
DoubleProperty m_max_d0_cut
track |d0| wrt a vertex (<999999.)
StringProperty m_BDTFile
Filename of mvaUtils model file, located in /InDetV0FinderTool/BDT/v1/.
PublicToolHandle< Trk::IVertexFitter > m_iVertexFitter
BooleanProperty m_useV0Fitter
= true if using TrkV0Fitter, = false if using VKalVert (true)
InDetV0FinderTool(const std::string &t, const std::string &n, const IInterface *p)
DoubleProperty m_massK0S
Kshort mass (497.672 MeV).
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_mDecor_gmasserr
DoubleProperty m_lamin
min Lambda mass (1000.
DoubleProperty m_ptTRT
Minimum pT for TRT tracks (700.
BooleanProperty m_useTrkSel
= true uses TrackSelectorTool
bool d0Pass(const xAOD::TrackParticle *track1, const xAOD::TrackParticle *track2, const xAOD::VertexContainer *vertColl, const EventContext &ctx) const
Gaudi::Property< std::string > m_laKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_v0_laLinksDecorkey
DoubleProperty m_massp
proton mass (938.272 MeV)
std::atomic< unsigned int > m_Lambdabar_stored
Gaudi::Property< bool > m_useBeamSpotCond
DoubleProperty m_errmass
Maximum mass error (100.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
This class implements a vertex fitting algorithm optimised for V0 finding.
bool doFit
Eigen::Matrix< double, 3, 1 > Vector3D
Primary Vertex Finder.
static const InterfaceID IID_InDetV0FinderTool("InDetV0FinderTool", 1, 0)
constexpr double protonMassInMeV
the mass of the proton (in MeV)
constexpr double KZeroMassInMeV
the mass of the neutral kaon (K0) (in MeV)
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)
constexpr double electronMassInMeV
the mass of the electron (in MeV)
constexpr double lambdaMassInMeV
the mass of the lambda baryon (in MeV)
DecorHandleKeyArray< ReadDecorHandle< T, S >, ReadDecorHandleKey< T >, Gaudi::DataHandle::Reader > ReadDecorHandleKeyArray
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray
Ensure that the ATLAS eigen extensions are properly loaded.
ParametersBase< TrackParametersDim, Charged > TrackParameters
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.