116 <<
"=>=>=>=> Starting the function fillDatabase()" << endl;
118 if (
record_ !=
"SiPixelGainCalibrationOfflineRcd" &&
record_ !=
"SiPixelGainCalibrationForHLTRcd") {
120 <<
record_ <<
" : this record can't be used !" << std::endl;
122 <<
"Please select SiPixelGainCalibrationForHLTRcd or SiPixelGainCalibrationOfflineRcd" << std::endl;
127 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
129 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
134 edm::LogInfo(
"SiPixelCondObjOfflineBuilder") <<
" There are " << pDD->
dets().size() <<
" detectors" << std::endl;
136 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
141 }
else if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
157 <<
"New payload will have pedlow,hi " <<
pedlow_ <<
"," <<
pedhi_ <<
" and gainlow,hi " <<
gainlow_ <<
"," 159 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
162 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
173 bool willNoisyPixBeInserted;
177 willNoisyPixBeInserted =
false;
178 for (TrackerGeometry::DetContainer::const_iterator
mod = pDD->
dets().begin();
mod != pDD->
dets().end();
mod++) {
180 if (dynamic_cast<PixelGeomDetUnit const*>((*
mod)) !=
nullptr)
181 detid = ((*mod)->geographicalId()).rawId();
182 if (detid == it->first) {
183 willNoisyPixBeInserted =
true;
187 if (!willNoisyPixBeInserted)
189 <<
"All Noisy Pixels in detid " << it->first
190 <<
"won't be inserted, check the TrackerGeometry you are using !! You are missing some modules" << endl;
194 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Starting Loop over all modules" << endl;
197 for (TrackerGeometry::DetContainer::const_iterator it = pDD->
dets().begin(); it != pDD->
dets().end(); it++) {
199 if (dynamic_cast<PixelGeomDetUnit const*>((*it)) !=
nullptr)
200 detid = ((*it)->geographicalId()).rawId();
208 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> We are in module " << detid << endl;
213 int nrows = topol.
nrows();
217 float gainforthiscol[2];
218 float pedforthiscol[2];
221 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
223 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
226 std::vector<char> theSiPixelGainCalibrationGainPerColPedPerPixel;
227 std::vector<char> theSiPixelGainCalibrationPerCol;
230 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Starting Loop for each rows/cols " << endl;
232 for (
int icol = 0; icol <=
ncols - 1; icol++) {
234 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Starting a new column" << endl;
236 nusedrows[0] = nusedrows[1] = 0;
237 gainforthiscol[0] = gainforthiscol[1] = 0;
238 pedforthiscol[0] = pedforthiscol[1] = 0;
240 for (
int jrow = 0; jrow <= nrows - 1; jrow++) {
243 <<
"=>=>=>=> We are in col,row " << icol <<
"," << jrow << endl;
247 size_t iglobalrow = 0;
248 int noisyPixInRow = 0;
249 if (jrow > nrowsrocsplit) {
254 bool isPixelDeadOld =
false;
255 bool isColumnDeadOld =
false;
259 bool isPixelNoisyOld =
false;
260 bool isColumnNoisyOld =
false;
261 bool isPixelNoisyNew =
false;
262 bool isColumnNoisyNew =
false;
264 bool isColumnDead =
false;
265 bool isColumnNoisy =
false;
266 bool isPixelDead =
false;
267 bool isPixelNoisy =
false;
270 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Trying to get gain/ped " << endl;
273 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
279 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
283 if (!isColumnDeadOld && !isColumnNoisyOld) {
284 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
286 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
291 if (!isPixelDeadOld && !isPixelNoisyOld)
292 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
296 <<
"Problem trying to catch gain/ped from DETID " << detid <<
" @ col,row " << icol <<
"," << jrow
303 <<
"=>=>=>=> Found gain " << gainforthiscol[iglobalrow] <<
" and ped " << pedforthiscol[iglobalrow]
310 for (
unsigned int i = 0;
i < (it->second).
size();
i++)
311 if (it->first == detid && (it->second.at(
i)).
first == icol && (it->second.at(
i)).
second == jrow)
312 isPixelNoisyNew =
true;
314 isColumnDead = isColumnDeadOld;
315 isPixelDead = isPixelDeadOld;
319 if (noisyPixInRow == nrowsrocsplit)
320 isColumnNoisyNew =
true;
323 isColumnNoisy = isColumnNoisyOld;
324 isPixelNoisy = isPixelNoisyOld;
326 isPixelNoisy = isPixelNoisyNew;
327 isColumnNoisy = isColumnNoisyNew;
329 isPixelNoisy = isPixelNoisyNew || isPixelNoisyOld;
330 isColumnNoisy = isColumnNoisyNew || isColumnNoisyOld;
335 <<
"Inserting a noisy pixel in " << detid <<
" at col,row " << icol <<
"," << jrow << endl;
338 <<
"Inserting a noisy column in " << detid <<
" at col,row " << icol <<
"," << jrow << endl;
345 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Now Starting to fill the DB" << endl;
351 <<
"=>=>=>=> Filling Pixel Level Calibration" << endl;
354 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
357 else if (isPixelNoisy)
364 if ((jrow + 1) % nrowsrocsplit == 0) {
367 <<
"=>=>=>=> Filling Column Level Calibration" << endl;
370 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
372 theSiPixelGainCalibrationGainPerColPedPerPixel);
373 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
375 }
else if (isColumnNoisy) {
376 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
378 theSiPixelGainCalibrationGainPerColPedPerPixel);
379 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
382 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd")
384 gainforthiscol[iglobalrow], nrowsrocsplit, theSiPixelGainCalibrationGainPerColPedPerPixel);
385 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd")
387 pedforthiscol[iglobalrow], gainforthiscol[iglobalrow], theSiPixelGainCalibrationPerCol);
393 <<
"=>=>=>=> This pixel is finished inserting" << endl;
399 <<
"=>=>=>=> This column is finished inserting" << endl;
404 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> Loop over rows/cols is finished" << endl;
406 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
408 theSiPixelGainCalibrationGainPerColPedPerPixel.end());
411 <<
"warning: detid already exists for Offline (gain per col, ped per pixel) calibration database" 414 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
416 theSiPixelGainCalibrationPerCol.end());
419 <<
"warning: detid already exists for HLT (gain per col, ped per col) calibration database" << std::endl;
423 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
"=>=>=>=> This detid is finished inserting" << endl;
427 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" --- writing to DB!" << std::endl;
433 if (
record_ ==
"SiPixelGainCalibrationOfflineRcd") {
435 <<
"now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl;
436 if (mydbservice->
isNewTagRequest(
"SiPixelGainCalibrationOfflineRcd")) {
444 if (
record_ ==
"SiPixelGainCalibrationForHLTRcd") {
446 <<
"now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl;
457 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" ---> SUMMARY :" << std::endl;
459 <<
" File had " <<
nnoisyininput <<
" noisy pixels" << std::endl;
461 edm::LogPrint(
"SiPixelGainCalibrationRejectNoisyAndDead") <<
" DB has now " << nnoisy <<
" noisy pixels" << std::endl;
462 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_
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
bool getData(T &iHolder) const
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