rivet is hosted by Hepforge, IPPP Durham
Rivet 4.0.2
AliceCommon.hh
1#ifndef PROJECTIONS_ALICECOMMON_HH
2#define PROJECTIONS_ALICECOMMON_HH
3
4#include "Rivet/Tools/AliceCommon.hh"
5#include "Rivet/Projections/FinalState.hh"
6#include "Rivet/Projections/SingleValueProjection.hh"
7#include "Rivet/Projections/TriggerProjection.hh"
8#include "Rivet/Projections/PrimaryParticles.hh"
9
10namespace Rivet {
11 namespace ALICE {
12
13
22 template <int MODE>
24 public:
25 using SingleValueProjection::operator=;
27 setName(MODE<0 ? "ALICE::V0CMultiplicity":
28 MODE>0 ? "ALICE::V0AMultiplicity":
29 "ALICE::V0MMultiplicity");
30 Cut cut;
31 if (MODE < 0) cut = V0Cacceptance;
32 else if (MODE > 0) cut = V0Aacceptance;
33 else cut = (V0Aacceptance || V0Cacceptance);
34 // Declare our projection. Note, the cuts stipulate charged
35 // particles, so we just use a final state (rather than
36 // charged-final state) projection here.
37 const FinalState fs(cut);
38 this->declare(fs, "FinalState");
39 }
40
42 virtual ~V0Multiplicity() {}
43
49 virtual void project(const Event& e) {
50 clear();
51 setValue(apply<FinalState>(e,"FinalState").particles().size());
52 }
53
57 virtual std::unique_ptr<Rivet::Projection> clone() const {
58 return std::unique_ptr<Projection>(new V0Multiplicity<MODE>(*this));
59 }
60
62 using Projection::operator =;
63
67 virtual CmpState compare(const Projection& p) const {
68 return dynamic_cast<const V0Multiplicity<MODE>*>(&p) ?
69 CmpState::EQ : CmpState::NEQ;
70 }
71
72 };
73
74
79
84
89
90
91
99 template <bool INNER>
101 public:
102
105 setName("ALICE::CLMultiplicity");
106 Cut cut;
107 if (INNER) cut = CL0acceptance;
108 else cut = CL1acceptance;
109 // Declare our projection. Note, the cuts stipulate charged
110 // particles, so we just use a final state (rather than
111 // charged-final state) projection here.
112 const FinalState fs(cut);
113 this->declare(fs, "FinalState");
114 }
115
117 virtual ~CLMultiplicity() {}
118
124 virtual void project(const Event& e) {
125 clear();
126 set(apply<FinalState>(e,"FinalState").particles().size());
127 }
128
132 virtual std::unique_ptr<Rivet::Projection> clone() const {
133 return std::unique_ptr<Projection>(new CLMultiplicity<INNER>(*this));
134 }
135
137 using Projection::operator =;
138
142 virtual CmpState compare(const Projection& p) const {
143 return dynamic_cast<const CLMultiplicity<INNER>*>(&p) ?
144 CmpState::EQ : CmpState::NEQ;
145 }
146
147 };
148
149
154
159
160
161
169 template <int MODE>
171 public:
172
175 setName("ALICE::V0Trigger");
176 // Declare our projection. Note, the cuts stipulate charged
177 // particles, so we just use a final state (rather than
178 // charged-final state) projection here.
179 const V0Multiplicity<MODE> fs;
180 this->declare(fs, "FinalState");
181 }
182
184 virtual ~V0Trigger() {}
185
190 virtual void project(const Event& e) {
191 fail(); // Assume failure
192 if (apply<V0Multiplicity<MODE>>(e, "FinalState")() > 0) pass();
193 }
194
198 virtual std::unique_ptr<Rivet::Projection> clone() const {
199 return std::unique_ptr<Projection>(new V0Trigger<MODE>(*this));
200 }
201
203 using Projection::operator =;
204
211 virtual CmpState compare(const Projection& p) const {
212 return dynamic_cast<const V0Trigger<MODE>*>(&p) ?
213 CmpState::EQ : CmpState::NEQ;
214 }
215
216 };
217
218
223
228
233
234
235
238 public:
239
242 const V0ATrigger v0a;
243 const V0CTrigger v0c;
244 this->declare(v0a, "V0A");
245 this->declare(v0c, "V0C");
246 }
247
249 virtual ~V0AndTrigger() {}
250
255 virtual void project(const Event& e) {
256 fail(); // Assume failure
257 if (apply<V0ATrigger>(e,"V0A")() && apply<V0CTrigger>(e,"V0C")()) pass();
258 }
259
263 virtual CmpState compare(const Projection& p) const
264 {
265 return dynamic_cast<const V0AndTrigger*>(&p) ?
266 CmpState::EQ : CmpState::NEQ;
267 }
268
272 virtual std::unique_ptr<Rivet::Projection> clone() const {
273 return std::unique_ptr<Projection>(new V0AndTrigger(*this));
274 }
275
277 using Projection::operator =;
278
279 };
280
281
289 public:
290
291 PrimaryParticles(const Cut& c=Cuts::open())
293 { }
294
302 virtual CmpState compare(const Projection& p) const {
303 const PrimaryParticles* o = dynamic_cast<const PrimaryParticles*>(&p);
304 if (_cuts != o->_cuts) return CmpState::NEQ;
305 return mkPCmp(*o,"PrimaryParticles");
306 }
307
309 virtual std::unique_ptr<Rivet::Projection> clone() const {
310 return std::unique_ptr<Projection>(new PrimaryParticles(*this));
311 }
312
314 using Projection::operator =;
315
316
317 protected:
318
332 bool isPrimaryPID(ConstGenParticlePtr p) const {
333 const int pdg = abs(p->pdg_id());
334 // Check for nucleus
335 if (pdg > 1000000000) return true;
336
337 switch (pdg) {
338 case Rivet::PID::MUON:
339 case Rivet::PID::ELECTRON:
340 case Rivet::PID::GAMMA:
341 case Rivet::PID::PIPLUS:
342 case Rivet::PID::KPLUS:
343 case Rivet::PID::K0S:
344 case Rivet::PID::K0L:
345 case Rivet::PID::PROTON:
346 case Rivet::PID::NEUTRON:
347 case Rivet::PID::LAMBDA:
348 case Rivet::PID::SIGMAMINUS:
349 case Rivet::PID::SIGMAPLUS:
350 case Rivet::PID::XIMINUS:
351 case Rivet::PID::XI0:
352 case Rivet::PID::OMEGAMINUS:
353 case Rivet::PID::NU_E:
354 case Rivet::PID::NU_MU:
355 case Rivet::PID::NU_TAU:
356 return true;
357 }
358 return false;
359 }
360
361 };
362
363
364 }
365}
366
367#endif
Definition AliceCommon.hh:100
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:142
virtual ~CLMultiplicity()
Destructor.
Definition AliceCommon.hh:117
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:132
CLMultiplicity()
Constructor.
Definition AliceCommon.hh:104
virtual void project(const Event &e)
Definition AliceCommon.hh:124
Standard ALICE primary particle definition.
Definition AliceCommon.hh:288
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:302
virtual std::unique_ptr< Rivet::Projection > clone() const
Clone this projection.
Definition AliceCommon.hh:309
bool isPrimaryPID(ConstGenParticlePtr p) const
Definition AliceCommon.hh:332
Trigger projection for the ALICE V0-AND (a.k.a. CINT7) requirement.
Definition AliceCommon.hh:237
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:263
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:272
virtual ~V0AndTrigger()
Destructor.
Definition AliceCommon.hh:249
V0AndTrigger()
Constructor.
Definition AliceCommon.hh:241
virtual void project(const Event &e)
Definition AliceCommon.hh:255
Definition AliceCommon.hh:23
virtual ~V0Multiplicity()
Destructor.
Definition AliceCommon.hh:42
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:67
virtual void project(const Event &e)
Definition AliceCommon.hh:49
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:57
Definition AliceCommon.hh:170
virtual CmpState compare(const Projection &p) const
Definition AliceCommon.hh:211
V0Trigger()
Constructor.
Definition AliceCommon.hh:174
virtual void project(const Event &e)
Definition AliceCommon.hh:190
virtual std::unique_ptr< Rivet::Projection > clone() const
Definition AliceCommon.hh:198
virtual ~V0Trigger()
Destructor.
Definition AliceCommon.hh:184
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:18
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:88
V0Multiplicity<-1 > V0CMultiplicity
Definition AliceCommon.hh:83
V0Multiplicity<+1 > V0AMultiplicity
Definition AliceCommon.hh:78
CLMultiplicity< false > CL1Multiplicity
Definition AliceCommon.hh:158
CLMultiplicity< true > CL0Multiplicity
Definition AliceCommon.hh:153
const Cut & open()
Fully open cut singleton, accepts everything.
Definition MC_CENT_PPB_Projections.hh:10