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