Rivet API documentation

Rivet 4.1.3
VetoedFinalState.hh
1// -*- C++ -*-
2#ifndef RIVET_VetoedFinalState_HH
3#define RIVET_VetoedFinalState_HH
4
5#include "Rivet/Projections/FinalState.hh"
6
7namespace Rivet {
8
9
12 public:
13
16
18 VetoedFinalState(const FinalState& fsp, const vector<Cut>& cuts)
19 : FinalState(), _vetoCuts(cuts) {
20 setName("VetoedFinalState");
21 declare(fsp, "FS");
22 }
23
25 VetoedFinalState(const FinalState& fsp, const Cut& cut)
26 : VetoedFinalState(fsp, vector<Cut>{cut}) { }
27
29 VetoedFinalState(const vector<Cut>& cuts)
30 : VetoedFinalState(FinalState(), cuts) { }
31
33 VetoedFinalState(const Cut& cut)
34 : VetoedFinalState(FinalState(), vector<Cut>{cut}) { }
35
37 VetoedFinalState(const FinalState& fsp, const vector<PdgId>& vetopids)
38 : VetoedFinalState(fsp, {}) {
39 _vetoCuts.reserve(vetopids.size());
40 for (PdgId pid : vetopids) addVeto(pid);
41 }
42
44 VetoedFinalState(const FinalState& fsp, PdgId vetopid)
45 : VetoedFinalState(fsp, vector<Cut>{Cuts::pid == vetopid}) { }
46
48 VetoedFinalState(const vector<PdgId>& vetopids)
50 _vetoCuts.reserve(vetopids.size());
51 for (PdgId pid : vetopids) addVeto(pid);
52 }
53
55 VetoedFinalState(PdgId vetopid)
56 : VetoedFinalState(FinalState(), vector<Cut>{Cuts::pid == vetopid}) { }
57
60 : VetoedFinalState(fsp, vector<Cut>()) { }
61
64 : VetoedFinalState(FinalState(), vector<Cut>()) { }
65
66
69
71
73 using Projection::operator=;
74
75
77 const vector<Cut>& vetoDetails() const {
78 return _vetoCuts;
79 }
80 //using vetos = vetoDetails;
81
82
84 VetoedFinalState& addVeto(const Cut& cut) {
85 _vetoCuts.push_back(cut);
86 return *this;
87 }
88
90 VetoedFinalState& addVeto(PdgId pid, const Cut& cut = Cuts::OPEN) {
91 _vetoCuts.push_back(Cuts::pid == pid && cut);
92 return *this;
93 }
94
96 VetoedFinalState& addVetoPair(PdgId pid, const Cut& cut = Cuts::OPEN) {
97 _vetoCuts.push_back(Cuts::abspid == pid && cut);
98 return *this;
99 }
100
101
106 double ptmin,
107 double ptmax = std::numeric_limits<double>::max()) {
108 return addVeto(pid, Cuts::ptIn(ptmin, ptmax));
109 }
110 //const auto addVeto = addVetoDetail;
111
117 double ptmin,
118 double ptmax = std::numeric_limits<double>::max()) {
119 return addVetoPair(pid, Cuts::ptIn(ptmin, ptmax));
120 }
121 //using addVetoPair = addVetoPairDetail;
122
125 return addVeto(pid);
126 }
127 //using addVeto = addVetoId;
128
134 return addVetoPair(pid);
135 }
136 //using addVetoPair = addVetoPairId;
137
138
140 VetoedFinalState& setVetoDetails(const vector<Cut>& cuts) {
141 _vetoCuts = cuts;
142 return *this;
143 }
144 //const auto setVetos = setVetoDetails;
145
146
149 addVetoPairId(PID::NU_E);
150 addVetoPairId(PID::NU_MU);
151 addVetoPairId(PID::NU_TAU);
152 return *this;
153 }
154
155
159 VetoedFinalState& addCompositeMassVeto(double mass, double width, int nProducts = 2) {
160 const double halfWidth = 0.5 * width;
161 pair<double, double> massRange(mass - halfWidth, mass + halfWidth);
162 _compositeVetoes.insert(make_pair(nProducts, massRange));
163 _nCompositeDecays.insert(nProducts);
164 return *this;
165 }
166
167
172 _parentVetoes.insert(pid);
173 return *this;
174 }
175
178 const string name = "FS_" + to_str(_vetofsnames.size());
179 declare(fs, name);
180 _vetofsnames.insert(name);
181 return *this;
182 }
183
189
190
193 _vetoCuts.clear();
194 return *this;
195 }
196
197
199 void project(const Event& e);
200
202 CmpState compare(const Projection& p) const;
203
204
205 protected:
206
208 vector<Cut> _vetoCuts;
209
212 multimap<PdgId, pair<double, double>> _compositeVetoes;
213 set<int> _nCompositeDecays;
214
216 set<PdgId> _parentVetoes;
217
219 set<string> _vetofsnames;
220 };
221
222
223}
224
225
226#endif
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
FinalState(const Cut &c=Cuts::OPEN)
Construction using Cuts object.
Base class for projections which return subsets of an event's particles.
Definition ParticleFinder.hh:11
const PROJ & declare(const PROJ &proj, const std::string &name) const
Register a contained projection (user-facing version).
Definition ProjectionApplier.hh:205
Base class for all Rivet projections.
Definition Projection.hh:29
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:146
virtual std::string name() const
Get the name of the projection.
Definition Projection.hh:61
const vector< Cut > & vetoDetails() const
Get the list of particle IDs and ranges to veto.
Definition VetoedFinalState.hh:77
VetoedFinalState(const Cut &cut)
Constructor with a default FinalState and a single cut to veto.
Definition VetoedFinalState.hh:33
VetoedFinalState(const FinalState &fsp, const Cut &cut)
Constructor with a specific FinalState and a single cut to veto.
Definition VetoedFinalState.hh:25
VetoedFinalState & addVetoPairId(PdgId pid)
Add a particle/antiparticle pair to veto.
Definition VetoedFinalState.hh:133
RIVET_DEFAULT_PROJ_CLONE(VetoedFinalState)
Clone on the heap.
VetoedFinalState(const FinalState &fsp, const vector< Cut > &cuts)
Constructor with a specific FinalState and a cuts list to veto.
Definition VetoedFinalState.hh:18
VetoedFinalState & addVetoPair(PdgId pid, const Cut &cut=Cuts::OPEN)
Add a particle/antiparticle selection to be vetoed from the final state.
Definition VetoedFinalState.hh:96
VetoedFinalState(const vector< PdgId > &vetopids)
Constructor with a default FinalState and a PID list to veto.
Definition VetoedFinalState.hh:48
VetoedFinalState & reset()
Clear the list of particle IDs and ranges to veto.
Definition VetoedFinalState.hh:192
VetoedFinalState & addVetoPairDetail(PdgId pid, double ptmin, double ptmax=std::numeric_limits< double >::max())
Add a particle/antiparticle pair to veto in a given range.
Definition VetoedFinalState.hh:116
VetoedFinalState & setVetoDetails(const vector< Cut > &cuts)
Set the list of particle selections to veto.
Definition VetoedFinalState.hh:140
VetoedFinalState(const FinalState &fsp)
Constructor with specific FinalState but no cuts.
Definition VetoedFinalState.hh:59
VetoedFinalState & vetoNeutrinos()
Veto all neutrinos (convenience method).
Definition VetoedFinalState.hh:148
VetoedFinalState & vetoFinalState(const ParticleFinder &fs)
Veto particles from a supplied final state.
Definition VetoedFinalState.hh:177
VetoedFinalState()
Default constructor with default FinalState and no cuts.
Definition VetoedFinalState.hh:63
VetoedFinalState & addCompositeMassVeto(double mass, double width, int nProducts=2)
Definition VetoedFinalState.hh:159
VetoedFinalState(PdgId vetopid)
Constructor with a default FinalState and a PID to veto.
Definition VetoedFinalState.hh:55
VetoedFinalState & addDecayProductsVeto(PdgId pid)
Definition VetoedFinalState.hh:171
VetoedFinalState & addVetoOnThisFinalState(const ParticleFinder &fs)
Definition VetoedFinalState.hh:186
void project(const Event &e)
Apply the projection on the supplied event.
VetoedFinalState & addVetoDetail(PdgId pid, double ptmin, double ptmax=std::numeric_limits< double >::max())
Add a particle ID and range to veto.
Definition VetoedFinalState.hh:105
VetoedFinalState(const FinalState &fsp, const vector< PdgId > &vetopids)
Constructor with a specific FinalState and a PID list to veto.
Definition VetoedFinalState.hh:37
CmpState compare(const Projection &p) const
Compare projections.
VetoedFinalState(const FinalState &fsp, PdgId vetopid)
Constructor with a specific FinalState and a PID to veto.
Definition VetoedFinalState.hh:44
VetoedFinalState & addVeto(const Cut &cut)
Add a particle selection to be vetoed from the final state.
Definition VetoedFinalState.hh:84
VetoedFinalState & addVeto(PdgId pid, const Cut &cut=Cuts::OPEN)
Add a particle selection to be vetoed from the final state.
Definition VetoedFinalState.hh:90
VetoedFinalState & addVetoId(PdgId pid)
Add a particle ID to veto (all range will be vetoed).
Definition VetoedFinalState.hh:124
VetoedFinalState(const vector< Cut > &cuts)
Constructor with a default FinalState and a cuts list to veto.
Definition VetoedFinalState.hh:29
double mass(const FourMomentum &a, const FourMomentum &b)
Calculate mass of two 4-vectors.
Definition Vector4.hh:1474
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:819
int pid(const Particle &p)
Unbound function access to PID code.
Definition ParticleUtils.hh:23
string to_str(const T &x)
Convert any object to a string.
Definition Utils.hh:80
Definition LHCbCommon.hh:9