ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/OSUT3Analysis/AnaTools/src/PUWeight.cc
Revision: 1.3
Committed: Sat Mar 9 21:56:42 2013 UTC (12 years, 2 months ago) by ahart
Content type: text/plain
Branch: MAIN
Changes since 1.2: +3 -4 lines
Log Message:
Now uses the correct histogram to fill trimmedMC.

File Contents

# User Rev Content
1 ahart 1.1 #include "OSUT3Analysis/AnaTools/interface/PUWeight.h"
2    
3     PUWeight::PUWeight (const string &puFile, const string &dataPU, const string &mcPU)
4     {
5     TFile *fin = TFile::Open (puFile.c_str ());
6     TH1D *mc = (TH1D *) fin->Get (mcPU.c_str ());
7     puWeight_ = (TH1D *) fin->Get (dataPU.c_str ());
8     mc->SetDirectory (0);
9     puWeight_->SetDirectory (0);
10     mc->Scale (puWeight_->Integral () / mc->Integral ());
11 ahart 1.3 TH1D *trimmedMC = new TH1D ("bla", "bla", puWeight_->GetNbinsX(), 0, puWeight_->GetNbinsX());
12     for (int bin = 1; bin <= puWeight_->GetNbinsX(); bin++)
13     trimmedMC->SetBinContent (bin, mc->GetBinContent (bin));
14 lantonel 1.2 puWeight_->Divide (trimmedMC);
15 ahart 1.1 fin->Close ();
16     delete mc;
17     }
18    
19     PUWeight::~PUWeight ()
20     {
21     delete puWeight_;
22     }