rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
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 {
21 setName("VetoedFinalState");
22 declare(fsp, "FS");
23 }
24
26 VetoedFinalState(const FinalState& fsp, const Cut& cut)
27 : VetoedFinalState(fsp, vector<Cut>{cut})
28 { }
29
31 VetoedFinalState(const vector<Cut>& cuts)
33 { }
34
36 VetoedFinalState(const Cut& cut)
37 : VetoedFinalState(FinalState(), vector<Cut>{cut})
38 { }
39
41 VetoedFinalState(const FinalState& fsp, const vector<PdgId>& vetopids)
42 : VetoedFinalState(fsp, {})
43 {
44 _vetoCuts.reserve(vetopids.size());
45 for (PdgId pid : vetopids) addVeto(pid);
46 }
47
49 VetoedFinalState(const FinalState& fsp, PdgId vetopid)
50 : VetoedFinalState(fsp, vector<Cut>{Cuts::pid == vetopid})
51 { }
52
54 VetoedFinalState(const vector<PdgId>& vetopids)
56 {
57 _vetoCuts.reserve(vetopids.size());
58 for (PdgId pid : vetopids) addVeto(pid);
59 }
60
62 VetoedFinalState(PdgId vetopid)
63 : VetoedFinalState(FinalState(), vector<Cut>{Cuts::pid == vetopid})
64 { }
65
68 : VetoedFinalState(fsp, vector<Cut>())
69 { }
70
73 : VetoedFinalState(FinalState(), vector<Cut>())
74 { }
75
76
79
81
83 using Projection::operator =;
84
85
87 const vector<Cut>& vetoDetails() const {
88 return _vetoCuts;
89 }
90 //using vetos = vetoDetails;
91
92
94 VetoedFinalState& addVeto(const Cut& cut) {
95 _vetoCuts.push_back(cut);
96 return *this;
97 }
98
100 VetoedFinalState& addVeto(PdgId pid, const Cut& cut=Cuts::OPEN) {
101 _vetoCuts.push_back(Cuts::pid == pid && cut);
102 return *this;
103 }
104
106 VetoedFinalState& addVetoPair(PdgId pid, const Cut& cut=Cuts::OPEN) {
107 _vetoCuts.push_back(Cuts::abspid == pid && cut);
108 return *this;
109 }
110
111
115 VetoedFinalState& addVetoDetail(PdgId pid, double ptmin, double ptmax=std::numeric_limits<double>::max()) {
116 return addVeto(pid, Cuts::ptIn(ptmin, ptmax));
117 }
118 //const auto addVeto = addVetoDetail;
119
124 VetoedFinalState& addVetoPairDetail(PdgId pid, double ptmin, double ptmax=std::numeric_limits<double>::max()) {
125 return addVetoPair(pid, Cuts::ptIn(ptmin, ptmax));
126 }
127 //using addVetoPair = addVetoPairDetail;
128
131 return addVeto(pid);
132 }
133 //using addVeto = addVetoId;
134
140 return addVetoPair(pid);
141 }
142 //using addVetoPair = addVetoPairId;
143
144
146 VetoedFinalState& setVetoDetails(const vector<Cut>& cuts) {
147 _vetoCuts = cuts;
148 return *this;
149 }
150 //const auto setVetos = setVetoDetails;
151
152
155 addVetoPairId(PID::NU_E);
156 addVetoPairId(PID::NU_MU);
157 addVetoPairId(PID::NU_TAU);
158 return *this;
159 }
160
161
165 VetoedFinalState& addCompositeMassVeto(double mass, double width, int nProducts=2) {
166 const double halfWidth = 0.5*width;
167 pair<double,double> massRange(mass-halfWidth, mass+halfWidth);
168 _compositeVetoes.insert(make_pair(nProducts, massRange));
169 _nCompositeDecays.insert(nProducts);
170 return *this;
171 }
172
173
178 _parentVetoes.insert(pid);
179 return *this;
180 }
181
184 const string name = "FS_" + to_str(_vetofsnames.size());
185 declare(fs, name);
186 _vetofsnames.insert(name);
187 return *this;
188 }
195
196
199 _vetoCuts.clear();
200 return *this;
201 }
202
203
205 void project(const Event& e);
206
208 CmpState compare(const Projection& p) const;
209
210
211 protected:
212
214 vector<Cut> _vetoCuts;
215
218 multimap<PdgId, pair<double,double> > _compositeVetoes;
219 set<int> _nCompositeDecays;
220
222 set<PdgId> _parentVetoes;
223
225 set<string> _vetofsnames;
226
227 };
228
229
230}
231
232
233#endif
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
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:175
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:148
virtual std::string name() const
Get the name of the projection.
Definition Projection.hh:62
FS modifier to exclude classes of particles from the final state.
Definition VetoedFinalState.hh:11
const vector< Cut > & vetoDetails() const
Get the list of particle IDs and ranges to veto.
Definition VetoedFinalState.hh:87
VetoedFinalState(const Cut &cut)
Constructor with a default FinalState and a single cut to veto.
Definition VetoedFinalState.hh:36
VetoedFinalState(const FinalState &fsp, const Cut &cut)
Constructor with a specific FinalState and a single cut to veto.
Definition VetoedFinalState.hh:26
VetoedFinalState & addVetoPairId(PdgId pid)
Add a particle/antiparticle pair to veto.
Definition VetoedFinalState.hh:139
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:106
VetoedFinalState(const vector< PdgId > &vetopids)
Constructor with a default FinalState and a PID list to veto.
Definition VetoedFinalState.hh:54
VetoedFinalState & reset()
Clear the list of particle IDs and ranges to veto.
Definition VetoedFinalState.hh:198
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:124
VetoedFinalState & setVetoDetails(const vector< Cut > &cuts)
Set the list of particle selections to veto.
Definition VetoedFinalState.hh:146
VetoedFinalState(const FinalState &fsp)
Constructor with specific FinalState but no cuts.
Definition VetoedFinalState.hh:67
VetoedFinalState & vetoNeutrinos()
Veto all neutrinos (convenience method)
Definition VetoedFinalState.hh:154
VetoedFinalState & vetoFinalState(const ParticleFinder &fs)
Veto particles from a supplied final state.
Definition VetoedFinalState.hh:183
VetoedFinalState()
Default constructor with default FinalState and no cuts.
Definition VetoedFinalState.hh:72
VetoedFinalState & addCompositeMassVeto(double mass, double width, int nProducts=2)
Definition VetoedFinalState.hh:165
VetoedFinalState(PdgId vetopid)
Constructor with a default FinalState and a PID to veto.
Definition VetoedFinalState.hh:62
VetoedFinalState & addDecayProductsVeto(PdgId pid)
Definition VetoedFinalState.hh:177
VetoedFinalState & addVetoOnThisFinalState(const ParticleFinder &fs)
Definition VetoedFinalState.hh:192
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:115
VetoedFinalState(const FinalState &fsp, const vector< PdgId > &vetopids)
Constructor with a specific FinalState and a PID list to veto.
Definition VetoedFinalState.hh:41
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:49
VetoedFinalState & addVeto(const Cut &cut)
Add a particle selection to be vetoed from the final state.
Definition VetoedFinalState.hh:94
VetoedFinalState & addVeto(PdgId pid, const Cut &cut=Cuts::OPEN)
Add a particle selection to be vetoed from the final state.
Definition VetoedFinalState.hh:100
VetoedFinalState & addVetoId(PdgId pid)
Add a particle ID to veto (all range will be vetoed)
Definition VetoedFinalState.hh:130
VetoedFinalState(const vector< Cut > &cuts)
Constructor with a default FinalState and a cuts list to veto.
Definition VetoedFinalState.hh:31
double mass(const FourMomentum &a, const FourMomentum &b)
Calculate mass of two 4-vectors.
Definition Vector4.hh:1461
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:67
Definition MC_CENT_PPB_Projections.hh:10