CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
SiPixelGainCalibrationRejectNoisyAndDead Class Reference
Inheritance diagram for SiPixelGainCalibrationRejectNoisyAndDead:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiPixelGainCalibrationRejectNoisyAndDead (const edm::ParameterSet &)
 
 ~SiPixelGainCalibrationRejectNoisyAndDead () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void fillDatabase (const edm::EventSetup &)
 
void getNoisyPixels ()
 

Private Attributes

const bool DEBUG
 
float gainhi_
 
float gainlow_
 
std::map< int, std::vector< std::pair< int, int > > > insertednoisypixel
 
const int insertnoisypixelsindb_
 
int nnoisyininput
 
std::map< int, std::vector< std::pair< int, int > > > noisypixelkeeper
 
const std::string noisypixellist_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordpddToken_
 
float pedhi_
 
float pedlow_
 
const std::string record_
 
SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_
 
SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_
 
std::unique_ptr< SiPixelGainCalibrationForHLTtheGainCalibrationDbInputForHLT_
 
std::unique_ptr< SiPixelGainCalibrationOfflinetheGainCalibrationDbInputOffline_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 57 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Constructor & Destructor Documentation

◆ SiPixelGainCalibrationRejectNoisyAndDead()

SiPixelGainCalibrationRejectNoisyAndDead::SiPixelGainCalibrationRejectNoisyAndDead ( const edm::ParameterSet iConfig)
explicit

Definition at line 105 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

106  : pddToken_(esConsumes()),
109  noisypixellist_(iConfig.getUntrackedParameter<std::string>("noisyPixelList", "noisypixel.txt")),
110  insertnoisypixelsindb_(iConfig.getUntrackedParameter<int>("insertNoisyPixelsInDB", 1)),
111  record_(iConfig.getUntrackedParameter<std::string>("record", "SiPixelGainCalibrationOfflineRcd")),
112  DEBUG(iConfig.getUntrackedParameter<bool>("debug", false)) {
113  //now do what ever initialization is needed
114 }
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pddToken_
T getUntrackedParameter(std::string const &, T const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_
SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_

◆ ~SiPixelGainCalibrationRejectNoisyAndDead()

SiPixelGainCalibrationRejectNoisyAndDead::~SiPixelGainCalibrationRejectNoisyAndDead ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelGainCalibrationRejectNoisyAndDead::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

◆ fillDatabase()

void SiPixelGainCalibrationRejectNoisyAndDead::fillDatabase ( const edm::EventSetup iSetup)
private

Definition at line 125 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

References cond::service::PoolDBOutputService::appendOneIOV(), cond::service::PoolDBOutputService::beginOfTime(), cond::service::PoolDBOutputService::createOneIOV(), cond::service::PoolDBOutputService::currentTime(), DEBUG, TrackerGeometry::dets(), cppFunctionSkipper::exception, first, gainhi_, gainlow_, edm::EventSetup::getData(), SiPixelGainCalibrationOfflineService::getGain(), SiPixelGainCalibrationForHLTService::getGain(), SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainHigh(), SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getGainLow(), SiPixelGainCalibrationOfflineService::getPedestal(), SiPixelGainCalibrationForHLTService::getPedestal(), SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedHigh(), SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::getPedLow(), mps_fire::i, insertnoisypixelsindb_, edm::Service< T >::isAvailable(), SiPixelGainCalibrationOfflineService::isDead(), SiPixelGainCalibrationOfflineService::isDeadColumn(), SiPixelGainCalibrationForHLTService::isDeadColumn(), cond::service::PoolDBOutputService::isNewTagRequest(), SiPixelGainCalibrationOfflineService::isNoisy(), SiPixelGainCalibrationOfflineService::isNoisyColumn(), SiPixelGainCalibrationForHLTService::isNoisyColumn(), genParticles_cff::map, mod(), hgcalPlots::ncols, PixelTopology::ncolumns(), nnoisyininput, noisypixelkeeper, PixelTopology::nrows(), pddToken_, pedhi_, pedlow_, record_, edm::second(), SiPixelGainCalibrationServicePayloadGetter< thePayloadObject, theDBRecordType >::setESObjects(), SiPixelGainCalibrationForHLTService_, SiPixelGainCalibrationOfflineService_, findQualityFiles::size, PixelGeomDetUnit::specificTopology(), theGainCalibrationDbInputForHLT_, theGainCalibrationDbInputOffline_, and trackerHitRTTI::vector.

Referenced by analyze().

125  {
126  if (DEBUG)
127  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
128  << "=>=>=>=> Starting the function fillDatabase()" << endl;
129 
130  if (record_ != "SiPixelGainCalibrationOfflineRcd" && record_ != "SiPixelGainCalibrationForHLTRcd") {
131  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
132  << record_ << " : this record can't be used !" << std::endl;
133  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
134  << "Please select SiPixelGainCalibrationForHLTRcd or SiPixelGainCalibrationOfflineRcd" << std::endl;
135  return;
136  }
137 
138  //Get the Calibration Data
139  if (record_ == "SiPixelGainCalibrationOfflineRcd")
141  if (record_ == "SiPixelGainCalibrationForHLTRcd")
143 
144  //Get list of ideal detids
145  const TrackerGeometry* pDD = &iSetup.getData(pddToken_);
146  edm::LogInfo("SiPixelCondObjOfflineBuilder") << " There are " << pDD->dets().size() << " detectors" << std::endl;
147 
148  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
153  } else if (record_ == "SiPixelGainCalibrationForHLTRcd") {
158  }
159  if (gainlow_ < 0)
160  gainlow_ = 0;
161  if (gainhi_ > 21)
162  gainhi_ = 21;
163  if (pedlow_ < -100)
164  pedlow_ = -100;
165  if (pedhi_ > 300)
166  pedhi_ = 300;
167 
168  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
169  << "New payload will have pedlow,hi " << pedlow_ << "," << pedhi_ << " and gainlow,hi " << gainlow_ << ","
170  << gainhi_ << endl;
171  if (record_ == "SiPixelGainCalibrationOfflineRcd")
173  std::make_unique<SiPixelGainCalibrationOffline>(pedlow_, pedhi_, gainlow_, gainhi_);
174  if (record_ == "SiPixelGainCalibrationForHLTRcd")
176  std::make_unique<SiPixelGainCalibrationForHLT>(pedlow_, pedhi_, gainlow_, gainhi_);
177 
178  int nnoisy = 0;
179  int ndead = 0;
180 
181  int detid = 0;
182  int NDetid = 0;
183 
184  //checking for noisy pixels that won't be inserted ...
185  bool willNoisyPixBeInserted;
186  for (std::map<int, std::vector<std::pair<int, int> > >::const_iterator it = noisypixelkeeper.begin();
187  it != noisypixelkeeper.end();
188  it++) {
189  willNoisyPixBeInserted = false;
190  for (TrackerGeometry::DetContainer::const_iterator mod = pDD->dets().begin(); mod != pDD->dets().end(); mod++) {
191  detid = 0;
192  if (dynamic_cast<PixelGeomDetUnit const*>((*mod)) != nullptr)
193  detid = ((*mod)->geographicalId()).rawId();
194  if (detid == it->first) {
195  willNoisyPixBeInserted = true;
196  break;
197  }
198  }
199  if (!willNoisyPixBeInserted)
200  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
201  << "All Noisy Pixels in detid " << it->first
202  << "won't be inserted, check the TrackerGeometry you are using !! You are missing some modules" << endl;
203  }
204 
205  if (DEBUG)
206  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting Loop over all modules" << endl;
207 
208  //Looping over all modules
209  for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
210  detid = 0;
211  if (dynamic_cast<PixelGeomDetUnit const*>((*it)) != nullptr)
212  detid = ((*it)->geographicalId()).rawId();
213  if (detid == 0)
214  continue;
215  NDetid++;
216  //edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")<<NDetid<<" "<<detid<<endl;
217  //if(NDetid==164) continue;
218 
219  if (DEBUG)
220  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> We are in module " << detid << endl;
221 
222  // Get the module sizes
223  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>((*it));
224  const PixelTopology& topol = pixDet->specificTopology();
225  int nrows = topol.nrows(); // rows in x
226  int ncols = topol.ncolumns(); // cols in y
227 
228  float ped;
229  float gainforthiscol[2];
230  float pedforthiscol[2];
231  int nusedrows[2];
232  int nrowsrocsplit;
233  if (record_ == "SiPixelGainCalibrationOfflineRcd")
234  nrowsrocsplit = theGainCalibrationDbInputOffline_->getNumberOfRowsToAverageOver();
235  if (record_ == "SiPixelGainCalibrationForHLTRcd")
236  nrowsrocsplit = theGainCalibrationDbInputForHLT_->getNumberOfRowsToAverageOver();
237 
238  std::vector<char> theSiPixelGainCalibrationGainPerColPedPerPixel;
239  std::vector<char> theSiPixelGainCalibrationPerCol;
240 
241  if (DEBUG)
242  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting Loop for each rows/cols " << endl;
243 
244  for (int icol = 0; icol <= ncols - 1; icol++) {
245  if (DEBUG)
246  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting a new column" << endl;
247 
248  nusedrows[0] = nusedrows[1] = 0;
249  gainforthiscol[0] = gainforthiscol[1] = 0;
250  pedforthiscol[0] = pedforthiscol[1] = 0;
251 
252  for (int jrow = 0; jrow <= nrows - 1; jrow++) {
253  if (DEBUG)
254  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
255  << "=>=>=>=> We are in col,row " << icol << "," << jrow << endl;
256 
257  ped = 0;
258 
259  size_t iglobalrow = 0;
260  int noisyPixInRow = 0;
261  if (jrow > nrowsrocsplit) {
262  iglobalrow = 1;
263  noisyPixInRow = 0;
264  }
265 
266  bool isPixelDeadOld = false;
267  bool isColumnDeadOld = false;
268  // bool isPixelDeadNew = false;
269  // bool isColumnDeadNew = false;
270 
271  bool isPixelNoisyOld = false;
272  bool isColumnNoisyOld = false;
273  bool isPixelNoisyNew = false;
274  bool isColumnNoisyNew = false;
275 
276  bool isColumnDead = false;
277  bool isColumnNoisy = false;
278  bool isPixelDead = false;
279  bool isPixelNoisy = false;
280 
281  if (DEBUG)
282  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Trying to get gain/ped " << endl;
283 
284  try {
285  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
286  isPixelDeadOld = SiPixelGainCalibrationOfflineService_.isDead(detid, icol, jrow);
287  isPixelNoisyOld = SiPixelGainCalibrationOfflineService_.isNoisy(detid, icol, jrow);
288  isColumnDeadOld = SiPixelGainCalibrationOfflineService_.isNoisyColumn(detid, icol, jrow);
289  isColumnNoisyOld = SiPixelGainCalibrationOfflineService_.isDeadColumn(detid, icol, jrow);
290  }
291  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
292  isColumnDeadOld = SiPixelGainCalibrationForHLTService_.isNoisyColumn(detid, icol, jrow);
293  isColumnNoisyOld = SiPixelGainCalibrationForHLTService_.isDeadColumn(detid, icol, jrow);
294  }
295  if (!isColumnDeadOld && !isColumnNoisyOld) {
296  if (record_ == "SiPixelGainCalibrationOfflineRcd")
297  gainforthiscol[iglobalrow] = SiPixelGainCalibrationOfflineService_.getGain(detid, icol, jrow);
298  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
299  gainforthiscol[iglobalrow] = SiPixelGainCalibrationForHLTService_.getGain(detid, icol, jrow);
300  pedforthiscol[iglobalrow] = SiPixelGainCalibrationForHLTService_.getPedestal(detid, icol, jrow);
301  }
302  }
303  if (!isPixelDeadOld && !isPixelNoisyOld)
304  if (record_ == "SiPixelGainCalibrationOfflineRcd")
305  ped = SiPixelGainCalibrationOfflineService_.getPedestal(detid, icol, jrow);
306  } catch (const std::exception& er) {
307  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
308  << "Problem trying to catch gain/ped from DETID " << detid << " @ col,row " << icol << "," << jrow
309  << endl;
310  }
311  //edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")<<"For DetId "<<detid<<" we found gain : "<<gain<<", pedestal : "<<ped<<std::endl;
312 
313  if (DEBUG)
314  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
315  << "=>=>=>=> Found gain " << gainforthiscol[iglobalrow] << " and ped " << pedforthiscol[iglobalrow]
316  << endl;
317 
318  //Check if pixel is in new noisy list
319  for (std::map<int, std::vector<std::pair<int, int> > >::const_iterator it = noisypixelkeeper.begin();
320  it != noisypixelkeeper.end();
321  it++)
322  for (unsigned int i = 0; i < (it->second).size(); i++)
323  if (it->first == detid && (it->second.at(i)).first == icol && (it->second.at(i)).second == jrow)
324  isPixelNoisyNew = true;
325 
326  isColumnDead = isColumnDeadOld;
327  isPixelDead = isPixelDeadOld;
328 
329  if (isPixelNoisyNew)
330  noisyPixInRow++;
331  if (noisyPixInRow == nrowsrocsplit)
332  isColumnNoisyNew = true;
333 
334  if (insertnoisypixelsindb_ == 0) {
335  isColumnNoisy = isColumnNoisyOld;
336  isPixelNoisy = isPixelNoisyOld;
337  } else if (insertnoisypixelsindb_ == 1) {
338  isPixelNoisy = isPixelNoisyNew;
339  isColumnNoisy = isColumnNoisyNew;
340  } else if (insertnoisypixelsindb_ == 2) {
341  isPixelNoisy = isPixelNoisyNew || isPixelNoisyOld;
342  isColumnNoisy = isColumnNoisyNew || isColumnNoisyOld;
343  }
344 
345  if (isPixelNoisy)
346  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
347  << "Inserting a noisy pixel in " << detid << " at col,row " << icol << "," << jrow << endl;
348  if (isColumnNoisy)
349  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
350  << "Inserting a noisy column in " << detid << " at col,row " << icol << "," << jrow << endl;
351  if (isPixelNoisy)
352  nnoisy++;
353  if (isPixelDead)
354  ndead++;
355 
356  if (DEBUG)
357  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Now Starting to fill the DB" << endl;
358 
359  //********** Fill the new DB !!
360 
361  if (DEBUG)
362  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
363  << "=>=>=>=> Filling Pixel Level Calibration" << endl;
364 
365  //Set Pedestal
366  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
367  if (isPixelDead)
368  theGainCalibrationDbInputOffline_->setDeadPixel(theSiPixelGainCalibrationGainPerColPedPerPixel);
369  else if (isPixelNoisy)
370  theGainCalibrationDbInputOffline_->setNoisyPixel(theSiPixelGainCalibrationGainPerColPedPerPixel);
371  else
372  theGainCalibrationDbInputOffline_->setDataPedestal(ped, theSiPixelGainCalibrationGainPerColPedPerPixel);
373  }
374 
375  //Set Gain
376  if ((jrow + 1) % nrowsrocsplit == 0) {
377  if (DEBUG)
378  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
379  << "=>=>=>=> Filling Column Level Calibration" << endl;
380 
381  if (isColumnDead) {
382  if (record_ == "SiPixelGainCalibrationOfflineRcd")
383  theGainCalibrationDbInputOffline_->setDeadColumn(nrowsrocsplit,
384  theSiPixelGainCalibrationGainPerColPedPerPixel);
385  if (record_ == "SiPixelGainCalibrationForHLTRcd")
386  theGainCalibrationDbInputForHLT_->setDeadColumn(nrowsrocsplit, theSiPixelGainCalibrationPerCol);
387  } else if (isColumnNoisy) {
388  if (record_ == "SiPixelGainCalibrationOfflineRcd")
389  theGainCalibrationDbInputOffline_->setNoisyColumn(nrowsrocsplit,
390  theSiPixelGainCalibrationGainPerColPedPerPixel);
391  if (record_ == "SiPixelGainCalibrationForHLTRcd")
392  theGainCalibrationDbInputForHLT_->setNoisyColumn(nrowsrocsplit, theSiPixelGainCalibrationPerCol);
393  } else {
394  if (record_ == "SiPixelGainCalibrationOfflineRcd")
396  gainforthiscol[iglobalrow], nrowsrocsplit, theSiPixelGainCalibrationGainPerColPedPerPixel);
397  if (record_ == "SiPixelGainCalibrationForHLTRcd")
399  pedforthiscol[iglobalrow], gainforthiscol[iglobalrow], theSiPixelGainCalibrationPerCol);
400  }
401  }
402 
403  if (DEBUG)
404  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
405  << "=>=>=>=> This pixel is finished inserting" << endl;
406 
407  } //end of loop over rows
408 
409  if (DEBUG)
410  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
411  << "=>=>=>=> This column is finished inserting" << endl;
412 
413  } //end of loop over col
414 
415  if (DEBUG)
416  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Loop over rows/cols is finished" << endl;
417 
418  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
419  SiPixelGainCalibrationOffline::Range offlinerange(theSiPixelGainCalibrationGainPerColPedPerPixel.begin(),
420  theSiPixelGainCalibrationGainPerColPedPerPixel.end());
421  if (!theGainCalibrationDbInputOffline_->put(detid, offlinerange, ncols))
422  edm::LogError("SiPixelGainCalibrationAnalysis")
423  << "warning: detid already exists for Offline (gain per col, ped per pixel) calibration database"
424  << std::endl;
425  }
426  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
427  SiPixelGainCalibrationOffline::Range hltrange(theSiPixelGainCalibrationPerCol.begin(),
428  theSiPixelGainCalibrationPerCol.end());
429  if (!theGainCalibrationDbInputForHLT_->put(detid, hltrange, ncols))
430  edm::LogError("SiPixelGainCalibrationAnalysis")
431  << "warning: detid already exists for HLT (gain per col, ped per col) calibration database" << std::endl;
432  }
433 
434  if (DEBUG)
435  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> This detid is finished inserting" << endl;
436 
437  } //end of loop over Detids
438 
439  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " --- writing to DB!" << std::endl;
441  if (!mydbservice.isAvailable()) {
442  edm::LogError("db service unavailable");
443  return;
444  } else {
445  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
446  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
447  << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl;
448  if (mydbservice->isNewTagRequest("SiPixelGainCalibrationOfflineRcd")) {
450  *theGainCalibrationDbInputOffline_, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd");
451  } else {
453  *theGainCalibrationDbInputOffline_, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd");
454  }
455  }
456  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
457  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
458  << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl;
459  if (mydbservice->isNewTagRequest("SiPixelGainCalibrationForHLTRcd")) {
461  *theGainCalibrationDbInputForHLT_, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd");
462  } else {
464  *theGainCalibrationDbInputForHLT_, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd");
465  }
466  }
467  }
468 
469  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " ---> SUMMARY :" << std::endl;
470  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
471  << " File had " << nnoisyininput << " noisy pixels" << std::endl;
472 
473  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " DB has now " << nnoisy << " noisy pixels" << std::endl;
474  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " DB has now " << ndead << " dead pixels" << std::endl;
475 }
size
Write out results.
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pddToken_
virtual int ncolumns() const =0
float getPedestal(const uint32_t &detID, const int &col, const int &row) 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
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)
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
Definition: EventSetup.h:122
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
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
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
bool isAvailable() const
Definition: Service.h:40
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
float getGain(const uint32_t &detID, const int &col, const int &row) override

◆ fillDescriptions()

void SiPixelGainCalibrationRejectNoisyAndDead::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 95 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

95  {
97  desc.setComment("EDAnalyzer to create SiPixelGainCalibration payloads by rejecting noisy and dead ones");
98  desc.addUntracked<bool>("debug", false);
99  desc.addUntracked<int>("insertNoisyPixelsInDB", 1);
100  desc.addUntracked<std::string>("record", "SiPixelGainCalibrationOfflineRcd");
101  desc.addUntracked<std::string>("noisyPixelList", "noisypixel.txt");
102  descriptions.addWithDefaultLabel(desc);
103 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ getNoisyPixels()

void SiPixelGainCalibrationRejectNoisyAndDead::getNoisyPixels ( )
private

Definition at line 477 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

References cuy::col, recoMuon::in, mps_splice::line, nnoisyininput, noisypixelkeeper, noisypixellist_, and edm_modernize_messagelogger::stat.

Referenced by analyze().

477  {
478  nnoisyininput = 0;
479 
480  ifstream in;
481  struct stat Stat;
482  if (stat(noisypixellist_.c_str(), &Stat)) {
483  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "No file named " << noisypixellist_ << std::endl;
484  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
485  << "If you don't want to insert noisy pixel flag, disable it using tag insertNoisyPixelsInDB " << std::endl;
486  return;
487  }
488 
489  in.open(noisypixellist_.c_str());
490  if (in.is_open()) {
491  TString line;
492  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "opened" << endl;
493  char linetmp[201];
494  while (in.getline(linetmp, 200)) {
495  line = linetmp;
496  if (line.Contains("OFFLINE")) {
497  line.Remove(0, line.First(",") + 9);
498  TString detidstring = line;
499  detidstring.Remove(line.First(" "), line.Sizeof());
500 
501  line.Remove(0, line.First(",") + 20);
502  TString col = line;
503  col.Remove(line.First(","), line.Sizeof());
504  line.Remove(0, line.First(",") + 1);
505  TString row = line;
506  row.Remove(line.First(" "), line.Sizeof());
507 
508  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
509  << "Found noisy pixel in DETID " << detidstring << " col,row " << col << "," << row << std::endl;
510  nnoisyininput++;
511 
512  std::vector<std::pair<int, int> > tempvec;
513  if (noisypixelkeeper.find(detidstring.Atoi()) != noisypixelkeeper.end())
514  tempvec = (noisypixelkeeper.find(detidstring.Atoi()))->second;
515 
516  std::pair<int, int> temppair(col.Atoi(), row.Atoi());
517  tempvec.push_back(temppair);
518  noisypixelkeeper[detidstring.Atoi()] = tempvec;
519  }
520  }
521  }
522  /*
523  for(std::map <int,std::vector<std::pair<int,int> > >::const_iterator it=noisypixelkeeper.begin();it!=noisypixelkeeper.end();it++)
524  for(int i=0;i<(it->second).size();i++)
525  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")<<it->first<<" "<<(it->second.at(i)).first<<" "<<(it->second.at(i)).second<<std::endl;
526  */
527 }
std::map< int, std::vector< std::pair< int, int > > > noisypixelkeeper
Log< level::Warning, true > LogPrint
col
Definition: cuy.py:1009

Member Data Documentation

◆ DEBUG

const bool SiPixelGainCalibrationRejectNoisyAndDead::DEBUG
private

Definition at line 85 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ gainhi_

float SiPixelGainCalibrationRejectNoisyAndDead::gainhi_
private

Definition at line 89 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ gainlow_

float SiPixelGainCalibrationRejectNoisyAndDead::gainlow_
private

Definition at line 88 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ insertednoisypixel

std::map<int, std::vector<std::pair<int, int> > > SiPixelGainCalibrationRejectNoisyAndDead::insertednoisypixel
private

Definition at line 75 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

◆ insertnoisypixelsindb_

const int SiPixelGainCalibrationRejectNoisyAndDead::insertnoisypixelsindb_
private

Definition at line 83 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by analyze(), and fillDatabase().

◆ nnoisyininput

int SiPixelGainCalibrationRejectNoisyAndDead::nnoisyininput
private

Definition at line 76 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase(), and getNoisyPixels().

◆ noisypixelkeeper

std::map<int, std::vector<std::pair<int, int> > > SiPixelGainCalibrationRejectNoisyAndDead::noisypixelkeeper
private

Definition at line 74 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase(), and getNoisyPixels().

◆ noisypixellist_

const std::string SiPixelGainCalibrationRejectNoisyAndDead::noisypixellist_
private

Definition at line 82 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by getNoisyPixels().

◆ pddToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelGainCalibrationRejectNoisyAndDead::pddToken_
private

Definition at line 65 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ pedhi_

float SiPixelGainCalibrationRejectNoisyAndDead::pedhi_
private

Definition at line 87 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ pedlow_

float SiPixelGainCalibrationRejectNoisyAndDead::pedlow_
private

Definition at line 86 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ record_

const std::string SiPixelGainCalibrationRejectNoisyAndDead::record_
private

Definition at line 84 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ SiPixelGainCalibrationForHLTService_

SiPixelGainCalibrationForHLTService SiPixelGainCalibrationRejectNoisyAndDead::SiPixelGainCalibrationForHLTService_
private

Definition at line 69 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ SiPixelGainCalibrationOfflineService_

SiPixelGainCalibrationOfflineService SiPixelGainCalibrationRejectNoisyAndDead::SiPixelGainCalibrationOfflineService_
private

Definition at line 66 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ theGainCalibrationDbInputForHLT_

std::unique_ptr<SiPixelGainCalibrationForHLT> SiPixelGainCalibrationRejectNoisyAndDead::theGainCalibrationDbInputForHLT_
private

Definition at line 70 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

◆ theGainCalibrationDbInputOffline_

std::unique_ptr<SiPixelGainCalibrationOffline> SiPixelGainCalibrationRejectNoisyAndDead::theGainCalibrationDbInputOffline_
private

Definition at line 67 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().