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
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  bool find_if_checklist(const std::string x, std::vector<std::string> checklist);
54 
55  void addHeader(const Header &header) { headers_.push_back(header); }
56  void addComment(const std::string &line) { comments_.push_back(line); }
57 
58  const lhef::HEPRUP &heprup() const { return heprup_; }
59 
60  size_type headers_size() const { return headers_.size(); }
61  headers_const_iterator headers_begin() const { return headers_.begin(); }
62  headers_const_iterator headers_end() const { return headers_.end(); }
63 
64  size_type comments_size() const { return comments_.size(); }
65  comments_const_iterator comments_begin() const { return comments_.begin(); }
67 
69  public:
70  typedef std::forward_iterator_tag iterator_category;
72  typedef std::ptrdiff_t difference_type;
73  typedef std::string *pointer;
75 
76  const_iterator() : mode(kDone) {}
78 
79  bool operator == (const const_iterator &other) const;
80  inline bool operator != (const const_iterator &other) const
81  { return !operator == (other); }
82 
83  inline const_iterator &operator ++ ()
84  { next(); return *this; }
85  inline const_iterator operator ++ (int dummy)
86  { const_iterator orig = *this; next(); return orig; }
87 
88  const std::string &operator * () const { return tmp; }
89  const std::string *operator -> () const { return &tmp; }
90 
91  private:
92  friend class LHERunInfoProduct;
93 
94  void next();
95 
96  enum Mode {
101  kFooter
102  };
103 
105  headers_const_iterator header;
108  unsigned int line;
110  };
111 
112  const_iterator begin() const;
113  const_iterator init() const;
114  inline const_iterator end() const { return const_iterator(); }
115 
116  static const std::string &endOfFile();
117 
119  { return heprup_ == other.heprup_ && headers_ == other.headers_ && comments_ == other.comments_; }
120  inline bool operator != (const LHERunInfoProduct &other) const
121  { return !(*this == other); }
122 
123  bool mergeProduct(const LHERunInfoProduct &other);
124  bool isProductEqual(const LHERunInfoProduct &other) const
125  { return *this == other; }
126  static bool isTagComparedInMerge(const std::string& tag);
127 
128  private:
130  std::vector<Header> headers_;
131  std::vector<std::string> comments_;
132 };
133 
134 #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
std::vector< std::pair< std::string, std::string > > weights_defs
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
static std::vector< std::string > checklist
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
bool find_if_checklist(const std::string x, std::vector< std::string > checklist)
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