99 double zerothreshold) {
100 TH1 *hist =
new TH1D(
"test_slope1D",
"test_slope1D", nbinsx,
xmin,
xmax);
102 for (
int ix = 1; ix <= nbinsx; ++ix) {
103 double val = (0.5 + gRandom->Rndm()) * (nbinsx + ix);
104 if (gRandom->Rndm() < zerothreshold)
106 hist->SetBinContent(ix, val);
107 hist->SetBinError(ix, 0);
127 int nrnd, TH1 *histfine) {
131 int nbinsx = hist->GetNbinsX();
137 for (
rnd[0] = 0;
rnd[0] < 0.9999;
rnd[0] += 0.25) {
142 TH1 *hist_val =
nullptr;
144 hist_val = (TH1 *)histfine->Clone(TString(hist->GetName()) +
"hist_val");
146 hist_val = (TH1 *)hist->Clone(TString(hist->GetName()) +
"hist_val");
147 double weightfine = hist_val->Integral() / nrnd;
148 hist_val->SetTitle(
"toy simulation");
150 hist_val->SetLineColor(2);
153 TH1 *hist_diff = (TH1 *)hist->Clone(TString(hist->GetName()) +
"_difference");
154 hist_diff->SetTitle(
"cut efficiency difference");
159 for (
int i = 0; i < nrnd; ++i) {
160 rnd[0] = gRandom->Rndm();
162 hist_val->Fill(value[0], weightfine);
163 hist_diff->Fill(value[0], weight);
165 hist_diff->Add(hist, -1);
169 new TH1F(TString(hist->GetName()) +
"_pull",
"pull", 200, -10, 10);
170 for (
int ix = 1; ix <= nbinsx; ++ix) {
171 float val = hist_diff->GetBinContent(ix);
172 float err = hist_diff->GetBinError(ix);
174 hist_pull->Fill(val / err);
179#if defined(__FastCaloSimStandAlone__)
180 TCanvas *c =
new TCanvas(hist->GetName(), hist->GetName());
185 histfine->SetLineColor(kGray);
186 histfine->DrawClone(
"hist");
187 hist->DrawClone(
"same");
191 hist_val->DrawClone(
"sameshist");
195 histfine->SetLineColor(kGray);
196 histfine->DrawClone(
"hist");
197 hist->DrawClone(
"same");
201 hist_val->DrawClone(
"sameshist");