ATLAS Offline Software
Loading...
Searching...
No Matches
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
12#include "TH1I.h"
13#include "TH1F.h"
14#include "TH2F.h"
15#include "TMath.h"
16#include <stdexcept> // out_of_range exception
17
20
21int
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
28int
30 return m_numberOfEventsHisto->GetEntries();
31}
32
33int
34ISCT_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
46double
47ISCT_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
59void
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
70void
72 m_nLb=nLb;
73}
74
75int
77 return m_nLb;
78}
79
80void
82 m_nLbMerge = nLbMerge;
83}
84
85void
87 m_lumiBlock = nLb;
88}
89
90int
Header file to interface class for histograms in the SCT_CalibAlgs package.
void setNumberOfLb(const int nLb)
set number of lumiblocks
void setLb(const int nLb)
set lumiblock for Lb dependent maps
int LbToMerge() const
get number of lumiblocks
void binHistograms(const int nLbMerged)
virtual int getNumberOfEventsInBin(const int nbin) const
get number of events in a specific bin
std::vector< TH1F * > m_phistoVector
int size() const
get total number of entries in the number of events histo
void setLbToMerge(const int nLbMerge)
set number of lumiblocks
std::vector< TH2F * > m_phistoVector2D
int numberOfLb() const
get number of lumiblocks
double getBinForHistogramIndex(const int bin, const int histogramIndex) const
get bin content for bin in specific histogram