CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenEventInfoProduct.cc
Go to the documentation of this file.
1 #include <functional>
2 #include <numeric>
3 using std::ptrdiff_t;
4 
5 #include <HepMC/GenEvent.h>
6 #include <HepMC/WeightContainer.h>
7 #include <HepMC/PdfInfo.h>
8 
10 
12 
13 using namespace edm;
14 using namespace std;
15 
17  signalProcessID_(0), qScale_(-1.), alphaQCD_(-1.), alphaQED_(-1.)
18 {
19 }
20 
21 GenEventInfoProduct::GenEventInfoProduct(const HepMC::GenEvent *evt) :
22  weights_(evt->weights().begin(), evt->weights().end()),
23  signalProcessID_(evt->signal_process_id()),
24  qScale_(evt->event_scale()),
25  alphaQCD_(evt->alphaQCD()),
26  alphaQED_(evt->alphaQED())
27 {
28  const HepMC::PdfInfo *hepPDF = evt->pdf_info();
29  if (hepPDF) {
30  PDF pdf;
31 
32  pdf.id = std::make_pair(hepPDF->id1(), hepPDF->id2());
33  pdf.x = std::make_pair(hepPDF->x1(), hepPDF->x2());
34  pdf.xPDF = std::make_pair(hepPDF->pdf1(), hepPDF->pdf2());
35  pdf.scalePDF = hepPDF->scalePDF();
36 
37  setPDF(&pdf);
38  }
39 }
40 
42  weights_(other.weights_),
43  signalProcessID_(other.signalProcessID_),
44  qScale_(other.qScale_),
45  alphaQCD_(other.alphaQCD_),
46  alphaQED_(other.alphaQED_),
47  binningValues_(other.binningValues_)
48 {
49  setPDF(other.pdf());
50 }
51 
53 {
54 }
55 
57 {
58  weights_ = other.weights_;
60  qScale_ = other.qScale_;
61  alphaQCD_ = other.alphaQCD_;
62  alphaQED_ = other.alphaQED_;
64 
65  setPDF(other.pdf());
66 
67  return *this;
68 }
69 
71 {
72  return std::accumulate(weights_.begin(), weights_.end(),
73  1., std::multiplies<double>());
74 }
void setPDF(const PDF *pdf)
const PDF * pdf() const
std::pair< double, double > x
Definition: PdfInfo.h:11
GenEventInfoProduct & operator=(const GenEventInfoProduct &other)
std::pair< double, double > xPDF
Definition: PdfInfo.h:12
std::vector< double > weights_
#define end
Definition: vmac.h:37
std::pair< int, int > id
Definition: PdfInfo.h:10
std::vector< double > binningValues_
#define begin
Definition: vmac.h:30
unsigned int signalProcessID_
double scalePDF
Definition: PdfInfo.h:13