00001
00002 #ifndef RIVET_Event_HH
00003 #define RIVET_Event_HH
00004
00005 #include "Rivet/Rivet.hh"
00006 #include "Rivet/Projection.hh"
00007
00008 namespace Rivet {
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 class Event {
00021
00022 public:
00023
00024
00025
00026
00027
00028 Event(const GenEvent& ge);
00029
00030
00031 Event(const Event& e);
00032
00033
00034 Event& operator=(const Event& e);
00035
00036
00037
00038
00039 public:
00040
00041
00042 const GenEvent& genEvent() const {
00043 return _genEvent;
00044 }
00045
00046
00047 double weight() const {
00048 return _weight;
00049 }
00050
00051
00052 public:
00053
00054
00055
00056
00057
00058
00059
00060 template <typename PROJ>
00061 const PROJ& applyProjection(PROJ& p) const {
00062 const Projection* cpp(&p);
00063 std::set<const Projection*>::const_iterator old = _projections.find(cpp);
00064 if (old != _projections.end()) {
00065 const Projection& pRef = **old;
00066 return pcast<PROJ>(pRef);
00067 }
00068
00069
00070 Projection* pp = const_cast<Projection*>(cpp);
00071 pp->project(*this);
00072 _projections.insert(pp);
00073 return p;
00074 }
00075
00076
00077 template <typename PROJ>
00078 const PROJ& applyProjection(PROJ* pp) const {
00079 if (!pp) throw Error("Event::applyProjection(PROJ*): Projection pointer is null.");
00080 return applyProjection(*pp);
00081 }
00082
00083
00084 private:
00085
00086
00087
00088 GenEvent _genEvent;
00089
00090
00091 mutable std::set<ConstProjectionPtr> _projections;
00092
00093
00094
00095 double _weight;
00096
00097 };
00098
00099
00100 }
00101
00102 #endif