56 std::unique_ptr<SiStripApvGain>
getNewObject(
const std::map<std::pair<uint32_t, int>,
float>& theMap);
67 : m_Record(iConfig.getParameter<
std::
string>(
"Record")) {
92 std::map<std::pair<uint32_t, int>,
float> theMap;
94 std::vector<uint32_t> detid;
96 for (
const auto&
d : detid) {
102 for (
int it = 0; it < rangeG1_old.second - rangeG1_old.first; it++) {
105 std::pair<uint32_t, int>
index = std::make_pair(
d, nAPV);
107 float G1_old = g1g2Handle_->
getApvGain(it, rangeG1_old);
108 float G2_old = g1g2Handle_->
getApvGain(it, rangeG2_old);
109 float G1G2_old = G1_old * G2_old;
110 float G1_new = g3Handle_->
getApvGain(it, rangeG1_new);
114 float NewGain = G1G2_old / G1_new;
118 theMap[
index] = NewGain;
126 std::unique_ptr<SiStripApvGain> theAPVGains = this->
getNewObject(theMap);
134 throw std::runtime_error(
"PoolDBService required.");
145 const std::map<std::pair<uint32_t, int>,
float>& theMap) {
146 std::unique_ptr<SiStripApvGain>
obj = std::unique_ptr<SiStripApvGain>(
new SiStripApvGain());
148 std::vector<float> theSiStripVector;
149 uint32_t PreviousDetId = 0;
150 for (
const auto& element : theMap) {
151 uint32_t
DetId = element.first.first;
152 if (
DetId != PreviousDetId) {
153 if (!theSiStripVector.empty()) {
155 if (!
obj->put(PreviousDetId,
range))
156 printf(
"Bug to put detId = %i\n", PreviousDetId);
158 theSiStripVector.clear();
159 PreviousDetId =
DetId;
161 theSiStripVector.push_back(element.second);
164 <<
" DetId: " <<
DetId <<
" APV: " << element.first.second <<
" Gain: " << element.second << std::endl;
167 if (!theSiStripVector.empty()) {
169 if (!
obj->put(PreviousDetId,
range))
170 printf(
"Bug to put detId = %i\n", PreviousDetId);
181 " Utility class to rescale the values of SiStrip G2 by the ratio of G1_old/G1_new: this is useful in the case in "
182 "which a Gain2 payload needs to recycled after a G1 update to keep the G1*G2 product constant."
183 "PoolDBOutputService must be set up for 'SiStripApvGainRcd'.");
186 descriptions.
add(
"rescaleGain2byGain1", desc);