47 std::array<std::shared_ptr<TH1F>, 2> arr;
49 std::vector<uint32_t> detids_A;
50 payload_A->getDetIds(detids_A);
51 std::vector<uint32_t> detids_B;
52 payload_B->getDetIds(detids_B);
54 std::vector<float> v_ratios;
55 std::vector<float> v_diffs;
57 if (detids_A != detids_B) {
58 edm::LogError(
"fillDiffAndRatio") <<
"the list of DetIds for the two payloads are not equal"
59 <<
" cannot make any comparison!" << std::endl;
62 assert(detids_A == detids_B);
63 for (
const auto&
d : detids_A) {
64 auto range = payload_A->getRange(
d);
65 int numberOfRowsToAverageOver = payload_A->getNumberOfRowsToAverageOver();
66 int ncols = payload_A->getNCols(
d);
67 int nRocsInRow = (
range.second -
range.first) /
ncols / numberOfRowsToAverageOver;
68 unsigned int nRowsForHLT = 1;
69 int nrows =
std::max((payload_A->getNumberOfRowsToAverageOver() * nRocsInRow),
72 auto rAndCol_A = payload_A->getRangeAndNCols(
d);
73 auto rAndCol_B = payload_B->getRangeAndNCols(
d);
74 bool isDeadCol, isNoisyCol;
78 for (
int row = 0; row < nrows; row++) {
81 auto gainA = payload_A->getGain(
col, row, rAndCol_A.first, rAndCol_A.second, isDeadCol, isNoisyCol);
82 auto gainB = payload_B->getGain(
col, row, rAndCol_B.first, rAndCol_B.second, isDeadCol, isNoisyCol);
83 ratio = gainB != 0 ? (gainA / gainB) : -1.;
88 auto pedA = payload_A->getPed(
col, row, rAndCol_A.first, rAndCol_A.second, isDeadCol, isNoisyCol);
89 auto pedB = payload_B->getPed(
col, row, rAndCol_B.first, rAndCol_B.second, isDeadCol, isNoisyCol);
90 ratio = pedB != 0 ? (pedA / pedB) : -1.;
95 edm::LogError(
"gainCalibPI::fillTheHisto") <<
"Unrecognized type " << theType << std::endl;
99 v_diffs.push_back(
diff);
100 v_ratios.push_back(
ratio);
105 std::sort(v_diffs.begin(), v_diffs.end());
106 std::sort(v_ratios.begin(), v_ratios.end());
108 double minDiff = v_diffs.front();
109 double maxDiff = v_diffs.back();
110 double minRatio = v_ratios.front();
111 double maxRatio = v_ratios.back();
113 arr[0] = std::make_shared<TH1F>(
"h_Ratio",
"", 50, minRatio - 1., maxRatio + 1.);
114 arr[1] = std::make_shared<TH1F>(
"h_Diff",
"", 50, minDiff - 1.,
maxDiff + 1.);
116 for (
const auto&
r : v_ratios) {
119 for (
const auto&
d : v_diffs) {