DAS  3.0
Das Analysis System
ZmmYCommon.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 
8 
9 namespace DAS::Unfolding::ZmmY {
10 
11 #if !defined(__CLING__) || defined(__ROOTCLING__)
12 enum class EventCategory {
15  NotSelected,
16  MuMu,
17  MuMuGamma,
18 };
19 
26 template<class Muon, class Photon>
27 struct EventInfo
28 {
29  // Phase space cuts.
30  constexpr static double minMuon0Pt = 20,
31  minMuon1Pt = 15,
32  maxMuonEta = 2.4,
33  minPhotonPt = 20,
34  maxPhotonEta = 2.4,
35  minZMass = 76,
36  maxZMass = 106,
37  minMuMuMass = 40;
38  static_assert(minMuon0Pt >= minMuon1Pt, "leading pT always >= subleading");
39  static_assert(minZMass < maxZMass, "min mass always < max mass");
40 
43 
46 
48  float mMuMu;
49 
51  std::vector<Photon> selectedPhotons;
52 
54  float mMuMuGamma;
55 
59  float weight;
60 
65  , selectedPhotons{}
66  , mMuMu(-1)
67  , mMuMuGamma(-1)
68  , weight(0)
69  {
70  }
71 
74  EventInfo (const GenEvent* gEv,
75  const RecEvent* rEv,
76  const std::vector<Muon>& muons,
77  const std::vector<Photon>& photons,
78  const Uncertainties::Variation& v);
79 
80 private:
83  bool IsMassOnZPeak (float mass) const
84  {
85  return mass > minZMass && mass < maxZMass;
86  }
87 
92  const std::vector<Muon>& muons, const Uncertainties::Variation& v) const
93  {
94  if (muons.size() < 2) return {};
95 
97  const auto& m0 = muons[0],
98  & m1 = muons[1];
99 
100  const auto p0 = m0.CorrP4(v),
101  p1 = m1.CorrP4(v);
102 
103  if (m0.Q * m1.Q != -1 // opposite charges
104  || p0.Pt() < minMuon0Pt
105  || p1.Pt() < minMuon1Pt
106  || abs(p0.Eta()) >= maxMuonEta
107  || abs(p1.Eta()) >= maxMuonEta)
108  return {};
109 
110  return m0 + m1;
111  }
112 
117  bool IsGoodPhoton (const RecPhoton& photon,
118  const Uncertainties::Variation& v) const
119  {
120  auto p4 = photon.CorrP4(v);
121  return photon.Weight(v) != 0
122  && p4.Pt() > minPhotonPt && std::abs(p4.Eta()) < maxPhotonEta;
123  }
124 
127  bool IsGoodPhoton (const GenPhoton& photon,
128  const Uncertainties::Variation& v) const
129  {
130  auto p4 = photon.CorrP4(v);
131  return photon.Weight(v) != 0
132  && photon.zAncestor
133  && p4.Pt() > minPhotonPt && std::abs(p4.Eta()) < maxPhotonEta;
134  }
135 };
136 
137 template<class Muon, class Photon>
139  const RecEvent* rEv,
140  const std::vector<Muon>& muons,
141  const std::vector<Photon>& photons,
142  const Uncertainties::Variation& v)
143  : EventInfo()
144 {
145  weight = 1;
146  if (rEv) weight *= rEv->Weight(v);
147  if (gEv) weight *= gEv->Weight(v);
148 
149  // Start by looking at muons.
150  dimuon = SelectMuons(muons, v);
151  if (!dimuon) return;
152 
153  mMuMu = dimuon.CorrP4(v).M();
154 
155  // The dimuon system is on the Z peak. Don't consider photons.
156  if (IsMassOnZPeak(mMuMu)) {
158  weight *= dimuon.Weight(v);
159  return;
160  }
161 
162  // Do not consider muon pairs below minMuMuMass. This reduces
163  // backgrounds (e.g. vector meson + gamma).
164  // We also remove here events with mMuMu above the Z peak, as there is
165  // no way adding photons can bring them back to the peak.
166  if (mMuMu < minMuMuMass || mMuMu > minZMass)
167  return;
168 
169  // Now get photons. We must copy them because the photons collection could
170  // be reused with another variation.
171  std::copy_if(photons.begin(), photons.end(),
172  std::back_inserter(selectedPhotons),
173  [&] (auto photon) { return IsGoodPhoton(photon, v); });
174 
175  if (selectedPhotons.empty()) return;
176 
179  mMuMuGamma = (dimuon.CorrP4(v) + selectedPhotons[0].CorrP4(v)).M();
180  if (IsMassOnZPeak(mMuMuGamma)) {
182  weight *= dimuon.Weight(v) * selectedPhotons[0].Weight(v);
183  }
184 }
185 #endif
186 
187 } // end of DAS::Unfolding::ZmmY namespace
DAS::Unfolding::ZmmY::EventInfo::minZMass
constexpr static double minZMass
mZ - 15 GeV
Definition: ZmmYCommon.h:35
DAS::Di::Weight
double Weight(const Uncertainties::Variation &v=Uncertainties::nominal) const override
Definition: Di.h:73
DAS::Unfolding::ZmmY::EventInfo::category
EventCategory category
The event category. This determines which other fields are valid.
Definition: ZmmYCommon.h:38
DAS::PhysicsObject::Weight
double Weight(const Uncertainties::Variation &v) const final
< weight
Definition: PhysicsObject.h:67
DAS::PhysicsObject::CorrP4
FourVector CorrP4(size_t i=0) const
corrected 4-vector
Definition: PhysicsObject.h:54
Ntupliser_cfg.muons
string muons
Definition: Ntupliser_cfg.py:43
DAS::Unfolding::ZmmY::EventInfo::IsGoodPhoton
bool IsGoodPhoton(const RecPhoton &photon, const Uncertainties::Variation &v) const
Definition: ZmmYCommon.h:117
DAS::RecEvent
Definition: Event.h:52
DAS::Unfolding::ZmmY::EventInfo::weight
float weight
Definition: ZmmYCommon.h:59
Event.h
DAS::Unfolding::ZmmY::EventInfo
Definition: ZmmYCommon.h:28
DAS::Unfolding::ZmmY::EventInfo::mMuMu
float mMuMu
The invariant mass of the dimuon system. Invalid for NotSelected events.
Definition: ZmmYCommon.h:48
DAS::Unfolding::ZmmY::EventCategory::MuMuGamma
@ MuMuGamma
decay candidates.
DAS::Unfolding::ZmmY::EventInfo::maxMuonEta
constexpr static double maxMuonEta
Muon chamber acceptance.
Definition: ZmmYCommon.h:32
DAS::GenPhoton
class GenPhoton
Definition: Photon.h:13
DAS::Unfolding::ZmmY::EventInfo::minMuon0Pt
constexpr static double minMuon0Pt
Scale factors start at 15 GeV.
Definition: ZmmYCommon.h:30
DAS::Di< const Muon, const Muon >
DAS::Unfolding::ZmmY
Definition: BF.h:14
DAS::AbstractEvent::Weight
double Weight(const Uncertainties::Variation &v) const
< weight
Definition: Event.h:25
DAS::Unfolding::ZmmY::EventInfo::mMuMuGamma
float mMuMuGamma
Mass of the dimuon + photon system. Only valid for MuMuGamma events.
Definition: ZmmYCommon.h:54
DAS::Unfolding::ZmmY::EventInfo::EventInfo
EventInfo()
Default constructor to enable use as a variable in fillers.
Definition: ZmmYCommon.h:63
DAS::Unfolding::ZmmY::EventInfo::IsGoodPhoton
bool IsGoodPhoton(const GenPhoton &photon, const Uncertainties::Variation &v) const
Checks if a generated photon passes the selection criteria.
Definition: ZmmYCommon.h:127
DAS::Unfolding::ZmmY::EventCategory::MuMu
@ MuMu
Dimuon candidates close to the Z peak.
Di.h
Photon.h
DAS::Unfolding::ZmmY::EventInfo::EventInfo
EventInfo(const GenEvent *gEv, const RecEvent *rEv, const std::vector< Muon > &muons, const std::vector< Photon > &photons, const Uncertainties::Variation &v)
Main constructor.
Definition: ZmmYCommon.h:138
DAS::Unfolding::ZmmY::EventInfo::minMuon1Pt
constexpr static double minMuon1Pt
Dimuon trigger.
Definition: ZmmYCommon.h:31
DAS::Unfolding::ZmmY::EventInfo::selectedPhotons
std::vector< Photon > selectedPhotons
Considered photons. Only valid for MuMuGamma events.
Definition: ZmmYCommon.h:51
DAS::Unfolding::ZmmY::EventInfo::SelectMuons
DAS::Di< const Muon, const Muon > SelectMuons(const std::vector< Muon > &muons, const Uncertainties::Variation &v) const
Definition: ZmmYCommon.h:91
DAS::Unfolding::ZmmY::EventInfo::minMuMuMass
constexpr static double minMuMuMass
Trigger efficiency.
Definition: ZmmYCommon.h:37
DAS::GenPhoton::zAncestor
bool zAncestor
Z boson among the particle mothers.
Definition: Photon.h:17
DAS::Unfolding::ZmmY::EventInfo::maxPhotonEta
constexpr static double maxPhotonEta
Muon chamber acceptance.
Definition: ZmmYCommon.h:34
DAS::Unfolding::ZmmY::EventInfo::maxZMass
constexpr static double maxZMass
mZ + 15 GeV
Definition: ZmmYCommon.h:36
DAS::Unfolding::ZmmY::EventInfo::dimuon
Di< const Muon, const Muon > dimuon
The dimuon system. Invalid for NotSelected events.
Definition: ZmmYCommon.h:45
Ntupliser_cfg.photons
string photons
Definition: Ntupliser_cfg.py:44
DAS::Di::CorrP4
FourVector CorrP4(const Uncertainties::Variation &v=Uncertainties::nominal) const override
Definition: Di.h:46
DAS::Unfolding::ZmmY::EventCategory::NotSelected
@ NotSelected
The event fails some selection.
DAS::Unfolding::ZmmY::EventInfo::minPhotonPt
constexpr static double minPhotonPt
Scale factors start at 20 GeV.
Definition: ZmmYCommon.h:33
DAS::Unfolding::ZmmY::EventInfo::IsMassOnZPeak
bool IsMassOnZPeak(float mass) const
Checks if a mass should be considered close to the Z peak.
Definition: ZmmYCommon.h:83
DAS::Uncertainties::Variation
Definition: Variation.h:22
DAS::RecPhoton
class RecPhoton
Definition: Photon.h:27
DAS::Unfolding::ZmmY::EventCategory
EventCategory
Event categories used in the analysis.
Definition: ZmmYCommon.h:14
DAS::GenEvent
Definition: Event.h:38