ATLAS Offline Software
JpsiUpsilonCommon.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 
6 #ifndef JPSIUPSILONCOMMON
7 #define JPSIUPSILONCOMMON
8 
9 #include <vector>
11 #include "xAODMuon/MuonContainer.h"
12 #include <algorithm>
14 #include "xAODTracking/Vertex.h"
15 #include <array>
16 namespace xAOD{
17  class BPhysHelper;
18 }
19 
20 namespace Analysis {
21  class PrimaryVertexRefitter;
24  bool m_cleanup;
25  public:
26  const xAOD::Vertex* get() const { return m_vtx; }
27  ~CleanUpVertex(){ if (m_cleanup) delete m_vtx; }
28  CleanUpVertex(const xAOD::Vertex* vtx, bool cleanup) : m_vtx(vtx), m_cleanup(cleanup) {}
29  CleanUpVertex(const CleanUpVertex&) = delete;
30  CleanUpVertex(CleanUpVertex&& vtx) noexcept {
31  m_vtx = vtx.m_vtx;
32  m_cleanup = vtx.m_cleanup;
33  vtx.m_cleanup = false;
34  vtx.m_vtx = nullptr;
35  }
37  };
38 
40  public:
41 
42  static double getPt(const xAOD::TrackParticle*, const xAOD::TrackParticle*);
43  static double getPt(const xAOD::TrackParticle* trk1, const xAOD::TrackParticle* trk2, const xAOD::TrackParticle* trk3);
44  static double getPt(const xAOD::TrackParticle*, const xAOD::TrackParticle*, const xAOD::TrackParticle*, const xAOD::TrackParticle*);
45  static bool isContainedIn(const xAOD::TrackParticle*, const std::vector<const xAOD::TrackParticle*>&);
46  static bool isContainedIn(const xAOD::TrackParticle*, const xAOD::MuonContainer*);
47  static bool cutRangeOR(const std::vector<double> &values, double min, double max);
48  static bool cutRange(double value, double min, double max);
49  static bool cutAcceptGreaterOR(const std::vector<double> &values, double min);
50  static bool cutAcceptGreater(double value, double min);
52  template< size_t N>
53  static bool isContainedIn(const xAOD::TrackParticle*, const std::array<const xAOD::TrackParticle*, N>& );
54  static void RelinkVertexTracks(const std::vector<const xAOD::TrackParticleContainer*> &trkcols, xAOD::Vertex* vtx);
55  static void RelinkVertexMuons(const std::vector<const xAOD::MuonContainer*>& muoncols, xAOD::Vertex* vtx);
56 
57  };
58 
59 template< size_t N>
60 bool JpsiUpsilonCommon::isContainedIn(const xAOD::TrackParticle* t, const std::array<const xAOD::TrackParticle*, N>& cont )
61  {
62  return std::find(cont.begin(), cont.end(), t) != cont.end();
63  }
64 }
65 
66 #endif
67 
Analysis::JpsiUpsilonCommon::ClosestRefPV
static Analysis::CleanUpVertex ClosestRefPV(xAOD::BPhysHelper &, const xAOD::VertexContainer *, const Analysis::PrimaryVertexRefitter *)
Definition: JpsiUpsilonCommon.cxx:94
Analysis::CleanUpVertex
Definition: JpsiUpsilonCommon.h:22
Analysis::CleanUpVertex::get
const xAOD::Vertex * get() const
Definition: JpsiUpsilonCommon.h:26
Analysis::CleanUpVertex::CleanUpVertex
CleanUpVertex(CleanUpVertex &&vtx) noexcept
Definition: JpsiUpsilonCommon.h:30
VertexContainerFwd.h
xAOD::BPhysHelper
Definition: BPhysHelper.h:71
Analysis::CleanUpVertex::CleanUpVertex
CleanUpVertex(const CleanUpVertex &)=delete
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
Analysis::JpsiUpsilonCommon::RelinkVertexMuons
static void RelinkVertexMuons(const std::vector< const xAOD::MuonContainer * > &muoncols, xAOD::Vertex *vtx)
Definition: JpsiUpsilonCommon.cxx:148
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
Analysis::CleanUpVertex::~CleanUpVertex
~CleanUpVertex()
Definition: JpsiUpsilonCommon.h:27
Analysis::CleanUpVertex::CleanUpVertex
CleanUpVertex(const xAOD::Vertex *vtx, bool cleanup)
Definition: JpsiUpsilonCommon.h:28
Analysis::JpsiUpsilonCommon::cutAcceptGreaterOR
static bool cutAcceptGreaterOR(const std::vector< double > &values, double min)
Definition: JpsiUpsilonCommon.cxx:87
athena.value
value
Definition: athena.py:124
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
Analysis::JpsiUpsilonCommon::isContainedIn
static bool isContainedIn(const xAOD::TrackParticle *, const std::vector< const xAOD::TrackParticle * > &)
Definition: JpsiUpsilonCommon.cxx:58
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Analysis::JpsiUpsilonCommon::cutRange
static bool cutRange(double value, double min, double max)
Definition: JpsiUpsilonCommon.cxx:72
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
Analysis::CleanUpVertex::operator=
CleanUpVertex & operator=(const CleanUpVertex &)=delete
Analysis::JpsiUpsilonCommon::cutAcceptGreater
static bool cutAcceptGreater(double value, double min)
Definition: JpsiUpsilonCommon.cxx:83
Analysis::CleanUpVertex::m_cleanup
bool m_cleanup
Definition: JpsiUpsilonCommon.h:24
Analysis::PrimaryVertexRefitter
Definition: PrimaryVertexRefitter.h:26
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
Vertex.h
Analysis::JpsiUpsilonCommon::RelinkVertexTracks
static void RelinkVertexTracks(const std::vector< const xAOD::TrackParticleContainer * > &trkcols, xAOD::Vertex *vtx)
Definition: JpsiUpsilonCommon.cxx:126
Analysis::CleanUpVertex::m_vtx
const xAOD::Vertex * m_vtx
Definition: JpsiUpsilonCommon.h:23
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
MuonContainer.h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
TrackParticleFwd.h
Analysis::JpsiUpsilonCommon
Definition: JpsiUpsilonCommon.h:39
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
Analysis::JpsiUpsilonCommon::getPt
static double getPt(const xAOD::TrackParticle *, const xAOD::TrackParticle *)
Definition: JpsiUpsilonCommon.cxx:17
Analysis::JpsiUpsilonCommon::cutRangeOR
static bool cutRangeOR(const std::vector< double > &values, double min, double max)
Definition: JpsiUpsilonCommon.cxx:76