#include "TString.h"
#include "TFile.h"
#include "TCanvas.h"
#include "TKey.h"
#include <iostream>
#include "TH1F.h"
#include "TRandom.h"
Go to the source code of this file.
|
TCanvas * | createCanvas (int picpercan) |
|
int | comp_recoqa (TString fn="QA_histograms.root", TString fn2="QA_histograms_test.root", int picpercan=9, double minP=0.03, int minev=3, int maxfail=3) |
|
int comp_recoqa |
( |
TString |
fn = "QA_histograms.root" , |
|
|
TString |
fn2 = "QA_histograms_test.root" , |
|
|
int |
picpercan = 9 , |
|
|
double |
minP = 0.03 , |
|
|
int |
minev = 3 , |
|
|
int |
maxfail = 3 |
|
) |
| |
Definition at line 22 of file tracking/trackingQA/comp_recoqa.C.
References c1, createCanvas(), f, f2, h, h2, name, next, P, and TString.
27 std::vector<TCanvas*> canvasses;
28 TCanvas *
c1 =
new TCanvas();
32 TFile *
f =
new TFile(fn,
"READ");
34 TFile *
f2 =
new TFile(fn2,
"READ");
37 TIter
next(f->GetListOfKeys());
41 Int_t actualCanvas = 0;
43 while ((key = (TKey*)
next())) {
44 actualCanvas = TMath::Floor((
double)histoCount / picpercan);
45 actualPad = (histoCount % picpercan) + 1;
46 cout << histoCount <<
" : " << actualCanvas <<
"/" << actualPad << endl;
47 if (!(canvasses.size() > actualCanvas)){
48 cout <<
"New canvas" << endl;
51 canvasses[actualCanvas]->cd(actualPad);
52 TObject *obj = key->ReadObj();
55 if (!obj->InheritsFrom(
"TH1F"))
59 TH1F*
h = (TH1F*) obj;
60 TH1F*
h2 = (TH1F*) f2->Get(name);
64 if (h->GetMaximum() < h2->GetMaximum()) {
71 if (h->GetEntries() < minev) {
72 cout <<
"Histogram (almost) empty : " << name <<
" \""
73 << h2->GetTitle() <<
"\": N = " << h->GetEntries()
77 double P = h2->KolmogorovTest(h);
79 cout <<
"Incompatible distribution: " << name <<
" \""
80 << h2->GetTitle() <<
"\": P = " << P << endl;
85 auto legend =
new TLegend(0.1,0.7,0.48,0.9);
86 legend->SetHeader(
"File Comparison",
"C");
87 legend->AddEntry(h,fn.Data(),
"f");
88 legend->AddEntry(h2,fn2.Data(),
"f");
93 if (failcount < maxfail)
99 cout <<
" Test passed" << endl;
100 cout <<
" All ok " << endl;
102 cout <<
" Test Failed" << endl;
103 cout <<
" Not Ok " << endl;
TCanvas * createCanvas(int picpercan)
TCanvas* createCanvas |
( |
int |
picpercan | ) |
|
Definition at line 12 of file tracking/trackingQA/comp_recoqa.C.
References CAMath::Sqrt().
14 int first = ceil(division);
15 int second = round(division);
16 cout <<
"createCanvas: " << picpercan <<
" : " << first <<
"/" << second << endl;
17 TCanvas* newCan =
new TCanvas();
18 newCan->Divide(first, second);
static T Sqrt(const T &x)