23 std::shared_ptr<TFile>
f = std::make_shared<TFile>(fname.c_str(),
"old");
24 tmp = (TH1D*) f->Get(
"weight_2down");
25 if ( tmp )
histos_[-2] = std::make_shared<TH1D>(*tmp);
27 tmp = (TH1D*) f->Get(
"weight_1down");
28 if ( tmp )
histos_[-1] = std::make_shared<TH1D>(*tmp);
30 tmp = (TH1D*) f->Get(
"weight");
31 if ( tmp )
histos_[0] = std::make_shared<TH1D>(*tmp);
33 tmp = (TH1D*) f->Get(
"weight_1up");
34 if ( tmp )
histos_[1] = std::make_shared<TH1D>(*tmp);
36 tmp = (TH1D*) f->Get(
"weight_2up");
37 if ( tmp )
histos_[2] = std::make_shared<TH1D>(*tmp);
40 std::cout <<
"WARNING - PileupWeight::PileupWeight | Histogram weight_2down not found. Weight = 1" << std::endl;
42 std::cout <<
"WARNING - PileupWeight::PileupWeight | Histogram weight_1down not found. Weight = 1" << std::endl;
44 std::cout <<
"WARNING - PileupWeight::PileupWeight | Histogram weight not found. Weight = 1" << std::endl;
46 std::cout <<
"WARNING - PileupWeight::PileupWeight | Histogram weight_1up not found. Weight = 1" << std::endl;
48 std::cout <<
"WARNING - PileupWeight::PileupWeight | Histogram weight_2up not found. Weight = 1" << std::endl;
69 int bin =
histos_[var] -> FindBin(truepu);
70 weight =
histos_[var] -> GetBinContent(bin);