Go to the documentation of this file.00001 #include <functional>
00002 #include <numeric>
00003 using std::ptrdiff_t;
00004
00005 #include <HepMC/GenEvent.h>
00006 #include <HepMC/WeightContainer.h>
00007 #include <HepMC/PdfInfo.h>
00008
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010
00011 #include "SimDataFormats/GeneratorProducts/interface/GenEventInfoProduct.h"
00012
00013 using namespace edm;
00014 using namespace std;
00015
00016 GenEventInfoProduct::GenEventInfoProduct() :
00017 signalProcessID_(0), qScale_(-1.), alphaQCD_(-1.), alphaQED_(-1.)
00018 {
00019 }
00020
00021 GenEventInfoProduct::GenEventInfoProduct(const HepMC::GenEvent *evt) :
00022 weights_(evt->weights().begin(), evt->weights().end()),
00023 signalProcessID_(evt->signal_process_id()),
00024 qScale_(evt->event_scale()),
00025 alphaQCD_(evt->alphaQCD()),
00026 alphaQED_(evt->alphaQED())
00027 {
00028 const HepMC::PdfInfo *hepPDF = evt->pdf_info();
00029 if (hepPDF) {
00030 PDF pdf;
00031
00032 pdf.id = std::make_pair(hepPDF->id1(), hepPDF->id2());
00033 pdf.x = std::make_pair(hepPDF->x1(), hepPDF->x2());
00034 pdf.xPDF = std::make_pair(hepPDF->pdf1(), hepPDF->pdf2());
00035 pdf.scalePDF = hepPDF->scalePDF();
00036
00037 setPDF(&pdf);
00038 }
00039 }
00040
00041 GenEventInfoProduct::GenEventInfoProduct(GenEventInfoProduct const &other) :
00042 weights_(other.weights_),
00043 signalProcessID_(other.signalProcessID_),
00044 qScale_(other.qScale_),
00045 alphaQCD_(other.alphaQCD_),
00046 alphaQED_(other.alphaQED_),
00047 binningValues_(other.binningValues_)
00048 {
00049 setPDF(other.pdf());
00050 }
00051
00052 GenEventInfoProduct::~GenEventInfoProduct()
00053 {
00054 }
00055
00056 GenEventInfoProduct &GenEventInfoProduct::operator = (GenEventInfoProduct const &other)
00057 {
00058 weights_ = other.weights_;
00059 signalProcessID_ = other.signalProcessID_;
00060 qScale_ = other.qScale_;
00061 alphaQCD_ = other.alphaQCD_;
00062 alphaQED_ = other.alphaQED_;
00063 binningValues_ = other.binningValues_;
00064
00065 setPDF(other.pdf());
00066
00067 return *this;
00068 }
00069
00070 double GenEventInfoProduct::weight() const
00071 {
00072 return std::accumulate(weights_.begin(), weights_.end(),
00073 1., std::multiplies<double>());
00074 }