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  hepeup_ = std::move(other.hepeup_);
29  comments_ = std::move(other.comments_);
30  pdf_ = other.pdf_; // auto_ptr, so copy is actually a move
31  weights_ = std::move(other.weights_);
32  originalXWGTUP_ = std::move(other.originalXWGTUP_);
33  scales_ = std::move(other.scales_);
34  npLO_ = std::move(other.npLO_);
35  npNLO_ = std::move(other.npNLO_);
36  }
38  hepeup_ = std::move(other.hepeup_);
39  comments_ = std::move(other.comments_);
40  pdf_ = other.pdf_; // auto_ptr, so copy is actually a move
41  weights_ = std::move(other.weights_);
42  originalXWGTUP_ = std::move(other.originalXWGTUP_);
43  scales_ = std::move(other.scales_);
44  npLO_ = std::move(other.npLO_);
45  npNLO_ = std::move(other.npNLO_);
46  return *this;
47  }
49 
50  void setPDF(const PDF &pdf) { pdf_.reset(new PDF(pdf)); }
51  void addWeight(const WGT& wgt) {
52  weights_.push_back(wgt);
53  }
54  void addComment(const std::string &line) { comments_.push_back(line); }
55 
56  double originalXWGTUP() const { return originalXWGTUP_; }
57  const std::vector<WGT>& weights() const { return weights_; }
58 
59  const std::vector<float> &scales() const { return scales_; }
60  void setScales(const std::vector<float> &scales) { scales_ = scales; }
61 
62  int npLO() const { return npLO_; }
63  int npNLO() const { return npNLO_; }
64 
65  void setNpLO(int n) { npLO_ = n; }
66  void setNpNLO(int n) { npNLO_ = n; }
67 
68  const lhef::HEPEUP &hepeup() const { return hepeup_; }
69  const PDF *pdf() const { return pdf_.get(); }
70 
71  size_type comments_size() const { return comments_.size(); }
72  comments_const_iterator comments_begin() const { return comments_.begin(); }
74 
75  const char* getComment(unsigned i) const {
76  if(comments_.empty() || i>=comments_.size()) return "";
77  else return (const char*) comments_[i].c_str();
78  }
79 
81  public:
82  typedef std::forward_iterator_tag iterator_category;
84  typedef std::ptrdiff_t difference_type;
85  typedef std::string *pointer;
87 
90 
91  inline bool operator == (const const_iterator &other) const
92  { return line == other.line; }
93  inline bool operator != (const const_iterator &other) const
94  { return !operator == (other); }
95 
97  { next(); return *this; }
99  { const_iterator orig = *this; next(); return orig; }
100 
101  const std::string &operator * () const { return tmp; }
102  const std::string *operator -> () const { return &tmp; }
103 
104  private:
105  friend class LHEEventProduct;
106 
107  void next();
108 
110  unsigned int line;
112 
113  static const unsigned int npos = 99999;
114  };
115 
116  const_iterator begin() const;
117  inline const_iterator end() const { return const_iterator(); }
118 
119  private:
121  std::vector<std::string> comments_;
122  std::auto_ptr<PDF> pdf_;
123  std::vector<WGT> weights_;
125  std::vector<float> scales_; //scale value used to exclude EWK-produced partons from matching
126  int npLO_; //number of partons for LO process (used to steer matching/merging)
127  int npNLO_; //number of partons for NLO process (used to steer matching/merging)
128 };
129 
130 #endif // GeneratorEvent_LHEInterface_LHEEventProduct_h
double originalXWGTUP() const
const_iterator begin() const
const_iterator end() const
const lhef::HEPEUP & hepeup() const
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)
std::auto_ptr< PDF > pdf_
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
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_
LHEEventProduct(LHEEventProduct &&other)
gen::PdfInfo PDF
const std::string & operator*() const
std::forward_iterator_tag iterator_category
int npLO() const
LHEEventProduct & operator=(LHEEventProduct &&other)
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
def move(src, dest)
Definition: eostools.py:510
lhef::HEPEUP hepeup_