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
00021
00022 class Event {
00023 public:
00024
00025
00026
00027
00028
00029 Event(const GenEvent& ge);
00030
00031
00032 Event(const Event& e);
00033
00034
00035 ~Event();
00036
00037
00038
00039
00040 public:
00041
00042
00043 const GenEvent& genEvent() const;
00044
00045
00046 double weight() const {
00047 return _weight;
00048 }
00049
00050
00051 public:
00052
00053
00054
00055
00056
00057
00058
00059 template <typename PROJ>
00060 const PROJ& applyProjection(PROJ& p) const {
00061 const Projection* cpp(&p);
00062 std::set<const Projection*>::const_iterator old = _projections.find(cpp);
00063 if (old != _projections.end()) {
00064 const Projection& pRef = **old;
00065 return pcast<PROJ>(pRef);
00066 }
00067
00068
00069 Projection* pp = const_cast<Projection*>(cpp);
00070 pp->project(*this);
00071 _projections.insert(pp);
00072 return p;
00073 }
00074
00075
00076 template <typename PROJ>
00077 const PROJ& applyProjection(PROJ* pp) const {
00078 if (!pp) throw Error("Event::applyProjection(PROJ*): Projection pointer is null.");
00079 return applyProjection(*pp);
00080 }
00081
00082
00083 private:
00084 void _geNormAlignment();
00085
00086
00087
00088
00089 GenEvent const& _genEvent;
00090
00091 GenEvent* _modGenEvent;
00092
00093
00094 mutable std::set<ConstProjectionPtr> _projections;
00095
00096
00097
00098 double _weight;
00099
00100 };
00101
00102
00103 }
00104
00105 #endif