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 HepPDT{
29 class ParticleDataTable;
30}
31
32namespace DerivationFramework {
33
36 typedef std::vector<VertexLink> VertexLinkVector;
37 private:
40
43
44 public:
46 BPhysPVCascadeTools(const CascadeTools *cascadeTools);
47 BPhysPVCascadeTools(const CascadeTools *cascadeTools,
48 const xAOD::EventInfo*);
49
50
51 void ProcessVertex(const std::vector<TLorentzVector> &mom, Amg::MatrixX cov, xAOD::BPhysHypoHelper &vtx, xAOD::BPhysHelper::pv_type pvtype, double mass) const;
52
54 void FillBPhysHelper(const std::vector<TLorentzVector> &mom, Amg::MatrixX cov, xAOD::BPhysHelper &vtx, const xAOD::Vertex* refPV,const xAOD::VertexContainer* refPvContainer,
55 xAOD::BPhysHelper::pv_type pvtype, int) const;
56
58 size_t FindLowZIndex(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;
62 size_t FindLowA0Index(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &Obj,
63 const std::vector<const xAOD::Vertex*> &PVlist,
64 const size_t PV_minNTracks=0) const;
65
66 template< size_t NTracks> //NTracks = number of tracks in this type of vertex, if this is not known do not use this method
67 static bool VerticesMatchTracks(const xAOD::Vertex* v1, const xAOD::Vertex* v2);
68
69 template< size_t NTracks>
70 static const xAOD::Vertex* FindVertex(const xAOD::VertexContainer* c, const xAOD::Vertex* v);
71
76 static std::vector<const xAOD::Vertex*> GetGoodPV(const xAOD::VertexContainer* pvContainer);
77
84 void SetMinNTracksInPV(size_t PV_minNTracks);
85
90 [[nodiscard]] Amg::Vector3D GetBeamSpot() const;
91
94 size_t FindLowZ0BAIndex(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj,
95 const std::vector<const xAOD::Vertex*> &PVlist,
96 const size_t PV_minNTracks=0) const;
99 double DistInZtoDOCA(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj,
100 const xAOD::Vertex* vertex) const;
103 Amg::Vector3D DocaExtrapToBeamSpot(const std::vector<TLorentzVector> &mom, const xAOD::BPhysHelper &obj) const;
104
105 static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const xAOD::TrackParticleContainer* importedTrackCollection);
106 static void PrepareVertexLinks(Trk::VxCascadeInfo *result, const std::vector<const xAOD::TrackParticleContainer*>& );
107
108 StatusCode FillCandwithRefittedVertices( bool refitPV,
109 const xAOD::VertexContainer* pvContainer, xAOD::VertexContainer* refPvContainer,
110 const Analysis::PrimaryVertexRefitter *pvRefitter, size_t in_PV_max, int DoVertexType,
111 Trk::VxCascadeInfo* casc, int index,
112 double mass, xAOD::BPhysHypoHelper &vtx);
113
114 static std::vector<const xAOD::TrackParticle*> CollectAllChargedTracks(const std::vector<xAOD::Vertex*> &cascadeVertices);
115
117 static bool uniqueCollection(const std::vector<const xAOD::TrackParticle*>&);
118 static bool uniqueCollection(const std::vector<const xAOD::TrackParticle*>&, const std::vector<const xAOD::TrackParticle*>&);
119 static bool LinkVertices(SG::AuxElement::Decorator<VertexLinkVector> &decor, const std::vector<const xAOD::Vertex*>& vertices,
120 const xAOD::VertexContainer* vertexContainer, const xAOD::Vertex* vert);
121 static double getParticleMass(const HepPDT::ParticleDataTable* pdt, int pdg);
122 }; // class BPhysPVCascadeTools
123
124} // namespace DerivationFramework
125
126
127//added by ab
128template< size_t NTracks>
130{
131 if(v1->nTrackParticles() != v2->nTrackParticles()) return false;
132 assert(v1->nTrackParticles() == NTracks);
133 std::array<const xAOD::TrackParticle*, NTracks> a1;
134 std::array<const xAOD::TrackParticle*, NTracks> a2;
135 for(size_t i=0;i<NTracks;i++){
136 a1[i] = v1->trackParticle(i);
137 a2[i] = v2->trackParticle(i);
138 }
139 std::sort(a1.begin(), a1.end());
140 std::sort(a2.begin(), a2.end());
141 return a1 == a2;
142}
143
144template< size_t NTracks>
146 for (const xAOD::Vertex* a : *c){
147 if(VerticesMatchTracks<NTracks>(a,v)) return a;
148 }
149 return nullptr;
150}
151#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)
static double getParticleMass(const HepPDT::ParticleDataTable *pdt, int pdg)
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)
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:575
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".