rivet is hosted by Hepforge, IPPP Durham
Rivet  2.7.0
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 
12 namespace 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 
60 
62 
63 
68  virtual void project(const Event& e) = 0;
69 
89  virtual int compare(const Projection& p) const = 0;
90 
96  bool before(const Projection& p) const;
97 
99 
100 
101 
104 
105 
111  virtual const std::set<PdgIdPair> beamPairs() const;
112 
113 
116  Projection& addPdgIdPair(PdgId beam1, PdgId beam2) {
117  _beamPairs.insert(PdgIdPair(beam1, beam2));
118  return *this;
119  }
120 
122 
123 
124  protected:
125 
127  Log& getLog() const {
128  string logname = "Rivet.Projection." + name();
129  return Log::getLog(logname);
130  }
131 
133  void setName(const std::string& name) {
134  _name = name;
135  }
136 
139  Cmp<Projection> mkNamedPCmp(const Projection& otherparent, const std::string& pname) const;
140 
145  Cmp<Projection> mkPCmp(const Projection& otherparent, const std::string& pname) const;
146 
148  virtual Projection& operator = (const Projection&);
149 
150 
151  private:
152 
155  string _name;
156 
159  set<PdgIdPair> _beamPairs;
160 
161  };
162 
163 
164 }
165 
166 
168 inline bool std::less<const Rivet::Projection *>::operator()(const Rivet::Projection* x,
169  const Rivet::Projection* y) const {
170  return x->before(*y);
171 }
172 
173 
174 #endif
175 
176 
177 #include "Rivet/Event.hh"
178 #include "Rivet/Particle.hh"
179 #include "Rivet/Tools/Cmp.hh"
180 
181 
184 #define DEFAULT_RIVET_PROJ_CLONE(clsname) \
185  virtual unique_ptr<Projection> clone() const { return unique_ptr<Projection>(new clsname(*this)); }
void setName(const std::string &name)
Used by derived classes to set their name.
Definition: Projection.hh:133
Definition: ALICE_2010_I880049.cc:13
virtual Projection & operator=(const Projection &)
Block Projection copying.
Definition: Projection.cc:21
Projection()
The default constructor.
Definition: Projection.cc:11
virtual unique_ptr< Projection > clone() const =0
Clone on the heap.
static Log & getLog(const std::string &name)
Definition: Logging.cc:55
Definition: Logging.hh:9
virtual int compare(const Projection &p) const =0
virtual void project(const Event &e)=0
Projection & addPdgIdPair(PdgId beam1, PdgId beam2)
Definition: Projection.hh:116
Definition: Event.hh:22
Cmp< Projection > mkPCmp(const Projection &otherparent, const std::string &pname) const
Definition: Projection.cc:55
Common base class for Projection and Analysis, used for internal polymorphism.
Definition: ProjectionApplier.hh:21
Specialization of Cmp for checking the ordering of two {Projection}s.
Definition: Cmp.hh:112
virtual std::string name() const
Get the name of the projection.
Definition: Projection.hh:56
Cmp< Projection > mkNamedPCmp(const Projection &otherparent, const std::string &pname) const
Definition: Projection.cc:51
Definition: Cmp.hh:27
bool before(const Projection &p) const
Definition: Projection.cc:24
virtual const std::set< PdgIdPair > beamPairs() const
Definition: Projection.cc:39
Base class for all Rivet projections.
Definition: Projection.hh:29
Log & getLog() const
Get a Log object based on the getName() property of the calling projection object.
Definition: Projection.hh:127
virtual ~Projection()
The destructor.
Definition: Projection.cc:18