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

| Rivet 3.1.9

Projection.hh
1// -*- C++ -*-
2#ifndef RIVET_Projection_HH
3#define RIVET_Projection_HH
4
5#include "Rivet/Projection.fhh"
6#include "Rivet/ProjectionApplier.hh"
7#include "Rivet/ProjectionHandler.hh"
8#include "Rivet/Config/RivetCommon.hh"
9#include "Rivet/Tools/Cuts.hh"
10// NOTE: Cmp.hh, Event.hh and Particle.hh included at the bottom
11
12namespace Rivet {
13
14
15 // Forward declaration
16 class Event;
17
18
29 class Projection : public ProjectionApplier {
30 public:
31
33 friend class Event;
34
36 friend class Cmp<Projection>;
37
38
39
41
42
44 Projection();
45
47 virtual unique_ptr<Projection> clone() const = 0;
48
50 virtual ~Projection();
51
53
54
56 virtual std::string name() const {
57 return _name;
58 }
59
61 bool valid() const {
62 return _isValid;
63 }
64
66 bool failed() const {
67 return !valid();
68 }
69
71
72
77 virtual void project(const Event& e) = 0;
78
98 virtual CmpState compare(const Projection& p) const = 0;
99
105 bool before(const Projection& p) const;
106
108
109
110
113
114
120 virtual const std::set<PdgIdPair> beamPairs() const;
121
122
125 Projection& addPdgIdPair(PdgId beam1, PdgId beam2) {
126 _beamPairs.insert(PdgIdPair(beam1, beam2));
127 return *this;
128 }
129
131
132
133 protected:
134
136 Log& getLog() const {
137 string logname = "Rivet.Projection." + name();
138 return Log::getLog(logname);
139 }
140
142 void setName(const std::string& name) {
143 _name = name;
144 }
145
147 void fail() {
148 _isValid = false;
149 }
150
153 Cmp<Projection> mkNamedPCmp(const Projection& otherparent, const std::string& pname) const;
154
159 Cmp<Projection> mkPCmp(const Projection& otherparent, const std::string& pname) const;
160
162 virtual Projection& operator = (const Projection&);
163
164
165 private:
166
169 string _name;
170
173 set<PdgIdPair> _beamPairs;
174
176 bool _isValid;
177
178 };
179
180
181}
182
183
185inline bool std::less<const Rivet::Projection *>::operator()(const Rivet::Projection* x,
186 const Rivet::Projection* y) const {
187 return x->before(*y);
188}
189
190
191#endif
192
193
194#include "Rivet/Event.hh"
195#include "Rivet/Particle.hh"
196#include "Rivet/Tools/Cmp.hh"
197
198
201#define DEFAULT_RIVET_PROJ_CLONE(clsname) \
202 virtual unique_ptr<Projection> clone() const { return unique_ptr<Projection>(new clsname(*this)); }
Rivet::Event
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Rivet::Log
Logging system for controlled & formatted writing to stdout.
Definition Logging.hh:10
Rivet::Log::getLog
static Log & getLog(const std::string &name)
Rivet::ProjectionApplier
Common base class for Projection and Analysis, used for internal polymorphism.
Definition ProjectionApplier.hh:21
Rivet::Projection
Base class for all Rivet projections.
Definition Projection.hh:29
Rivet::Projection::beamPairs
virtual const std::set< PdgIdPair > beamPairs() const
Rivet::Projection::Projection
Projection()
The default constructor.
Rivet::Projection::~Projection
virtual ~Projection()
The destructor.
Rivet::Projection::addPdgIdPair
Projection & addPdgIdPair(PdgId beam1, PdgId beam2)
Definition Projection.hh:125
Rivet::Projection::compare
virtual CmpState compare(const Projection &p) const =0
Rivet::Projection::clone
virtual unique_ptr< Projection > clone() const =0
Clone on the heap.
Rivet::Projection::mkPCmp
Cmp< Projection > mkPCmp(const Projection &otherparent, const std::string &pname) const
Rivet::Projection::valid
bool valid() const
Get the state of the projetion.
Definition Projection.hh:61
Rivet::Projection::setName
void setName(const std::string &name)
Used by derived classes to set their name.
Definition Projection.hh:142
Rivet::Projection::name
virtual std::string name() const
Get the name of the projection.
Definition Projection.hh:56
Rivet::Projection::operator=
virtual Projection & operator=(const Projection &)
Block Projection copying.
Rivet::Projection::before
bool before(const Projection &p) const
Rivet::Projection::getLog
Log & getLog() const
Get a Log object based on the getName() property of the calling projection object.
Definition Projection.hh:136
Rivet::Projection::Cmp< Projection >
friend class Cmp< Projection >
The Cmp specialization for Projection is a friend.
Definition Projection.hh:36
Rivet::Projection::mkNamedPCmp
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
Rivet::Projection::project
virtual void project(const Event &e)=0
Rivet::Projection::failed
bool failed() const
Get the state of the projetion.
Definition Projection.hh:66
Rivet::Projection::fail
void fail()
Set the projection in an unvalid state.
Definition Projection.hh:147
Rivet::Kin::p
double p(const ParticleBase &p)
Unbound function access to p.
Definition ParticleBaseUtils.hh:684
Rivet
Definition MC_Cent_pPb.hh:10