19 using namespace HepMC;
42 pdfWeightOffset_(cfg.getParameter<unsigned int>(
"pdfWeightOffset")),
43 nPdfWeights_(cfg.getParameter<unsigned int>(
"nPdfWeights")),
44 nPdfEigWeights_(cfg.getParameter<unsigned int>(
"nPdfEigWeights")),
45 pdfweights_(nPdfWeights_),
46 pdfeigweights_(nPdfEigWeights_) {
48 tree_ = fs->
make<TTree>(
"tree",
"");
50 tree_->Branch(
"pdfrep", &pdfweights_);
51 tree_->Branch(
"pdfeig", &pdfeigweights_);
52 tree_->Branch(
"weight", &weight_);
55 pdfweightshelper_.Init(nPdfWeights_, nPdfEigWeights_, mc2hessianCSV);
67 double nomlheweight = lheInfo->weights()[0].wgt;
72 weight_ = genInfo->weight();
75 std::vector<double> inpdfweights(nPdfWeights_);
76 for (
unsigned int ipdf = 0; ipdf < nPdfWeights_; ++ipdf) {
77 unsigned int iwgt = ipdf + pdfWeightOffset_;
80 pdfweights_[ipdf] = lheInfo->weights()[iwgt].wgt * weight_ / nomlheweight;
83 inpdfweights[ipdf] = lheInfo->weights()[iwgt].wgt;
86 std::vector<double> outpdfweights(nPdfEigWeights_);
88 pdfweightshelper_.DoMC2Hessian(nomlheweight, inpdfweights.data(), outpdfweights.data());
90 for (
unsigned int iwgt = 0; iwgt < nPdfEigWeights_; ++iwgt) {
91 double wgtval = outpdfweights[iwgt];
94 pdfeigweights_[iwgt] = wgtval * weight_ / nomlheweight;
unsigned int nPdfWeights_
EDGetTokenT< LHEEventProduct > srcToken_
std::vector< float > pdfeigweights_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
T * make(const Args &...args) const
make new ROOT object
unsigned int pdfWeightOffset_
EDGetTokenT< GenEventInfoProduct > srcTokenGen_
unsigned int nPdfEigWeights_
PDFWeightsHelper pdfweightshelper_
std::vector< float > pdfweights_
T getParameter(std::string const &) const
void analyze(const Event &evt, const EventSetup &es) override
PDFWeightsTest(const ParameterSet &cfg)
EDGetTokenT< LHEEventProduct > srcTokenAlt_