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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices 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 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, dqmdumpme::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(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, genParticles_cff::map, mod(), hgcalPlots::ncols, PixelTopology::ncolumns(), nnoisyininput, noisypixelkeeper, PixelTopology::nrows(), pddToken_, QIE10Task_cfi::ped, pedhi_, pedlow_, nano_mu_digi_cff::rawId, 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 
183  //checking for noisy pixels that won't be inserted ...
184  bool willNoisyPixBeInserted;
185  for (std::map<int, std::vector<std::pair<int, int> > >::const_iterator it = noisypixelkeeper.begin();
186  it != noisypixelkeeper.end();
187  it++) {
188  willNoisyPixBeInserted = false;
189  for (TrackerGeometry::DetContainer::const_iterator mod = pDD->dets().begin(); mod != pDD->dets().end(); mod++) {
190  detid = 0;
191  if (dynamic_cast<PixelGeomDetUnit const*>((*mod)) != nullptr)
192  detid = ((*mod)->geographicalId()).rawId();
193  if (detid == it->first) {
194  willNoisyPixBeInserted = true;
195  break;
196  }
197  }
198  if (!willNoisyPixBeInserted)
199  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
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;
202  }
203 
204  if (DEBUG)
205  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting Loop over all modules" << endl;
206 
207  //Looping over all modules
208  for (TrackerGeometry::DetContainer::const_iterator it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
209  detid = 0;
210  if (dynamic_cast<PixelGeomDetUnit const*>((*it)) != nullptr)
211  detid = ((*it)->geographicalId()).rawId();
212  if (detid == 0)
213  continue;
214 
215  if (DEBUG)
216  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> We are in module " << detid << endl;
217 
218  // Get the module sizes
219  const PixelGeomDetUnit* pixDet = dynamic_cast<const PixelGeomDetUnit*>((*it));
220  const PixelTopology& topol = pixDet->specificTopology();
221  int nrows = topol.nrows(); // rows in x
222  int ncols = topol.ncolumns(); // cols in y
223 
224  float ped;
225  float gainforthiscol[2];
226  float pedforthiscol[2];
227  int nusedrows[2];
228  int nrowsrocsplit;
229  if (record_ == "SiPixelGainCalibrationOfflineRcd")
230  nrowsrocsplit = theGainCalibrationDbInputOffline_->getNumberOfRowsToAverageOver();
231  if (record_ == "SiPixelGainCalibrationForHLTRcd")
232  nrowsrocsplit = theGainCalibrationDbInputForHLT_->getNumberOfRowsToAverageOver();
233 
234  std::vector<char> theSiPixelGainCalibrationGainPerColPedPerPixel;
235  std::vector<char> theSiPixelGainCalibrationPerCol;
236 
237  if (DEBUG)
238  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting Loop for each rows/cols " << endl;
239 
240  for (int icol = 0; icol <= ncols - 1; icol++) {
241  if (DEBUG)
242  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Starting a new column" << endl;
243 
244  nusedrows[0] = nusedrows[1] = 0;
245  gainforthiscol[0] = gainforthiscol[1] = 0;
246  pedforthiscol[0] = pedforthiscol[1] = 0;
247 
248  for (int jrow = 0; jrow <= nrows - 1; jrow++) {
249  if (DEBUG)
250  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
251  << "=>=>=>=> We are in col,row " << icol << "," << jrow << endl;
252 
253  ped = 0;
254 
255  size_t iglobalrow = 0;
256  int noisyPixInRow = 0;
257  if (jrow > nrowsrocsplit) {
258  iglobalrow = 1;
259  noisyPixInRow = 0;
260  }
261 
262  bool isPixelDeadOld = false;
263  bool isColumnDeadOld = false;
264  // bool isPixelDeadNew = false;
265  // bool isColumnDeadNew = false;
266 
267  bool isPixelNoisyOld = false;
268  bool isColumnNoisyOld = false;
269  bool isPixelNoisyNew = false;
270  bool isColumnNoisyNew = false;
271 
272  bool isColumnDead = false;
273  bool isColumnNoisy = false;
274  bool isPixelDead = false;
275  bool isPixelNoisy = false;
276 
277  if (DEBUG)
278  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Trying to get gain/ped " << endl;
279 
280  try {
281  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
282  isPixelDeadOld = SiPixelGainCalibrationOfflineService_.isDead(detid, icol, jrow);
283  isPixelNoisyOld = SiPixelGainCalibrationOfflineService_.isNoisy(detid, icol, jrow);
284  isColumnDeadOld = SiPixelGainCalibrationOfflineService_.isNoisyColumn(detid, icol, jrow);
285  isColumnNoisyOld = SiPixelGainCalibrationOfflineService_.isDeadColumn(detid, icol, jrow);
286  }
287  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
288  isColumnDeadOld = SiPixelGainCalibrationForHLTService_.isNoisyColumn(detid, icol, jrow);
289  isColumnNoisyOld = SiPixelGainCalibrationForHLTService_.isDeadColumn(detid, icol, jrow);
290  }
291  if (!isColumnDeadOld && !isColumnNoisyOld) {
292  if (record_ == "SiPixelGainCalibrationOfflineRcd")
293  gainforthiscol[iglobalrow] = SiPixelGainCalibrationOfflineService_.getGain(detid, icol, jrow);
294  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
295  gainforthiscol[iglobalrow] = SiPixelGainCalibrationForHLTService_.getGain(detid, icol, jrow);
296  pedforthiscol[iglobalrow] = SiPixelGainCalibrationForHLTService_.getPedestal(detid, icol, jrow);
297  }
298  }
299  if (!isPixelDeadOld && !isPixelNoisyOld)
300  if (record_ == "SiPixelGainCalibrationOfflineRcd")
302  } catch (const std::exception& er) {
303  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
304  << "Problem trying to catch gain/ped from DETID " << detid << " @ col,row " << icol << "," << jrow
305  << endl;
306  }
307  //edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")<<"For DetId "<<detid<<" we found gain : "<<gain<<", pedestal : "<<ped<<std::endl;
308 
309  if (DEBUG)
310  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
311  << "=>=>=>=> Found gain " << gainforthiscol[iglobalrow] << " and ped " << pedforthiscol[iglobalrow]
312  << endl;
313 
314  //Check if pixel is in new noisy list
315  for (std::map<int, std::vector<std::pair<int, int> > >::const_iterator it = noisypixelkeeper.begin();
316  it != noisypixelkeeper.end();
317  it++)
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;
321 
322  isColumnDead = isColumnDeadOld;
323  isPixelDead = isPixelDeadOld;
324 
325  if (isPixelNoisyNew)
326  noisyPixInRow++;
327  if (noisyPixInRow == nrowsrocsplit)
328  isColumnNoisyNew = true;
329 
330  if (insertnoisypixelsindb_ == 0) {
331  isColumnNoisy = isColumnNoisyOld;
332  isPixelNoisy = isPixelNoisyOld;
333  } else if (insertnoisypixelsindb_ == 1) {
334  isPixelNoisy = isPixelNoisyNew;
335  isColumnNoisy = isColumnNoisyNew;
336  } else if (insertnoisypixelsindb_ == 2) {
337  isPixelNoisy = isPixelNoisyNew || isPixelNoisyOld;
338  isColumnNoisy = isColumnNoisyNew || isColumnNoisyOld;
339  }
340 
341  if (isPixelNoisy)
342  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
343  << "Inserting a noisy pixel in " << detid << " at col,row " << icol << "," << jrow << endl;
344  if (isColumnNoisy)
345  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
346  << "Inserting a noisy column in " << detid << " at col,row " << icol << "," << jrow << endl;
347  if (isPixelNoisy)
348  nnoisy++;
349  if (isPixelDead)
350  ndead++;
351 
352  if (DEBUG)
353  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Now Starting to fill the DB" << endl;
354 
355  //********** Fill the new DB !!
356 
357  if (DEBUG)
358  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
359  << "=>=>=>=> Filling Pixel Level Calibration" << endl;
360 
361  //Set Pedestal
362  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
363  if (isPixelDead)
364  theGainCalibrationDbInputOffline_->setDeadPixel(theSiPixelGainCalibrationGainPerColPedPerPixel);
365  else if (isPixelNoisy)
366  theGainCalibrationDbInputOffline_->setNoisyPixel(theSiPixelGainCalibrationGainPerColPedPerPixel);
367  else
368  theGainCalibrationDbInputOffline_->setDataPedestal(ped, theSiPixelGainCalibrationGainPerColPedPerPixel);
369  }
370 
371  //Set Gain
372  if ((jrow + 1) % nrowsrocsplit == 0) {
373  if (DEBUG)
374  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
375  << "=>=>=>=> Filling Column Level Calibration" << endl;
376 
377  if (isColumnDead) {
378  if (record_ == "SiPixelGainCalibrationOfflineRcd")
379  theGainCalibrationDbInputOffline_->setDeadColumn(nrowsrocsplit,
380  theSiPixelGainCalibrationGainPerColPedPerPixel);
381  if (record_ == "SiPixelGainCalibrationForHLTRcd")
382  theGainCalibrationDbInputForHLT_->setDeadColumn(nrowsrocsplit, theSiPixelGainCalibrationPerCol);
383  } else if (isColumnNoisy) {
384  if (record_ == "SiPixelGainCalibrationOfflineRcd")
385  theGainCalibrationDbInputOffline_->setNoisyColumn(nrowsrocsplit,
386  theSiPixelGainCalibrationGainPerColPedPerPixel);
387  if (record_ == "SiPixelGainCalibrationForHLTRcd")
388  theGainCalibrationDbInputForHLT_->setNoisyColumn(nrowsrocsplit, theSiPixelGainCalibrationPerCol);
389  } else {
390  if (record_ == "SiPixelGainCalibrationOfflineRcd")
392  gainforthiscol[iglobalrow], nrowsrocsplit, theSiPixelGainCalibrationGainPerColPedPerPixel);
393  if (record_ == "SiPixelGainCalibrationForHLTRcd")
395  pedforthiscol[iglobalrow], gainforthiscol[iglobalrow], theSiPixelGainCalibrationPerCol);
396  }
397  }
398 
399  if (DEBUG)
400  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
401  << "=>=>=>=> This pixel is finished inserting" << endl;
402 
403  } //end of loop over rows
404 
405  if (DEBUG)
406  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
407  << "=>=>=>=> This column is finished inserting" << endl;
408 
409  } //end of loop over col
410 
411  if (DEBUG)
412  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> Loop over rows/cols is finished" << endl;
413 
414  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
415  SiPixelGainCalibrationOffline::Range offlinerange(theSiPixelGainCalibrationGainPerColPedPerPixel.begin(),
416  theSiPixelGainCalibrationGainPerColPedPerPixel.end());
417  if (!theGainCalibrationDbInputOffline_->put(detid, offlinerange, ncols))
418  edm::LogError("SiPixelGainCalibrationAnalysis")
419  << "warning: detid already exists for Offline (gain per col, ped per pixel) calibration database"
420  << std::endl;
421  }
422  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
423  SiPixelGainCalibrationOffline::Range hltrange(theSiPixelGainCalibrationPerCol.begin(),
424  theSiPixelGainCalibrationPerCol.end());
425  if (!theGainCalibrationDbInputForHLT_->put(detid, hltrange, ncols))
426  edm::LogError("SiPixelGainCalibrationAnalysis")
427  << "warning: detid already exists for HLT (gain per col, ped per col) calibration database" << std::endl;
428  }
429 
430  if (DEBUG)
431  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << "=>=>=>=> This detid is finished inserting" << endl;
432 
433  } //end of loop over Detids
434 
435  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " --- writing to DB!" << std::endl;
437  if (!mydbservice.isAvailable()) {
438  edm::LogError("db service unavailable");
439  return;
440  } else {
441  if (record_ == "SiPixelGainCalibrationOfflineRcd") {
442  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
443  << "now doing SiPixelGainCalibrationOfflineRcd payload..." << std::endl;
444  if (mydbservice->isNewTagRequest("SiPixelGainCalibrationOfflineRcd")) {
446  *theGainCalibrationDbInputOffline_, mydbservice->beginOfTime(), "SiPixelGainCalibrationOfflineRcd");
447  } else {
449  *theGainCalibrationDbInputOffline_, mydbservice->currentTime(), "SiPixelGainCalibrationOfflineRcd");
450  }
451  }
452  if (record_ == "SiPixelGainCalibrationForHLTRcd") {
453  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
454  << "now doing SiPixelGainCalibrationForHLTRcd payload..." << std::endl;
455  if (mydbservice->isNewTagRequest("SiPixelGainCalibrationForHLTRcd")) {
457  *theGainCalibrationDbInputForHLT_, mydbservice->beginOfTime(), "SiPixelGainCalibrationForHLTRcd");
458  } else {
460  *theGainCalibrationDbInputForHLT_, mydbservice->currentTime(), "SiPixelGainCalibrationForHLTRcd");
461  }
462  }
463  }
464 
465  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " ---> SUMMARY :" << std::endl;
466  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead")
467  << " File had " << nnoisyininput << " noisy pixels" << std::endl;
468 
469  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " DB has now " << nnoisy << " noisy pixels" << std::endl;
470  edm::LogPrint("SiPixelGainCalibrationRejectNoisyAndDead") << " DB has now " << ndead << " dead pixels" << std::endl;
471 }
size
Write out results.
bool isNoisyColumn(const uint32_t &detID, const int &col, const int &row) override
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
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
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 473 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

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

Referenced by analyze().

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