16 #include "BCMTFTemplate.h" 24 , fOriginalNormalization(0)
26 fChannelName = channelname;
27 fProcessName = processname;
28 fFunctionContainer =
new std::vector<TF1*>(0);
29 fRandom =
new TRandom3(0);
48 fNBins = fHistogram->GetNbinsX();
51 double orignorm = fHistogram->Integral();
56 fHistogram->Scale(norm / orignorm);
60 fNormalization = norm;
66 fFunctionContainer = funccont;
79 if (options.find(
"P") < options.size()) {
83 if (options.find(
"G") < options.size()) {
87 if (options.find(
"Z") < options.size()) {
91 if (flag_p && flag_g) {
95 TH1D hist_temp = TH1D(*fHistogram);
97 for (
int i = 1; i <= fNBins; ++i) {
98 double expectation = fOriginalNormalization * hist_temp.GetBinContent(i);
99 double error = fOriginalNormalization * hist_temp.GetBinError(i);
104 n = (double) fRandom->Poisson(expectation);
109 double dn = fRandom->Gaus(expectation, error);
114 dn = fRandom->Gaus(expectation, error);
120 hist_temp.SetBinContent(i, n);
124 double orignorm = hist_temp.Integral();
127 hist_temp.Scale(norm / orignorm);
void SetFunctionContainer(std::vector< TF1 * > *funccont, int nbins)
Set a function container funccont The function container nbins The number of bins (and functions) ...
void SetOrignialNormalization(double norm)
Set the original normalization.
BCMTFTemplate(const std::string &channelname, const std::string &processname)
The default constructor.
void SetHistogram(TH1D *hist, double norm=1)
Set the histogram.
TH1D FluctuateHistogram(const std::string &options="GZ", double norm=1)
Fluctuate the original template histogram by the uncertainty on the bin content.
~BCMTFTemplate()
The default destructor.