CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PdfWeightProducerTool.cc
Go to the documentation of this file.
2 #include <cassert>
3 
4 namespace LHAPDF {
5  void initPDFSet(int nset, const std::string& filename, int member=0);
6  int numberPDF(int nset);
7  void usePDFMember(int nset, int member);
8  double xfx(int nset, double x, double Q, int fl);
9  double getXmin(int nset, int member);
10  double getXmax(int nset, int member);
11  double getQ2min(int nset, int member);
12  double getQ2max(int nset, int member);
13  void extrapolate(bool extrapolate=true);
14 }
15 
16 namespace heppy {
17 
19  pdfs_.push_back(name);
20  weights_[name] = std::vector<double>();
21 }
22 
24  for (unsigned int i = 0, n = pdfs_.size(); i < n; ++i) {
26  }
27 }
28 
30  float Q = pdfstuff.pdf()->scalePDF;
31 
32  int id1 = pdfstuff.pdf()->id.first;
33  double x1 = pdfstuff.pdf()->x.first;
34  double pdf1 = pdfstuff.pdf()->xPDF.first;
35 
36  int id2 = pdfstuff.pdf()->id.second;
37  double x2 = pdfstuff.pdf()->x.second;
38  double pdf2 = pdfstuff.pdf()->xPDF.second;
39 
40  for (unsigned int i = 0, n = pdfs_.size(); i < n; ++i) {
41  std::vector<double> & weights = weights_[pdfs_[i]];
42  unsigned int nweights = 1;
43  if (LHAPDF::numberPDF(i+1)>1) nweights += LHAPDF::numberPDF(i+1);
44  weights.resize(nweights);
45 
46  for (unsigned int j = 0; j < nweights; ++j) {
48  double newpdf1 = LHAPDF::xfx(i+1, x1, Q, id1)/x1;
49  double newpdf2 = LHAPDF::xfx(i+1, x2, Q, id2)/x2;
50  weights[j] = newpdf1/pdf1*newpdf2/pdf2;
51  }
52  }
53 }
54 
55 const std::vector<double> & PdfWeightProducerTool::getWeights(const std::string &name) const {
56  std::map<std::string, std::vector<double> >::const_iterator match = weights_.find(name);
57  assert(match != weights_.end());
58  return match->second;
59 }
60 
61 
62 }
int i
Definition: DBlmapReader.cc:9
const PDF * pdf() const
std::vector< std::string > pdfs_
assert(m_qm.get())
std::pair< double, double > x
Definition: PdfInfo.h:11
std::map< std::string, std::vector< double > > weights_
void addPdfSet(const std::string &name)
void processEvent(const GenEventInfoProduct &pdfstuff)
void initPDFSet(int nset, const std::string &filename, int member=0)
std::pair< double, double > xPDF
Definition: PdfInfo.h:12
double getXmax(int nset, int member)
double getQ2max(int nset, int member)
const std::vector< double > & getWeights(const std::string &name) const
void extrapolate(bool extrapolate=true)
int j
Definition: DBlmapReader.cc:9
int numberPDF(int nset)
double getXmin(int nset, int member)
std::pair< int, int > id
Definition: PdfInfo.h:10
double xfx(int nset, double x, double Q, int fl)
tuple filename
Definition: lut2db_cfg.py:20
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
double getQ2min(int nset, int member)
Definition: DDAxes.h:10
double scalePDF
Definition: PdfInfo.h:13
void usePDFMember(int nset, int member)