#include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
#include "TH1.h"
#include "TCanvas.h"
#include "TRandom.h"
#include <string>
#include <iostream>
Go to the source code of this file.
|
TH1 *TFCS1DFunction::generate_histogram_random_slope | ATLAS_NOT_THREAD_SAFE (int nbinsx, double xmin, double xmax, double zerothreshold) |
|
TH1 *TFCS1DFunction::generate_histogram_random_gauss | ATLAS_NOT_THREAD_SAFE (int nbinsx, int ntoy, double xmin, double xmax, double xpeak, double sigma) |
|
void TFCS1DFunction::unit_test | ATLAS_NOT_THREAD_SAFE (TH1 *hist, TFCS1DFunction *rtof, int nrnd, TH1 *histfine) |
|
◆ ATLAS_NOT_THREAD_SAFE() [1/3]
TH1* TFCS1DFunction::generate_histogram_random_slope ATLAS_NOT_THREAD_SAFE |
( |
int |
nbinsx, |
|
|
double |
xmin, |
|
|
double |
xmax, |
|
|
double |
zerothreshold |
|
) |
| |
Definition at line 95 of file TFCS1DFunction.cxx.
97 TH1 *
hist =
new TH1D(
"test_slope1D",
"test_slope1D", nbinsx,
xmin,
xmax);
99 for (
int ix = 1; ix <= nbinsx; ++ix) {
100 double val = (0.5 + gRandom->Rndm()) * (nbinsx + ix);
101 if (gRandom->Rndm() < zerothreshold)
104 hist->SetBinError(ix, 0);
◆ ATLAS_NOT_THREAD_SAFE() [2/3]
TH1* TFCS1DFunction::generate_histogram_random_gauss ATLAS_NOT_THREAD_SAFE |
( |
int |
nbinsx, |
|
|
int |
ntoy, |
|
|
double |
xmin, |
|
|
double |
xmax, |
|
|
double |
xpeak, |
|
|
double |
sigma |
|
) |
| |
Definition at line 110 of file TFCS1DFunction.cxx.
112 TH1 *
hist =
new TH1D(
"test_gauss1D",
"test_gauss1D", nbinsx,
xmin,
xmax);
114 for (
int i = 1;
i <= ntoy; ++
i) {
115 double x = gRandom->Gaus(xpeak,
sigma);
◆ ATLAS_NOT_THREAD_SAFE() [3/3]
void TFCS1DFunction::unit_test ATLAS_NOT_THREAD_SAFE |
( |
TH1 * |
hist, |
|
|
TFCS1DFunction * |
rtof, |
|
|
int |
nrnd, |
|
|
TH1 * |
histfine |
|
) |
| |
Definition at line 122 of file TFCS1DFunction.cxx.
128 int nbinsx =
hist->GetNbinsX();
134 for (rnd[0] = 0; rnd[0] < 0.9999; rnd[0] += 0.25) {
139 TH1 *hist_val =
nullptr;
141 hist_val = (TH1 *)histfine->Clone(TString(
hist->GetName()) +
"hist_val");
143 hist_val = (TH1 *)
hist->Clone(TString(
hist->GetName()) +
"hist_val");
144 double weightfine = hist_val->Integral() / nrnd;
145 hist_val->SetTitle(
"toy simulation");
147 hist_val->SetLineColor(2);
150 TH1 *hist_diff = (TH1 *)
hist->Clone(TString(
hist->GetName()) +
"_difference");
151 hist_diff->SetTitle(
"cut efficiency difference");
156 for (
int i = 0;
i < nrnd; ++
i) {
157 rnd[0] = gRandom->Rndm();
159 hist_val->Fill(
value[0], weightfine);
162 hist_diff->Add(
hist, -1);
166 new TH1F(TString(
hist->GetName()) +
"_pull",
"pull", 200, -10, 10);
167 for (
int ix = 1; ix <= nbinsx; ++ix) {
168 float val = hist_diff->GetBinContent(ix);
169 float err = hist_diff->GetBinError(ix);
171 hist_pull->Fill(
val /
err);
176 #if defined(__FastCaloSimStandAlone__)
177 TCanvas *
c =
new TCanvas(
hist->GetName(),
hist->GetName());
182 histfine->SetLineColor(kGray);
183 histfine->DrawClone(
"hist");
184 hist->DrawClone(
"same");
188 hist_val->DrawClone(
"sameshist");
192 histfine->SetLineColor(kGray);
193 histfine->DrawClone(
"hist");
194 hist->DrawClone(
"same");
198 hist_val->DrawClone(
"sameshist");
virtual void rnd_to_fct(float value[], const float rnd[]) const
Function gets array of random numbers rnd[] in the range [0,1) as arguments and returns function valu...