49 std::array<std::shared_ptr<TH1F>, 2> arr;
51 std::vector<uint32_t> detids_A;
52 payload_A->getDetIds(detids_A);
53 std::vector<uint32_t> detids_B;
54 payload_B->getDetIds(detids_B);
56 std::vector<float> v_ratios;
57 std::vector<float> v_diffs;
59 if (detids_A != detids_B) {
60 edm::LogError(
"fillDiffAndRatio") <<
"the list of DetIds for the two payloads are not equal"
61 <<
" cannot make any comparison!" << std::endl;
64 assert(detids_A == detids_B);
65 for (
const auto&
d : detids_A) {
66 auto range = payload_A->getRange(
d);
67 int numberOfRowsToAverageOver = payload_A->getNumberOfRowsToAverageOver();
68 int ncols = payload_A->getNCols(
d);
69 int nRocsInRow = (
range.second -
range.first) /
ncols / numberOfRowsToAverageOver;
70 unsigned int nRowsForHLT = 1;
71 int nrows =
std::max((payload_A->getNumberOfRowsToAverageOver() * nRocsInRow),
74 auto rAndCol_A = payload_A->getRangeAndNCols(
d);
75 auto rAndCol_B = payload_B->getRangeAndNCols(
d);
76 bool isDeadCol, isNoisyCol;
80 for (
int row = 0; row < nrows; row++) {
83 auto gainA = payload_A->getGain(
col, row, rAndCol_A.first, rAndCol_A.second, isDeadCol, isNoisyCol);
84 auto gainB = payload_B->getGain(
col, row, rAndCol_B.first, rAndCol_B.second, isDeadCol, isNoisyCol);
85 ratio = gainB != 0 ? (gainA / gainB) : -1.;
90 auto pedA = payload_A->getPed(
col, row, rAndCol_A.first, rAndCol_A.second, isDeadCol, isNoisyCol);
91 auto pedB = payload_B->getPed(
col, row, rAndCol_B.first, rAndCol_B.second, isDeadCol, isNoisyCol);
92 ratio = pedB != 0 ? (pedA / pedB) : -1.;
97 edm::LogError(
"gainCalibPI::fillTheHisto") <<
"Unrecognized type " << theType << std::endl;
101 v_diffs.push_back(
diff);
102 v_ratios.push_back(
ratio);
107 std::sort(v_diffs.begin(), v_diffs.end());
108 std::sort(v_ratios.begin(), v_ratios.end());
110 double minDiff = v_diffs.front();
111 double maxDiff = v_diffs.back();
112 double minRatio = v_ratios.front();
113 double maxRatio = v_ratios.back();
115 arr[0] = std::make_shared<TH1F>(
"h_Ratio",
"", 50, minRatio - 1., maxRatio + 1.);
116 arr[1] = std::make_shared<TH1F>(
"h_Diff",
"", 50, minDiff - 1.,
maxDiff + 1.);
118 for (
const auto&
r : v_ratios) {
121 for (
const auto&
d : v_diffs) {