![]() |
![]() |
00001 #ifndef SimDataFormats_GeneratorProducts_LHEEventProduct_h 00002 #define SimDataFormats_GeneratorProducts_LHEEventProduct_h 00003 00004 #include <memory> 00005 #include <vector> 00006 #include <string> 00007 00008 #include "SimDataFormats/GeneratorProducts/interface/LesHouches.h" 00009 #include "SimDataFormats/GeneratorProducts/interface/PdfInfo.h" 00010 #include "SimDataFormats/GeneratorProducts/interface/WeightsInfo.h" 00011 00012 class LHEEventProduct { 00013 public: 00014 typedef gen::PdfInfo PDF; 00015 typedef gen::WeightsInfo WGT; 00016 00017 typedef std::vector<std::string>::const_iterator 00018 comments_const_iterator; 00019 typedef std::vector<std::string>::size_type size_type; 00020 00021 LHEEventProduct() {} 00022 LHEEventProduct(const lhef::HEPEUP &hepeup) : 00023 hepeup_(hepeup), originalXWGTUP_(0) {} 00024 LHEEventProduct(const lhef::HEPEUP &hepeup, 00025 const double originalXWGTUP) : 00026 hepeup_(hepeup), originalXWGTUP_(originalXWGTUP) {} 00027 ~LHEEventProduct() {} 00028 00029 void setPDF(const PDF &pdf) { pdf_.reset(new PDF(pdf)); } 00030 void addWeight(const WGT& wgt) { 00031 weights_.push_back(wgt); 00032 } 00033 void addComment(const std::string &line) { comments_.push_back(line); } 00034 00035 double originalXWGTUP() const { return originalXWGTUP_; } 00036 const std::vector<WGT>& weights() const { return weights_; } 00037 00038 const lhef::HEPEUP &hepeup() const { return hepeup_; } 00039 const PDF *pdf() const { return pdf_.get(); } 00040 00041 size_type comments_size() const { return comments_.size(); } 00042 comments_const_iterator comments_begin() const { return comments_.begin(); } 00043 comments_const_iterator comments_end() const { return comments_.end(); } 00044 00045 class const_iterator { 00046 public: 00047 typedef std::forward_iterator_tag iterator_category; 00048 typedef std::string value_type; 00049 typedef std::ptrdiff_t difference_type; 00050 typedef std::string *pointer; 00051 typedef std::string &reference; 00052 00053 const_iterator() : line(npos) {} 00054 ~const_iterator() {} 00055 00056 inline bool operator == (const const_iterator &other) const 00057 { return line == other.line; } 00058 inline bool operator != (const const_iterator &other) const 00059 { return !operator == (other); } 00060 00061 inline const_iterator &operator ++ () 00062 { next(); return *this; } 00063 inline const_iterator operator ++ (int dummy) 00064 { const_iterator orig = *this; next(); return orig; } 00065 00066 const std::string &operator * () const { return tmp; } 00067 const std::string *operator -> () const { return &tmp; } 00068 00069 private: 00070 friend class LHEEventProduct; 00071 00072 void next(); 00073 00074 const LHEEventProduct *event; 00075 unsigned int line; 00076 std::string tmp; 00077 00078 static const unsigned int npos = 99999; 00079 }; 00080 00081 const_iterator begin() const; 00082 inline const_iterator end() const { return const_iterator(); } 00083 00084 private: 00085 lhef::HEPEUP hepeup_; 00086 std::vector<std::string> comments_; 00087 std::auto_ptr<PDF> pdf_; 00088 std::vector<WGT> weights_; 00089 double originalXWGTUP_; 00090 }; 00091 00092 #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h