ATLAS Offline Software
Loading...
Searching...
No Matches
InDetV0FinderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 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 "GaudiKernel/IPartPropSvc.h"
30#include <atomic>
31
37#include "MVAUtils/BDT.h"
38#include <TTree.h>
39#include <TFile.h>
41
84
85
86/* Forward declarations */
87
88namespace Trk
89{
91 class V0Tools;
92}
93
94namespace HepPDT{
95 class ParticleDataTable;
96}
97
98namespace InDet
99{
100 static const InterfaceID IID_InDetV0FinderTool("InDetV0FinderTool", 1, 0);
101
103 {
104 public:
105 InDetV0FinderTool(const std::string& t, const std::string& n, const IInterface* p);
107 StatusCode initialize();
108 StatusCode finalize();
109
110 static const InterfaceID& interfaceID() { return IID_InDetV0FinderTool;}
111
112 StatusCode performSearch(xAOD::VertexContainer* v0Container,
113 xAOD::VertexContainer* ksContainer,
114 xAOD::VertexContainer* laContainer,
115 xAOD::VertexContainer* lbContainer,
116 const xAOD::Vertex* vertex,
117 const xAOD::VertexContainer* vertColl, const EventContext& ctx
118 ) const;
119
120 //protected:
121 private:
122 SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackParticleKey { this, "TrackParticleCollection", "InDetTrackParticles",
123 "key for retrieval of TrackParticles" };
124
125 PublicToolHandle<Trk::IVertexFitter> m_iVertexFitter {
126 this, "VertexFitterTool", "Trk::V0VertexFitter"};
127 PublicToolHandle<Trk::IVertexFitter> m_iVKVertexFitter{
128 this, "VKVertexFitterTool", "Trk::TrkVKalVrtFitter"};
129 PublicToolHandle<Trk::IVertexFitter> m_iKshortFitter{
130 this, "KshortFitterTool", "Trk::TrkVKalVrtFitter"};
131 PublicToolHandle<Trk::IVertexFitter> m_iLambdaFitter{
132 this, "LambdaFitterTool", "Trk::TrkVKalVrtFitter"};
133 PublicToolHandle<Trk::IVertexFitter> m_iLambdabarFitter{
134 this, "LambdabarFitterTool", "Trk::TrkVKalVrtFitter"};
135 PublicToolHandle<Trk::IVertexFitter> m_iGammaFitter{
136 this, "GammaFitterTool", "Trk::TrkVKalVrtFitter"};
137 PublicToolHandle<Trk::V0Tools> m_V0Tools{
138 this, "V0Tools", "Trk::V0Tools"};
139 PublicToolHandle<Reco::ITrackToVertex> m_trackToVertexTool{
140 this, "TrackToVertexTool", "Reco::TrackToVertex"};
141 PublicToolHandle<Trk::ITrackSelectorTool> m_trkSelector{
142 this, "TrackSelectorTool", "InDet::TrackSelectorTool"};
143 PublicToolHandle<InDet::VertexPointEstimator> m_vertexEstimator{
144 this, "VertexPointEstimator", "InDet::VertexPointEstimator"};
145 PublicToolHandle<Trk::IExtrapolator> m_extrapolator{
146 this, "Extrapolator", "Trk::Extrapolator"};
147
148 const HepPDT::ParticleDataTable *m_particleDataTable = nullptr;
149
150 BooleanProperty m_doSimpleV0{this, "doSimpleV0", false};
151 BooleanProperty m_useorigin{this, "useorigin", true};
152 BooleanProperty m_samesign{this, "AddSameSign", false};
153 BooleanProperty m_pv{this, "trkSelPV", false};
154 BooleanProperty m_use_vertColl{this, "useVertexCollection", false};
155 BooleanProperty m_useTRTplusTRT{this, "useTRTplusTRT", false};
156 BooleanProperty m_useTRTplusSi{this, "useTRTplusSi", false};
157 BooleanProperty m_useV0Fitter{this, "useV0Fitter", false};
158 BooleanProperty m_use_innerPixHits{this, "use_innerPixHits", false};
159 BooleanProperty m_useBDT{this, "useBDT", false};
160 BooleanProperty m_useTrkSel{this, "use_TrackSelector", true};
161
162 IntegerProperty m_masses{this, "masses", 1};
163 DoubleProperty m_masspi{this, "masspi", ParticleConstants::chargedPionMassInMeV};
164 DoubleProperty m_massp{this, "massp", ParticleConstants::protonMassInMeV};
165 DoubleProperty m_masse{this, "masse", ParticleConstants::electronMassInMeV};
166 DoubleProperty m_massK0S{this, "massK0S", ParticleConstants::KZeroMassInMeV};
167 DoubleProperty m_massLambda{this, "massLambda", ParticleConstants::lambdaMassInMeV};
168 DoubleProperty m_ptTRT{this, "ptTRT", 700.};
169 DoubleProperty m_maxsxy{this, "maxsxy", 1000.};
170 DoubleProperty m_uksmin{this, "uksmin", 400.};
171 DoubleProperty m_uksmax{this, "uksmax", 600.};
172 DoubleProperty m_ulamin{this, "ulamin", 1000.};
173 DoubleProperty m_ulamax{this, "ulamax", 1200.};
174 DoubleProperty m_ksmin{this, "ksmin", 400.};
175 DoubleProperty m_ksmax{this, "ksmax", 600.};
176 DoubleProperty m_lamin{this, "lamin", 1000.};
177 DoubleProperty m_lamax{this, "lamax", 1200.};
178 DoubleProperty m_errmass{this, "errmass", 100.};
179 DoubleProperty m_minVertProb{this, "minVertProb", 0.0001};
180 DoubleProperty m_minConstrVertProb{this, "minConstrVertProb", 0.0001};
181 DoubleProperty m_d0_cut{this, "d0_cut", 2.};
182 DoubleProperty m_max_d0_cut{this, "max_d0_cut", 999999.};
183 DoubleProperty m_max_z0_cut{this, "max_z0_cut", 999999.};
184 DoubleProperty m_vert_lxy_sig{this, "vert_lxy_sig", 2.};
185 DoubleProperty m_vert_lxy_cut{this, "vert_lxy_cut", 500.};
186 DoubleProperty m_vert_a0xy_cut{this, "vert_a0xy_cut", 3.};
187 DoubleProperty m_vert_a0z_cut{this, "vert_a0z_cut", 15.};
188 DoubleProperty m_vert_cos_cut{this, "vert_cos_cut", 0.};
189 DoubleProperty m_BDTCut{this, "BDTCut", -1};
190
191 StringProperty m_BDTFile{this, "BDTFile", "XGBModelBetterVertex.root"};
192
193
194 mutable std::atomic<unsigned int> m_events_processed{};
195 mutable std::atomic<unsigned int> m_V0s_stored{};
196 mutable std::atomic<unsigned int> m_Kshort_stored{};
197 mutable std::atomic<unsigned int> m_Lambda_stored{};
198 mutable std::atomic<unsigned int> m_Lambdabar_stored{};
199 mutable std::atomic<unsigned int> m_Gamma_stored{};
200
201
202 void SGError(const std::string& errService) const;
203
204 static double invariantMass(const Trk::TrackParameters* per1, const Trk::TrackParameters* per2, double m1, double m2) ;
205
206 bool doFit(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, Amg::Vector3D &startingPoint, const EventContext& ctx) const;
207
208 bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::TrackParticle* track2, const xAOD::VertexContainer * vertColl, const EventContext& ctx) const;
209 bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::VertexContainer * vertColl, const EventContext& ctx) const;
210 bool d0Pass(const xAOD::TrackParticle* track1, const xAOD::Vertex * vertex, const EventContext& ctx) const;
211 bool d0Pass(const xAOD::TrackParticle* track1, const Amg::Vector3D& vertex, const EventContext& ctx) const;
212
213 bool pointAtVertex(const xAOD::Vertex* v0, const xAOD::Vertex* PV, float &score) const;
214 bool pointAtVertexColl(xAOD::Vertex* v0, const xAOD::VertexContainer * vertColl, float &score) const;
215
216 bool doMassFit(xAOD::Vertex* vxCandidate, int pdgID) const;
217
218 xAOD::Vertex* massFit(int pdgID, const std::vector<const xAOD::TrackParticle*> &pairV0, const Amg::Vector3D &vertex) const;
219
221
222 SG::ReadHandleKey<xAOD::VertexContainer> m_vertexKey { this, "VertexContainer", "PrimaryVertices",
223 "primary vertex container" };
230
235
237
238 std::unique_ptr<MVAUtils::BDT> m_BDT;
239
240 SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo_key{this, "EventInfo", "EventInfo", "Input event information"};
241 SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
242 SG::ReadDecorHandleKeyArray<xAOD::EventInfo> m_beamSpotDecoKey{this, "BeamSpotDecoKeys", m_eventInfo_key, {"beamPosX", "beamPosY", "beamPosZ"}, "Add the scheduler dependencies on the beamspot information"};
243 Gaudi::Property<bool> m_useBeamSpotCond { this, "UseBeamSpotCond", false };
244 // V0 candidate output container name (same calling alg)
245 Gaudi::Property<std::string> m_v0Key { this, "V0ContainerName", "V0Candidates", "V0 container name (same calling alg)" };
246 Gaudi::Property<std::string> m_ksKey { this, "KshortContainerName", "KshortCandidates", "Ks container name (same calling alg)" };
247 Gaudi::Property<std::string> m_laKey { this, "LambdaContainerName", "LambdaCandidates",
248 "Lambda container name (same calling alg)" };
249 Gaudi::Property<std::string> m_lbKey { this, "LambdabarContainerName", "LambdabarCandidates",
250 "Lambdabar container name (same calling alg)" };
251 Gaudi::Property<int> m_maxPV { this, "MaxPV", 999999 };
252 SG::ReadHandleKeyArray<xAOD::TrackParticleContainer> m_RelinkContainers{this, "RelinkTracks", {}, "Track Containers if they need to be relinked through indirect use" };
253 ElementLink<xAOD::TrackParticleContainer> makeLink(const xAOD::TrackParticle*, const std::vector<const xAOD::TrackParticleContainer*>&) const;
254
255 ServiceHandle<IPartPropSvc> m_partPropSvc{this, "PartPropSvc", "PartPropSvc"};
256 };
257
258}//end of namespace InDet
259
260#endif
261
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.
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)
ServiceHandle< IPartPropSvc > m_partPropSvc
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
xAOD::Vertex * massFit(int pdgID, const std::vector< const xAOD::TrackParticle * > &pairV0, const Amg::Vector3D &vertex) 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/.
const HepPDT::ParticleDataTable * m_particleDataTable
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.