CMS 3D CMS Logo

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 { return tag_ == other.tag_ && lines_ == other.lines_; }
35  inline bool operator!=(const Header &other) const { return !(*this == other); }
36 
37  private:
39  std::vector<std::string> lines_;
40  };
41 
43  typedef std::vector<Header>::const_iterator headers_const_iterator;
44  typedef std::vector<std::string>::const_iterator comments_const_iterator;
45 
49 
50  bool find_if_checklist(const std::string x, std::vector<std::string> checklist);
51 
52  void addHeader(const Header &header) { headers_.push_back(header); }
53  void addComment(const std::string &line) { comments_.push_back(line); }
54 
55  const lhef::HEPRUP &heprup() const { return heprup_; }
56 
57  size_type headers_size() const { return headers_.size(); }
58  headers_const_iterator headers_begin() const { return headers_.begin(); }
59  headers_const_iterator headers_end() const { return headers_.end(); }
60 
61  size_type comments_size() const { return comments_.size(); }
62  comments_const_iterator comments_begin() const { return comments_.begin(); }
64 
66  public:
67  typedef std::forward_iterator_tag iterator_category;
69  typedef std::ptrdiff_t difference_type;
70  typedef std::string *pointer;
72 
75 
76  bool operator==(const const_iterator &other) const;
77  inline bool operator!=(const const_iterator &other) const { return !operator==(other); }
78 
80  next();
81  return *this;
82  }
84  const_iterator orig = *this;
85  next();
86  return orig;
87  }
88 
89  const std::string &operator*() const { return tmp; }
90  const std::string *operator->() const { return &tmp; }
91 
92  private:
93  friend class LHERunInfoProduct;
94 
95  void next();
96 
98 
103  unsigned int line;
105  };
106 
107  const_iterator begin() const;
108  const_iterator init() const;
109  inline const_iterator end() const { return const_iterator(); }
110 
111  static const std::string &endOfFile();
112 
113  bool operator==(const LHERunInfoProduct &other) const {
114  return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_;
115  }
116  inline bool operator!=(const LHERunInfoProduct &other) const { return !(*this == other); }
117 
118  bool mergeProduct(const LHERunInfoProduct &other);
120  bool isProductEqual(const LHERunInfoProduct &other) const { return *this == other; }
121  static bool isTagComparedInMerge(const std::string &tag);
122 
123 private:
125  std::vector<Header> headers_;
126  std::vector<std::string> comments_;
127 };
128 
129 #endif // GeneratorRunInfo_LHEInterface_LHERunInfoProduct_h
const std::string * operator->() const
std::vector< Header >::const_iterator headers_const_iterator
const std::string & operator*() const
bool operator!=(const Header &other) const
void addHeader(const Header &header)
const_iterator end() const
bool operator==(const const_iterator &other) const
std::forward_iterator_tag iterator_category
headers_const_iterator headers_begin() const
bool operator!=(const LHERunInfoProduct &other) const
bool operator==(const Header &other) const
LHERunInfoProduct(const lhef::HEPRUP &heprup)
const LHERunInfoProduct * runInfo
bool isProductEqual(const LHERunInfoProduct &other) const
std::vector< std::string >::const_iterator const_iterator
uint16_t size_type
comments_const_iterator comments_end() const
static std::vector< std::string > checklist
const_iterator end() const
void swap(LHERunInfoProduct &other)
headers_const_iterator headers_end() const
const lhef::HEPRUP & heprup() const
bool operator!=(const const_iterator &other) const
bool operator==(const LHERunInfoProduct &other) const
void addLine(const std::string &line)
std::vector< std::pair< std::string, std::string > > weights_defs
static bool isTagComparedInMerge(const std::string &tag)
const_iterator init() const
std::vector< std::string >::size_type size_type
const_iterator begin() const
void addComment(const std::string &line)
std::vector< Header >::size_type size_type
std::vector< std::string >::const_iterator comments_const_iterator
bool mergeProduct(const LHERunInfoProduct &other)
Header(const std::string &tag)
const std::vector< std::string > & lines() const
const std::string & tag() const
const_iterator begin() const
bool find_if_checklist(const std::string x, std::vector< std::string > checklist)
std::vector< Header > headers_
comments_const_iterator comments_begin() const
size_type headers_size() const
static const std::string & endOfFile()
size_type comments_size() const
std::vector< std::string > lines_
const_iterator operator++(int dummy)
std::vector< std::string > comments_