|
DAS
3.0
Das Analysis System
|
Go to the documentation of this file.
24 std::function<
const char *(
const char *,
bool)> hname,
25 float maxWeight = std::numeric_limits<float>::max()
27 nominal(fData->Get<TH1>(hname(
"nominal", false))),
28 upper (fData->Get<TH1>(hname((
"PU" +
SysUp).c_str(), false))),
29 lower (fData->Get<TH1>(hname((
"PU" +
SysDown).c_str(), false)))
34 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No profile found in input", *fData) );
36 auto integral = h->Integral();
38 BOOST_THROW_EXCEPTION(
DE::BadInput(
"Empty profile", *h) );
39 h->Scale(1./integral);
42 auto n = hname(
"nominal",
true);
43 std::cout <<
"Fetching " << n << std::endl;
44 auto sim =
dynamic_cast<TH1*
>(fMC->Get(n));
46 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No profile found in input", *fMC) );
47 auto integral = sim->Integral();
49 BOOST_THROW_EXCEPTION(
DE::BadInput(
"Empty profile", *sim) );
50 sim->Scale(1./integral);
55 for (
int i = 0; i <= h->GetNbinsX()+1; ++i) {
56 if (h->GetBinContent(i) < maxWeight)
continue;
57 h->SetBinContent(i, maxWeight);
73 case '+': h =
upper ;
break;
74 case '-': h =
lower ;
break;
76 BOOST_THROW_EXCEPTION( std::runtime_error(
"Unknown variation") );
79 BOOST_THROW_EXCEPTION(
DE::BadInput(
"No correction found for this variation input", *h) );
80 int ibin = h->FindBin(pu);
81 return h->GetBinContent(ibin);
91 if (
reset) h->Reset();
94 upper->Write(
"upper");
95 lower->Write(
"lower");
TH1 * lower
Definition: PUcorrection.h:19
TH1 * upper
Definition: PUcorrection.h:19
const std::string SysUp
Suffix used for "up" uncertainties. Follows the Combine convention.
Definition: Format.h:8
Definition: applyBinnedPUprofCorrection.cc:35
void reset(Weights &wgts, const double v=0)
Definition: applyDataNormalisation.h:28
Handling of exceptions.
Definition: darwin.h:35
Functor to apply the PU profile correction.
Definition: PUcorrection.h:18
void Write(TDirectory *d, bool reset)
Write output to given directory.
Definition: PUcorrection.h:86
Correction(TFile *fMC, TFile *fData, std::function< const char *(const char *, bool)> hname, float maxWeight=std::numeric_limits< float >::max())
Constructor.
Definition: PUcorrection.h:23
TH1 * nominal
Definition: PUcorrection.h:19
const std::string SysDown
Suffix used for "down" uncertainties. Follows the Combine convention.
Definition: Format.h:10
float operator()(float pu, char v='0') const
Definition: PUcorrection.h:67