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
20 
23  hepeup_(hepeup), originalXWGTUP_(0) {}
25  const double originalXWGTUP) :
26  hepeup_(hepeup), originalXWGTUP_(originalXWGTUP) {}
28 
30 
31  ~LHEEventProduct() =default;
32 
33  void setPDF(const PDF &pdf) { pdf_.reset(new PDF(pdf)); }
34  void addWeight(const WGT& wgt) {
35  weights_.push_back(wgt);
36  }
37  void addComment(const std::string &line) { comments_.push_back(line); }
38 
39  double originalXWGTUP() const { return originalXWGTUP_; }
40  const std::vector<WGT>& weights() const { return weights_; }
41 
42  const std::vector<float> &scales() const { return scales_; }
43  void setScales(const std::vector<float> &scales) { scales_ = scales; }
44 
45  int npLO() const { return npLO_; }
46  int npNLO() const { return npNLO_; }
47 
48  void setNpLO(int n) { npLO_ = n; }
49  void setNpNLO(int n) { npNLO_ = n; }
50 
51  const lhef::HEPEUP &hepeup() const { return hepeup_; }
52  const PDF *pdf() const { return pdf_.get(); }
53 
54  size_type comments_size() const { return comments_.size(); }
55  comments_const_iterator comments_begin() const { return comments_.begin(); }
57 
58  const char* getComment(unsigned i) const {
59  if(comments_.empty() || i>=comments_.size()) return "";
60  else return (const char*) comments_[i].c_str();
61  }
62 
64  public:
65  typedef std::forward_iterator_tag iterator_category;
67  typedef std::ptrdiff_t difference_type;
68  typedef std::string *pointer;
70 
73 
74  inline bool operator == (const const_iterator &other) const
75  { return line == other.line; }
76  inline bool operator != (const const_iterator &other) const
77  { return !operator == (other); }
78 
80  { next(); return *this; }
82  { const_iterator orig = *this; next(); return orig; }
83 
84  const std::string &operator * () const { return tmp; }
85  const std::string *operator -> () const { return &tmp; }
86 
87  private:
88  friend class LHEEventProduct;
89 
90  void next();
91 
93  unsigned int line;
95 
96  static const unsigned int npos = 99999;
97  };
98 
99  const_iterator begin() const;
100  inline const_iterator end() const { return const_iterator(); }
101 
102  private:
104  std::vector<std::string> comments_;
105  std::unique_ptr<PDF> pdf_;
106  std::vector<WGT> weights_;
108  std::vector<float> scales_; //scale value used to exclude EWK-produced partons from matching
109  int npLO_; //number of partons for LO process (used to steer matching/merging)
110  int npNLO_; //number of partons for NLO process (used to steer matching/merging)
111 };
112 
113 #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h
double originalXWGTUP() const
const_iterator begin() const
const_iterator end() const
const lhef::HEPEUP & hepeup() const
LHEEventProduct & operator=(LHEEventProduct &&other)=default
~LHEEventProduct()=default
bool operator!=(const const_iterator &other) const
void addComment(const std::string &line)
std::vector< std::string >::size_type size_type
void setScales(const std::vector< float > &scales)
const PDF * pdf() const
void setNpLO(int n)
LHEEventProduct(const lhef::HEPEUP &hepeup, const double originalXWGTUP)
void addWeight(const WGT &wgt)
const std::string * operator->() const
gen::WeightsInfo WGT
std::vector< std::string > comments_
LHEEventProduct(const lhef::HEPEUP &hepeup)
size_type comments_size() const
uint16_t size_type
std::unique_ptr< PDF > pdf_
const char * getComment(unsigned i) const
const std::vector< WGT > & weights() const
const LHEEventProduct * event
comments_const_iterator comments_begin() const
std::vector< WGT > weights_
gen::PdfInfo PDF
const std::string & operator*() const
std::forward_iterator_tag iterator_category
int npLO() const
void setPDF(const PDF &pdf)
void setNpNLO(int n)
const std::vector< float > & scales() const
bool operator==(const const_iterator &other) const
comments_const_iterator comments_end() const
std::vector< float > scales_
static const unsigned int npos
int npNLO() const
std::vector< std::string >::const_iterator comments_const_iterator
lhef::HEPEUP hepeup_