#include "ISF_FastCaloSimEvent/TFCS2DFunction.h"
#include "ISF_FastCaloSimEvent/TFCS2DFunctionHistogram.h"
#include "ISF_FastCaloSimEvent/TFCS2DFunctionTemplateHistogram.h"
#include "TH2.h"
#include "TCanvas.h"
#include "TH2F.h"
#include "TRandom.h"
#include "TFile.h"
#include <cmath>
#include <iostream>
Go to the source code of this file.
◆ ATLAS_NOT_THREAD_SAFE() [1/3]
| TH2* create_random_TH2 ATLAS_NOT_THREAD_SAFE |
( |
int |
nbinsx = 64, |
|
|
int |
nbinsy = 64 |
|
) |
| |
Definition at line 76 of file TFCS2DFunction.cxx.
77 TH2 *
hist =
new TH2F(
"test2D",
"test2D", nbinsx, 0, 1, nbinsy, 0, 1);
79 for (
int ix = 1; ix <= nbinsx; ++ix) {
80 for (
int iy = 1; iy <= nbinsy; ++iy) {
81 hist->SetBinContent(ix, iy,
82 (0.5 + gRandom->Rndm()) * (nbinsx + ix) *
83 (nbinsy * nbinsy / 2 + iy * iy));
84 if (gRandom->Rndm() < 0.1)
85 hist->SetBinContent(ix, iy, 0);
86 hist->SetBinError(ix, iy, 0);
◆ ATLAS_NOT_THREAD_SAFE() [2/3]
| void TFCS2DFunction::unit_tests ATLAS_NOT_THREAD_SAFE |
( |
TH2 * |
hist, |
|
|
const char * |
outfilename, |
|
|
int |
nrnd |
|
) |
| |
◆ ATLAS_NOT_THREAD_SAFE() [3/3]
| void TFCS2DFunction::unit_test ATLAS_NOT_THREAD_SAFE |
( |
TH2 * |
hist, |
|
|
TFCS2DFunction * |
rtof, |
|
|
const char * |
outfilename, |
|
|
int |
nrnd |
|
) |
| |
Definition at line 92 of file TFCS2DFunction.cxx.
98 hist = create_random_TH2();
102 int nbinsx =
hist->GetNbinsX();
103 int nbinsy =
hist->GetNbinsY();
108 for (rnd[0] = 0; rnd[0] < 0.9999; rnd[0] += 0.25) {
109 for (rnd[1] = 0; rnd[1] < 0.9999; rnd[1] += 0.25) {
112 <<
" -> x=" <<
value[0]
113 <<
" y=" <<
value[1]);
121 (
TH2F *)
hist->Clone(TString(
hist->GetName()) +
"_" + rtof->ClassName());
126 for (
int i = 0;
i < nrnd; ++
i) {
127 rnd[0] = gRandom->Rndm();
128 rnd[1] = gRandom->Rndm();
132 hist_val->Add(
hist, -1);
135 new TH1F(TString(
"pull_") + rtof->ClassName(),
136 TString(
"pull for ") + rtof->ClassName(), 80, -4, 4);
137 for (
int ix = 1; ix <= nbinsx; ++ix) {
138 for (
int iy = 1; iy <= nbinsy; ++iy) {
139 float val = hist_val->GetBinContent(ix, iy);
140 float err = hist_val->GetBinError(ix, iy);
142 hist_pull->Fill(
val /
err);
157 #if defined(__FastCaloSimStandAlone__)
158 new TCanvas(
hist->GetName(),
hist->GetTitle());
161 new TCanvas(hist_val->GetName(), hist_val->GetTitle());
162 hist_val->Draw(
"colz");
164 new TCanvas(hist_pull->GetName(), hist_pull->GetTitle());
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)