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
LHERunInfoProduct::comments_size
size_type comments_size() const
Definition: LHERunInfoProduct.h:61
LHERunInfoProduct::Header::operator!=
bool operator!=(const Header &other) const
Definition: LHERunInfoProduct.h:35
LHERunInfoProduct::headers_
std::vector< Header > headers_
Definition: LHERunInfoProduct.h:125
LHERunInfoProduct::Header::const_iterator
std::vector< std::string >::const_iterator const_iterator
Definition: LHERunInfoProduct.h:18
LHERunInfoProduct::Header
Definition: LHERunInfoProduct.h:16
LHERunInfoProduct::const_iterator::kFooter
Definition: LHERunInfoProduct.h:97
LHERunInfoProduct::const_iterator::header
headers_const_iterator header
Definition: LHERunInfoProduct.h:100
LHERunInfoProduct::Header::lines
const std::vector< std::string > & lines() const
Definition: LHERunInfoProduct.h:28
LHERunInfoProduct::const_iterator::kDone
Definition: LHERunInfoProduct.h:97
LHERunInfoProduct::const_iterator::operator++
const_iterator operator++(int dummy)
Definition: LHERunInfoProduct.h:83
LHERunInfoProduct::heprup
const lhef::HEPRUP & heprup() const
Definition: LHERunInfoProduct.h:55
LHERunInfoProduct::const_iterator::value_type
std::string value_type
Definition: LHERunInfoProduct.h:68
LHERunInfoProduct::const_iterator::next
void next()
Definition: LHERunInfoProduct.cc:38
LHERunInfoProduct::const_iterator::operator==
bool operator==(const const_iterator &other) const
Definition: LHERunInfoProduct.cc:16
LHERunInfoProduct::const_iterator::kHeader
Definition: LHERunInfoProduct.h:97
LHERunInfoProduct::const_iterator::tmp
std::string tmp
Definition: LHERunInfoProduct.h:104
DDAxes::x
LHERunInfoProduct::headers_end
headers_const_iterator headers_end() const
Definition: LHERunInfoProduct.h:59
LHERunInfoProduct::const_iterator::kInit
Definition: LHERunInfoProduct.h:97
LHERunInfoProduct::addHeader
void addHeader(const Header &header)
Definition: LHERunInfoProduct.h:52
LHERunInfoProduct::init
const_iterator init() const
Definition: LHERunInfoProduct.cc:127
LHERunInfoProduct::const_iterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: LHERunInfoProduct.h:67
LHERunInfoProduct::Header::size_type
std::vector< std::string >::size_type size_type
Definition: LHERunInfoProduct.h:19
LHERunInfoProduct::headers_const_iterator
std::vector< Header >::const_iterator headers_const_iterator
Definition: LHERunInfoProduct.h:43
LHERunInfoProduct::headers_begin
headers_const_iterator headers_begin() const
Definition: LHERunInfoProduct.h:58
checklist
static std::vector< std::string > checklist
Definition: LHERunInfoProduct.cc:179
LHERunInfoProduct::Header::Header
Header(const std::string &tag)
Definition: LHERunInfoProduct.h:22
LHERunInfoProduct::Header::end
const_iterator end() const
Definition: LHERunInfoProduct.h:32
LHERunInfoProduct
Definition: LHERunInfoProduct.h:13
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
LHERunInfoProduct::end
const_iterator end() const
Definition: LHERunInfoProduct.h:109
LHERunInfoProduct::const_iterator::difference_type
std::ptrdiff_t difference_type
Definition: LHERunInfoProduct.h:69
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
LHERunInfoProduct::Header::size
size_type size() const
Definition: LHERunInfoProduct.h:30
LHERunInfoProduct::~LHERunInfoProduct
~LHERunInfoProduct()
Definition: LHERunInfoProduct.h:48
LHERunInfoProduct::addComment
void addComment(const std::string &line)
Definition: LHERunInfoProduct.h:53
LHERunInfoProduct::const_iterator::kBody
Definition: LHERunInfoProduct.h:97
LHERunInfoProduct::operator!=
bool operator!=(const LHERunInfoProduct &other) const
Definition: LHERunInfoProduct.h:116
trackingPlots.other
other
Definition: trackingPlots.py:1460
LHERunInfoProduct::Header::~Header
~Header()
Definition: LHERunInfoProduct.h:23
LHERunInfoProduct::Header::tag
const std::string & tag() const
Definition: LHERunInfoProduct.h:27
LHERunInfoProduct::const_iterator::operator++
const_iterator & operator++()
Definition: LHERunInfoProduct.h:79
LHERunInfoProduct::Header::operator==
bool operator==(const Header &other) const
Definition: LHERunInfoProduct.h:34
LHERunInfoProduct::const_iterator::runInfo
const LHERunInfoProduct * runInfo
Definition: LHERunInfoProduct.h:99
LHERunInfoProduct::mergeProduct
bool mergeProduct(const LHERunInfoProduct &other)
Definition: LHERunInfoProduct.cc:193
LHERunInfoProduct::Header::Header
Header()
Definition: LHERunInfoProduct.h:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LHERunInfoProduct::const_iterator::line
unsigned int line
Definition: LHERunInfoProduct.h:103
LHERunInfoProduct::swap
void swap(LHERunInfoProduct &other)
Definition: LHERunInfoProduct.cc:278
LHERunInfoProduct::const_iterator::reference
std::string & reference
Definition: LHERunInfoProduct.h:71
LHERunInfoProduct::headers_size
size_type headers_size() const
Definition: LHERunInfoProduct.h:57
LHERunInfoProduct::comments_begin
comments_const_iterator comments_begin() const
Definition: LHERunInfoProduct.h:62
LHERunInfoProduct::const_iterator::operator->
const std::string * operator->() const
Definition: LHERunInfoProduct.h:90
LHERunInfoProduct::const_iterator::pointer
std::string * pointer
Definition: LHERunInfoProduct.h:70
LHERunInfoProduct::comments_end
comments_const_iterator comments_end() const
Definition: LHERunInfoProduct.h:63
LHERunInfoProduct::operator==
bool operator==(const LHERunInfoProduct &other) const
Definition: LHERunInfoProduct.h:113
LHERunInfoProduct::begin
const_iterator begin() const
Definition: LHERunInfoProduct.cc:115
lhef::HEPRUP
Definition: LesHouches.h:22
LHERunInfoProduct::const_iterator::Mode
Mode
Definition: LHERunInfoProduct.h:97
LHERunInfoProduct::isTagComparedInMerge
static bool isTagComparedInMerge(const std::string &tag)
Definition: LHERunInfoProduct.cc:188
LesHouches.h
LHERunInfoProduct::Header::addLine
void addLine(const std::string &line)
Definition: LHERunInfoProduct.h:25
LHERunInfoProduct::const_iterator
Definition: LHERunInfoProduct.h:65
LHERunInfoProduct::const_iterator::mode
Mode mode
Definition: LHERunInfoProduct.h:102
LHERunInfoProduct::Header::begin
const_iterator begin() const
Definition: LHERunInfoProduct.h:31
LHERunInfoProduct::LHERunInfoProduct
LHERunInfoProduct()
Definition: LHERunInfoProduct.h:46
LHERunInfoProduct::weights_defs
std::vector< std::pair< std::string, std::string > > weights_defs
Definition: LHERunInfoProduct.h:15
LHERunInfoProduct::comments_
std::vector< std::string > comments_
Definition: LHERunInfoProduct.h:126
LHERunInfoProduct::const_iterator::iter
Header::const_iterator iter
Definition: LHERunInfoProduct.h:101
LHERunInfoProduct::Header::lines_
std::vector< std::string > lines_
Definition: LHERunInfoProduct.h:39
LHERunInfoProduct::size_type
std::vector< Header >::size_type size_type
Definition: LHERunInfoProduct.h:42
LHERunInfoProduct::const_iterator::operator*
const std::string & operator*() const
Definition: LHERunInfoProduct.h:89
LHERunInfoProduct::const_iterator::const_iterator
const_iterator()
Definition: LHERunInfoProduct.h:73
LHERunInfoProduct::const_iterator::~const_iterator
~const_iterator()
Definition: LHERunInfoProduct.h:74
RecoTauValidation_cfi.header
header
Definition: RecoTauValidation_cfi.py:292
LHERunInfoProduct::Header::tag_
std::string tag_
Definition: LHERunInfoProduct.h:38
dummy
Definition: DummySelector.h:38
LHERunInfoProduct::heprup_
lhef::HEPRUP heprup_
Definition: LHERunInfoProduct.h:124
mps_splice.line
line
Definition: mps_splice.py:76
LHERunInfoProduct::const_iterator::operator!=
bool operator!=(const const_iterator &other) const
Definition: LHERunInfoProduct.h:77
LHERunInfoProduct::find_if_checklist
bool find_if_checklist(const std::string x, std::vector< std::string > checklist)
Definition: LHERunInfoProduct.cc:182
LHERunInfoProduct::comments_const_iterator
std::vector< std::string >::const_iterator comments_const_iterator
Definition: LHERunInfoProduct.h:44
LHERunInfoProduct::LHERunInfoProduct
LHERunInfoProduct(const lhef::HEPRUP &heprup)
Definition: LHERunInfoProduct.h:47
LHERunInfoProduct::isProductEqual
bool isProductEqual(const LHERunInfoProduct &other) const
Definition: LHERunInfoProduct.h:120
LHERunInfoProduct::endOfFile
static const std::string & endOfFile()
Definition: LHERunInfoProduct.cc:138