20 |
|
fPrintDebug(kFALSE), |
21 |
|
fMCEvInfoName(Names::gkMCEvtInfoBrn), |
22 |
|
fPDFName("cteq65.LHgrid"), |
23 |
+ |
fRunPDF(kFALSE), |
24 |
+ |
fIsData(kFALSE), |
25 |
|
fMCEventInfo(0) |
26 |
|
{ |
27 |
|
// Constructor |
32 |
|
{ |
33 |
|
// Process entries of the tree. |
34 |
|
|
33 |
– |
LoadBranch(fMCEvInfoName); |
34 |
– |
|
35 |
– |
Double_t Q = fMCEventInfo->Scale(); |
36 |
– |
Int_t id1 = fMCEventInfo->Id1(); |
37 |
– |
Double_t x1 = fMCEventInfo->X1(); |
38 |
– |
Double_t pdf1 = fMCEventInfo->Pdf1(); |
39 |
– |
Int_t id2 = fMCEventInfo->Id2(); |
40 |
– |
Double_t x2 = fMCEventInfo->X2(); |
41 |
– |
Double_t pdf2 = fMCEventInfo->Pdf2(); |
42 |
– |
|
43 |
– |
if (GetFillHist()) { |
44 |
– |
hDPDFHisto[0]->Fill(TMath::Min(Q,999.999)); |
45 |
– |
hDPDFHisto[1]->Fill(TMath::Min(pdf1,999.999)); |
46 |
– |
hDPDFHisto[2]->Fill(TMath::Min(pdf2,999.999)); |
47 |
– |
hDPDFHisto[3]->Fill(TMath::Min(x1,0.999)); |
48 |
– |
hDPDFHisto[4]->Fill(TMath::Min(x2,0.999)); |
49 |
– |
} |
50 |
– |
|
51 |
– |
UInt_t nmembers = LHAPDF::numberPDF() + 1; |
52 |
– |
|
35 |
|
// Array to be filled |
36 |
+ |
UInt_t nmembers = LHAPDF::numberPDF() + 1; |
37 |
|
FArrDouble *PDFArr = new FArrDouble(nmembers); |
38 |
|
|
39 |
< |
ParticleOArr *leptons = GetObjThisEvt<ParticleOArr>(ModNames::gkMergedLeptonsName); |
40 |
< |
if(leptons->GetEntries() >= 2){ // Nlep >= 2 to fill it |
41 |
< |
if (fPrintDebug) |
42 |
< |
cout << "Start loop over PDF members:" << endl; |
43 |
< |
|
44 |
< |
for (UInt_t i=0; i<nmembers; ++i) { |
45 |
< |
LHAPDF::usePDFMember(i); |
46 |
< |
Double_t newpdf1 = LHAPDF::xfx(x1, Q, id1)/x1; |
47 |
< |
Double_t newpdf2 = LHAPDF::xfx(x2, Q, id2)/x2; |
48 |
< |
Double_t TheWeight = newpdf1/pdf1*newpdf2/pdf2; |
49 |
< |
|
50 |
< |
if (fPrintDebug) { |
51 |
< |
cout << i << " --> " << pdf1 << " " << pdf2 << " | " |
52 |
< |
<< x1 << " " << x2 << " | " |
53 |
< |
<< id1 << " " << id2 << " | " |
54 |
< |
<< Q << " : " << TheWeight << endl; |
39 |
> |
if(fIsData == kFALSE){ |
40 |
> |
LoadBranch(fMCEvInfoName); |
41 |
> |
|
42 |
> |
Double_t Q = fMCEventInfo->Scale(); |
43 |
> |
Int_t id1 = fMCEventInfo->Id1(); |
44 |
> |
Double_t x1 = fMCEventInfo->X1(); |
45 |
> |
Double_t pdf1 = fMCEventInfo->Pdf1(); |
46 |
> |
Int_t id2 = fMCEventInfo->Id2(); |
47 |
> |
Double_t x2 = fMCEventInfo->X2(); |
48 |
> |
Double_t pdf2 = fMCEventInfo->Pdf2(); |
49 |
> |
|
50 |
> |
if (GetFillHist()) { |
51 |
> |
hDPDFHisto[0]->Fill(TMath::Min(Q,999.999)); |
52 |
> |
hDPDFHisto[1]->Fill(TMath::Min(pdf1,999.999)); |
53 |
> |
hDPDFHisto[2]->Fill(TMath::Min(pdf2,999.999)); |
54 |
> |
hDPDFHisto[3]->Fill(TMath::Min(x1,0.999)); |
55 |
> |
hDPDFHisto[4]->Fill(TMath::Min(x2,0.999)); |
56 |
> |
if(x1 + x2 > 0){ |
57 |
> |
hDPDFHisto[5]->Fill(TMath::Min(x1/(x1+x2),0.999)); |
58 |
|
} |
59 |
< |
if (GetFillHist()) { |
60 |
< |
hDPDFHisto[5]->Fill(TMath::Min(TheWeight,99.999)); |
61 |
< |
hDPDFHisto[6]->Fill(TheWeight); |
59 |
> |
} |
60 |
> |
|
61 |
> |
if(fRunPDF == kTRUE){ |
62 |
> |
ParticleOArr *leptons = GetObjThisEvt<ParticleOArr>(ModNames::gkMergedLeptonsName); |
63 |
> |
if(leptons->GetEntries() >= 2){ // Nlep >= 2 to fill it |
64 |
> |
if (fPrintDebug) |
65 |
> |
cout << "Start loop over PDF members:" << endl; |
66 |
> |
|
67 |
> |
for (UInt_t i=0; i<nmembers; ++i) { |
68 |
> |
LHAPDF::usePDFMember(i); |
69 |
> |
Double_t newpdf1 = LHAPDF::xfx(x1, Q, id1)/x1; |
70 |
> |
Double_t newpdf2 = LHAPDF::xfx(x2, Q, id2)/x2; |
71 |
> |
Double_t TheWeight = newpdf1/pdf1*newpdf2/pdf2; |
72 |
> |
|
73 |
> |
if (fPrintDebug) { |
74 |
> |
cout << i << " --> " << pdf1 << " " << pdf2 << " | " |
75 |
> |
<< x1 << " " << x2 << " | " |
76 |
> |
<< id1 << " " << id2 << " | " |
77 |
> |
<< Q << " : " << TheWeight << endl; |
78 |
> |
} |
79 |
> |
if (GetFillHist()) { |
80 |
> |
hDPDFHisto[6]->Fill(TMath::Min(TheWeight,99.999)); |
81 |
> |
hDPDFHisto[7]->Fill(TheWeight); |
82 |
> |
} |
83 |
> |
PDFArr->Add(TheWeight); |
84 |
> |
} |
85 |
> |
} // Nlep >= 2 to fill it |
86 |
> |
else { |
87 |
> |
for (UInt_t i=0; i<nmembers; ++i) PDFArr->Add(1.0); |
88 |
|
} |
77 |
– |
PDFArr->Add(TheWeight); |
89 |
|
} |
79 |
– |
} // Nlep >= 2 to fill it |
80 |
– |
else { |
81 |
– |
for (UInt_t i=0; i<nmembers; ++i) PDFArr->Add(1.0); |
90 |
|
} |
83 |
– |
|
91 |
|
AddObjThisEvt(PDFArr, "PDFWeights"); |
92 |
|
} |
93 |
|
|
101 |
|
LHAPDF::initPDFSet(fPDFName.Data()); |
102 |
|
LHAPDF::getDescription(); |
103 |
|
|
104 |
< |
ReqBranch(fMCEvInfoName, fMCEventInfo); |
104 |
> |
if(fIsData == kFALSE){ |
105 |
> |
ReqBranch(fMCEvInfoName, fMCEventInfo); |
106 |
> |
} |
107 |
|
|
108 |
|
if (GetFillHist()) { |
109 |
|
char sb[1024]; |
112 |
|
sprintf(sb,"hDPDFHisto_%d", 2); hDPDFHisto[2] = new TH1D(sb,sb,500,0,1000); |
113 |
|
sprintf(sb,"hDPDFHisto_%d", 3); hDPDFHisto[3] = new TH1D(sb,sb,100,0,1); |
114 |
|
sprintf(sb,"hDPDFHisto_%d", 4); hDPDFHisto[4] = new TH1D(sb,sb,100,0,1); |
115 |
< |
sprintf(sb,"hDPDFHisto_%d", 5); hDPDFHisto[5] = new TH1D(sb,sb,500,0,100); |
116 |
< |
sprintf(sb,"hDPDFHisto_%d", 6); hDPDFHisto[6] = new TH1D(sb,sb,1,0,1); |
117 |
< |
for(int i=0; i<7; i++){ |
115 |
> |
sprintf(sb,"hDPDFHisto_%d", 5); hDPDFHisto[5] = new TH1D(sb,sb,100,0,1); |
116 |
> |
sprintf(sb,"hDPDFHisto_%d", 6); hDPDFHisto[6] = new TH1D(sb,sb,500,0,100); |
117 |
> |
sprintf(sb,"hDPDFHisto_%d", 7); hDPDFHisto[7] = new TH1D(sb,sb,1,0,1); |
118 |
> |
for(int i=0; i<8; i++){ |
119 |
|
AddOutput(hDPDFHisto[i]); |
120 |
|
} |
121 |
|
} |