Rivet: /Users/chrisg/software/rivet/include/Rivet/Projections/AliceCommon.hh Source File

| Rivet 3.1.9

AliceCommon.hh
1#ifndef PROJECTIONS_ALICECOMMON_HH
2#define PROJECTIONS_ALICECOMMON_HH
3#include "Rivet/Tools/AliceCommon.hh"
4#include "Rivet/Projections/FinalState.hh"
5#include "Rivet/Projections/SingleValueProjection.hh"
6#include "Rivet/Projections/TriggerProjection.hh"
7#include "Rivet/Projections/PrimaryParticles.hh"
8
9namespace Rivet {
10 namespace ALICE {
11
12
21 template <int MODE>
22 class V0Multiplicity : public SingleValueProjection {
23 public:
24 V0Multiplicity() : SingleValueProjection() {
25 setName(MODE<0 ? "ALICE::V0CMultiplicity":
26 MODE>0 ? "ALICE::V0AMultiplicity":
27 "ALICE::V0MMultiplicity");
28 Cut cut;
29 if (MODE < 0) cut = V0Cacceptance;
30 else if (MODE > 0) cut = V0Aacceptance;
31 else cut = (V0Aacceptance || V0Cacceptance);
32 // Declare our projection. Note, the cuts stipulate charged
33 // particles, so we just use a final state (rather than
34 // charged-final state) projection here.
35 const FinalState fs(cut);
36 this->declare(fs, "FinalState");
37 }
38
40 virtual ~V0Multiplicity() {}
41
47 virtual void project(const Event& e) {
48 clear();
49 set(apply<FinalState>(e,"FinalState").particles().size());
50 }
51
55 virtual std::unique_ptr<Rivet::Projection> clone() const {
56 return std::unique_ptr<Projection>(new V0Multiplicity<MODE>(*this));
57 }
58
60 using Projection::operator =;
61
65 virtual CmpState compare(const Projection& p) const {
66 return dynamic_cast<const V0Multiplicity<MODE>*>(&p) ?
67 CmpState::EQ : CmpState::NEQ;
68 }
69
70 };
71
72
76 typedef V0Multiplicity<+1> V0AMultiplicity;
77
81 typedef V0Multiplicity<-1> V0CMultiplicity;
82
86 typedef V0Multiplicity<0> V0MMultiplicity;
87
88
89
97 template <bool INNER>
98 class CLMultiplicity : public SingleValueProjection {
99 public:
100
102 CLMultiplicity() : SingleValueProjection() {
103 setName("ALICE::CLMultiplicity");
104 Cut cut;
105 if (INNER) cut = CL0acceptance;
106 else cut = CL1acceptance;
107 // Declare our projection. Note, the cuts stipulate charged
108 // particles, so we just use a final state (rather than
109 // charged-final state) projection here.
110 const FinalState fs(cut);
111 this->declare(fs, "FinalState");
112 }
113
115 virtual ~CLMultiplicity() {}
116
122 virtual void project(const Event& e) {
123 clear();
124 set(apply<FinalState>(e,"FinalState").particles().size());
125 }
126
130 virtual std::unique_ptr<Rivet::Projection> clone() const {
131 return std::unique_ptr<Projection>(new CLMultiplicity<INNER>(*this));
132 }
133
135 using Projection::operator =;
136
140 virtual CmpState compare(const Projection& p) const {
141 return dynamic_cast<const CLMultiplicity<INNER>*>(&p) ?
142 CmpState::EQ : CmpState::NEQ;
143 }
144
145 };
146
147
151 typedef CLMultiplicity<true> CL0Multiplicity;
152
156 typedef CLMultiplicity<false> CL1Multiplicity;
157
158
159
167 template <int MODE>
168 class V0Trigger : public TriggerProjection {
169 public:
170
172 V0Trigger() : TriggerProjection() {
173 setName("ALICE::V0Trigger");
174 // Declare our projection. Note, the cuts stipulate charged
175 // particles, so we just use a final state (rather than
176 // charged-final state) projection here.
177 const V0Multiplicity<MODE> fs;
178 this->declare(fs, "FinalState");
179 }
180
182 virtual ~V0Trigger() {}
183
188 virtual void project(const Event& e) {
189 fail(); // Assume failure
190 if (apply<V0Multiplicity<MODE>>(e, "FinalState")() > 0) pass();
191 }
192
196 virtual std::unique_ptr<Rivet::Projection> clone() const {
197 return std::unique_ptr<Projection>(new V0Trigger<MODE>(*this));
198 }
199
201 using Projection::operator =;
202
209 virtual CmpState compare(const Projection& p) const {
210 return dynamic_cast<const V0Trigger<MODE>*>(&p) ?
211 CmpState::EQ : CmpState::NEQ;
212 }
213
214 };
215
216
220 using V0ATrigger = V0Trigger<-1>;
221
225 using V0CTrigger = V0Trigger<+1>;
226
230 using V0OrTrigger = V0Trigger<0>;
231
232
233
235 class V0AndTrigger : public TriggerProjection {
236 public:
237
239 V0AndTrigger() : TriggerProjection() {
240 const V0ATrigger v0a;
241 const V0CTrigger v0c;
242 this->declare(v0a, "V0A");
243 this->declare(v0c, "V0C");
244 }
245
247 virtual ~V0AndTrigger() {}
248
253 virtual void project(const Event& e) {
254 fail(); // Assume failure
255 if (apply<V0ATrigger>(e,"V0A")() && apply<V0CTrigger>(e,"V0C")()) pass();
256 }
257
261 virtual CmpState compare(const Projection& p) const
262 {
263 return dynamic_cast<const V0AndTrigger*>(&p) ?
264 CmpState::EQ : CmpState::NEQ;
265 }
266
270 virtual std::unique_ptr<Rivet::Projection> clone() const {
271 return std::unique_ptr<Projection>(new V0AndTrigger(*this));
272 }
273
275 using Projection::operator =;
276
277 };
278
279
286 class PrimaryParticles : public Rivet::PrimaryParticles {
287 public:
288
289 PrimaryParticles(const Cut& c=Cuts::open())
290 : Rivet::PrimaryParticles({},c)
291 { }
292
300 virtual CmpState compare(const Projection& p) const {
301 const PrimaryParticles* o = dynamic_cast<const PrimaryParticles*>(&p);
302 if (_cuts != o->_cuts) return CmpState::NEQ;
303 return mkPCmp(*o,"PrimaryParticles");
304 }
305
307 virtual std::unique_ptr<Rivet::Projection> clone() const {
308 return std::unique_ptr<Projection>(new PrimaryParticles(*this));
309 }
310
312 using Projection::operator =;
313
314
315 protected:
316
330 bool isPrimaryPID(ConstGenParticlePtr p) const {
331 const int pdg = abs(p->pdg_id());
332 // Check for nucleus
333 if (pdg > 1000000000) return true;
334
335 switch (pdg) {
336 case Rivet::PID::MUON:
337 case Rivet::PID::ELECTRON:
338 case Rivet::PID::GAMMA:
339 case Rivet::PID::PIPLUS:
340 case Rivet::PID::KPLUS:
341 case Rivet::PID::K0S:
342 case Rivet::PID::K0L:
343 case Rivet::PID::PROTON:
344 case Rivet::PID::NEUTRON:
345 case Rivet::PID::LAMBDA:
346 case Rivet::PID::SIGMAMINUS:
347 case Rivet::PID::SIGMAPLUS:
348 case Rivet::PID::XIMINUS:
349 case Rivet::PID::XI0:
350 case Rivet::PID::OMEGAMINUS:
351 case Rivet::PID::NU_E:
352 case Rivet::PID::NU_MU:
353 case Rivet::PID::NU_TAU:
354 return true;
355 }
356 return false;
357 }
358
359 };
360
361
362 }
363}
364
365#endif
Rivet::ALICE::CLMultiplicity
Definition AliceCommon.hh:98
Rivet::ALICE::CLMultiplicity::compare
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:140
Rivet::ALICE::CLMultiplicity::~CLMultiplicity
virtual ~CLMultiplicity()
Destructor.
Definition AliceCommon.hh:115
Rivet::ALICE::CLMultiplicity::clone
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:130
Rivet::ALICE::CLMultiplicity::CLMultiplicity
CLMultiplicity()
Constructor.
Definition AliceCommon.hh:102
Rivet::ALICE::CLMultiplicity::project
virtual void project(const Event &e)
Definition AliceCommon.hh:122
Rivet::ALICE::PrimaryParticles
Standard ALICE primary particle definition.
Definition AliceCommon.hh:286
Rivet::ALICE::PrimaryParticles::compare
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:300
Rivet::ALICE::PrimaryParticles::clone
virtual std::unique_ptr< Rivet::Projection > clone() const
Clone this projection.
Definition AliceCommon.hh:307
Rivet::ALICE::PrimaryParticles::isPrimaryPID
bool isPrimaryPID(ConstGenParticlePtr p) const
Definition AliceCommon.hh:330
Rivet::ALICE::V0AndTrigger
Trigger projection for the ALICE V0-AND (a.k.a. CINT7) requirement.
Definition AliceCommon.hh:235
Rivet::ALICE::V0AndTrigger::compare
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:261
Rivet::ALICE::V0AndTrigger::clone
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:270
Rivet::ALICE::V0AndTrigger::~V0AndTrigger
virtual ~V0AndTrigger()
Destructor.
Definition AliceCommon.hh:247
Rivet::ALICE::V0AndTrigger::V0AndTrigger
V0AndTrigger()
Constructor.
Definition AliceCommon.hh:239
Rivet::ALICE::V0AndTrigger::project
virtual void project(const Event &e)
Definition AliceCommon.hh:253
Rivet::ALICE::V0Multiplicity
Definition AliceCommon.hh:22
Rivet::ALICE::V0Multiplicity::~V0Multiplicity
virtual ~V0Multiplicity()
Destructor.
Definition AliceCommon.hh:40
Rivet::ALICE::V0Multiplicity::compare
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:65
Rivet::ALICE::V0Multiplicity::project
virtual void project(const Event &e)
Definition AliceCommon.hh:47
Rivet::ALICE::V0Multiplicity::clone
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:55
Rivet::ALICE::V0Trigger
Definition AliceCommon.hh:168
Rivet::ALICE::V0Trigger::compare
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:209
Rivet::ALICE::V0Trigger::V0Trigger
V0Trigger()
Constructor.
Definition AliceCommon.hh:172
Rivet::ALICE::V0Trigger::project
virtual void project(const Event &e)
Definition AliceCommon.hh:188
Rivet::ALICE::V0Trigger::clone
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:196
Rivet::ALICE::V0Trigger::~V0Trigger
virtual ~V0Trigger()
Destructor.
Definition AliceCommon.hh:182
Rivet::Event
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Rivet::FinalState
Project out all final-state particles in an event. Probably the most important projection in Rivet!
Definition FinalState.hh:12
Rivet::PrimaryParticles
Project out primary particles according to definition.
Definition PrimaryParticles.hh:19
Rivet::ProjectionApplier::declare
const PROJ & declare(const PROJ &proj, const std::string &name)
Register a contained projection (user-facing version)
Definition ProjectionApplier.hh:170
Rivet::ProjectionApplier::apply
std::enable_if_t< std::is_base_of< Projection, PROJ >::value, const PROJ & > apply(const Event &evt, const Projection &proj) const
Apply the supplied projection on event evt (user-facing alias).
Definition ProjectionApplier.hh:89
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::Projection::mkPCmp
Cmp< Projection > mkPCmp(const Projection &otherparent, const std::string &pname) const
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:142
Rivet::SingleValueProjection
Base class for projections returning a single floating point value.
Definition SingleValueProjection.hh:17
Rivet::SingleValueProjection::set
void set(double v)
Definition SingleValueProjection.hh:55
Rivet::SingleValueProjection::SingleValueProjection
SingleValueProjection()
The default constructor.
Definition SingleValueProjection.hh:21
Rivet::SingleValueProjection::clear
void clear()
Unset the value.
Definition SingleValueProjection.hh:58
Rivet::TriggerProjection
Base class for projections returning a bool corresponding to a trigger.
Definition TriggerProjection.hh:17
Rivet::TriggerProjection::fail
void fail()
Indicate that the event has failed the trigger.
Definition TriggerProjection.hh:56
Rivet::TriggerProjection::pass
void pass()
Indicate that the event has passed the trigger.
Definition TriggerProjection.hh:46
Rivet::ALICE::V0Cacceptance
const Cut V0Cacceptance
Definition AliceCommon.hh:30
Rivet::ALICE::CL1acceptance
const Cut CL1acceptance
Definition AliceCommon.hh:42
Rivet::ALICE::CL0acceptance
const Cut CL0acceptance
Definition AliceCommon.hh:36
Rivet::ALICE::V0Aacceptance
const Cut V0Aacceptance
Definition AliceCommon.hh:24
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet::ALICE::V0MMultiplicity
V0Multiplicity< 0 > V0MMultiplicity
Definition AliceCommon.hh:86
Rivet::ALICE::V0CMultiplicity
V0Multiplicity<-1 > V0CMultiplicity
Definition AliceCommon.hh:81
Rivet::ALICE::V0AMultiplicity
V0Multiplicity<+1 > V0AMultiplicity
Definition AliceCommon.hh:76
Rivet::ALICE::CL1Multiplicity
CLMultiplicity< false > CL1Multiplicity
Definition AliceCommon.hh:156
Rivet::ALICE::CL0Multiplicity
CLMultiplicity< true > CL0Multiplicity
Definition AliceCommon.hh:151
Rivet::Cuts::open
const Cut & open()
Fully open cut singleton, accepts everything.
Rivet
Definition MC_Cent_pPb.hh:10