ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/PDFProducerMod.cc
(Generate patch)

Comparing UserCode/MitPhysics/Mods/src/PDFProducerMod.cc (file contents):
Revision 1.1 by loizides, Tue Aug 11 10:56:48 2009 UTC vs.
Revision 1.3 by ceballos, Sat Mar 13 20:50:03 2010 UTC

# Line 3 | Line 3
3   #include "MitPhysics/Mods/interface/PDFProducerMod.h"
4   #include "MitCommon/MathTools/interface/MathUtils.h"
5   #include "MitAna/DataTree/interface/MCEventInfo.h"
6 + #include "MitAna/DataTree/interface/ParticleCol.h"
7   #include "MitPhysics/Init/interface/ModNames.h"
8   #include <TH1D.h>
9   #include <TH2D.h>
# Line 19 | Line 20 | PDFProducerMod::PDFProducerMod(const cha
20    fPrintDebug(kFALSE),
21    fMCEvInfoName(Names::gkMCEvtInfoBrn),
22    fPDFName("cteq65.LHgrid"),
23 +  fRunPDF(kFALSE),
24    fMCEventInfo(0)
25   {
26    // Constructor
# Line 38 | Line 40 | void PDFProducerMod::Process()
40    Int_t    id2  = fMCEventInfo->Id2();
41    Double_t x2   = fMCEventInfo->X2();
42    Double_t pdf2 = fMCEventInfo->Pdf2();
43 <  
43 >
44 >  if (GetFillHist()) {
45 >    hDPDFHisto[0]->Fill(TMath::Min(Q,999.999));
46 >    hDPDFHisto[1]->Fill(TMath::Min(pdf1,999.999));
47 >    hDPDFHisto[2]->Fill(TMath::Min(pdf2,999.999));
48 >    hDPDFHisto[3]->Fill(TMath::Min(x1,0.999));
49 >    hDPDFHisto[4]->Fill(TMath::Min(x2,0.999));
50 >    if(x1 + x2 > 0){
51 >      hDPDFHisto[5]->Fill(TMath::Min(x1/(x1+x2),0.999));
52 >    }
53 >  }
54 >
55    UInt_t nmembers = LHAPDF::numberPDF() + 1;
56  
57    // Array to be filled
58    FArrDouble *PDFArr = new FArrDouble(nmembers);
59  
60 <  if (fPrintDebug)
61 <    cout << "Start loop over PDF members:" << endl;
62 <
63 <  for (UInt_t i=0; i<nmembers; ++i) {
64 <    LHAPDF::usePDFMember(i);
65 <    Double_t newpdf1 = LHAPDF::xfx(x1, Q, id1)/x1;
66 <    Double_t newpdf2 = LHAPDF::xfx(x2, Q, id2)/x2;
67 <    Double_t TheWeight = newpdf1/pdf1*newpdf2/pdf2;
68 <    
69 <    if (fPrintDebug) {
70 <      cout << i << " --> " << pdf1 << " "   << pdf2 << " | "
71 <                           << x1   << " "   << x2   << " | "
72 <                           << id1  << " "   << id2  << " | "
73 <                           << Q    << " : " <<  TheWeight << endl;
60 >  if(fRunPDF == kTRUE){
61 >    ParticleOArr *leptons = GetObjThisEvt<ParticleOArr>(ModNames::gkMergedLeptonsName);
62 >    if(leptons->GetEntries() >= 2){ // Nlep >= 2 to fill it
63 >      if (fPrintDebug)
64 >        cout << "Start loop over PDF members:" << endl;
65 >
66 >      for (UInt_t i=0; i<nmembers; ++i) {
67 >        LHAPDF::usePDFMember(i);
68 >        Double_t newpdf1 = LHAPDF::xfx(x1, Q, id1)/x1;
69 >        Double_t newpdf2 = LHAPDF::xfx(x2, Q, id2)/x2;
70 >        Double_t TheWeight = newpdf1/pdf1*newpdf2/pdf2;
71 >
72 >        if (fPrintDebug) {
73 >          cout << i << " --> " << pdf1 << " "   << pdf2 << " | "
74 >                               << x1   << " "   << x2   << " | "
75 >                               << id1  << " "   << id2  << " | "
76 >                               << Q    << " : " <<  TheWeight << endl;
77 >        }
78 >        if (GetFillHist()) {
79 >          hDPDFHisto[6]->Fill(TMath::Min(TheWeight,99.999));
80 >          hDPDFHisto[7]->Fill(TheWeight);
81 >        }
82 >        PDFArr->Add(TheWeight);
83 >      }
84 >    } // Nlep >= 2 to fill it
85 >    else {
86 >      for (UInt_t i=0; i<nmembers; ++i) PDFArr->Add(1.0);
87      }
62    if (GetFillHist()) {
63      hDPDFHisto[0]->Fill(TheWeight);
64    }
65    PDFArr->Add(TheWeight);
88    }
89  
90    AddObjThisEvt(PDFArr, "PDFWeights");
# Line 82 | Line 104 | void PDFProducerMod::SlaveBegin()
104  
105    if (GetFillHist()) {
106      char sb[1024];
107 <    sprintf(sb,"hDPDFHisto_%d", 0);  
108 <    hDPDFHisto[0] = new TH1D(sb,sb,1,0,1);
109 <    AddOutput(hDPDFHisto[0]);
107 >    sprintf(sb,"hDPDFHisto_%d", 0); hDPDFHisto[0] = new TH1D(sb,sb,500,0,1000);
108 >    sprintf(sb,"hDPDFHisto_%d", 1); hDPDFHisto[1] = new TH1D(sb,sb,500,0,1000);
109 >    sprintf(sb,"hDPDFHisto_%d", 2); hDPDFHisto[2] = new TH1D(sb,sb,500,0,1000);
110 >    sprintf(sb,"hDPDFHisto_%d", 3); hDPDFHisto[3] = new TH1D(sb,sb,100,0,1);
111 >    sprintf(sb,"hDPDFHisto_%d", 4); hDPDFHisto[4] = new TH1D(sb,sb,100,0,1);
112 >    sprintf(sb,"hDPDFHisto_%d", 5); hDPDFHisto[5] = new TH1D(sb,sb,100,0,1);
113 >    sprintf(sb,"hDPDFHisto_%d", 6); hDPDFHisto[6] = new TH1D(sb,sb,500,0,100);
114 >    sprintf(sb,"hDPDFHisto_%d", 7); hDPDFHisto[7] = new TH1D(sb,sb,1,0,1);
115 >    for(int i=0; i<8; i++){
116 >      AddOutput(hDPDFHisto[i]);
117 >    }
118    }
119   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines