CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/SimDataFormats/GeneratorProducts/interface/LHEEventProduct.h

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