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.2 by ceballos, Sun Dec 6 14:59:28 2009 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 38 | Line 39 | void PDFProducerMod::Process()
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  
53    // Array to be filled
54    FArrDouble *PDFArr = new FArrDouble(nmembers);
55  
56 <  if (fPrintDebug)
57 <    cout << "Start loop over PDF members:" << endl;
58 <
59 <  for (UInt_t i=0; i<nmembers; ++i) {
60 <    LHAPDF::usePDFMember(i);
61 <    Double_t newpdf1 = LHAPDF::xfx(x1, Q, id1)/x1;
62 <    Double_t newpdf2 = LHAPDF::xfx(x2, Q, id2)/x2;
63 <    Double_t TheWeight = newpdf1/pdf1*newpdf2/pdf2;
64 <    
65 <    if (fPrintDebug) {
66 <      cout << i << " --> " << pdf1 << " "   << pdf2 << " | "
67 <                           << x1   << " "   << x2   << " | "
68 <                           << id1  << " "   << id2  << " | "
69 <                           << Q    << " : " <<  TheWeight << endl;
70 <    }
71 <    if (GetFillHist()) {
72 <      hDPDFHisto[0]->Fill(TheWeight);
56 >  ParticleOArr *leptons = GetObjThisEvt<ParticleOArr>(ModNames::gkMergedLeptonsName);
57 >  if(leptons->GetEntries() >= 2){ // Nlep >= 2 to fill it
58 >    if (fPrintDebug)
59 >      cout << "Start loop over PDF members:" << endl;
60 >
61 >    for (UInt_t i=0; i<nmembers; ++i) {
62 >      LHAPDF::usePDFMember(i);
63 >      Double_t newpdf1 = LHAPDF::xfx(x1, Q, id1)/x1;
64 >      Double_t newpdf2 = LHAPDF::xfx(x2, Q, id2)/x2;
65 >      Double_t TheWeight = newpdf1/pdf1*newpdf2/pdf2;
66 >
67 >      if (fPrintDebug) {
68 >        cout << i << " --> " << pdf1 << " "   << pdf2 << " | "
69 >                             << x1   << " "   << x2   << " | "
70 >                             << id1  << " "   << id2  << " | "
71 >                             << Q    << " : " <<  TheWeight << endl;
72 >      }
73 >      if (GetFillHist()) {
74 >        hDPDFHisto[5]->Fill(TMath::Min(TheWeight,99.999));
75 >        hDPDFHisto[6]->Fill(TheWeight);
76 >      }
77 >      PDFArr->Add(TheWeight);
78      }
79 <    PDFArr->Add(TheWeight);
79 >  } // Nlep >= 2 to fill it
80 >  else {
81 >    for (UInt_t i=0; i<nmembers; ++i) PDFArr->Add(1.0);
82    }
83  
84    AddObjThisEvt(PDFArr, "PDFWeights");
# Line 82 | Line 98 | void PDFProducerMod::SlaveBegin()
98  
99    if (GetFillHist()) {
100      char sb[1024];
101 <    sprintf(sb,"hDPDFHisto_%d", 0);  
102 <    hDPDFHisto[0] = new TH1D(sb,sb,1,0,1);
103 <    AddOutput(hDPDFHisto[0]);
101 >    sprintf(sb,"hDPDFHisto_%d", 0); hDPDFHisto[0] = new TH1D(sb,sb,500,0,1000);
102 >    sprintf(sb,"hDPDFHisto_%d", 1); hDPDFHisto[1] = new TH1D(sb,sb,500,0,1000);
103 >    sprintf(sb,"hDPDFHisto_%d", 2); hDPDFHisto[2] = new TH1D(sb,sb,500,0,1000);
104 >    sprintf(sb,"hDPDFHisto_%d", 3); hDPDFHisto[3] = new TH1D(sb,sb,100,0,1);
105 >    sprintf(sb,"hDPDFHisto_%d", 4); hDPDFHisto[4] = new TH1D(sb,sb,100,0,1);
106 >    sprintf(sb,"hDPDFHisto_%d", 5); hDPDFHisto[5] = new TH1D(sb,sb,500,0,100);
107 >    sprintf(sb,"hDPDFHisto_%d", 6); hDPDFHisto[6] = new TH1D(sb,sb,1,0,1);
108 >    for(int i=0; i<7; i++){
109 >      AddOutput(hDPDFHisto[i]);
110 >    }
111    }
112   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines