CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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)
 

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,
TrackerDigiGeometryRecord
pddToken_
 
float pedhi_
 
float pedlow_
 
const std::string record_
 
SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_
 
SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_
 
std::unique_ptr
< SiPixelGainCalibrationForHLT
theGainCalibrationDbInputForHLT_
 
std::unique_ptr
< SiPixelGainCalibrationOffline
theGainCalibrationDbInputOffline_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 93 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

94  : pddToken_(esConsumes()),
97  noisypixellist_(iConfig.getUntrackedParameter<std::string>("noisyPixelList", "noisypixel.txt")),
98  insertnoisypixelsindb_(iConfig.getUntrackedParameter<int>("insertNoisyPixelsInDB", 1)),
99  record_(iConfig.getUntrackedParameter<std::string>("record", "SiPixelGainCalibrationOfflineRcd")),
100  DEBUG(iConfig.getUntrackedParameter<bool>("debug", false)) {
101  //now do what ever initialization is needed
102 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > pddToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
SiPixelGainCalibrationForHLTService SiPixelGainCalibrationForHLTService_
SiPixelGainCalibrationOfflineService SiPixelGainCalibrationOfflineService_
SiPixelGainCalibrationRejectNoisyAndDead::~SiPixelGainCalibrationRejectNoisyAndDead ( )
overridedefault

Member Function Documentation

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

Definition at line 113 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(), mod(), 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().

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

Definition at line 465 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

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

Referenced by analyze().

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

Member Data Documentation

const bool SiPixelGainCalibrationRejectNoisyAndDead::DEBUG
private

Definition at line 83 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

float SiPixelGainCalibrationRejectNoisyAndDead::gainhi_
private

Definition at line 87 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

float SiPixelGainCalibrationRejectNoisyAndDead::gainlow_
private

Definition at line 86 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

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

Definition at line 73 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

const int SiPixelGainCalibrationRejectNoisyAndDead::insertnoisypixelsindb_
private

Definition at line 81 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by analyze(), and fillDatabase().

int SiPixelGainCalibrationRejectNoisyAndDead::nnoisyininput
private

Definition at line 74 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase(), and getNoisyPixels().

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

Definition at line 72 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase(), and getNoisyPixels().

const std::string SiPixelGainCalibrationRejectNoisyAndDead::noisypixellist_
private

Definition at line 80 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by getNoisyPixels().

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

Definition at line 63 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

float SiPixelGainCalibrationRejectNoisyAndDead::pedhi_
private

Definition at line 85 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

float SiPixelGainCalibrationRejectNoisyAndDead::pedlow_
private

Definition at line 84 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

const std::string SiPixelGainCalibrationRejectNoisyAndDead::record_
private

Definition at line 82 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

SiPixelGainCalibrationForHLTService SiPixelGainCalibrationRejectNoisyAndDead::SiPixelGainCalibrationForHLTService_
private

Definition at line 67 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

SiPixelGainCalibrationOfflineService SiPixelGainCalibrationRejectNoisyAndDead::SiPixelGainCalibrationOfflineService_
private

Definition at line 64 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

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

Definition at line 68 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().

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

Definition at line 65 of file SiPixelGainCalibrationRejectNoisyAndDead.cc.

Referenced by fillDatabase().