42 std::vector<double>& peds,
43 std::vector<double>& gains,
44 std::map<int, int>& myindxmap,
46 void setDummyFullPlane(std::vector<float>& peds, std::vector<float>& gains,
int npixplane);
66 : m_record(iConfig.getUntrackedParameter<
std::
string>(
"record",
"CTPPSPixelGainCalibrationsRcd")),
67 m_inputHistosFileName(iConfig.getUntrackedParameter<
std::
string>(
"inputrootfile",
"inputfile.root")),
68 m_usedummy(iConfig.getUntrackedParameter<
bool>(
"useDummyValues",
true)),
69 npfitmin(iConfig.getUntrackedParameter<
int>(
"minimumNpfit", 3)),
70 gainlow(iConfig.getUntrackedParameter<double>(
"gainLowLimit", 0.0)),
71 gainhigh(iConfig.getUntrackedParameter<double>(
"gainHighLimit", 100.0)) {}
110 int sector[2] = {45, 56};
117 for (
int i = 0;
i < nsec;
i++)
118 for (
int st = 0; st < nst; st++)
119 for (
int pot = 0; pot < npt; pot++) {
123 char temppathrp[100];
124 sprintf(temppathrp,
"CTPPS/CTPPS_SEC%d/CTPPS_SEC%d_RP%d%d%d", sector[
i], sector[
i], arm,
station[st], pot);
128 for (
int plane = 0; plane < 6; plane++) {
130 char temppathplane[100];
131 sprintf(temppathplane,
132 "CTPPS/CTPPS_SEC%d/CTPPS_SEC%d_RP%d%d%d/CTPPS_SEC%d_RP%d%d%d_PLN%d",
148 std::vector<std::string> histnamevec;
149 std::vector<int> listrocs;
151 char temppathhistos[200];
155 "CTPPS/CTPPS_SEC%d/CTPPS_SEC%d_RP%d%d%d/CTPPS_SEC%d_RP%d%d%d_PLN%d/CTPPS_SEC%d_RP%d%d%d_PLN%d_ROC%d",
175 std::string pathintercept = pathhistos +
"_Intercept2D";
177 histnamevec.push_back(pathhistos);
178 listrocs.push_back(
roc);
184 <<
"Raw DetId = " << mytempid.
rawId() <<
" Arm = " << arm <<
" Sector = " << sector[arm]
185 <<
" Station = " <<
station[st] <<
" Pot = " << pot <<
" Plane = " << plane;
198 uint32_t tempdetid = it->first;
199 std::vector<int>
rocs = it->second;
201 std::map<int, int> mapIPixIndx;
203 std::vector<double> gainsFromHistos;
204 std::vector<double> pedsFromHistos;
208 for (
unsigned int i = 0;
i <
nrocs;
i++) {
212 std::vector<float> orderedGains;
213 std::vector<float> orderedPeds;
214 for (
unsigned int k = 0;
k <
nrocs * 52 * 80;
k++) {
215 int indx = mapIPixIndx[
k];
216 float tmpped = pedsFromHistos[indx];
217 float tmpgain = gainsFromHistos[indx];
218 orderedGains.push_back(tmpgain);
219 orderedPeds.push_back(tmpped);
220 tempPGCalib.
putData(
k, tmpped, tmpgain);
224 edm::LogWarning(
"CTPPSPixGainsCalibrationWriter") <<
" plane with detID =" << tempdetid <<
" is empty";
236 edm::LogError(
"CTPPSPixGainsCalibrationWriter") <<
"Db Service Unavailable";
243 std::vector<float>& gains,
245 for (
int i = 0;
i < npixplane; ++
i) {
247 gains.push_back(0.5);
254 std::vector<double>& peds,
255 std::vector<double>& gains,
256 std::map<int, int>& mymap,
268 int ncols = tempslope->GetNbinsX();
269 int nrows = tempslope->GetNbinsY();
270 if (nrows != 80 ||
ncols != 52)
272 <<
"Something wrong ncols = " <<
ncols <<
" and nrows = " << nrows;
274 for (
int jrow = 0; jrow < nrows;
276 for (
int icol = 0; icol <
ncols; ++icol) {
277 double tmpslp = tempslope->GetBinContent(icol + 1, jrow + 1);
278 double tmpgain = (tmpslp == 0.0) ? 0.0 : 1.0 / tmpslp;
279 double tmpped = tempintrcpt->GetBinContent(icol + 1, jrow + 1);
281 int tmpnpfit = tempnpfit->GetBinContent(icol + 1, jrow + 1);
293 gains.push_back(tmpgain);
294 peds.push_back(tmpped);
298 int indx = gains.size() - 1;
299 int pixIndx = modCol + modRow * (52 *
nrocs / 2);
300 mymap[pixIndx] = indx;