#include "ISF_FastCaloSimEvent/TFCS1DFunction.h"
#include "TH1.h"
#include "TCanvas.h"
#include "TRandom.h"
#include <string>
#include <iostream>
#include <cmath>
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 96 of file TFCS1DFunction.cxx.
98 TH1 *
hist =
new TH1D(
"test_slope1D",
"test_slope1D", nbinsx,
xmin,
xmax);
100 for (
int ix = 1; ix <= nbinsx; ++ix) {
101 double val = (0.5 + gRandom->Rndm()) * (nbinsx + ix);
102 if (gRandom->Rndm() < zerothreshold)
105 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 111 of file TFCS1DFunction.cxx.
113 TH1 *
hist =
new TH1D(
"test_gauss1D",
"test_gauss1D", nbinsx,
xmin,
xmax);
115 for (
int i = 1;
i <= ntoy; ++
i) {
116 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 123 of file TFCS1DFunction.cxx.
129 int nbinsx =
hist->GetNbinsX();
135 for (rnd[0] = 0; rnd[0] < 0.9999; rnd[0] += 0.25) {
140 TH1 *hist_val =
nullptr;
142 hist_val = (TH1 *)histfine->Clone(TString(
hist->GetName()) +
"hist_val");
144 hist_val = (TH1 *)
hist->Clone(TString(
hist->GetName()) +
"hist_val");
145 double weightfine = hist_val->Integral() / nrnd;
146 hist_val->SetTitle(
"toy simulation");
148 hist_val->SetLineColor(2);
151 TH1 *hist_diff = (TH1 *)
hist->Clone(TString(
hist->GetName()) +
"_difference");
152 hist_diff->SetTitle(
"cut efficiency difference");
157 for (
int i = 0;
i < nrnd; ++
i) {
158 rnd[0] = gRandom->Rndm();
160 hist_val->Fill(
value[0], weightfine);
163 hist_diff->Add(
hist, -1);
167 new TH1F(TString(
hist->GetName()) +
"_pull",
"pull", 200, -10, 10);
168 for (
int ix = 1; ix <= nbinsx; ++ix) {
169 float val = hist_diff->GetBinContent(ix);
170 float err = hist_diff->GetBinError(ix);
172 hist_pull->Fill(
val /
err);
177 #if defined(__FastCaloSimStandAlone__)
178 TCanvas *
c =
new TCanvas(
hist->GetName(),
hist->GetName());
183 histfine->SetLineColor(kGray);
184 histfine->DrawClone(
"hist");
185 hist->DrawClone(
"same");
189 hist_val->DrawClone(
"sameshist");
193 histfine->SetLineColor(kGray);
194 histfine->DrawClone(
"hist");
195 hist->DrawClone(
"same");
199 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...