CMS 3D CMS Logo

LHEEventProduct.h
Go to the documentation of this file.
1 #ifndef SimDataFormats_GeneratorProducts_LHEEventProduct_h
2 #define SimDataFormats_GeneratorProducts_LHEEventProduct_h
3 
4 #include <memory>
5 #include <vector>
6 #include <string>
7 
11 
13 public:
14  typedef gen::PdfInfo PDF;
16 
17  typedef std::vector<std::string>::const_iterator comments_const_iterator;
19 
25 
27 
28  ~LHEEventProduct() = default;
29 
30  void setPDF(const PDF &pdf) { pdf_ = std::make_unique<PDF>(pdf); }
31  void addWeight(const WGT &wgt) { weights_.push_back(wgt); }
32  void addComment(const std::string &line) { comments_.push_back(line); }
33 
34  double originalXWGTUP() const { return originalXWGTUP_; }
35  const std::vector<WGT> &weights() const { return weights_; }
36 
37  const std::vector<float> &scales() const { return scales_; }
38  void setScales(const std::vector<float> &scales) { scales_ = scales; }
39 
40  int npLO() const { return npLO_; }
41  int npNLO() const { return npNLO_; }
42  int evtnum() const { return evtnum_; }
43 
44  void setNpLO(int n) { npLO_ = n; }
45  void setNpNLO(int n) { npNLO_ = n; }
46  void setEvtNum(int n) { evtnum_ = n; }
47 
48  const lhef::HEPEUP &hepeup() const { return hepeup_; }
49  const PDF *pdf() const { return pdf_.get(); }
50 
51  size_type comments_size() const { return comments_.size(); }
52  comments_const_iterator comments_begin() const { return comments_.begin(); }
54 
55  const char *getComment(unsigned i) const {
56  if (comments_.empty() || i >= comments_.size())
57  return "";
58  else
59  return (const char *)comments_[i].c_str();
60  }
61 
63  public:
64  typedef std::forward_iterator_tag iterator_category;
66  typedef std::ptrdiff_t difference_type;
67  typedef std::string *pointer;
69 
72 
73  inline bool operator==(const const_iterator &other) const { return line == other.line; }
74  inline bool operator!=(const const_iterator &other) const { return !operator==(other); }
75 
77  next();
78  return *this;
79  }
81  const_iterator orig = *this;
82  next();
83  return orig;
84  }
85 
86  const std::string &operator*() const { return tmp; }
87  const std::string *operator->() const { return &tmp; }
88 
89  private:
90  friend class LHEEventProduct;
91 
92  void next();
93 
95  unsigned int line;
97 
98  static const unsigned int npos = 99999;
99  };
100 
101  const_iterator begin() const;
102  inline const_iterator end() const { return const_iterator(); }
103 
104 private:
106  std::vector<std::string> comments_;
107  std::unique_ptr<PDF> pdf_;
108  std::vector<WGT> weights_;
110  std::vector<float> scales_; //scale value used to exclude EWK-produced partons from matching
111  int npLO_; //number of partons for LO process (used to steer matching/merging)
112  int npNLO_; //number of partons for NLO process (used to steer matching/merging)
113  int evtnum_; //The number of the event (needed to ensure the correct LHE events are saved for MG +Herwig)
114 };
115 
116 #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h
LHEEventProduct & operator=(LHEEventProduct &&other)=default
~LHEEventProduct()=default
double originalXWGTUP() const
void addComment(const std::string &line)
std::vector< std::string >::size_type size_type
void setScales(const std::vector< float > &scales)
const_iterator begin() const
void setNpLO(int n)
LHEEventProduct(const lhef::HEPEUP &hepeup, const double originalXWGTUP)
int npLO() const
void addWeight(const WGT &wgt)
gen::WeightsInfo WGT
std::vector< std::string > comments_
LHEEventProduct(const lhef::HEPEUP &hepeup)
uint16_t size_type
std::unique_ptr< PDF > pdf_
bool operator!=(const const_iterator &other) const
const std::vector< float > & scales() const
void setEvtNum(int n)
int evtnum() const
const LHEEventProduct * event
const std::string * operator->() const
const_iterator operator++(int dummy)
std::vector< WGT > weights_
size_type comments_size() const
gen::PdfInfo PDF
const PDF * pdf() const
std::forward_iterator_tag iterator_category
comments_const_iterator comments_begin() const
void setPDF(const PDF &pdf)
void setNpNLO(int n)
bool operator==(const const_iterator &other) const
const std::string & operator*() const
std::vector< float > scales_
static const unsigned int npos
const char * getComment(unsigned i) const
std::vector< std::string >::const_iterator comments_const_iterator
int npNLO() const
const_iterator end() const
const std::vector< WGT > & weights() const
lhef::HEPEUP hepeup_
comments_const_iterator comments_end() const
const lhef::HEPEUP & hepeup() const