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  class Header {
16  public:
17  typedef std::vector<std::string>::const_iterator const_iterator;
19 
20  Header() {}
21  Header(const std::string &tag) : tag_(tag) {}
22  ~Header() {}
23 
24  void addLine(const std::string &line) { lines_.push_back(line); }
25 
26  const std::string &tag() const { return tag_; }
27  const std::vector<std::string> &lines() const { return lines_; }
28 
29  size_type size() const { return lines_.size(); }
30  const_iterator begin() const { return lines_.begin(); }
31  const_iterator end() const { return lines_.end(); }
32 
33  bool operator == (const Header &other) const
34  { return tag_ == other.tag_ && lines_ == other.lines_; }
35  inline bool operator != (const Header &other) const
36  { return !(*this == other); }
37 
38  private:
40  std::vector<std::string> lines_;
41  };
42 
44  typedef std::vector<Header>::const_iterator headers_const_iterator;
45  typedef std::vector<std::string>::const_iterator
47 
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 
73  const_iterator() : mode(kDone) {}
75 
76  bool operator == (const const_iterator &other) const;
77  inline bool operator != (const const_iterator &other) const
78  { return !operator == (other); }
79 
80  inline const_iterator &operator ++ ()
81  { next(); return *this; }
82  inline const_iterator operator ++ (int dummy)
83  { const_iterator orig = *this; next(); return orig; }
84 
85  const std::string &operator * () const { return tmp; }
86  const std::string *operator -> () const { return &tmp; }
87 
88  private:
89  friend class LHERunInfoProduct;
90 
91  void next();
92 
93  enum Mode {
98  kFooter
99  };
100 
102  headers_const_iterator header;
105  unsigned int line;
107  };
108 
109  const_iterator begin() const;
110  const_iterator init() const;
111  inline const_iterator end() const { return const_iterator(); }
112 
113  static const std::string &endOfFile();
114 
116  { return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_; }
117  inline bool operator != (const LHERunInfoProduct &other) const
118  { return !(*this == other); }
119 
120  bool mergeProduct(const LHERunInfoProduct &other);
121  bool isProductEqual(const LHERunInfoProduct &other) const
122  { return *this == other; }
123  static bool isTagComparedInMerge(const std::string& tag);
124 
125  private:
127  std::vector<Header> headers_;
128  std::vector<std::string> comments_;
129 };
130 
131 #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
comments_const_iterator comments_end() const
LHERunInfoProduct(const lhef::HEPRUP &heprup)
const LHERunInfoProduct * runInfo
headers_const_iterator headers_end() 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
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)
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< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::vector< Header > headers_
static const std::string & endOfFile()
std::vector< std::string > lines_
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
const_iterator end() const
const_iterator init() const
std::vector< std::string > comments_
const_iterator begin() const