55 std::unique_ptr<SiStripApvGain>
getNewObject(
const std::map<std::pair<uint32_t, int>,
float>& theMap);
91 std::map<std::pair<uint32_t, int>,
float> theMap;
93 std::vector<uint32_t> detid;
94 g1g2.getDetIds(detid);
95 for (
const auto&
d : detid) {
101 for (
int it = 0; it < rangeG1_old.second - rangeG1_old.first; it++) {
104 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
106 float G1_old = g1g2.getApvGain(it, rangeG1_old);
107 float G2_old = g1g2.getApvGain(it, rangeG2_old);
108 float G1G2_old = G1_old * G2_old;
109 float G1_new = g3.getApvGain(it, rangeG1_new);
113 float NewGain = G1G2_old / G1_new;
117 theMap[
index] = NewGain;
125 std::unique_ptr<SiStripApvGain> theAPVGains = this->
getNewObject(theMap);
133 throw std::runtime_error(
"PoolDBService required.");
144 const std::map<std::pair<uint32_t, int>,
float>& theMap) {
145 std::unique_ptr<SiStripApvGain>
obj = std::make_unique<SiStripApvGain>();
147 std::vector<float> theSiStripVector;
148 uint32_t PreviousDetId = 0;
149 for (
const auto& element : theMap) {
150 uint32_t
DetId = element.first.first;
151 if (
DetId != PreviousDetId) {
152 if (!theSiStripVector.empty()) {
154 if (!
obj->put(PreviousDetId,
range))
155 printf(
"Bug to put detId = %i\n", PreviousDetId);
157 theSiStripVector.clear();
158 PreviousDetId =
DetId;
160 theSiStripVector.push_back(element.second);
163 <<
" DetId: " <<
DetId <<
" APV: " << element.first.second <<
" Gain: " << element.second << std::endl;
166 if (!theSiStripVector.empty()) {
168 if (!
obj->put(PreviousDetId,
range))
169 printf(
"Bug to put detId = %i\n", PreviousDetId);
180 " Utility class to rescale the values of SiStrip G2 by the ratio of G1_old/G1_new: this is useful in the case in "
181 "which a Gain2 payload needs to recycled after a G1 update to keep the G1*G2 product constant."
182 "PoolDBOutputService must be set up for 'SiStripApvGainRcd'.");
185 descriptions.
add(
"rescaleGain2byGain1",
desc);