128 <<
"=>=>=>=> Starting the function fillDatabase()" << endl;
130 if (
record_ !=
"SiPixelGainCalibrationOfflineRcd" &&
record_ !=
"SiPixelGainCalibrationForHLTRcd") {
132 <<
record_ <<
" : this record can't be used !" << std::endl;
134 <<
"Please select SiPixelGainCalibrationForHLTRcd or SiPixelGainCalibrationOfflineRcd" << std::endl;
139 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
141 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
146 edm::LogInfo(
"SiPixelCondObjOfflineBuilder") <<
" There are " << pDD->
dets().size() <<
" detectors" << std::endl;
148 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
153 }
else if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
169 <<
"New payload will have pedlow,hi " <<
pedlow_ <<
"," <<
pedhi_ <<
" and gainlow,hi " <<
gainlow_ <<
"," 171 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
174 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
184 bool willNoisyPixBeInserted;
188 willNoisyPixBeInserted =
false;
189 for (TrackerGeometry::DetContainer::const_iterator
mod = pDD->
dets().begin();
mod != pDD->
dets().end();
mod++) {
191 if (dynamic_cast<PixelGeomDetUnit const*>((*
mod)) !=
nullptr)
192 detid = ((*mod)->geographicalId()).
rawId();
193 if (detid ==
it->first) {
194 willNoisyPixBeInserted =
true;
198 if (!willNoisyPixBeInserted)
200 <<
"All Noisy Pixels in detid " <<
it->first
201 <<
"won't be inserted, check the TrackerGeometry you are using !! You are missing some modules" << endl;
205 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Starting Loop over all modules" << endl;
208 for (TrackerGeometry::DetContainer::const_iterator
it = pDD->
dets().begin();
it != pDD->
dets().end();
it++) {
210 if (dynamic_cast<PixelGeomDetUnit const*>((*
it)) !=
nullptr)
211 detid = ((*it)->geographicalId()).
rawId();
216 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> We are in module " << detid << endl;
221 int nrows = topol.
nrows();
225 float gainforthiscol[2];
226 float pedforthiscol[2];
229 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
231 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
234 std::vector<char> theSiPixelGainCalibrationGainPerColPedPerPixel;
235 std::vector<char> theSiPixelGainCalibrationPerCol;
238 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Starting Loop for each rows/cols " << endl;
240 for (
int icol = 0; icol <=
ncols - 1; icol++) {
242 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Starting a new column" << endl;
244 nusedrows[0] = nusedrows[1] = 0;
245 gainforthiscol[0] = gainforthiscol[1] = 0;
246 pedforthiscol[0] = pedforthiscol[1] = 0;
248 for (
int jrow = 0; jrow <= nrows - 1; jrow++) {
251 <<
"=>=>=>=> We are in col,row " << icol <<
"," << jrow << endl;
255 size_t iglobalrow = 0;
256 int noisyPixInRow = 0;
257 if (jrow > nrowsrocsplit) {
262 bool isPixelDeadOld =
false;
263 bool isColumnDeadOld =
false;
267 bool isPixelNoisyOld =
false;
268 bool isColumnNoisyOld =
false;
269 bool isPixelNoisyNew =
false;
270 bool isColumnNoisyNew =
false;
272 bool isColumnDead =
false;
273 bool isColumnNoisy =
false;
274 bool isPixelDead =
false;
275 bool isPixelNoisy =
false;
278 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Trying to get gain/ped " << endl;
281 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
287 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
291 if (!isColumnDeadOld && !isColumnNoisyOld) {
292 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
294 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
299 if (!isPixelDeadOld && !isPixelNoisyOld)
300 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
304 <<
"Problem trying to catch gain/ped from DETID " << detid <<
" @ col,row " << icol <<
"," << jrow
311 <<
"=>=>=>=> Found gain " << gainforthiscol[iglobalrow] <<
" and ped " << pedforthiscol[iglobalrow]
318 for (
unsigned int i = 0;
i < (
it->second).
size();
i++)
319 if (
it->first == detid && (
it->second.at(
i)).
first == icol && (
it->second.at(
i)).
second == jrow)
320 isPixelNoisyNew =
true;
322 isColumnDead = isColumnDeadOld;
323 isPixelDead = isPixelDeadOld;
327 if (noisyPixInRow == nrowsrocsplit)
328 isColumnNoisyNew =
true;
331 isColumnNoisy = isColumnNoisyOld;
332 isPixelNoisy = isPixelNoisyOld;
334 isPixelNoisy = isPixelNoisyNew;
335 isColumnNoisy = isColumnNoisyNew;
337 isPixelNoisy = isPixelNoisyNew || isPixelNoisyOld;
338 isColumnNoisy = isColumnNoisyNew || isColumnNoisyOld;
343 <<
"Inserting a noisy pixel in " << detid <<
" at col,row " << icol <<
"," << jrow << endl;
346 <<
"Inserting a noisy column in " << detid <<
" at col,row " << icol <<
"," << jrow << endl;
353 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Now Starting to fill the DB" << endl;
359 <<
"=>=>=>=> Filling Pixel Level Calibration" << endl;
362 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
365 else if (isPixelNoisy)
372 if ((jrow + 1) % nrowsrocsplit == 0) {
375 <<
"=>=>=>=> Filling Column Level Calibration" << endl;
378 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
380 theSiPixelGainCalibrationGainPerColPedPerPixel);
381 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
383 }
else if (isColumnNoisy) {
384 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
386 theSiPixelGainCalibrationGainPerColPedPerPixel);
387 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
390 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
392 gainforthiscol[iglobalrow], nrowsrocsplit, theSiPixelGainCalibrationGainPerColPedPerPixel);
393 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
395 pedforthiscol[iglobalrow], gainforthiscol[iglobalrow], theSiPixelGainCalibrationPerCol);
401 <<
"=>=>=>=> This pixel is finished inserting" << endl;
407 <<
"=>=>=>=> This column is finished inserting" << endl;
412 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Loop over rows/cols is finished" << endl;
414 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
416 theSiPixelGainCalibrationGainPerColPedPerPixel.end());
419 <<
"warning: detid already exists for Offline (gain per col, ped per pixel) calibration database" 422 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
424 theSiPixelGainCalibrationPerCol.end());
427 <<
"warning: detid already exists for HLT (gain per col, ped per col) calibration database" << std::endl;
431 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> This detid is finished inserting" << endl;
435 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" --- writing to DB!" << std::endl;
441 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
443 <<
"now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl;
444 if (mydbservice->
isNewTagRequest(
"SiPixelGainCalibrationOfflineRcd")) {
452 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
454 <<
"now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl;
465 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" ---> SUMMARY :" << std::endl;
467 <<
" File had " <<
nnoisyininput <<
" noisy pixels" << std::endl;
469 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" DB has now " << nnoisy <<
" noisy pixels" << std::endl;
470 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" DB has now " << ndead <<
" dead pixels" << std::endl;
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override
const int insertnoisypixelsindb_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pddToken_
virtual int ncolumns() const =0
float getPedestal(const uint32_t &detID, const int &col, const int &row) override
cond::Time_t beginOfTime() const
double getGainLow() override
virtual int nrows() const =0
std::unique_ptr< SiPixelGainCalibrationOffline > theGainCalibrationDbInputOffline_
std::map< int, std::vector< std::pair< int, int > > > noisypixelkeeper
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Log< level::Error, false > LogError
std::pair< ContainerIterator, ContainerIterator > Range
double getGainHigh() override
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
U second(std::pair< T, U > const &p)
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
std::unique_ptr< SiPixelGainCalibrationForHLT > theGainCalibrationDbInputForHLT_
float getGain(const uint32_t &detID, const int &col, const int &row) override
bool isNewTagRequest(const std::string &recordName)
double getPedLow() override
cond::Time_t currentTime() const
SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_
void setESObjects(const edm::EventSetup &es) override
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override
bool isDead(const uint32_t &detID, const int &col, const int &row) override
Log< level::Warning, true > LogPrint
SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_
bool isNoisy(const uint32_t &detID, const int &col, const int &row) override
Log< level::Info, false > LogInfo
double getPedHigh() override
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
const std::string record_
bool isDeadColumn(const uint32_t &detID, const int &col, const int &row) override
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override
float getPedestal(const uint32_t &detID, const int &col, const int &row) override
T mod(const T &a, const T &b)
float getGain(const uint32_t &detID, const int &col, const int &row) override