#include "ISF_FastCaloSimEvent/TFCS1DFunctionInt32Histogram.h"
#include <algorithm>
#include <iostream>
#include "TMath.h"
#include "TCanvas.h"
#include "TH2F.h"
#include "TRandom.h"
#include "TFile.h"
#include "TClass.h"
Go to the source code of this file.
◆ ATLAS_NOT_THREAD_SAFE()
void TFCS1DFunctionInt32Histogram::unit_test ATLAS_NOT_THREAD_SAFE |
( |
TH1 * |
hist | ) |
|
Definition at line 107 of file TFCS1DFunctionInt32Histogram.cxx.
110 if (
hist ==
nullptr) {
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)
119 hist->SetBinError(ix, 0);
123 nbinsx =
hist->GetNbinsX();
128 for (rnd[0] = 0; rnd[0] < 0.9999; rnd[0] += 0.25) {
129 rtof.rnd_to_fct(
value, rnd);
133 TH1 *hist_val = (TH1 *)
hist->Clone(
"hist_val");
134 hist_val->SetTitle(
"difference");
139 for (
int i = 0;
i < nrnd; ++
i) {
140 rnd[0] = gRandom->Rndm();
141 rtof.rnd_to_fct(
value, rnd);
144 hist_val->Add(
hist, -1);
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);
151 hist_pull->Fill(
val /
err);
157 #if defined(__FastCaloSimStandAlone__)
158 new TCanvas(
"input",
"Input");
161 new TCanvas(
"validation",
"Validation");
164 new TCanvas(
"pull",
"Pull");