CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
SiPixelStatusHarvester Class Reference

#include <SiPixelStatusHarvester.h>

Inheritance diagram for SiPixelStatusHarvester:
SiPixelPhase1Base one::DQMEDAnalyzer< T > HistogramManagerHolder one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) final
 
void beginJob () override
 
void beginLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
void endJob () override
 
void endLuminosityBlock (const edm::LuminosityBlock &, const edm::EventSetup &) final
 
void endRunProduce (edm::Run &, const edm::EventSetup &) final
 
 SiPixelStatusHarvester (const edm::ParameterSet &)
 
 ~SiPixelStatusHarvester () override
 
- Public Member Functions inherited from SiPixelPhase1Base
void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override=0
 
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &iSetup) override
 
 SiPixelPhase1Base (const edm::ParameterSet &iConfig)
 
 ~SiPixelPhase1Base () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from HistogramManagerHolder
 HistogramManagerHolder (const edm::ParameterSet &iConfig)
 

Private Types

enum  {
  BADROC, PERMANENTBADROC, FEDERRORROC, STUCKTBMROC,
  OTHERBADROC, PROMPTBADROC
}
 

Private Member Functions

void constructTag (std::map< int, SiPixelQuality * >siPixelQualityTag, edm::Service< cond::service::PoolDBOutputService > &poolDbService, std::string tagName, edm::Run &iRun)
 
bool equal (SiPixelQuality *a, SiPixelQuality *b)
 
edm::LuminosityBlockNumber_t stepIOV (edm::LuminosityBlockNumber_t pin, std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t > IOV)
 

Private Attributes

int aveDigiOcc_
 
const SiPixelQualitybadPixelInfo_
 
const SiPixelFedCablingcablingMap_ = 0
 
int countLumi_ = 0
 
bool debug_
 
edm::LuminosityBlockNumber_t endLumiBlock_
 
std::string label_
 
std::string moduleName_
 
int nLumi_
 
std::string outputBase_
 
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
 
std::string recordName_
 
std::map< int, unsigned int > sensorSize_
 
SiPixelStatusManager siPixelStatusManager_
 
const TrackerGeometrytrackerGeometry_ = 0
 

Additional Inherited Members

- Protected Types inherited from SiPixelPhase1Base
enum  { DCS }
 
- Protected Member Functions inherited from SiPixelPhase1Base
bool checktrigger (const edm::Event &iEvent, const edm::EventSetup &iSetup, const unsigned trgidx) const
 
- Protected Attributes inherited from HistogramManagerHolder
GeometryInterface geometryInterface
 
std::vector< HistogramManagerhisto
 

Detailed Description

harvest per-lumi prduced SiPixelDetector status and make the payload for SiPixelQualityFromDB

Definition at line 17 of file SiPixelStatusHarvester.h.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

SiPixelStatusHarvester::SiPixelStatusHarvester ( const edm::ParameterSet iConfig)

Definition at line 53 of file SiPixelStatusHarvester.cc.

References countLumi_, debug_, endLumiBlock_, edm::ParameterSet::getUntrackedParameter(), pixelO2O_, recordName_, SiPixelStatusManager::reset(), sensorSize_, siPixelStatusManager_, and AlCaHLTBitMon_QueryRunRegistry::string.

53  :
54  SiPixelPhase1Base(iConfig),
55  outputBase_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<std::string>("outputBase")),
56  aveDigiOcc_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<int>("aveDigiOcc")),
57  nLumi_(iConfig.getParameter<edm::ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<int>("resetEveryNLumi")),
58  moduleName_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<std::string>("moduleName")),
59  label_(iConfig.getParameter<ParameterSet>("SiPixelStatusManagerParameters").getUntrackedParameter<std::string>("label")){
60 
61  SiPixelStatusManager* siPixelStatusManager = new SiPixelStatusManager(iConfig, consumesCollector());
62  siPixelStatusManager_ = *siPixelStatusManager;
63  debug_ = iConfig.getUntrackedParameter<bool>("debug");
64  recordName_ = iConfig.getUntrackedParameter<std::string>("recordName", "SiPixelQualityFromDbRcd");
65 
66  sensorSize_.clear();
67  pixelO2O_.clear();
68 
70  endLumiBlock_ = 0;
71  countLumi_ = 0;
72 
73 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, unsigned int > sensorSize_
edm::LuminosityBlockNumber_t endLumiBlock_
SiPixelStatusManager siPixelStatusManager_
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
SiPixelStatusHarvester::~SiPixelStatusHarvester ( )
override

Definition at line 76 of file SiPixelStatusHarvester.cc.

76 {}

Member Function Documentation

void SiPixelStatusHarvester::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
final

Definition at line 85 of file SiPixelStatusHarvester.cc.

85 {}
void SiPixelStatusHarvester::beginJob ( void  )
override

Definition at line 79 of file SiPixelStatusHarvester.cc.

79 { }
void SiPixelStatusHarvester::beginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iEventSetup 
)
final

Definition at line 520 of file SiPixelStatusHarvester.cc.

References countLumi_.

520  {
521  countLumi_++;
522 }
void SiPixelStatusHarvester::constructTag ( std::map< int, SiPixelQuality * >  siPixelQualityTag,
edm::Service< cond::service::PoolDBOutputService > &  poolDbService,
std::string  tagName,
edm::Run iRun 
)
private

Definition at line 599 of file SiPixelStatusHarvester.cc.

References DEFINE_FWK_MODULE, equal(), edm::RunBase::id(), recordName_, edm::RunID::run(), edm::second(), and cond::service::PoolDBOutputService::writeOne().

Referenced by endRunProduce().

599  {
600 
601  for (std::map<int, SiPixelQuality*>::iterator qIt = siPixelQualityTag.begin(); qIt != siPixelQualityTag.end(); ++qIt) {
602 
603  edm::LuminosityBlockID lu(iRun.id().run(),qIt->first);
604  cond::Time_t thisIOV = (cond::Time_t)(lu.value());
605 
606  SiPixelQuality* thisPayload = qIt->second;
607  if(qIt==siPixelQualityTag.begin())
608  poolDbService->writeOne<SiPixelQuality>(thisPayload, thisIOV, recordName_+"_"+tagName);
609  else{
610  SiPixelQuality* prevPayload = (std::prev(qIt))->second;
611  if(!SiPixelStatusHarvester::equal(thisPayload,prevPayload)) // only append newIOV if this payload differs wrt last
612  poolDbService->writeOne<SiPixelQuality>(thisPayload, thisIOV, recordName_+"_"+tagName);
613  }
614  }
615 
616 }
RunID const & id() const
Definition: RunBase.h:39
bool equal(SiPixelQuality *a, SiPixelQuality *b)
RunNumber_t run() const
Definition: RunID.h:39
U second(std::pair< T, U > const &p)
unsigned long long Time_t
Definition: Time.h:16
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
void SiPixelStatusHarvester::endJob ( void  )
override

Definition at line 82 of file SiPixelStatusHarvester.cc.

Referenced by o2olib.O2ORunMgr::executeJob().

82 { }
void SiPixelStatusHarvester::endLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iEVentSetup 
)
final

Definition at line 526 of file SiPixelStatusHarvester.cc.

References endLumiBlock_, edm::LuminosityBlockBase::luminosityBlock(), SiPixelStatusManager::readLumi(), and siPixelStatusManager_.

526  {
527 
529  // update endLumiBlock_ by current lumi block
530  if(endLumiBlock_<iLumi.luminosityBlock())
531  endLumiBlock_ = iLumi.luminosityBlock();
532 
533 }
edm::LuminosityBlockNumber_t endLumiBlock_
SiPixelStatusManager siPixelStatusManager_
LuminosityBlockNumber_t luminosityBlock() const
void readLumi(const edm::LuminosityBlock &)
void SiPixelStatusHarvester::endRunProduce ( edm::Run iRun,
const edm::EventSetup iSetup 
)
final

Definition at line 88 of file SiPixelStatusHarvester.cc.

References SiPixelQuality::addDisabledModule(), aveDigiOcc_, badPixelInfo_, BADROC, SiPixelQuality::disabledModuleType::BadRocs, cablingMap_, sipixelobjects::GlobalPixel::col, PixelTopology::colsperroc(), constructTag(), SiPixelStatusManager::createPayloads(), debug_, SiPixelFedCabling::det2PathMap(), SiPixelQuality::disabledModuleType::DetID, TrackerGeometry::dets(), SiPixelModuleStatus::digiOccROC(), MillePedeFileConverter_cfg::e, endLumiBlock_, SiPixelQuality::disabledModuleType::errorType, FEDERRORROC, spr::find(), SiPixelFedCabling::findItem(), edm::EventSetup::get(), SiPixelQuality::getBadComponentList(), SiPixelStatusManager::getBadComponents(), SiPixelDetectorStatus::getDetectorStatus(), SiPixelStatusManager::getFEDerror25Rocs(), HistogramManagerHolder::histo, mps_fire::i, edm::RunBase::id(), sipixelobjects::PixelROC::idInDetUnit(), createfilelist::int, edm::Service< T >::isAvailable(), SiPixelQuality::IsRocBad(), list(), DTRecHitClients_cfi::local, genParticles_cff::map, PixelTopology::ncolumns(), GetRecoTauVFromDQM_MC_cff::next, SiPixelModuleStatus::nrocs(), PixelTopology::nrows(), OTHERBADROC, outputBase_, callgraph::path, PERMANENTBADROC, SiPixelDetectorStatus::perRocDigiOcc(), pixelO2O_, edm::ESHandle< T >::product(), PROMPTBADROC, DetId::rawId(), recordName_, sipixelobjects::GlobalPixel::row, PixelTopology::rowsperroc(), edm::RunID::run(), edm::second(), sensorSize_, siPixelStatusManager_, PixelGeomDetUnit::specificTopology(), stepIOV(), STUCKTBMROC, sipixelobjects::PixelROC::toGlobal(), trackerGeometry_, cond::service::PoolDBOutputService::writeOne(), and globals_cff::x1.

88  {
89 
90  // tracker geometry and cabling map to convert offline row/column (module) to online row/column
91  edm::ESHandle<TrackerGeometry> tmpTkGeometry;
92  iSetup.get<TrackerDigiGeometryRecord>().get(tmpTkGeometry);
93  trackerGeometry_ = tmpTkGeometry.product();
94 
96  iSetup.get<SiPixelFedCablingMapRcd>().get(pixelCabling);
97  cablingMap_ = pixelCabling.product();
98 
99  for (TrackerGeometry::DetContainer::const_iterator it = trackerGeometry_->dets().begin(); it != trackerGeometry_->dets().end(); it++){
100 
101  const PixelGeomDetUnit *pgdu = dynamic_cast<const PixelGeomDetUnit*>((*it));
102  if (pgdu == nullptr) continue;
103  DetId detId = (*it)->geographicalId();
104  int detid = detId.rawId();
105 
106  const PixelTopology* topo = static_cast<const PixelTopology*>(&pgdu->specificTopology());
107  // number of row/columns for a given module
108  int rowsperroc = topo->rowsperroc();
109  int colsperroc = topo->colsperroc();
110 
111  int nROCrows = pgdu->specificTopology().nrows()/rowsperroc;
112  int nROCcolumns = pgdu->specificTopology().ncolumns()/colsperroc;
113  unsigned int nrocs = nROCrows*nROCcolumns;
114  sensorSize_[detid] = nrocs;
115 
116  std::map<int, std::pair<int,int> > rocToOfflinePixel;
117 
118  std::vector<sipixelobjects::CablingPathToDetUnit> path = (cablingMap_->det2PathMap()).find(detId.rawId())->second;
119  typedef std::vector<sipixelobjects::CablingPathToDetUnit>::const_iterator IT;
120  for(IT it = path.begin(); it != path.end(); ++it) {
121  // Pixel ROC building from path in cabling map
122  const sipixelobjects::PixelROC *roc = cablingMap_->findItem(*it);
123  int idInDetUnit = (int) roc->idInDetUnit();
124 
125  // local to global conversion
126  sipixelobjects::LocalPixel::RocRowCol local = {rowsperroc/2, colsperroc/2};
128 
129  rocToOfflinePixel[idInDetUnit] = std::pair<int,int>(global.row, global.col);
130 
131  }
132 
133  pixelO2O_[detid] = rocToOfflinePixel;
134  }
135 
136  // Permananent bad components
137  edm::ESHandle<SiPixelQuality> qualityInfo;
138  iSetup.get<SiPixelQualityFromDbRcd>().get( qualityInfo );
139  badPixelInfo_ = qualityInfo.product();
140 
141  // read in SiPixel occupancy data in ALCARECO/ALCAPROMPT
143  std::map<edm::LuminosityBlockNumber_t,std::map<int,std::vector<int>> > FEDerror25Map = siPixelStatusManager_.getFEDerror25Rocs();
144  std::map<edm::LuminosityBlockNumber_t,SiPixelDetectorStatus> siPixelStatusMap = siPixelStatusManager_.getBadComponents();
145 
146  // DB service
148 
149  if(poolDbService.isAvailable() ) {// if(poolDbService.isAvailable() )
150 
151  std::vector<int> vDetId;
152  // start producing tag for permanent component removed
153  SiPixelQuality *siPixelQualityPermBad = new SiPixelQuality();
154  const std::vector<SiPixelQuality::disabledModuleType> badComponentList = badPixelInfo_->getBadComponentList();
155  for(unsigned int i = 0; i<badComponentList.size();i++){
156 
157  siPixelQualityPermBad->addDisabledModule(badComponentList[i]);
158 
159  uint32_t detId = badComponentList[i].DetID;
160  int detid = int(detId);
161  unsigned int nroc = sensorSize_[detid];
162 
163  for(int iroc = 0; iroc<int(nroc); iroc++){
164  if(badPixelInfo_->IsRocBad(detId, short(iroc)) ){
165  std::map<int, std::pair<int,int> > rocToOfflinePixel = pixelO2O_[detid];
166  int row = rocToOfflinePixel[iroc].first;
167  int column = rocToOfflinePixel[iroc].second;
168  histo[PERMANENTBADROC].fill(detId, nullptr, column, row);
169  }
170  }
171 
172  }
173  if(debug_==true){ // only produced for debugging reason
174  cond::Time_t thisIOV = (cond::Time_t) iRun.id().run();
175  poolDbService->writeOne<SiPixelQuality>(siPixelQualityPermBad, thisIOV, recordName_+"_permanentBad");
176  }
177 
178  // IOV for final payloads. FEDerror25 and pcl
179  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> finalIOV;
180  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> fedError25IOV;
181  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t> pclIOV;
182 
183  //int nLumiBlock_ = countLumi_-FEDerror25Map.begin()->first+1;
184 
185  // container for SiPixelQuality for the whole run
186  std::map<int, SiPixelQuality*> siPixelQualityStuckTBM_Tag;
187 
188  // stuckTBM tag from FED error 25 with permanent component removed
189  for(SiPixelStatusManager::FEDerror25Map_iterator it=FEDerror25Map.begin(); it!=FEDerror25Map.end();it++){
190 
191  cond::Time_t thisIOV = 1;
192  edm::LuminosityBlockID lu(iRun.id().run(),it->first);
193  thisIOV = (cond::Time_t)(lu.value());
194 
195  int interval = 0;
196  // interval is the number of lumi sections in the IOV
198  if(nextIt!=FEDerror25Map.end()) interval = int(nextIt->first - it->first);
199  else interval = int(endLumiBlock_ - it->first + 1);
200 
201  SiPixelQuality *siPixelQuality_stuckTBM = new SiPixelQuality();
202  SiPixelQuality *siPixelQuality_FEDerror25 = new SiPixelQuality();
203 
204  std::map<int, std::vector<int> > tmpFEDerror25 = it->second;
205  for(std::map<int, std::vector<int> >::iterator ilist = tmpFEDerror25.begin(); ilist!=tmpFEDerror25.end();ilist++){
206 
207  int detid = ilist->first;
208  uint32_t detId = uint32_t(detid);
209 
210  SiPixelQuality::disabledModuleType BadModule_stuckTBM, BadModule_FEDerror25;
211 
212  BadModule_stuckTBM.DetID = uint32_t(detid); BadModule_FEDerror25.DetID = uint32_t(detid);
213  BadModule_stuckTBM.errorType = 3; BadModule_FEDerror25.errorType = 3;
214 
215  BadModule_stuckTBM.BadRocs = 0; BadModule_FEDerror25.BadRocs = 0;
216  std::vector<uint32_t> BadRocList_stuckTBM, BadRocList_FEDerror25;
217  std::vector<int> list = ilist->second;
218 
219  for(unsigned int i=0; i<list.size();i++){
220 
221  int iroc = list[i];
222  std::map<int, std::pair<int,int> > rocToOfflinePixel = pixelO2O_[detid];
223  int row = rocToOfflinePixel[iroc].first;
224  int column = rocToOfflinePixel[iroc].second;
225 
226  BadRocList_FEDerror25.push_back(uint32_t(iroc));
227  for (int iLumi = 0; iLumi<interval;iLumi++){
228  histo[FEDERRORROC].fill(detId, nullptr, column, row);// 1.0/nLumiBlock_);
229  }
230 
231  // only include rocs that are not permanent known bad
232  if(!badPixelInfo_->IsRocBad(detId, short(iroc))){ // stuckTBM = FEDerror25 - permanent bad
233  BadRocList_stuckTBM.push_back(uint32_t(iroc));
234  for (int iLumi = 0; iLumi<interval;iLumi++){
235  histo[STUCKTBMROC].fill(detId, nullptr, column, row);//, 1.0/nLumiBlock_);
236  }
237  }
238 
239  }
240 
241  // change module error type if all ROCs are bad
242  if(BadRocList_stuckTBM.size()==sensorSize_[detid])
243  BadModule_stuckTBM.errorType = 0;
244 
245  short badrocs_stuckTBM = 0;
246  for(std::vector<uint32_t>::iterator iter = BadRocList_stuckTBM.begin(); iter != BadRocList_stuckTBM.end(); ++iter){
247  badrocs_stuckTBM += 1 << *iter; // 1 << *iter = 2^{*iter} using bitwise shift
248  }
249  // fill the badmodule only if there is(are) bad ROC(s) in it
250  if(badrocs_stuckTBM!=0){
251  BadModule_stuckTBM.BadRocs = badrocs_stuckTBM;
252  siPixelQuality_stuckTBM->addDisabledModule(BadModule_stuckTBM);
253  }
254 
255  // change module error type if all ROCs are bad
256  if(BadRocList_FEDerror25.size()==sensorSize_[detid])
257  BadModule_FEDerror25.errorType = 0;
258 
259  short badrocs_FEDerror25 = 0;
260  for(std::vector<uint32_t>::iterator iter = BadRocList_FEDerror25.begin(); iter != BadRocList_FEDerror25.end(); ++iter){
261  badrocs_FEDerror25 += 1 << *iter; // 1 << *iter = 2^{*iter} using bitwise shift
262  }
263  // fill the badmodule only if there is(are) bad ROC(s) in it
264  if(badrocs_FEDerror25!=0){
265  BadModule_FEDerror25.BadRocs = badrocs_FEDerror25;
266  siPixelQuality_FEDerror25->addDisabledModule(BadModule_FEDerror25);
267  }
268 
269  } // loop over modules
270 
271  siPixelQualityStuckTBM_Tag[it->first] = siPixelQuality_stuckTBM;
272 
273  finalIOV[it->first] = it->first;
274  fedError25IOV[it->first] = it->first;
275 
276  if(debug_==true) // only produced for debugging reason
277  poolDbService->writeOne<SiPixelQuality>(siPixelQuality_FEDerror25, thisIOV, recordName_+"_FEDerror25");
278 
279  delete siPixelQuality_FEDerror25;
280 
281  }
282 
283  // IOV for PCL output tags that "combines" permanent bad/stuckTBM/other
284  for(SiPixelStatusManager::siPixelStatusMap_iterator it=siPixelStatusMap.begin(); it!=siPixelStatusMap.end();it++){
285  finalIOV[it->first] = it->first;
286  pclIOV[it->first] = it->first;
287  }
288 
289  // loop over final IOV
290  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
291 
292  // container for SiPixelQuality for the whole run
293  std::map<int, SiPixelQuality*> siPixelQualityPCL_Tag;
294  std::map<int, SiPixelQuality*> siPixelQualityPrompt_Tag;
295  std::map<int, SiPixelQuality*> siPixelQualityOther_Tag;
296 
297  for(itIOV=finalIOV.begin();itIOV!=finalIOV.end();itIOV++){
298 
299  int interval = 0;
300  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV = std::next(itIOV);
301  if(nextItIOV!=finalIOV.end()) interval = int(nextItIOV->first - itIOV->first);
302  else interval = int(endLumiBlock_ - itIOV->first + 1);
303 
304  edm::LuminosityBlockNumber_t lumiFEDerror25 = SiPixelStatusHarvester::stepIOV(itIOV->first,fedError25IOV);
305  edm::LuminosityBlockNumber_t lumiPCL = SiPixelStatusHarvester::stepIOV(itIOV->first,pclIOV);
306 
307  // get badROC list due to FEDerror25 = stuckTBM + permanent bad components
308  std::map<int, std::vector<int> > tmpFEDerror25 = FEDerror25Map[lumiFEDerror25];
309  // get SiPixelDetectorStatus
310  SiPixelDetectorStatus tmpSiPixelStatus = siPixelStatusMap[lumiPCL];
311  double DetAverage = tmpSiPixelStatus.perRocDigiOcc();
312 
313  // For the IOV of which the statistics is too low, for e.g., a cosmic run
314  // When using dynamicLumibased harvester or runbased harvester
315  // this only happens when the full run is lack of statistics
316  if(DetAverage<aveDigiOcc_) {
317 
318  edm::LogInfo("SiPixelStatusHarvester")
319  << "Tag requested for prompt in low statistics IOV in the "<<outputBase_<<" harvester"<< std::endl;
320  siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPermBad;
321  siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPermBad;
322 
323  // loop over modules to fill the PROMPT DQM plots with permanent bad components
324  std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.getDetectorStatus();
325  std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
326  for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
327 
328  int detid = itMod->first;
329  uint32_t detId = uint32_t(detid);
330  SiPixelModuleStatus modStatus = itMod->second;
331 
332  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
333 
334  if(badPixelInfo_->IsRocBad(detId, short(iroc))){
335  std::map<int, std::pair<int,int> > rocToOfflinePixel = pixelO2O_[detid];
336  int row = rocToOfflinePixel[iroc].first;
337  int column = rocToOfflinePixel[iroc].second; for (int iLumi = 0; iLumi<interval;iLumi++){
338  histo[PROMPTBADROC].fill(detId, nullptr, column, row);//, 1.0/nLumiBlock_);
339  }
340 
341  } // if permanent BAD
342 
343  } // loop over ROCs
344 
345  } // loop over modules
346 
347  // add empty bad components to "other" tag
348  edm::LogInfo("SiPixelStatusHarvester")
349  << "Tag requested for other in low statistics IOV in the "<<outputBase_<<" harvester"<< std::endl;
350  siPixelQualityOther_Tag[itIOV->first] = new SiPixelQuality();
351 
352  continue;
353 
354  }
355 
357 
358  // create the DB object
359  // payload including all : PCL = permanent bad (low DIGI ROC) + other + stuckTBM
360  SiPixelQuality *siPixelQualityPCL = new SiPixelQuality();
361  SiPixelQuality *siPixelQualityOther = new SiPixelQuality();
362  // Prompt = permanent bad(low DIGI + low eff/damaged ROCs + other)
363  SiPixelQuality *siPixelQualityPrompt = new SiPixelQuality();
364 
365  // loop over modules
366  std::map<int, SiPixelModuleStatus> detectorStatus = tmpSiPixelStatus.getDetectorStatus();
367  std::map<int, SiPixelModuleStatus>::iterator itModEnd = detectorStatus.end();
368  for (std::map<int, SiPixelModuleStatus>::iterator itMod = detectorStatus.begin(); itMod != itModEnd; ++itMod) {
369 
370  // create the bad module list for PCL and other
371  SiPixelQuality::disabledModuleType BadModulePCL, BadModuleOther;
372 
373  int detid = itMod->first;
374  uint32_t detId = uint32_t(detid);
375 
376  BadModulePCL.DetID = uint32_t(detid); BadModuleOther.DetID = uint32_t(detid);
377  BadModulePCL.errorType = 3; BadModuleOther.errorType = 3;
378  BadModulePCL.BadRocs = 0; BadModuleOther.BadRocs = 0;
379 
380  std::vector<uint32_t> BadRocListPCL, BadRocListOther;
381 
382  // module status and FEDerror25 status for module with DetId detId
383  SiPixelModuleStatus modStatus = itMod->second;
384  std::vector<int> listFEDerror25 = tmpFEDerror25[detid];
385 
386  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
387 
388  unsigned int rocOccupancy = modStatus.digiOccROC(iroc);
389 
390  // Bad ROC are from low DIGI Occ ROCs
391  if(rocOccupancy<1.e-4*DetAverage){ // if BAD
392 
393  std::map<int, std::pair<int,int> > rocToOfflinePixel = pixelO2O_[detid];
394  int row = rocToOfflinePixel[iroc].first;
395  int column = rocToOfflinePixel[iroc].second;
396 
397  //PCL bad roc list
398  BadRocListPCL.push_back(uint32_t(iroc));
399  for (int iLumi = 0; iLumi<interval;iLumi++){
400  histo[BADROC].fill(detId, nullptr, column, row);//, 1.0/nLumiBlock_);
401  }
402 
403  //FEDerror25 list
404  std::vector<int>::iterator it = std::find(listFEDerror25.begin(), listFEDerror25.end(),iroc);
405 
406  // other source of bad components = PCL bad - FEDerror25 - permanent bad
407  if(it==listFEDerror25.end() && !(badPixelInfo_->IsRocBad(detId, short(iroc)))){
408  // if neither permanent nor FEDerror25
409  BadRocListOther.push_back(uint32_t(iroc));
410  for (int iLumi = 0; iLumi<interval;iLumi++){
411  histo[OTHERBADROC].fill(detId, nullptr, column, row);//, 1.0/nLumiBlock_);
412  }
413  }
414 
415  }// if BAD
416 
417  } // loop over ROCs
418 
419  // errorType 0 means the full module is bad
420  if(BadRocListPCL.size()==sensorSize_[detid]) BadModulePCL.errorType = 0;
421  if(BadRocListOther.size()==sensorSize_[detid]) BadModuleOther.errorType = 0;
422 
423  // PCL
424  short badrocsPCL = 0;
425  for(std::vector<uint32_t>::iterator iterPCL = BadRocListPCL.begin(); iterPCL != BadRocListPCL.end(); ++iterPCL){
426  badrocsPCL += 1 << *iterPCL; // 1 << *iter = 2^{*iter} using bitwise shift
427  }
428  if(badrocsPCL!=0){
429  BadModulePCL.BadRocs = badrocsPCL;
430  siPixelQualityPCL->addDisabledModule(BadModulePCL);
431  }
432 
433  // Other
434  short badrocsOther = 0;
435  for(std::vector<uint32_t>::iterator iterOther = BadRocListOther.begin(); iterOther != BadRocListOther.end(); ++iterOther){
436  badrocsOther += 1 << *iterOther; // 1 << *iter = 2^{*iter} using bitwise shift
437  }
438  if(badrocsOther!=0){
439  BadModuleOther.BadRocs = badrocsOther;
440  siPixelQualityOther->addDisabledModule(BadModuleOther);
441  }
442 
443  // start constructing bad components for prompt = "other" + permanent
444  SiPixelQuality::disabledModuleType BadModulePrompt;
445  BadModulePrompt.DetID = uint32_t(detid);
446  BadModulePrompt.errorType = 3;
447  BadModulePrompt.BadRocs = 0;
448 
449  std::vector<uint32_t> BadRocListPrompt;
450  for (int iroc = 0; iroc < modStatus.nrocs(); ++iroc) {
451  // if in permannet bad tag or is in other tag
452  if(badPixelInfo_->IsRocBad(detId, short(iroc))|| ((badrocsOther >> short(iroc))&0x1)){
453  BadRocListPrompt.push_back(uint32_t(iroc));
454 
455  std::map<int, std::pair<int,int> > rocToOfflinePixel = pixelO2O_[detid];
456  int row = rocToOfflinePixel[iroc].first;
457  int column = rocToOfflinePixel[iroc].second;
458  for (int iLumi = 0; iLumi<interval;iLumi++){
459  histo[PROMPTBADROC].fill(detId, nullptr, column, row);//, 1.0/nLumiBlock_);
460  }
461  } // if bad
462  } // loop over all ROCs
463 
464  // errorType 0 means the full module is bad
465  if(BadRocListPrompt.size()==sensorSize_[detid]) BadModulePrompt.errorType = 0;
466 
467  short badrocsPrompt = 0;
468  for(std::vector<uint32_t>::iterator iterPrompt = BadRocListPrompt.begin(); iterPrompt != BadRocListPrompt.end(); ++iterPrompt){
469  badrocsPrompt += 1 << *iterPrompt; // 1 << *iter = 2^{*iter} using bitwise shift
470  }
471  if(badrocsPrompt!=0){
472  BadModulePrompt.BadRocs = badrocsPrompt;
473  siPixelQualityPrompt->addDisabledModule(BadModulePrompt);
474  }
475 
476  } // end module loop
477 
478  // PCL
479  siPixelQualityPCL_Tag[itIOV->first] = siPixelQualityPCL;
480  // Prompt
481  siPixelQualityPrompt_Tag[itIOV->first] = siPixelQualityPrompt;
482  // Other
483  siPixelQualityOther_Tag[itIOV->first] = siPixelQualityOther;
484 
485  }// loop over IOV
486 
487  // Now construct the tags made of payloads
488  // and only append newIOV if this payload differs wrt last
489 
490  //PCL
491  if(debug_==true)// only produced for debugging reason
492  SiPixelStatusHarvester::constructTag(siPixelQualityPCL_Tag, poolDbService, "PCL", iRun);
493  // other
494  SiPixelStatusHarvester::constructTag(siPixelQualityOther_Tag, poolDbService, "other", iRun);
495  // prompt
496  SiPixelStatusHarvester::constructTag(siPixelQualityPrompt_Tag, poolDbService, "prompt", iRun);
497  // stuckTBM
498  SiPixelStatusHarvester::constructTag(siPixelQualityStuckTBM_Tag, poolDbService, "stuckTBM", iRun);
499 
500  // Add a dummy IOV starting from last lumisection+1 to close the tag for the run
501  if(outputBase_ == "nLumibased" || outputBase_ == "dynamicLumibased"){
502 
504  cond::Time_t thisIOV = (cond::Time_t)(lu.value());
505  poolDbService->writeOne<SiPixelQuality>(siPixelQualityPermBad, thisIOV, recordName_+"_prompt");
506 
507  // add empty bad components to "other" tag
508  SiPixelQuality* siPixelQualityDummy = new SiPixelQuality();
509  poolDbService->writeOne<SiPixelQuality>(siPixelQualityDummy, thisIOV, recordName_+"_other");
510  delete siPixelQualityDummy;
511  }
512 
513  delete siPixelQualityPermBad;
514 
515  } // end of if(poolDbService.isAvailable() )
516 
517 }
void addDisabledModule(disabledModuleType module)
virtual int nrows() const =0
virtual int rowsperroc() const =0
RunID const & id() const
Definition: RunBase.h:39
std::map< int, unsigned int > sensorSize_
void constructTag(std::map< int, SiPixelQuality * >siPixelQualityTag, edm::Service< cond::service::PoolDBOutputService > &poolDbService, std::string tagName, edm::Run &iRun)
RunNumber_t run() const
Definition: RunID.h:39
const std::map< edm::LuminosityBlockNumber_t, std::map< int, std::vector< int > > > & getFEDerror25Rocs()
edm::LuminosityBlockNumber_t endLumiBlock_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
virtual std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap() const =0
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
edm::LuminosityBlockNumber_t stepIOV(edm::LuminosityBlockNumber_t pin, std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t > IOV)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
unsigned int LuminosityBlockNumber_t
SiPixelStatusManager siPixelStatusManager_
identify pixel inside single ROC
Definition: LocalPixel.h:7
global coordinates (row and column in DetUnit, as in PixelDigi)
Definition: GlobalPixel.h:6
U second(std::pair< T, U > const &p)
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
unsigned long long Time_t
Definition: Time.h:16
virtual int colsperroc() const =0
const SiPixelQuality * badPixelInfo_
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
Definition: PixelROC.h:40
bool isAvailable() const
Definition: Service.h:46
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
const std::vector< disabledModuleType > getBadComponentList() const
const SiPixelFedCabling * cablingMap_
std::vector< LinkConnSpec >::const_iterator IT
const TrackerGeometry * trackerGeometry_
std::map< int, SiPixelModuleStatus > getDetectorStatus()
std::map< edm::LuminosityBlockNumber_t, std::map< int, std::vector< int > > >::iterator FEDerror25Map_iterator
Definition: DetId.h:18
virtual const sipixelobjects::PixelROC * findItem(const sipixelobjects::CablingPathToDetUnit &) const =0
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
row and collumn in ROC representation
Definition: LocalPixel.h:15
std::map< int, std::map< int, std::pair< int, int > > > pixelO2O_
std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus >::iterator siPixelStatusMap_iterator
std::vector< HistogramManager > histo
virtual int ncolumns() const =0
T get() const
Definition: EventSetup.h:62
unsigned int digiOccROC(int iroc)
return ROC status (= hits on ROC iroc)
const std::map< edm::LuminosityBlockNumber_t, SiPixelDetectorStatus > & getBadComponents()
T const * product() const
Definition: ESHandle.h:86
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
GlobalPixel toGlobal(const LocalPixel &loc) const
Definition: PixelROC.h:59
bool SiPixelStatusHarvester::equal ( SiPixelQuality a,
SiPixelQuality b 
)
private

Definition at line 561 of file SiPixelStatusHarvester.cc.

References SiPixelQuality::getBadComponentList(), mps_fire::i, cuy::ib, and findQualityFiles::size.

Referenced by constructTag().

561  {
562 
563  std::vector<SiPixelQuality::disabledModuleType> badRocListA;
564  std::vector<SiPixelQuality::disabledModuleType> badRocListB;
565 
566  for(unsigned int ia = 0; ia < (a->getBadComponentList()).size();ia++){
567  badRocListA.push_back((a->getBadComponentList())[ia]);
568  }
569  for(unsigned int ib = 0; ib < (b->getBadComponentList()).size();ib++){
570  badRocListB.push_back((b->getBadComponentList())[ib]);
571  }
572 
573  if(badRocListA.size()!=badRocListB.size()) return false;
574 
575  // ordering ROCs by DetId
576  std::sort(badRocListA.begin(),badRocListA.end(),SiPixelQuality::BadComponentStrictWeakOrdering());
577  std::sort(badRocListB.begin(),badRocListB.end(),SiPixelQuality::BadComponentStrictWeakOrdering());
578 
579  for(unsigned int i = 0; i<badRocListA.size();i++){
580 
581  uint32_t detIdA = badRocListA[i].DetID;
582  uint32_t detIdB = badRocListB[i].DetID;
583  if(detIdA!=detIdB) return false;
584  else{
585  unsigned short BadRocsA = badRocListA[i].BadRocs;
586  unsigned short BadRocsB = badRocListB[i].BadRocs;
587  if(BadRocsA!=BadRocsB) return false;
588  }
589 
590  }
591 
592  //if the module list is the same, and for each module, roc list is the same
593  //the two SiPixelQualitys are equal
594  return true;
595 
596 
597 }
size
Write out results.
const std::vector< disabledModuleType > getBadComponentList() const
ib
Definition: cuy.py:662
edm::LuminosityBlockNumber_t SiPixelStatusHarvester::stepIOV ( edm::LuminosityBlockNumber_t  pin,
std::map< edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t IOV 
)
private

Definition at line 536 of file SiPixelStatusHarvester.cc.

References plotBeamSpotDB::first.

Referenced by endRunProduce().

536  {
537 
538  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator itIOV;
539  for(itIOV=IOV.begin();itIOV!=IOV.end();itIOV++){
540  std::map<edm::LuminosityBlockNumber_t, edm::LuminosityBlockNumber_t>::iterator nextItIOV;
541  nextItIOV = itIOV; nextItIOV++;
542 
543  if(nextItIOV!=IOV.end()){
544  if(pin>=itIOV->first && pin<nextItIOV->first){
545  return itIOV->first;
546  }
547  }
548  else{
549  if(pin>=itIOV->first){
550  return itIOV->first;
551  }
552  }
553 
554  }
555 
556  // return the firstIOV in case all above fail
557  return (IOV.begin())->first;
558 
559 }

Member Data Documentation

int SiPixelStatusHarvester::aveDigiOcc_
private

Definition at line 48 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce().

const SiPixelQuality* SiPixelStatusHarvester::badPixelInfo_
private

Definition at line 60 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce().

const SiPixelFedCabling* SiPixelStatusHarvester::cablingMap_ = 0
private

Definition at line 68 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce().

int SiPixelStatusHarvester::countLumi_ = 0
private

Definition at line 63 of file SiPixelStatusHarvester.h.

Referenced by beginLuminosityBlock(), and SiPixelStatusHarvester().

bool SiPixelStatusHarvester::debug_
private

Definition at line 55 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce(), and SiPixelStatusHarvester().

edm::LuminosityBlockNumber_t SiPixelStatusHarvester::endLumiBlock_
private
std::string SiPixelStatusHarvester::label_
private
std::string SiPixelStatusHarvester::moduleName_
private

Definition at line 50 of file SiPixelStatusHarvester.h.

int SiPixelStatusHarvester::nLumi_
private

Definition at line 49 of file SiPixelStatusHarvester.h.

std::string SiPixelStatusHarvester::outputBase_
private

Definition at line 47 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce().

std::map<int, std::map<int, std::pair<int,int> > > SiPixelStatusHarvester::pixelO2O_
private

Definition at line 72 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce(), and SiPixelStatusHarvester().

std::string SiPixelStatusHarvester::recordName_
private

Definition at line 57 of file SiPixelStatusHarvester.h.

Referenced by constructTag(), endRunProduce(), and SiPixelStatusHarvester().

std::map<int, unsigned int> SiPixelStatusHarvester::sensorSize_
private

Definition at line 69 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce(), and SiPixelStatusHarvester().

SiPixelStatusManager SiPixelStatusHarvester::siPixelStatusManager_
private
const TrackerGeometry* SiPixelStatusHarvester::trackerGeometry_ = 0
private

Definition at line 67 of file SiPixelStatusHarvester.h.

Referenced by endRunProduce().