107 {
109 int nbinsx;
110 if (hist == nullptr) {
111 nbinsx = 400;
112 hist =
new TH1D(
"test1D",
"test1D", nbinsx, 0, 1);
114 for (int ix = 1; ix <= nbinsx; ++ix) {
115 double val = (0.5 + gRandom->Rndm()) * (nbinsx + ix);
116 if (gRandom->Rndm() < 0.1)
118 hist->SetBinContent(ix, val);
119 hist->SetBinError(ix, 0);
120 }
121 }
123 nbinsx =
hist->GetNbinsX();
124
127
128 for (
rnd[0] = 0;
rnd[0] < 0.9999;
rnd[0] += 0.25) {
129 rtof.rnd_to_fct(value,
rnd);
131 }
132
133 TH1 *hist_val = (TH1 *)
hist->Clone(
"hist_val");
134 hist_val->SetTitle("difference");
135 hist_val->Reset();
136 int nrnd = 10000000;
138 hist_val->Sumw2();
139 for (
int i = 0;
i < nrnd; ++
i) {
140 rnd[0] = gRandom->Rndm();
141 rtof.rnd_to_fct(value,
rnd);
142 hist_val->Fill(value[0], weight);
143 }
144 hist_val->Add(hist, -1);
145
146 TH1F *hist_pull =
new TH1F(
"pull",
"pull", 200, -10, 10);
147 for (int ix = 1; ix <= nbinsx; ++ix) {
148 float val = hist_val->GetBinContent(ix);
149 float err = hist_val->GetBinError(ix);
150 if (err > 0)
151 hist_pull->Fill(val / err);
153 }
154
155
156
157#if defined(__FastCaloSimStandAlone__)
158 new TCanvas("input", "Input");
160
161 new TCanvas("validation", "Validation");
162 hist_val->Draw();
163
164 new TCanvas("pull", "Pull");
165 hist_pull->Draw();
166#endif
167}
#define ATH_MSG_NOCLASS(logger_name, x)
static Root::TMsgLogger logger("iLumiCalc")
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)