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 |
|
|
puWeight_->Divide (mc);
|
12 |
|
|
fin->Close ();
|
13 |
|
|
delete mc;
|
14 |
|
|
}
|
15 |
|
|
|
16 |
|
|
PUWeight::~PUWeight ()
|
17 |
|
|
{
|
18 |
|
|
delete puWeight_;
|
19 |
|
|
}
|