ATLAS Offline Software
InnerDetector
InDetCalibAlgs
SCT_CalibAlgs
src
ISCT_CalibHistoTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
11
#include "
SCT_CalibAlgs/ISCT_CalibHistoTool.h
"
12
#include "TH1I.h"
13
#include "TH1F.h"
14
#include "TH2F.h"
15
#include "TMath.h"
16
#include <stdexcept>
// out_of_range exception
17
18
ISCT_CalibHistoTool::ISCT_CalibHistoTool
() {
19
}
20
21
int
22
ISCT_CalibHistoTool::getNumberOfEventsInBin
(
const
int
nbin)
const
{
23
if
(
m_numberOfEventsHisto
)
return
m_numberOfEventsHisto
->GetBinContent(nbin);
24
std::cout <<
"ERROR: a histogram pointer, m_numberOfEventsHisto, is zero"
<< std::endl;
25
return
0;
26
}
27
28
int
29
ISCT_CalibHistoTool::size
()
const
{
30
return
m_numberOfEventsHisto
->GetEntries();
31
}
32
33
int
34
ISCT_CalibHistoTool::size
(
const
int
histogramIndex)
const
{
35
TH1F
* pHisto{
nullptr
};
36
int
result
{0};
37
try
{
38
pHisto =
m_phistoVector
.at(histogramIndex);
39
result
= pHisto->GetEntries();
40
}
catch
(
const
std::out_of_range& outOfRange) {
41
//do nothing, result is zero if the vector<>.at() throws
42
}
43
return
result
;
44
}
45
46
double
47
ISCT_CalibHistoTool::getBinForHistogramIndex
(
const
int
bin
,
const
int
histogramIndex)
const
{
48
TH1F
* pHisto{
nullptr
};
49
double
result
{0.0};
50
try
{
51
pHisto =
m_phistoVector
.at(histogramIndex);
52
result
= pHisto->GetBinContent(
bin
);
53
}
catch
(
const
std::out_of_range& outOfRange) {
54
//do nothing, result is zero if the vector<>.at() throws
55
}
56
return
result
;
57
}
58
59
void
60
ISCT_CalibHistoTool::binHistograms
(
const
int
nLbMerged) {
61
int
nLb{
numberOfLb
()};
62
int
yAxisBins{
static_cast<
int
>
(TMath::Ceil(1.0*nLb/nLbMerged))};
63
64
for
(
std::vector<TH2F*>::iterator
it
{
m_phistoVector2D
.begin()};
it
!=
m_phistoVector2D
.end(); ++
it
) {
65
(*it)->SetBins(768, -0.5, 768+0.5, yAxisBins, 0.5, nLbMerged*yAxisBins+0.5);
66
}
67
68
}
69
70
void
71
ISCT_CalibHistoTool::setNumberOfLb
(
const
int
nLb) {
72
m_nLb
=nLb;
73
}
74
75
int
76
ISCT_CalibHistoTool::numberOfLb
()
const
{
77
return
m_nLb
;
78
}
79
80
void
81
ISCT_CalibHistoTool::setLbToMerge
(
const
int
nLbMerge) {
82
m_nLbMerge
= nLbMerge;
83
}
84
85
void
86
ISCT_CalibHistoTool::setLb
(
const
int
nLb) {
87
m_lumiBlock
= nLb;
88
}
89
90
int
91
ISCT_CalibHistoTool::LbToMerge
()
const
{
92
return
m_nLbMerge
;
93
}
xAOD::iterator
JetConstituentVector::iterator iterator
Definition:
JetConstituentVector.cxx:68
ISCT_CalibHistoTool::m_nLb
int m_nLb
Definition:
ISCT_CalibHistoTool.h:68
get_generator_info.result
result
Definition:
get_generator_info.py:21
skel.it
it
Definition:
skel.GENtoEVGEN.py:396
bin
Definition:
BinsDiffFromStripMedian.h:43
ISCT_CalibHistoTool::m_numberOfEventsHisto
TH1I * m_numberOfEventsHisto
Definition:
ISCT_CalibHistoTool.h:64
ISCT_CalibHistoTool::setLbToMerge
void setLbToMerge(const int nLbMerge)
set number of lumiblocks
Definition:
ISCT_CalibHistoTool.cxx:81
ISCT_CalibHistoTool::numberOfLb
int numberOfLb() const
get number of lumiblocks
Definition:
ISCT_CalibHistoTool.cxx:76
ISCT_CalibHistoTool::size
int size() const
get total number of entries in the number of events histo
Definition:
ISCT_CalibHistoTool.cxx:29
ISCT_CalibHistoTool::binHistograms
void binHistograms(const int nLbMerged)
Definition:
ISCT_CalibHistoTool.cxx:60
ISCT_CalibHistoTool::setLb
void setLb(const int nLb)
set lumiblock for Lb dependent maps
Definition:
ISCT_CalibHistoTool.cxx:86
ISCT_CalibHistoTool::ISCT_CalibHistoTool
ISCT_CalibHistoTool()
Definition:
ISCT_CalibHistoTool.cxx:18
ISCT_CalibHistoTool::LbToMerge
int LbToMerge() const
get number of lumiblocks
Definition:
ISCT_CalibHistoTool.cxx:91
ISCT_CalibHistoTool::m_nLbMerge
int m_nLbMerge
Definition:
ISCT_CalibHistoTool.h:69
ISCT_CalibHistoTool::getBinForHistogramIndex
double getBinForHistogramIndex(const int bin, const int histogramIndex) const
get bin content for bin in specific histogram
Definition:
ISCT_CalibHistoTool.cxx:47
ISCT_CalibHistoTool::setNumberOfLb
void setNumberOfLb(const int nLb)
set number of lumiblocks
Definition:
ISCT_CalibHistoTool.cxx:71
ISCT_CalibHistoTool::m_phistoVector
std::vector< TH1F * > m_phistoVector
Definition:
ISCT_CalibHistoTool.h:62
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition:
TrigEgammaMonitorHelper.py:24
ISCT_CalibHistoTool::m_lumiBlock
int m_lumiBlock
Definition:
ISCT_CalibHistoTool.h:67
ISCT_CalibHistoTool.h
ISCT_CalibHistoTool::getNumberOfEventsInBin
virtual int getNumberOfEventsInBin(const int nbin) const
get number of events in a specific bin
Definition:
ISCT_CalibHistoTool.cxx:22
ISCT_CalibHistoTool::m_phistoVector2D
std::vector< TH2F * > m_phistoVector2D
Definition:
ISCT_CalibHistoTool.h:63
Generated on Thu Nov 7 2024 21:17:26 for ATLAS Offline Software by
1.8.18