ATLAS Offline Software
Loading...
Searching...
No Matches
BPhysPVCascadeTools.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef DERIVATIONFRAMEWORK_PVCASCADETOOLS_H
6#define DERIVATIONFRAMEWORK_PVCASCADETOOLS_H
7
8#include "GaudiKernel/ToolHandle.h"
13#include <vector>
14// Authors: Adam Barton <abarton@SPAMMENOTTtttcern.ch>
15// Eva Bouhova <bouhova@SPAMMENOTTtttcern.ch>
16
17
18//class CascadeTools;
19namespace Trk {
20 class V0Tools;
21 class VxCascadeInfo;
22}
23
24namespace Analysis{
26}
27
28namespace DerivationFramework {
29
32 typedef std::vector<VertexLink> VertexLinkVector;
33 private:
36
39
40 public:
42 BPhysPVCascadeTools(const CascadeTools *cascadeTools);
43 BPhysPVCascadeTools(const CascadeTools *cascadeTools,
44 const xAOD::EventInfo*);
45
46
47 void ProcessVertex(const std::vector<TLorentzVector> &mom, Amg::MatrixX cov, xAOD::BPhysHypoHelper &vtx, xAOD::BPhysHelper::pv_type pvtype, double mass) const;
48
50 void FillBPhysHelper(const std::vector<TLorentzVector> &mom, Amg::MatrixX cov, xAOD::BPhysHelper &vtx, const xAOD::Vertex* refPV,const xAOD::VertexContainer* refPvContainer,
51 xAOD::BPhysHelper::pv_type pvtype, int) const;
52
54 size_t FindLowZIndex(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &Obj,
55 const std::vector<const xAOD::Vertex*> &PVlist,
56 const size_t PV_minNTracks=0) const;
58 size_t FindLowA0Index(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &Obj,
59 const std::vector<const xAOD::Vertex*> &PVlist,
60 const size_t PV_minNTracks=0) const;
61
62 template< size_t NTracks> //NTracks = number of tracks in this type of vertex, if this is not known do not use this method
63 static bool VerticesMatchTracks(const xAOD::Vertex* v1, const xAOD::Vertex* v2);
64
65 template< size_t NTracks>
66 static const xAOD::Vertex* FindVertex(const xAOD::VertexContainer* c, const xAOD::Vertex* v);
67
72 static std::vector<const xAOD::Vertex*> GetGoodPV(const xAOD::VertexContainer* pvContainer);
73
80 void SetMinNTracksInPV(size_t PV_minNTracks);
81
86 [[nodiscard]] Amg::Vector3D GetBeamSpot() const;
87
90 size_t FindLowZ0BAIndex(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj,
91 const std::vector<const xAOD::Vertex*> &PVlist,
92 const size_t PV_minNTracks=0) const;
95 double DistInZtoDOCA(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj,
96 const xAOD::Vertex* vertex) const;
99 Amg::Vector3D DocaExtrapToBeamSpot(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj) const;
100
101 static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const xAOD::TrackParticleContainer* importedTrackCollection);
102 static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const std::vector<const xAOD::TrackParticleContainer*>& );
103
104 StatusCode FillCandwithRefittedVertices( bool refitPV,
105 const xAOD::VertexContainer* pvContainer, xAOD::VertexContainer* refPvContainer,
106 const Analysis::PrimaryVertexRefitter *pvRefitter, size_t in_PV_max, int DoVertexType,
107 Trk::VxCascadeInfo* casc, int index,
108 double mass, xAOD::BPhysHypoHelper &vtx);
109
110 static std::vector<const xAOD::TrackParticle*> CollectAllChargedTracks(const std::vector<xAOD::Vertex*> &cascadeVertices);
111
113 static bool uniqueCollection(const std::vector<const xAOD::TrackParticle*>&);
114 static bool uniqueCollection(const std::vector<const xAOD::TrackParticle*>&, const std::vector<const xAOD::TrackParticle*>&);
115 static bool LinkVertices(SG::AuxElement::Decorator<VertexLinkVector> &decor, const std::vector<const xAOD::Vertex*>& vertices,
116 const xAOD::VertexContainer* vertexContainer, const xAOD::Vertex* vert);
117 }; // class BPhysPVCascadeTools
118
119} // namespace DerivationFramework
120
121
122//added by ab
123template< size_t NTracks>
125{
126 if(v1->nTrackParticles() != v2->nTrackParticles()) return false;
127 assert(v1->nTrackParticles() == NTracks);
128 std::array<const xAOD::TrackParticle*, NTracks> a1;
129 std::array<const xAOD::TrackParticle*, NTracks> a2;
130 for(size_t i=0;i<NTracks;i++){
131 a1[i] = v1->trackParticle(i);
132 a2[i] = v2->trackParticle(i);
133 }
134 std::sort(a1.begin(), a1.end());
135 std::sort(a2.begin(), a2.end());
136 return a1 == a2;
137}
138
139template< size_t NTracks>
141 for (const xAOD::Vertex* a : *c){
142 if(VerticesMatchTracks<NTracks>(a,v)) return a;
143 }
144 return nullptr;
145}
146#endif // DERIVATIONFRAMEWORK_PVCASCADETOOLS_H
: B-physics xAOD helpers.
static Double_t a
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
static bool uniqueCollection(const std::vector< const xAOD::TrackParticle * > &)
size_t m_PV_minNTracks
minimum number of tracks required in PVs considered
double DistInZtoDOCA(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &obj, const xAOD::Vertex *vertex) const
Calculate the distance along z axis between the PV and SV's DOCA point w.r.t.
static bool LinkVertices(SG::AuxElement::Decorator< VertexLinkVector > &decor, const std::vector< const xAOD::Vertex * > &vertices, const xAOD::VertexContainer *vertexContainer, const xAOD::Vertex *vert)
size_t FindLowZIndex(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &Obj, const std::vector< const xAOD::Vertex * > &PVlist, const size_t PV_minNTracks=0) const
Returns the index integer of the vertex with the lowest Z in relation to the given vertex.
Amg::Vector3D GetBeamSpot() const
Get the current beamspot position either from cache or from BeamCondSvc.
static std::vector< const xAOD::TrackParticle * > CollectAllChargedTracks(const std::vector< xAOD::Vertex * > &cascadeVertices)
void FillBPhysHelper(const std::vector< TLorentzVector > &mom, Amg::MatrixX cov, xAOD::BPhysHelper &vtx, const xAOD::Vertex *refPV, const xAOD::VertexContainer *refPvContainer, xAOD::BPhysHelper::pv_type pvtype, int) const
Fills the BPhysHelper object with the standard parameters.
static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const xAOD::TrackParticleContainer *importedTrackCollection)
void SetMinNTracksInPV(size_t PV_minNTracks)
Set the minimum number of tracks required for primary vertices to be considered for primary vertex as...
ElementLink< xAOD::VertexContainer > VertexLink
Amg::Vector3D DocaExtrapToBeamSpot(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &obj) const
Point of DOCA w.r.t.
static const xAOD::Vertex * FindVertex(const xAOD::VertexContainer *c, const xAOD::Vertex *v)
static bool VerticesMatchTracks(const xAOD::Vertex *v1, const xAOD::Vertex *v2)
static std::vector< const xAOD::Vertex * > GetGoodPV(const xAOD::VertexContainer *pvContainer)
Static method call with DerivationFramework::BPhysDerHelpers::GetGoodPV Returns a std::vector contain...
static void SetVectorInfo(xAOD::BPhysHelper &, const Trk::VxCascadeInfo *)
void ProcessVertex(const std::vector< TLorentzVector > &mom, Amg::MatrixX cov, xAOD::BPhysHypoHelper &vtx, xAOD::BPhysHelper::pv_type pvtype, double mass) const
StatusCode FillCandwithRefittedVertices(bool refitPV, const xAOD::VertexContainer *pvContainer, xAOD::VertexContainer *refPvContainer, const Analysis::PrimaryVertexRefitter *pvRefitter, size_t in_PV_max, int DoVertexType, Trk::VxCascadeInfo *casc, int index, double mass, xAOD::BPhysHypoHelper &vtx)
size_t FindLowA0Index(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &Obj, const std::vector< const xAOD::Vertex * > &PVlist, const size_t PV_minNTracks=0) const
Returns the index integer of the vertex with the lowest A0 in relation to the given vertex.
size_t FindLowZ0BAIndex(const std::vector< TLorentzVector > &mom, const xAOD::BPhysHelper &obj, const std::vector< const xAOD::Vertex * > &PVlist, const size_t PV_minNTracks=0) const
Find the index for the PV with the lowest distance in z of the SV's DOCA point w.r....
BPhysPVCascadeTools(const CascadeTools *cascadeTools)
pv_type
: Enum type of the PV
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 3, 1 > Vector3D
The namespace of all packages in PhysicsAnalysis/JetTagging.
THE reconstruction tool.
Ensure that the ATLAS eigen extensions are properly loaded.
Definition index.py:1
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
EventInfo_v1 EventInfo
Definition of the latest event info version.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".