CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LHERunInfoProduct.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_GeneratorProducts_LHERunInfoProduct_h
2 #define SimDataFormats_GeneratorProducts_LHERunInfoProduct_h
3 
4 #include <iterator>
5 #include <memory>
6 #include <vector>
7 #include <string>
8 
9 //#include <hepml.hpp>
10 
12 
14  public:
15  typedef std::vector<std::pair<std::string,std::string> > weights_defs;
16  class Header {
17  public:
18  typedef std::vector<std::string>::const_iterator const_iterator;
20 
21  Header() {}
22  Header(const std::string &tag) : tag_(tag) {}
23  ~Header() {}
24 
25  void addLine(const std::string &line) { lines_.push_back(line); }
26 
27  const std::string &tag() const { return tag_; }
28  const std::vector<std::string> &lines() const { return lines_; }
29 
30  size_type size() const { return lines_.size(); }
31  const_iterator begin() const { return lines_.begin(); }
32  const_iterator end() const { return lines_.end(); }
33 
34  bool operator == (const Header &other) const
35  { return tag_ == other.tag_ && lines_ == other.lines_; }
36  inline bool operator != (const Header &other) const
37  { return !(*this == other); }
38 
39  private:
41  std::vector<std::string> lines_;
42  };
43 
45  typedef std::vector<Header>::const_iterator headers_const_iterator;
46  typedef std::vector<std::string>::const_iterator
48 
52 
53  void addHeader(const Header &header) { headers_.push_back(header); }
54  void addComment(const std::string &line) { comments_.push_back(line); }
55 
56  const lhef::HEPRUP &heprup() const { return heprup_; }
57 
58  size_type headers_size() const { return headers_.size(); }
59  headers_const_iterator headers_begin() const { return headers_.begin(); }
60  headers_const_iterator headers_end() const { return headers_.end(); }
61 
62  size_type comments_size() const { return comments_.size(); }
63  comments_const_iterator comments_begin() const { return comments_.begin(); }
65 
67  public:
68  typedef std::forward_iterator_tag iterator_category;
70  typedef std::ptrdiff_t difference_type;
71  typedef std::string *pointer;
73 
76 
77  bool operator == (const const_iterator &other) const;
78  inline bool operator != (const const_iterator &other) const
79  { return !operator == (other); }
80 
82  { next(); return *this; }
83  inline const_iterator operator ++ (int dummy)
84  { const_iterator orig = *this; next(); return orig; }
85 
86  const std::string &operator * () const { return tmp; }
87  const std::string *operator -> () const { return &tmp; }
88 
89  private:
90  friend class LHERunInfoProduct;
91 
92  void next();
93 
94  enum Mode {
100  };
101 
106  unsigned int line;
108  };
109 
110  const_iterator begin() const;
111  const_iterator init() const;
112  inline const_iterator end() const { return const_iterator(); }
113 
114  static const std::string &endOfFile();
115 
116  bool operator == (const LHERunInfoProduct &other) const
117  { return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_; }
118  inline bool operator != (const LHERunInfoProduct &other) const
119  { return !(*this == other); }
120 
121  bool mergeProduct(const LHERunInfoProduct &other);
122  bool isProductEqual(const LHERunInfoProduct &other) const
123  { return *this == other; }
124  static bool isTagComparedInMerge(const std::string& tag);
125 
126  private:
128  std::vector<Header> headers_;
129  std::vector<std::string> comments_;
130 };
131 
132 #endif // GeneratorRunInfo_LHEInterface_LHERunInfoProduct_h
const std::vector< std::string > & lines() const
std::vector< Header >::const_iterator headers_const_iterator
void addHeader(const Header &header)
std::forward_iterator_tag iterator_category
bool operator!=(const LHERunInfoProduct &other) const
comments_const_iterator comments_end() const
std::vector< std::pair< std::string, std::string > > weights_defs
LHERunInfoProduct(const lhef::HEPRUP &heprup)
const LHERunInfoProduct * runInfo
headers_const_iterator headers_end() const
bool operator!=(const const_iterator &other) const
std::vector< std::string >::const_iterator const_iterator
const_iterator end() const
bool isProductEqual(const LHERunInfoProduct &other) const
uint16_t size_type
const lhef::HEPRUP & heprup() const
const std::string & operator*() const
bool operator==(const const_iterator &other) const
headers_const_iterator headers_begin() const
bool operator!=(const Header &other) const
void addLine(const std::string &line)
const std::string & tag() const
static bool isTagComparedInMerge(const std::string &tag)
bool operator==(const LHERunInfoProduct &other) const
std::vector< std::string >::size_type size_type
size_type comments_size() const
void addComment(const std::string &line)
bool operator==(const Header &other) const
std::vector< Header >::size_type size_type
comments_const_iterator comments_begin() const
std::vector< std::string >::const_iterator comments_const_iterator
bool mergeProduct(const LHERunInfoProduct &other)
Header(const std::string &tag)
size_type headers_size() const
std::vector< Header > headers_
static const std::string & endOfFile()
std::vector< std::string > lines_
const_iterator end() const
const_iterator init() const
std::vector< std::string > comments_
const_iterator begin() const
const std::string * operator->() const
const_iterator begin() const