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 00010 class LHEEventProduct { 00011 public: 00012 struct PDF { 00013 std::pair<int, int> id; 00014 std::pair<double, double> x; 00015 std::pair<double, double> xPDF; 00016 double scalePDF; 00017 }; 00018 00019 typedef std::vector<std::string>::const_iterator 00020 comments_const_iterator; 00021 typedef std::vector<std::string>::size_type size_type; 00022 00023 LHEEventProduct() {} 00024 LHEEventProduct(const lhef::HEPEUP &hepeup) : hepeup_(hepeup) {} 00025 ~LHEEventProduct() {} 00026 00027 void setPDF(const PDF &pdf) { pdf_.reset(new PDF(pdf)); } 00028 void addComment(const std::string &line) { comments_.push_back(line); } 00029 00030 const lhef::HEPEUP &hepeup() const { return hepeup_; } 00031 const PDF *pdf() const { return pdf_.get(); } 00032 00033 size_type comments_size() const { return comments_.size(); } 00034 comments_const_iterator comments_begin() const { return comments_.begin(); } 00035 comments_const_iterator comments_end() const { return comments_.end(); } 00036 00037 class const_iterator { 00038 public: 00039 typedef std::forward_iterator_tag iterator_category; 00040 typedef std::string value_type; 00041 typedef std::ptrdiff_t difference_type; 00042 typedef std::string *pointer; 00043 typedef std::string &reference; 00044 00045 const_iterator() : line(npos) {} 00046 ~const_iterator() {} 00047 00048 inline bool operator == (const const_iterator &other) const 00049 { return line == other.line; } 00050 inline bool operator != (const const_iterator &other) const 00051 { return !operator == (other); } 00052 00053 inline const_iterator &operator ++ () 00054 { next(); return *this; } 00055 inline const_iterator operator ++ (int dummy) 00056 { const_iterator orig = *this; next(); return orig; } 00057 00058 const std::string &operator * () const { return tmp; } 00059 const std::string *operator -> () const { return &tmp; } 00060 00061 private: 00062 friend class LHEEventProduct; 00063 00064 void next(); 00065 00066 const LHEEventProduct *event; 00067 unsigned int line; 00068 std::string tmp; 00069 00070 static const unsigned int npos = 99999; 00071 }; 00072 00073 const_iterator begin() const; 00074 inline const_iterator end() const { return const_iterator(); } 00075 00076 private: 00077 lhef::HEPEUP hepeup_; 00078 std::vector<std::string> comments_; 00079 std::auto_ptr<PDF> pdf_; 00080 }; 00081 00082 #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h