ATLAS Offline Software
Loading...
Searching...
No Matches
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>
12#include <algorithm>
14#include "xAODTracking/Vertex.h"
15#include <array>
16#include <span>
17
18namespace xAOD{
19 class BPhysHelper;
20}
21
22namespace Analysis {
27 public:
28 const xAOD::Vertex* get() const { return m_vtx; }
29 ~CleanUpVertex(){ if (m_cleanup) delete m_vtx; }
30 CleanUpVertex(const xAOD::Vertex* vtx, bool cleanup) : m_vtx(vtx), m_cleanup(cleanup) {}
31 CleanUpVertex(const CleanUpVertex&) = delete;
32 CleanUpVertex(CleanUpVertex&& vtx) noexcept {
33 m_vtx = vtx.m_vtx;
34 m_cleanup = vtx.m_cleanup;
35 vtx.m_cleanup = false;
36 vtx.m_vtx = nullptr;
37 }
39 };
40
42 public:
43
44 static double getInvariantMass(const xAOD::TrackParticle* trk1, double mass1, const xAOD::TrackParticle* trk2, double mass2);
45 static double getInvariantMass(std::span<const xAOD::TrackParticle*> trk,
46 std::span<const double> masses);
47 static double getPt(std::span<const xAOD::TrackParticle* const> tracks);
48 static bool isContainedIn(const xAOD::TrackParticle*, std::span<const xAOD::TrackParticle* const>) noexcept;
49 static bool isContainedIn(const xAOD::TrackParticle*, const xAOD::MuonContainer*);
50 static bool cutRangeOR(std::span<double const> values, double min, double max) noexcept;
51 static bool cutRange(double value, double min, double max) noexcept;
52 static bool cutAcceptGreaterOR(std::span<double const> values, double min) noexcept;
53 static bool cutAcceptGreater(double value, double min) noexcept;
55 static void RelinkVertexTracks(std::span<const xAOD::TrackParticleContainer* const> trkcols, xAOD::Vertex* vtx);
56 static void RelinkVertexMuons(std::span<const xAOD::MuonContainer* const> muoncols, xAOD::Vertex* vtx);
57 template <typename... Tracks>
58 static double getPt(const xAOD::TrackParticle* first, const Tracks*... rest)
59 {
60 // Start with the four-momentum of the first track
61 auto momentum = first->genvecP4();
62
63 // Fold the rest of the tracks into the sum using +=
64 // (The expansion applies += to each subsequent genvecP4())
65 ( (momentum += rest->genvecP4()), ... );
66
67 return std::sqrt(momentum.Perp2());
68 }
69 };
70
71
72}
73
74#endif
75
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
CleanUpVertex(const CleanUpVertex &)=delete
const xAOD::Vertex * m_vtx
CleanUpVertex(const xAOD::Vertex *vtx, bool cleanup)
CleanUpVertex(CleanUpVertex &&vtx) noexcept
CleanUpVertex & operator=(const CleanUpVertex &)=delete
const xAOD::Vertex * get() const
static double getPt(const xAOD::TrackParticle *first, const Tracks *... rest)
static bool cutRange(double value, double min, double max) noexcept
static void RelinkVertexMuons(std::span< const xAOD::MuonContainer *const > muoncols, xAOD::Vertex *vtx)
static double getInvariantMass(const xAOD::TrackParticle *trk1, double mass1, const xAOD::TrackParticle *trk2, double mass2)
static void RelinkVertexTracks(std::span< const xAOD::TrackParticleContainer *const > trkcols, xAOD::Vertex *vtx)
static bool cutAcceptGreaterOR(std::span< double const > values, double min) noexcept
static Analysis::CleanUpVertex ClosestRefPV(xAOD::BPhysHelper &, const xAOD::VertexContainer *, const Analysis::PrimaryVertexRefitter *)
static bool cutRangeOR(std::span< double const > values, double min, double max) noexcept
static bool isContainedIn(const xAOD::TrackParticle *, std::span< const xAOD::TrackParticle *const >) noexcept
static double getPt(std::span< const xAOD::TrackParticle *const > tracks)
static bool cutAcceptGreater(double value, double min) noexcept
The namespace of all packages in PhysicsAnalysis/JetTagging.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
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.
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".