9 #include <top/dbobjects/TOPCalPhotonYields.h>
10 #include <framework/logging/Logger.h>
20 void TOPCalPhotonYields::set(
int slot,
const TH1F* photonYields,
const TH1F* backgroundYields,
const TH1F* alphaRatio,
21 const TH1F* activePixels,
const TH2F* pulseHeights,
const TH1F* muonZ)
23 string slotName = (slot < 10) ?
"_0" + to_string(slot) :
"_" + to_string(slot);
25 m_photonYields.push_back(TH2F((
"photonYields" + slotName).c_str(),
26 (
"Photon yields for slot " + to_string(slot) +
"; pixel column; pixel row").c_str(),
27 c_numCols, 0.5, c_numCols + 0.5, c_numRows, 0.5, c_numRows + 0.5));
28 copyContent(photonYields, m_photonYields.back());
30 m_backgroundYields.push_back(TH2F((
"backgroundYields" + slotName).c_str(),
31 (
"Background yields for slot " + to_string(slot) +
"; pixel column; pixel row").c_str(),
32 c_numCols, 0.5, c_numCols + 0.5, c_numRows, 0.5, c_numRows + 0.5));
33 copyContent(backgroundYields, m_backgroundYields.back());
35 m_alphaRatio.push_back(TH2F((
"alphaRatio" + slotName).c_str(),
36 (
"Equalized alpha ratio for slot " + to_string(slot) +
"; pixel column; pixel row").c_str(),
37 c_numCols, 0.5, c_numCols + 0.5, c_numRows, 0.5, c_numRows + 0.5));
38 copyContent(alphaRatio, m_alphaRatio.back());
40 m_activePixels.push_back(TH2F((
"activePixels" + slotName).c_str(),
41 (
"Active pixels for slot " + to_string(slot) +
"; pixel column; pixel row").c_str(),
42 c_numCols, 0.5, c_numCols + 0.5, c_numRows, 0.5, c_numRows + 0.5));
43 copyContent(activePixels, m_activePixels.back());
44 m_activePixels.back().Scale(1 / muonZ->GetEntries());
46 m_pulseHeights.push_back(*pulseHeights);
47 m_muonZ.push_back(*muonZ);
51 void TOPCalPhotonYields::copyContent(
const TH1F* input, TH2F& output)
53 for (
int bin = 1; bin <= input->GetNbinsX(); bin++) {
54 int row = (bin - 1) / 64 + 1;
55 int col = (bin - 1) % 64 + 1;
56 output.SetBinContent(col, row, input->GetBinContent(bin));
57 output.SetBinError(col, row, input->GetBinError(bin));
62 const TH2F* TOPCalPhotonYields::getPhotonYields(
int slot)
const
64 unsigned index = slot - 1;
65 if (index < m_photonYields.size())
return &m_photonYields[index];
70 const TH2F* TOPCalPhotonYields::getBackgroundYields(
int slot)
const
72 unsigned index = slot - 1;
73 if (index < m_backgroundYields.size())
return &m_backgroundYields[index];
78 const TH2F* TOPCalPhotonYields::getAlphaRatio(
int slot)
const
80 unsigned index = slot - 1;
81 if (index < m_alphaRatio.size())
return &m_alphaRatio[index];
86 const TH2F* TOPCalPhotonYields::getActivePixels(
int slot)
const
88 unsigned index = slot - 1;
89 if (index < m_activePixels.size())
return &m_activePixels[index];
94 const TH2F* TOPCalPhotonYields::getPulseHeights(
int slot)
const
96 unsigned index = slot - 1;
97 if (index < m_pulseHeights.size())
return &m_pulseHeights[index];
102 const TH1F* TOPCalPhotonYields::getMuonZ(
int slot)
const
104 unsigned index = slot - 1;
105 if (index < m_muonZ.size())
return &m_muonZ[index];
Abstract base class for different kinds of events.