00001
00002 #ifndef RIVET_Event_HH
00003 #define RIVET_Event_HH
00004
00005 #include "Rivet/Rivet.hh"
00006 #include "Rivet/Projection.hh"
00007 #include "HepMC/GenEvent.h"
00008 #include "Event.fhh"
00009
00010
00011 namespace Rivet {
00012
00013
00014 typedef HepMC::GenEvent GenEvent;
00015
00016
00017 typedef HepMC::GenVertex GenVertex;
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 class Event {
00030
00031 public:
00032
00033
00034
00035
00036 inline Event(const GenEvent & geneve)
00037 : theGenEvent(&geneve), theWeight(1.0) {
00038 if ( geneve.weights().size() ) theWeight = geneve.weights()[0];
00039 }
00040
00041
00042 inline Event(const Event& x)
00043 : theGenEvent(x.theGenEvent), theWeight(x.theWeight)
00044 { }
00045
00046
00047 virtual ~Event() { }
00048
00049
00050 public:
00051
00052
00053 inline const GenEvent& genEvent() const { return *theGenEvent; }
00054
00055
00056
00057
00058
00059
00060
00061 template <typename PROJ>
00062 inline const PROJ& applyProjection(PROJ& p) const {
00063 std::set<const Projection*>::const_iterator old = theProjections.find(&p);
00064 if ( old != theProjections.end() ) {
00065 return *( dynamic_cast<const PROJ*>(*old) );
00066 }
00067
00068
00069 Projection* pp = &p;
00070 pp->project(*this);
00071 theProjections.insert(pp);
00072 return p;
00073 }
00074
00075
00076 inline double weight() const { return theWeight; }
00077
00078 private:
00079
00080
00081 const GenEvent* theGenEvent;
00082
00083
00084 mutable std::set<const Projection*> theProjections;
00085
00086
00087 double theWeight;
00088
00089 private:
00090
00091
00092
00093 Event& operator=(const Event&);
00094
00095 };
00096
00097 }
00098
00099 #endif