ATLAS Offline Software
Loading...
Searching...
No Matches
EfficiencyPurityCalculator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7void
9 if (in->GetEntries() == 0) {
10 return;
11 }
12 int nbinsx = in->GetXaxis()->GetNbins();
13 int nbinsy = in->GetYaxis()->GetNbins();
14 if (axis == kX) {
15 for (int j = 0; j < nbinsy; ++j) {
16 float ntotal = 0;
17 for (int i = nbinsx; i >= 0; --i) {
18 ntotal += in->GetBinContent(i, j);
19 out->SetBinContent(i, j, ntotal);
20 }
21 }
22 }else {
23 for (int i = 0; i < nbinsx; ++i) {
24 float ntotal = 0;
25 for (int j = nbinsy; j >= 0; --j) {
26 ntotal += in->GetBinContent(i, j);
27 out->SetBinContent(i, j, ntotal);
28 }
29 }
30 }
31}
32
33void
34EfficiencyPurityCalculator::calculateIntegrated(TH1 *all, TH1 *matched, TH1 *puri, int axis, int /*dim*/) {
35 inverseSum(matched, puri, axis);
36 int nbinsx = matched->GetXaxis()->GetNbins();
37 double xmin = matched->GetXaxis()->GetXmin();
38 double xmax = matched->GetXaxis()->GetXmax();
39 // int nbinsy = matched->GetYaxis()->GetNbins();
40 // double ymin = matched->GetYaxis()->GetXmin();
41 // double ymax = matched->GetYaxis()->GetXmax();
42// TH1* alli = 0;
43 TH1 *alli = new TH1F("tmp", "tmp", nbinsx, xmin, xmax);
44// if (dim == 1) alli = new TH1F("tmp","tmp",nbinsx,xmin,xmax);
45// if (dim == 2) alli = new TH2F("tmp","tmp",nbinsx,xmin,xmax, nbinsy, ymin, ymax);
46 inverseSum(all, alli, axis);
47 puri->Sumw2();
48 puri->Divide(puri, alli, 1, 1, "B");
49 delete alli;
50}
51
52void
54 effPur->Add(matched);
55 effPur->Sumw2();
56 effPur->Divide(effPur, reference, 1, 1, "B");
57}
static void calculateEfficiency(TH1 *reference, TH1 *matched, TH1 *effPur)
static void calculateIntegrated(TH1 *all, TH1 *matched, TH1 *puri, int axis, int dim=1)
static void inverseSum(TH1 *in, TH1 *out, int axis)
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60