CMS 3D CMS Logo

GenEventInfoProduct3.cc
Go to the documentation of this file.
1 #include <functional>
2 #include <numeric>
3 using std::ptrdiff_t;
4 
5 #include <HepMC3/GenEvent.h>
6 // #include <HepMC3/WeightContainer.h>
7 #include <HepMC3/GenPdfInfo.h>
8 
10 
12 
13 using namespace edm;
14 using namespace std;
15 
17  : signalProcessID_(0), qScale_(-1.), alphaQCD_(-1.), alphaQED_(-1.), nMEPartons_(-1), nMEPartonsFiltered_(-1) {}
18 
19 GenEventInfoProduct3::GenEventInfoProduct3(const HepMC3::GenEvent *evt)
20  : weights_(evt->weights().begin(), evt->weights().end()), nMEPartons_(-1), nMEPartonsFiltered_(-1) {
21  std::shared_ptr<HepMC3::IntAttribute> A_signal_process_id = evt->attribute<HepMC3::IntAttribute>("signal_process_id");
22  std::shared_ptr<HepMC3::DoubleAttribute> A_event_scale = evt->attribute<HepMC3::DoubleAttribute>("event_scale");
23  std::shared_ptr<HepMC3::DoubleAttribute> A_alphaQCD = evt->attribute<HepMC3::DoubleAttribute>("alphaQCD");
24  std::shared_ptr<HepMC3::DoubleAttribute> A_alphaQED = evt->attribute<HepMC3::DoubleAttribute>("alphaQED");
25  //std::shared_ptr<HepMC3::IntAttribute> A_mpi = evt->attribute<HepMC3::IntAttribute>("mpi");
26 
27  signalProcessID_ = A_signal_process_id ? (A_signal_process_id->value()) : 0;
28  qScale_ = A_event_scale ? (A_event_scale->value()) : 0.0;
29  alphaQCD_ = A_alphaQCD ? (A_alphaQCD->value()) : 0.0;
30  alphaQED_ = A_alphaQED ? (A_alphaQED->value()) : 0.0;
31 
32  std::shared_ptr<HepMC3::GenPdfInfo> A_pdf = evt->attribute<HepMC3::GenPdfInfo>("GenPdfInfo");
33  if (A_pdf) {
34  PDF pdf;
35  pdf.id = std::make_pair(A_pdf->parton_id[0], A_pdf->parton_id[1]);
36  pdf.x = std::make_pair(A_pdf->x[0], A_pdf->x[1]);
37  pdf.xPDF = std::make_pair(A_pdf->xf[0], A_pdf->xf[1]);
38  pdf.scalePDF = A_pdf->scale;
39  setPDF(&pdf);
40  }
41 }
42 
44  : weights_(other.weights_),
45  signalProcessID_(other.signalProcessID_),
46  qScale_(other.qScale_),
47  alphaQCD_(other.alphaQCD_),
48  alphaQED_(other.alphaQED_),
49  binningValues_(other.binningValues_),
50  DJRValues_(other.DJRValues_),
51  nMEPartons_(other.nMEPartons_),
52  nMEPartonsFiltered_(other.nMEPartons_) {
53  setPDF(other.pdf());
54 }
55 
57 
59  weights_ = other.weights_;
60  signalProcessID_ = other.signalProcessID_;
61  qScale_ = other.qScale_;
62  alphaQCD_ = other.alphaQCD_;
63  alphaQED_ = other.alphaQED_;
64  binningValues_ = other.binningValues_;
65  DJRValues_ = other.DJRValues_;
66  nMEPartons_ = other.nMEPartons_;
67  nMEPartonsFiltered_ = other.nMEPartonsFiltered_;
68 
69  setPDF(other.pdf());
70 
71  return *this;
72 }
73 
75  return std::accumulate(weights_.begin(), weights_.end(), 1., std::multiplies<double>());
76 }
void setPDF(const PDF *pdf)
std::pair< double, double > x
Definition: PdfInfo.h:13
const PDF * pdf() const
GenEventInfoProduct3 & operator=(const GenEventInfoProduct3 &other)
std::pair< double, double > xPDF
Definition: PdfInfo.h:14
std::vector< double > weights_
std::vector< float > DJRValues_
std::pair< int, int > id
Definition: PdfInfo.h:12
HLT enums.
std::vector< double > binningValues_
double scalePDF
Definition: PdfInfo.h:15