Definition at line 42 of file SiStripFEDDataCheck.cc.
SiStripFEDCheckPlugin::SiStripFEDCheckPlugin | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 96 of file SiStripFEDDataCheck.cc.
References checkChannelLengths_, checkChannelStatusBits_, checkFELengths_, checkPacketCodes_, doPayloadChecks_, and ss.
00097 : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))), 00098 dirName_(iConfig.getUntrackedParameter<std::string>("DirName","SiStrip/FEDIntegrity/")), 00099 printDebug_(iConfig.getUntrackedParameter<bool>("PrintDebugMessages",false)), 00100 writeDQMStore_(iConfig.getUntrackedParameter<bool>("WriteDQMStore",false)), 00101 updateFrequency_(iConfig.getUntrackedParameter<unsigned int>("HistogramUpdateFrequency",0)), 00102 fedsPresentBinContents_(FEDNumbering::getSiStripFEDIds().second+1,0), 00103 fedFatalErrorBinContents_(FEDNumbering::getSiStripFEDIds().second+1,0), 00104 fedNonFatalErrorBinContents_(FEDNumbering::getSiStripFEDIds().second+1,0), 00105 eventCount_(0), 00106 doPayloadChecks_(iConfig.getUntrackedParameter<bool>("DoPayloadChecks",true)), 00107 checkChannelLengths_(iConfig.getUntrackedParameter<bool>("CheckChannelLengths",true)), 00108 checkPacketCodes_(iConfig.getUntrackedParameter<bool>("CheckChannelPacketCodes",true)), 00109 checkFELengths_(iConfig.getUntrackedParameter<bool>("CheckFELengths",true)), 00110 checkChannelStatusBits_(iConfig.getUntrackedParameter<bool>("CheckChannelStatus",true)), 00111 cablingCacheId_(0) 00112 { 00113 if (!doPayloadChecks_ && (checkChannelLengths_ || checkPacketCodes_ || checkFELengths_ || checkChannelStatusBits_) ) { 00114 std::stringstream ss; 00115 ss << "Payload checks are disabled but individual payload checks have been enabled. The following payload checks will be skipped: "; 00116 if (checkChannelLengths_) ss << "Channel length check, "; 00117 if (checkPacketCodes_) ss << "Channel packet code check, "; 00118 if (checkChannelStatusBits_) ss << "Cabled channel status bits checks, "; 00119 if (checkFELengths_) ss << "FE Unit legnth check"; 00120 edm::LogWarning("SiStripFEDCheck") << ss.str(); 00121 } 00122 }
SiStripFEDCheckPlugin::~SiStripFEDCheckPlugin | ( | ) |
void SiStripFEDCheckPlugin::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 135 of file SiStripFEDDataCheck.cc.
References FEDRawData::data(), doUpdateIfNeeded(), FEDRawDataCollection::FEDData(), fillFatalError(), fillNonFatalError(), fillPresent(), edm::Event::getByLabel(), FEDNumbering::getSiStripFEDIds(), hasFatalError(), hasNonFatalError(), rawDataTag_, FEDRawData::size(), and updateCabling().
00136 { 00137 //update cabling 00138 updateCabling(iSetup); 00139 00140 //get raw data 00141 edm::Handle<FEDRawDataCollection> rawDataCollectionHandle; 00142 iEvent.getByLabel(rawDataTag_,rawDataCollectionHandle); 00143 const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle; 00144 00145 //get FED IDs 00146 const unsigned int siStripFedIdMin = FEDNumbering::getSiStripFEDIds().first; 00147 const unsigned int siStripFedIdMax = FEDNumbering::getSiStripFEDIds().second; 00148 00149 //loop over siStrip FED IDs 00150 for (unsigned int fedId = siStripFedIdMin; fedId <= siStripFedIdMax; fedId++) { 00151 const FEDRawData& fedData = rawDataCollection.FEDData(fedId); 00152 //check data exists 00153 if (!fedData.size() || !fedData.data()) { 00154 fillPresent(fedId,0); 00155 continue; 00156 } 00157 //fill buffer present histogram 00158 fillPresent(fedId,1); 00159 //check for fatal errors 00160 if (hasFatalError(fedData,fedId)) { 00161 fillFatalError(fedId,1); 00162 } else { 00163 fillFatalError(fedId,0); 00164 //fill non-fatal errors histogram if there were no fatal errors 00165 fillNonFatalError(fedId,hasNonFatalError(fedData,fedId) ? 1 : 0); 00166 } 00167 }//loop over FED IDs 00168 00169 //update histograms if needed 00170 doUpdateIfNeeded(); 00171 }
void SiStripFEDCheckPlugin::beginJob | ( | const edm::EventSetup & | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 175 of file SiStripFEDDataCheck.cc.
References DQMStore::book1D(), dirName_, dqm_, fedFatalErrors_, fedNonFatalErrors_, fedsPresent_, FEDNumbering::getSiStripFEDIds(), MonitorElement::setAxisTitle(), and DQMStore::setCurrentFolder().
00176 { 00177 //get FED IDs 00178 const FEDNumbering numbering; 00179 const unsigned int siStripFedIdMin = numbering.getSiStripFEDIds().first; 00180 const unsigned int siStripFedIdMax = numbering.getSiStripFEDIds().second; 00181 //get DQM store 00182 dqm_ = &(*edm::Service<DQMStore>()); 00183 dqm_->setCurrentFolder(dirName_); 00184 //book histograms 00185 fedsPresent_ = dqm_->book1D("FEDEntries", 00186 "Number of times FED buffer is present in data", 00187 siStripFedIdMax-siStripFedIdMin+1, 00188 siStripFedIdMin-0.5,siStripFedIdMax+0.5); 00189 fedsPresent_->setAxisTitle("FED-ID",1); 00190 fedFatalErrors_ = dqm_->book1D("FEDFatal", 00191 "Number of fatal errors in FED buffer", 00192 siStripFedIdMax-siStripFedIdMin+1, 00193 siStripFedIdMin-0.5,siStripFedIdMax+0.5); 00194 fedFatalErrors_->setAxisTitle("FED-ID",1); 00195 fedNonFatalErrors_ = dqm_->book1D("FEDNonFatal", 00196 "Number of non fatal errors in FED buffer", 00197 siStripFedIdMax-siStripFedIdMin+1, 00198 siStripFedIdMin-0.5,siStripFedIdMax+0.5); 00199 fedNonFatalErrors_->setAxisTitle("FED-ID",1); 00200 }
void SiStripFEDCheckPlugin::doUpdateIfNeeded | ( | ) | [private] |
Definition at line 342 of file SiStripFEDDataCheck.cc.
References eventCount_, updateFrequency_, and updateHistograms().
Referenced by analyze().
00343 { 00344 eventCount_++; 00345 if (updateFrequency_ && !(eventCount_%updateFrequency_)) { 00346 updateHistograms(); 00347 } 00348 }
Reimplemented from edm::EDAnalyzer.
Definition at line 204 of file SiStripFEDDataCheck.cc.
References dqm_, DQMStore::save(), updateHistograms(), and writeDQMStore_.
00205 { 00206 updateHistograms(); 00207 if (writeDQMStore_) dqm_->save("DQMStore.root"); 00208 }
void SiStripFEDCheckPlugin::fillFatalError | ( | unsigned int | fedId, | |
bool | fatalError | |||
) | [inline, private] |
Definition at line 324 of file SiStripFEDDataCheck.cc.
References fedFatalErrorBinContents_, fedFatalErrors_, MonitorElement::Fill(), and updateFrequency_.
Referenced by analyze().
00325 { 00326 if (updateFrequency_) { 00327 if (fatalError) fedFatalErrorBinContents_[fedId]++; 00328 } else { 00329 fedFatalErrors_->Fill( fatalError ? 1 : 0 ); 00330 } 00331 }
void SiStripFEDCheckPlugin::fillNonFatalError | ( | unsigned int | fedId, | |
bool | nonFatalError | |||
) | [inline, private] |
Definition at line 333 of file SiStripFEDDataCheck.cc.
References fedNonFatalErrorBinContents_, fedNonFatalErrors_, MonitorElement::Fill(), and updateFrequency_.
Referenced by analyze().
00334 { 00335 if (updateFrequency_) { 00336 if (nonFatalError) fedNonFatalErrorBinContents_[fedId]++; 00337 } else { 00338 fedNonFatalErrors_->Fill( nonFatalError ? 1 : 0 ); 00339 } 00340 }
Definition at line 316 of file SiStripFEDDataCheck.cc.
References fedsPresent_, fedsPresentBinContents_, MonitorElement::Fill(), and updateFrequency_.
Referenced by analyze().
00317 { 00318 if (present) { 00319 if (updateFrequency_) fedsPresentBinContents_[fedId]++; 00320 else fedsPresent_->Fill(fedId); 00321 } 00322 }
bool SiStripFEDCheckPlugin::hasFatalError | ( | const FEDRawData & | fedData, | |
unsigned int | fedId | |||
) | const [private] |
Definition at line 211 of file SiStripFEDDataCheck.cc.
References FEDRawData::data(), lat::endl(), printDebug_, FEDRawData::size(), and ss.
Referenced by analyze().
00212 { 00213 bool fatalError = false; 00214 //first build a base buffer object to do basic checks (without checking channel data) 00215 const sistrip::FEDBufferBase buffer(fedData.data(),fedData.size(),true); 00216 //check for errors signaled in DAQ header and trailer and that length is consistent with buffer length 00217 if (!buffer.doDAQHeaderAndTrailerChecks()) fatalError = true; 00218 //check that buffer format byte is valid 00219 if (!buffer.checkBufferFormat()) fatalError = true; 00220 //check CRC 00221 if (!buffer.checkCRC()) fatalError = true; 00222 //if there was an error then provide info 00223 if (fatalError) { 00224 if (printDebug_) { 00225 edm::LogInfo("SiStripFEDCheck") << "Fatal error with FED ID " << fedId << ". Check summary: " 00226 << std::endl << buffer.checkSummary() << std::endl; 00227 std::stringstream ss; 00228 buffer.dump(ss); 00229 edm::LogInfo("SiStripFEDCheck") << ss.str(); 00230 } 00231 return true; 00232 } else { 00233 return false; 00234 } 00235 }
bool SiStripFEDCheckPlugin::hasNonFatalError | ( | const FEDRawData & | fedData, | |
unsigned int | fedId | |||
) | const [private] |
Definition at line 237 of file SiStripFEDDataCheck.cc.
References c, cabling_, checkChannelLengths_, checkChannelStatusBits_, checkFELengths_, checkPacketCodes_, SiStripFedCabling::connection(), FEDRawData::data(), doPayloadChecks_, e, lat::endl(), sistrip::FEDCH_PER_FED, FedChannelConnection::isConnected(), printDebug_, FEDRawData::size(), ss, and cms::Exception::what().
Referenced by analyze().
00238 { 00239 const sistrip::FEDBufferBase baseBuffer(fedData.data(),fedData.size(),true); 00240 if (!baseBuffer.doTrackerSpecialHeaderChecks()) { 00241 if (printDebug_) { 00242 edm::LogInfo("SiStripFEDCheck") << "Error with header for FED ID " << fedId << ". Check summary: " 00243 << std::endl << baseBuffer.checkSummary() << std::endl; 00244 std::stringstream ss; 00245 baseBuffer.dump(ss); 00246 edm::LogInfo("SiStripFEDCheck") << ss.str(); 00247 } 00248 return true; 00249 } 00250 if (doPayloadChecks_) { 00251 //check that channels can all be found in buffer 00252 std::auto_ptr<const sistrip::FEDBuffer> pBuffer; 00253 try { 00254 pBuffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size())); 00255 } catch (const cms::Exception& e) { 00256 pBuffer.reset(new sistrip::FEDBuffer(fedData.data(),fedData.size(),true)); 00257 if (printDebug_) { 00258 edm::LogInfo("SiStripFEDCheck") << "Error constructing buffer object for FED ID " << fedId 00259 << std::endl << e.what() << std::endl << "Check summary: " 00260 << std::endl << pBuffer->checkSummary() << std::endl; 00261 std::stringstream ss; 00262 pBuffer->dump(ss); 00263 edm::LogInfo("SiStripFEDCheck") << ss.str(); 00264 } 00265 return true; 00266 } 00267 //check that all fields in buffer are valid and that there are no problems with data 00268 bool channelLengthsOK = checkChannelLengths_ ? pBuffer->checkChannelLengthsMatchBufferLength() : true; 00269 bool channelPacketCodesOK = checkPacketCodes_ ? pBuffer->checkChannelPacketCodes() : true; 00270 bool feLengthsOK = checkFELengths_ ? pBuffer->checkFEUnitLengths() : true; 00271 if (!pBuffer->doChecks() || 00272 !channelLengthsOK || 00273 !channelPacketCodesOK || 00274 !feLengthsOK ) { 00275 if (printDebug_) { 00276 edm::LogInfo("SiStripFEDCheck") << "Error with FED ID " << fedId << ". Check summary: " 00277 << std::endl << pBuffer->checkSummary() << std::endl; 00278 std::stringstream ss; 00279 pBuffer->dump(ss); 00280 edm::LogInfo("SiStripFEDCheck") << ss.str(); 00281 } 00282 return true; 00283 } 00284 //check that channels in cabling have no bad status bits and are enabled 00285 if (checkChannelStatusBits_) { 00286 for (unsigned int c = 0; c < sistrip::FEDCH_PER_FED; c++) { 00287 if (!cabling_->connection(fedId,c).isConnected()) continue; 00288 else if (!pBuffer->channelGood(c)) { 00289 if (printDebug_) { 00290 edm::LogInfo("SiStripFEDCheck") << "Error with FED ID " << fedId << " channel " << c << ". Check summary: " 00291 << std::endl << pBuffer->checkSummary() << std::endl; 00292 std::stringstream ss; 00293 pBuffer->dump(ss); 00294 edm::LogInfo("SiStripFEDCheck") << ss.str(); 00295 } 00296 return true; 00297 } 00298 } 00299 } 00300 } 00301 //if the checks above all passed then there are no errors 00302 return false; 00303 }
void SiStripFEDCheckPlugin::updateCabling | ( | const edm::EventSetup & | eventSetup | ) | [private] |
Definition at line 305 of file SiStripFEDDataCheck.cc.
References cabling_, cablingCacheId_, edm::EventSetup::get(), and edm::ESHandle< T >::product().
Referenced by analyze().
00306 { 00307 uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier(); 00308 if (cablingCacheId_ != currentCacheId) { 00309 edm::ESHandle<SiStripFedCabling> cablingHandle; 00310 eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle); 00311 cabling_ = cablingHandle.product(); 00312 cablingCacheId_ = currentCacheId; 00313 } 00314 }
void SiStripFEDCheckPlugin::updateHistograms | ( | ) | [private] |
Definition at line 350 of file SiStripFEDDataCheck.cc.
References fedFatalErrorBinContents_, fedFatalErrors_, fedNonFatalErrorBinContents_, fedNonFatalErrors_, fedsPresent_, fedsPresentBinContents_, FEDNumbering::getSiStripFEDIds(), MonitorElement::getTH1(), and updateFrequency_.
Referenced by doUpdateIfNeeded(), and endJob().
00351 { 00352 //if the cache is not being used then do nothing 00353 if (!updateFrequency_) return; 00354 const unsigned int siStripFedIdMin = FEDNumbering::getSiStripFEDIds().first; 00355 const unsigned int siStripFedIdMax = FEDNumbering::getSiStripFEDIds().second; 00356 unsigned int entriesFedsPresent = 0; 00357 unsigned int entriesFatalErrors = 0; 00358 unsigned int entriesNonFatalErrors = 0; 00359 for (unsigned int fedId = siStripFedIdMin, bin = 1; fedId < siStripFedIdMax+1; fedId++, bin++) { 00360 unsigned int fedsPresentBin = fedsPresentBinContents_[fedId]; 00361 fedsPresent_->getTH1()->SetBinContent(bin,fedsPresentBin); 00362 entriesFedsPresent += fedsPresentBin; 00363 unsigned int fedFatalErrorsBin = fedFatalErrorBinContents_[fedId]; 00364 fedFatalErrors_->getTH1()->SetBinContent(bin,fedFatalErrorsBin); 00365 entriesFatalErrors += fedFatalErrorsBin; 00366 unsigned int fedNonFatalErrorsBin = fedNonFatalErrorBinContents_[fedId]; 00367 fedNonFatalErrors_->getTH1()->SetBinContent(bin,fedFatalErrorsBin); 00368 entriesNonFatalErrors += fedNonFatalErrorsBin; 00369 } 00370 fedsPresent_->getTH1()->SetEntries(entriesFedsPresent); 00371 fedFatalErrors_->getTH1()->SetEntries(entriesFatalErrors); 00372 fedNonFatalErrors_->getTH1()->SetEntries(entriesNonFatalErrors); 00373 }
const SiStripFedCabling* SiStripFEDCheckPlugin::cabling_ [private] |
Definition at line 88 of file SiStripFEDDataCheck.cc.
Referenced by hasNonFatalError(), and updateCabling().
uint32_t SiStripFEDCheckPlugin::cablingCacheId_ [private] |
Definition at line 84 of file SiStripFEDDataCheck.cc.
Referenced by hasNonFatalError(), and SiStripFEDCheckPlugin().
Definition at line 84 of file SiStripFEDDataCheck.cc.
Referenced by hasNonFatalError(), and SiStripFEDCheckPlugin().
bool SiStripFEDCheckPlugin::checkFELengths_ [private] |
Definition at line 84 of file SiStripFEDDataCheck.cc.
Referenced by hasNonFatalError(), and SiStripFEDCheckPlugin().
bool SiStripFEDCheckPlugin::checkPacketCodes_ [private] |
Definition at line 84 of file SiStripFEDDataCheck.cc.
Referenced by hasNonFatalError(), and SiStripFEDCheckPlugin().
std::string SiStripFEDCheckPlugin::dirName_ [private] |
bool SiStripFEDCheckPlugin::doPayloadChecks_ [private] |
Definition at line 84 of file SiStripFEDDataCheck.cc.
Referenced by hasNonFatalError(), and SiStripFEDCheckPlugin().
DQMStore* SiStripFEDCheckPlugin::dqm_ [private] |
unsigned int SiStripFEDCheckPlugin::eventCount_ [private] |
std::vector<unsigned int> SiStripFEDCheckPlugin::fedFatalErrorBinContents_ [private] |
Definition at line 79 of file SiStripFEDDataCheck.cc.
Referenced by fillFatalError(), and updateHistograms().
Definition at line 72 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), fillFatalError(), and updateHistograms().
std::vector<unsigned int> SiStripFEDCheckPlugin::fedNonFatalErrorBinContents_ [private] |
Definition at line 80 of file SiStripFEDDataCheck.cc.
Referenced by fillNonFatalError(), and updateHistograms().
Definition at line 73 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), fillNonFatalError(), and updateHistograms().
Definition at line 71 of file SiStripFEDDataCheck.cc.
Referenced by beginJob(), fillPresent(), and updateHistograms().
std::vector<unsigned int> SiStripFEDCheckPlugin::fedsPresentBinContents_ [private] |
Definition at line 78 of file SiStripFEDDataCheck.cc.
Referenced by fillPresent(), and updateHistograms().
bool SiStripFEDCheckPlugin::printDebug_ [private] |
Definition at line 66 of file SiStripFEDDataCheck.cc.
Referenced by hasFatalError(), and hasNonFatalError().
unsigned int SiStripFEDCheckPlugin::updateFrequency_ [private] |
Definition at line 76 of file SiStripFEDDataCheck.cc.
Referenced by doUpdateIfNeeded(), fillFatalError(), fillNonFatalError(), fillPresent(), and updateHistograms().
bool SiStripFEDCheckPlugin::writeDQMStore_ [private] |