rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.0
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>
23 public:
24 using SingleValueProjection::operator=;
26 setName(MODE<0 ? "ALICE::V0CMultiplicity":
27 MODE>0 ? "ALICE::V0AMultiplicity":
28 "ALICE::V0MMultiplicity");
29 Cut cut;
30 if (MODE < 0) cut = V0Cacceptance;
31 else if (MODE > 0) cut = V0Aacceptance;
32 else cut = (V0Aacceptance || V0Cacceptance);
33 // Declare our projection. Note, the cuts stipulate charged
34 // particles, so we just use a final state (rather than
35 // charged-final state) projection here.
36 const FinalState fs(cut);
37 this->declare(fs, "FinalState");
38 }
39
41 virtual ~V0Multiplicity() {}
42
48 virtual void project(const Event& e) {
49 clear();
50 setValue(apply<FinalState>(e,"FinalState").particles().size());
51 }
52
56 virtual std::unique_ptr<Rivet::Projection> clone() const {
57 return std::unique_ptr<Projection>(new V0Multiplicity<MODE>(*this));
58 }
59
61 using Projection::operator =;
62
66 virtual CmpState compare(const Projection& p) const {
67 return dynamic_cast<const V0Multiplicity<MODE>*>(&p) ?
68 CmpState::EQ : CmpState::NEQ;
69 }
70
71 };
72
73
78
83
88
89
90
98 template <bool INNER>
100 public:
101
104 setName("ALICE::CLMultiplicity");
105 Cut cut;
106 if (INNER) cut = CL0acceptance;
107 else cut = CL1acceptance;
108 // Declare our projection. Note, the cuts stipulate charged
109 // particles, so we just use a final state (rather than
110 // charged-final state) projection here.
111 const FinalState fs(cut);
112 this->declare(fs, "FinalState");
113 }
114
116 virtual ~CLMultiplicity() {}
117
123 virtual void project(const Event& e) {
124 clear();
125 set(apply<FinalState>(e,"FinalState").particles().size());
126 }
127
131 virtual std::unique_ptr<Rivet::Projection> clone() const {
132 return std::unique_ptr<Projection>(new CLMultiplicity<INNER>(*this));
133 }
134
136 using Projection::operator =;
137
141 virtual CmpState compare(const Projection& p) const {
142 return dynamic_cast<const CLMultiplicity<INNER>*>(&p) ?
143 CmpState::EQ : CmpState::NEQ;
144 }
145
146 };
147
148
153
158
159
160
168 template <int MODE>
170 public:
171
174 setName("ALICE::V0Trigger");
175 // Declare our projection. Note, the cuts stipulate charged
176 // particles, so we just use a final state (rather than
177 // charged-final state) projection here.
178 const V0Multiplicity<MODE> fs;
179 this->declare(fs, "FinalState");
180 }
181
183 virtual ~V0Trigger() {}
184
189 virtual void project(const Event& e) {
190 fail(); // Assume failure
191 if (apply<V0Multiplicity<MODE>>(e, "FinalState")() > 0) pass();
192 }
193
197 virtual std::unique_ptr<Rivet::Projection> clone() const {
198 return std::unique_ptr<Projection>(new V0Trigger<MODE>(*this));
199 }
200
202 using Projection::operator =;
203
210 virtual CmpState compare(const Projection& p) const {
211 return dynamic_cast<const V0Trigger<MODE>*>(&p) ?
212 CmpState::EQ : CmpState::NEQ;
213 }
214
215 };
216
217
222
227
232
233
234
237 public:
238
241 const V0ATrigger v0a;
242 const V0CTrigger v0c;
243 this->declare(v0a, "V0A");
244 this->declare(v0c, "V0C");
245 }
246
248 virtual ~V0AndTrigger() {}
249
254 virtual void project(const Event& e) {
255 fail(); // Assume failure
256 if (apply<V0ATrigger>(e,"V0A")() && apply<V0CTrigger>(e,"V0C")()) pass();
257 }
258
262 virtual CmpState compare(const Projection& p) const
263 {
264 return dynamic_cast<const V0AndTrigger*>(&p) ?
265 CmpState::EQ : CmpState::NEQ;
266 }
267
271 virtual std::unique_ptr<Rivet::Projection> clone() const {
272 return std::unique_ptr<Projection>(new V0AndTrigger(*this));
273 }
274
276 using Projection::operator =;
277
278 };
279
280
288 public:
289
290 PrimaryParticles(const Cut& c=Cuts::open())
292 { }
293
301 virtual CmpState compare(const Projection& p) const {
302 const PrimaryParticles* o = dynamic_cast<const PrimaryParticles*>(&p);
303 if (_cuts != o->_cuts) return CmpState::NEQ;
304 return mkPCmp(*o,"PrimaryParticles");
305 }
306
308 virtual std::unique_ptr<Rivet::Projection> clone() const {
309 return std::unique_ptr<Projection>(new PrimaryParticles(*this));
310 }
311
313 using Projection::operator =;
314
315
316 protected:
317
331 bool isPrimaryPID(ConstGenParticlePtr p) const {
332 const int pdg = abs(p->pdg_id());
333 // Check for nucleus
334 if (pdg > 1000000000) return true;
335
336 switch (pdg) {
337 case Rivet::PID::MUON:
338 case Rivet::PID::ELECTRON:
339 case Rivet::PID::GAMMA:
340 case Rivet::PID::PIPLUS:
341 case Rivet::PID::KPLUS:
342 case Rivet::PID::K0S:
343 case Rivet::PID::K0L:
344 case Rivet::PID::PROTON:
345 case Rivet::PID::NEUTRON:
346 case Rivet::PID::LAMBDA:
347 case Rivet::PID::SIGMAMINUS:
348 case Rivet::PID::SIGMAPLUS:
349 case Rivet::PID::XIMINUS:
350 case Rivet::PID::XI0:
351 case Rivet::PID::OMEGAMINUS:
352 case Rivet::PID::NU_E:
353 case Rivet::PID::NU_MU:
354 case Rivet::PID::NU_TAU:
355 return true;
356 }
357 return false;
358 }
359
360 };
361
362
363 }
364}
365
366#endif
Definition AliceCommon.hh:99
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:141
virtual ~CLMultiplicity()
Destructor.
Definition AliceCommon.hh:116
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:131
CLMultiplicity()
Constructor.
Definition AliceCommon.hh:103
virtual void project(const Event &e)
Definition AliceCommon.hh:123
Standard ALICE primary particle definition.
Definition AliceCommon.hh:287
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:301
virtual std::unique_ptr< Rivet::Projection > clone() const
Clone this projection.
Definition AliceCommon.hh:308
bool isPrimaryPID(ConstGenParticlePtr p) const
Definition AliceCommon.hh:331
Trigger projection for the ALICE V0-AND (a.k.a. CINT7) requirement.
Definition AliceCommon.hh:236
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:262
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:271
virtual ~V0AndTrigger()
Destructor.
Definition AliceCommon.hh:248
V0AndTrigger()
Constructor.
Definition AliceCommon.hh:240
virtual void project(const Event &e)
Definition AliceCommon.hh:254
Definition AliceCommon.hh:22
virtual ~V0Multiplicity()
Destructor.
Definition AliceCommon.hh:41
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:66
virtual void project(const Event &e)
Definition AliceCommon.hh:48
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:56
Definition AliceCommon.hh:169
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:210
V0Trigger()
Constructor.
Definition AliceCommon.hh:173
virtual void project(const Event &e)
Definition AliceCommon.hh:189
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:197
virtual ~V0Trigger()
Destructor.
Definition AliceCommon.hh:183
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
Project out primary particles according to definition.
Definition PrimaryParticles.hh:19
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.
Definition ProjectionApplier.hh:110
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
Cmp< Projection > mkPCmp(const Projection &otherparent, const std::string &pname) const
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:148
Base class for projections returning a single floating point value.
Definition SingleValueProjection.hh:17
void setValue(double v)
Set the value.
Definition SingleValueProjection.hh:48
SingleValueProjection()
The default constructor.
Definition SingleValueProjection.hh:21
void clear()
Unset the value.
Definition SingleValueProjection.hh:54
Base class for projections returning a bool corresponding to a trigger.
Definition TriggerProjection.hh:18
void fail()
Indicate that the event has failed the trigger.
Definition TriggerProjection.hh:57
void pass()
Indicate that the event has passed the trigger.
Definition TriggerProjection.hh:47
const Cut V0Cacceptance
Definition AliceCommon.hh:30
const Cut CL1acceptance
Definition AliceCommon.hh:42
const Cut CL0acceptance
Definition AliceCommon.hh:36
const Cut V0Aacceptance
Definition AliceCommon.hh:24
V0Multiplicity< 0 > V0MMultiplicity
Definition AliceCommon.hh:87
V0Multiplicity<-1 > V0CMultiplicity
Definition AliceCommon.hh:82
V0Multiplicity<+1 > V0AMultiplicity
Definition AliceCommon.hh:77
CLMultiplicity< false > CL1Multiplicity
Definition AliceCommon.hh:157
CLMultiplicity< true > CL0Multiplicity
Definition AliceCommon.hh:152
const Cut & open()
Fully open cut singleton, accepts everything.
Definition MC_CENT_PPB_Projections.hh:10