Rivet  1.8.0
Projection.hh
00001 // -*- C++ -*-
00002 #ifndef RIVET_Projection_HH
00003 #define RIVET_Projection_HH
00004 
00005 #include "Rivet/Rivet.hh"
00006 #include "Rivet/Projection.fhh"
00007 #include "Rivet/ProjectionApplier.hh"
00008 #include "Rivet/ProjectionHandler.hh"
00009 #include "Rivet/Constraints.hh"
00010 #include "Rivet/ParticleName.hh"
00011 #include "Rivet/Event.fhh"
00012 #include "Rivet/Tools/Logging.hh"
00013 #include "Rivet/Cmp.fhh"
00014 
00015 
00016 namespace Rivet {
00017 
00028   class Projection : public ProjectionApplier {
00029 
00030   public:
00031 
00033     friend class Event;
00034 
00036     friend class Cmp<Projection>;
00037 
00038   public:
00039 
00041 
00042 
00043     Projection();
00044 
00046     virtual const Projection* clone() const = 0;
00047 
00049     virtual ~Projection();
00051 
00052 
00053   public:
00054 
00059     virtual void project(const Event& e) = 0;
00060 
00061 
00062   protected:
00063 
00083     virtual int compare(const Projection& p) const = 0;
00084 
00085   public:
00086 
00092     bool before(const Projection& p) const;
00093 
00098     virtual const std::set<PdgIdPair> beamPairs() const;
00099 
00101     virtual std::string name() const {
00102       return _name;
00103     }
00104 
00105 
00107     Projection& addPdgIdPair(PdgId beam1, PdgId beam2) {
00108       _beamPairs.insert(PdgIdPair(beam1, beam2));
00109       return *this;
00110     }
00111 
00112 
00114     Log& getLog() const {
00115       string logname = "Rivet.Projection." + name();
00116       return Log::getLog(logname);
00117     }
00118 
00120     void setName(const std::string& name) {
00121       _name = name;
00122     }
00123 
00124   protected:
00125 
00128     Cmp<Projection> mkNamedPCmp(const Projection& otherparent, const std::string& pname) const;
00129 
00130 
00133     Cmp<Projection> mkPCmp(const Projection& otherparent, const std::string& pname) const;
00134 
00135 
00136   private:
00137 
00140     string _name;
00141 
00143     set<PdgIdPair> _beamPairs;
00144 
00145   };
00146 
00147 
00148 }
00149 
00150 
00152 inline bool std::less<const Rivet::Projection *>::operator()(const Rivet::Projection* x,
00153                                                              const Rivet::Projection* y) const {
00154   return x->before(*y);
00155 }
00156 
00157 
00158 // Definition of the comparison objects and functions
00159 #include "Rivet/Cmp.hh"
00160 
00161 
00162 #endif