rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
VetoedFinalState.hh
1 // -*- C++ -*-
2 #ifndef RIVET_VetoedFinalState_HH
3 #define RIVET_VetoedFinalState_HH
4 
5 #include "Rivet/Projections/FinalState.hh"
6 
7 namespace Rivet {
8 
9 
11  class VetoedFinalState : public FinalState {
12  public:
13 
15 
16 
18  VetoedFinalState(const FinalState& fsp, const vector<Cut>& cuts)
19  : FinalState(), _vetoCuts(cuts)
20  {
21  setName("VetoedFinalState");
22  addProjection(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)
32  : VetoedFinalState(FinalState(), 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 
78  //DEPRECATED("Prefer constructors using Cut arguments")
79  VetoedFinalState(const map<PdgId,pair<double,double>>& vetocodes)
81  {
82  for (const auto& it : vetocodes) {
83  addVeto(it.first, Cuts::pT > it.second.first && Cuts::pT < it.second.second);
84  }
85  }
86 
87 
90 
92 
93 
94 
96  const vector<Cut>& vetoDetails() const {
97  return _vetoCuts;
98  }
99  //using vetos = vetoDetails;
100 
101 
103  VetoedFinalState& addVeto(const Cut& cut) {
104  _vetoCuts.push_back(cut);
105  return *this;
106  }
107 
109  VetoedFinalState& addVeto(PdgId pid, const Cut& cut=Cuts::OPEN) {
110  _vetoCuts.push_back(Cuts::pid == pid && cut);
111  return *this;
112  }
113 
115  VetoedFinalState& addVetoPair(PdgId pid, const Cut& cut=Cuts::OPEN) {
116  _vetoCuts.push_back(Cuts::abspid == pid && cut);
117  return *this;
118  }
119 
120 
124  VetoedFinalState& addVetoDetail(PdgId pid, double ptmin, double ptmax=numeric_limits<double>::max()) {
125  return addVeto(pid, Cuts::ptIn(ptmin, ptmax));
126  }
127  //const auto addVeto = addVetoDetail;
128 
133  VetoedFinalState& addVetoPairDetail(PdgId pid, double ptmin, double ptmax=numeric_limits<double>::max()) {
134  return addVetoPair(pid, Cuts::ptIn(ptmin, ptmax));
135  }
136  //using addVetoPair = addVetoPairDetail;
137 
140  return addVeto(pid);
141  }
142  //using addVeto = addVetoId;
143 
149  return addVetoPair(pid);
150  }
151  //using addVetoPair = addVetoPairId;
152 
153 
155  VetoedFinalState& setVetoDetails(const vector<Cut>& cuts) {
156  _vetoCuts = cuts;
157  return *this;
158  }
159  //const auto setVetos = setVetoDetails;
160 
161 
164  addVetoPairId(PID::NU_E);
165  addVetoPairId(PID::NU_MU);
166  addVetoPairId(PID::NU_TAU);
167  return *this;
168  }
169 
170 
174  VetoedFinalState& addCompositeMassVeto(double mass, double width, int nProducts=2) {
175  const double halfWidth = 0.5*width;
176  pair<double,double> massRange(mass-halfWidth, mass+halfWidth);
177  _compositeVetoes.insert(make_pair(nProducts, massRange));
178  _nCompositeDecays.insert(nProducts);
179  return *this;
180  }
181 
182 
187  _parentVetoes.insert(pid);
188  return *this;
189  }
190 
193  const string name = "FS_" + to_str(_vetofsnames.size());
194  addProjection(fs, name);
195  _vetofsnames.insert(name);
196  return *this;
197  }
198 
199 
202  _vetoCuts.clear();
203  return *this;
204  }
205 
206 
208  void project(const Event& e);
209 
211  int compare(const Projection& p) const;
212 
213 
214  private:
215 
217  vector<Cut> _vetoCuts;
218 
221  multimap<PdgId, pair<double,double> > _compositeVetoes;
222  set<int> _nCompositeDecays;
223 
225  set<PdgId> _parentVetoes;
226 
228  set<string> _vetofsnames;
229 
230  };
231 
232 
233 }
234 
235 
236 #endif
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:133
Definition: ALICE_2010_I880049.cc:13
VetoedFinalState & addVetoOnThisFinalState(const ParticleFinder &fs)
Veto particles from a supplied final state.
Definition: VetoedFinalState.hh:192
VetoedFinalState & addVetoId(PdgId pid)
Add a particle ID to veto (all range will be vetoed)
Definition: VetoedFinalState.hh:139
const vector< Cut > & vetoDetails() const
Get the list of particle IDs and ranges to veto.
Definition: VetoedFinalState.hh:96
VetoedFinalState & addDecayProductsVeto(PdgId pid)
Definition: VetoedFinalState.hh:186
DEFAULT_RIVET_PROJ_CLONE(VetoedFinalState)
Clone on the heap.
VetoedFinalState & vetoNeutrinos()
Veto all neutrinos (convenience method)
Definition: VetoedFinalState.hh:163
int pid(const Particle &p)
Unbound function access to PID code.
Definition: ParticleUtils.hh:20
Base class for projections which return subsets of an event&#39;s particles.
Definition: ParticleFinder.hh:11
VetoedFinalState(const vector< Cut > &cuts)
Constructor with a default FinalState and a cuts list to veto.
Definition: VetoedFinalState.hh:31
VetoedFinalState(const map< PdgId, pair< double, double >> &vetocodes)
Definition: VetoedFinalState.hh:79
VetoedFinalState(PdgId vetopid)
Constructor with a default FinalState and a PID to veto.
Definition: VetoedFinalState.hh:62
VetoedFinalState & addVeto(PdgId pid, const Cut &cut=Cuts::OPEN)
Add a particle selection to be vetoed from the final state.
Definition: VetoedFinalState.hh:109
FS modifier to exclude classes of particles from the final state.
Definition: VetoedFinalState.hh:11
VetoedFinalState(const FinalState &fsp, const Cut &cut)
Constructor with a specific FinalState and a single cut to veto.
Definition: VetoedFinalState.hh:26
Definition: Event.hh:22
VetoedFinalState & addVetoPairDetail(PdgId pid, double ptmin, double ptmax=numeric_limits< double >::max())
Add a particle/antiparticle pair to veto in a given range.
Definition: VetoedFinalState.hh:133
VetoedFinalState & addVeto(const Cut &cut)
Add a particle selection to be vetoed from the final state.
Definition: VetoedFinalState.hh:103
void project(const Event &e)
Apply the projection on the supplied event.
Definition: VetoedFinalState.cc:20
int compare(const Projection &p) const
Compare projections.
Definition: VetoedFinalState.cc:7
VetoedFinalState & addVetoPairId(PdgId pid)
Add a particle/antiparticle pair to veto.
Definition: VetoedFinalState.hh:148
VetoedFinalState & setVetoDetails(const vector< Cut > &cuts)
Set the list of particle selections to veto.
Definition: VetoedFinalState.hh:155
virtual std::string name() const
Get the name of the projection.
Definition: Projection.hh:56
VetoedFinalState()
Default constructor with default FinalState and no cuts.
Definition: VetoedFinalState.hh:72
VetoedFinalState(const FinalState &fsp)
Constructor with specific FinalState but no cuts.
Definition: VetoedFinalState.hh:67
VetoedFinalState & reset()
Clear the list of particle IDs and ranges to veto.
Definition: VetoedFinalState.hh:201
VetoedFinalState(const Cut &cut)
Constructor with a default FinalState and a single cut to veto.
Definition: VetoedFinalState.hh:36
VetoedFinalState & addCompositeMassVeto(double mass, double width, int nProducts=2)
Definition: VetoedFinalState.hh:174
VetoedFinalState(const FinalState &fsp, const vector< PdgId > &vetopids)
Constructor with a specific FinalState and a PID list to veto.
Definition: VetoedFinalState.hh:41
Project out all final-state particles in an event. Probably the most important projection in Rivet! ...
Definition: FinalState.hh:12
const PROJ & addProjection(const PROJ &proj, const std::string &name)
Register a contained projection (user-facing version)
Definition: ProjectionApplier.hh:170
VetoedFinalState(const vector< PdgId > &vetopids)
Constructor with a default FinalState and a PID list to veto.
Definition: VetoedFinalState.hh:54
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:115
string to_str(const T &x)
Convert any object to a string.
Definition: Utils.hh:82
Base class for all Rivet projections.
Definition: Projection.hh:29
VetoedFinalState & addVetoDetail(PdgId pid, double ptmin, double ptmax=numeric_limits< double >::max())
Add a particle ID and range to veto.
Definition: VetoedFinalState.hh:124
VetoedFinalState(const FinalState &fsp, PdgId vetopid)
Constructor with a specific FinalState and a PID to veto.
Definition: VetoedFinalState.hh:49