20 using namespace HepMC;
43 pdfWeightOffset_(cfg.getParameter<unsigned
int>(
"pdfWeightOffset")),
44 nPdfWeights_(cfg.getParameter<unsigned
int>(
"nPdfWeights")),
45 nPdfEigWeights_(cfg.getParameter<unsigned
int>(
"nPdfEigWeights")),
46 pdfweights_(nPdfWeights_),
47 pdfeigweights_(nPdfEigWeights_)
51 tree_ = fs->
make<TTree>(
"tree",
"");
53 tree_->Branch(
"pdfrep",&pdfweights_);
54 tree_->Branch(
"pdfeig",&pdfeigweights_);
55 tree_->Branch(
"weight",&weight_);
58 pdfweightshelper_.
Init(nPdfWeights_,nPdfEigWeights_,mc2hessianCSV);
71 double nomlheweight = lheInfo->
weights()[0].wgt;
76 weight_ = genInfo->
weight();
79 std::vector<double> inpdfweights(nPdfWeights_);
80 for (
unsigned int ipdf=0; ipdf<nPdfWeights_; ++ipdf) {
81 unsigned int iwgt = ipdf + pdfWeightOffset_;
84 pdfweights_[ipdf] = lheInfo->
weights()[iwgt].wgt*weight_/nomlheweight;
87 inpdfweights[ipdf] = lheInfo->
weights()[iwgt].wgt;
91 std::vector<double> outpdfweights(nPdfEigWeights_);
93 pdfweightshelper_.
DoMC2Hessian(nomlheweight,inpdfweights.data(),outpdfweights.data());
95 for (
unsigned int iwgt=0; iwgt<nPdfEigWeights_; ++iwgt) {
96 double wgtval = outpdfweights[iwgt];
99 pdfeigweights_[iwgt] = wgtval*weight_/nomlheweight;
unsigned int nPdfWeights_
T getParameter(std::string const &) const
EDGetTokenT< LHEEventProduct > srcToken_
std::vector< float > pdfeigweights_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void Init(unsigned int nreplicas, unsigned int neigenvectors, const edm::FileInPath &incsv)
void DoMC2Hessian(double nomweight, const double *inweights, double *outweights) const
T * make(const Args &...args) const
make new ROOT object
unsigned int pdfWeightOffset_
const std::vector< WGT > & weights() const
EDGetTokenT< GenEventInfoProduct > srcTokenGen_
unsigned int nPdfEigWeights_
PDFWeightsHelper pdfweightshelper_
std::vector< float > pdfweights_
void analyze(const Event &evt, const EventSetup &es) override
PDFWeightsTest(const ParameterSet &cfg)
EDGetTokenT< LHEEventProduct > srcTokenAlt_