209 std::map<unsigned int,std::pair<unsigned short,unsigned short> > badChannelFraction;
211 unsigned int lNFEDMonitoring = 0;
212 unsigned int lNFEDUnpacker = 0;
213 unsigned int lNChannelMonitoring = 0;
214 unsigned int lNChannelUnpacker = 0;
216 unsigned int lNTotBadFeds = 0;
217 unsigned int lNTotBadChannels = 0;
218 unsigned int lNTotBadActiveChannels = 0;
220 std::vector<std::vector<std::pair<unsigned int,unsigned int> > > lFeMajFrac;
221 const unsigned int nParts = 4;
223 lFeMajFrac.resize(nParts);
225 lFeMajFrac[0].reserve(912);
226 lFeMajFrac[1].reserve(1080);
227 lFeMajFrac[2].reserve(768);
228 lFeMajFrac[3].reserve(760);
237 unsigned int lNBadChannels_perFEDID = 0;
243 double aLumiSection = iEvent.
orbitNumber()/262144.0;
247 bool lDataExist =
fedErrors_.checkDataPresent(fedData);
269 bool lFailUnpackerFEDcheck =
fedErrors_.failUnpackerFEDCheck();
272 unsigned int lSize = fedData.
size();
280 bool lFailMonitoringFEDcheck =
fedErrors_.failMonitoringFEDCheck();
281 if (lFailMonitoringFEDcheck) lNTotBadFeds++;
287 if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) {
289 std::ostringstream debugStream;
290 debugStream <<
" --- WARNING: FED " <<
fedId << std::endl
291 <<
" ------ Monitoring FED check " ;
292 if (lFailMonitoringFEDcheck) debugStream <<
"failed." << std::endl;
293 else debugStream <<
"passed." << std::endl ;
294 debugStream <<
" ------ Unpacker FED check " ;
295 if (lFailUnpackerFEDcheck) debugStream <<
"failed." << std::endl;
296 else debugStream <<
"passed." << std::endl ;
297 edm::LogError(
"SiStripMonitorHardware") << debugStream.str();
300 if (lFailMonitoringFEDcheck) lNFEDMonitoring++;
301 else if (lFailUnpackerFEDcheck) lNFEDUnpacker++;
310 <<
", TkHistoMap enabled but pointer is null." << std::endl;
317 lNTotBadActiveChannels,
318 lNBadChannels_perFEDID
325 for (
unsigned int iP(0); iP<nParts; ++iP){
328 if (lFeMajFrac[iP].
empty())
continue;
331 unsigned int lMajorityCounter = 0;
332 std::vector<unsigned int> lfedIds;
334 getMajority(lFeMajFrac[iP],lMajorityCounter,lfedIds);
336 fedHists_.fillMajorityHistograms(iP,static_cast<float>(lMajorityCounter)/lFeMajFrac[iP].
size(),lfedIds);
340 if ((lNTotBadFeds> 0 || lNTotBadChannels>0) &&
printDebug_>1) {
341 std::ostringstream debugStream;
342 debugStream <<
"[SiStripFEDMonitorPlugin] --- Total number of bad feds = " 343 << lNTotBadFeds << std::endl
344 <<
"[SiStripFEDMonitorPlugin] --- Total number of bad channels = " 345 << lNTotBadChannels << std::endl
346 <<
"[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " 347 << lNTotBadActiveChannels << std::endl;
348 edm::LogInfo(
"SiStripMonitorHardware") << debugStream.str();
351 if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) &&
printDebug_) {
352 std::ostringstream debugStream;
354 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
355 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
356 <<
"[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : " << std::endl
357 <<
"[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring << std::endl
358 <<
"[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker << std::endl
359 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
360 <<
"[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : " << std::endl
361 <<
"[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring << std::endl
362 <<
"[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker << std::endl
363 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
364 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl ;
365 edm::LogError(
"SiStripMonitorHardware") << debugStream.str();
369 fedErrors_.getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels;
370 fedErrors_.getFEDErrorsCounters().nTotalBadActiveChannels = lNTotBadActiveChannels;
375 double eventNumber =
static_cast<double>(iEvent.
id().
event());
EventNumber_t event() const
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
long long deltaBX(const unsigned int ev2, const unsigned int ev1) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const SiStripFedCabling * cabling_
void getMajority(const std::vector< std::pair< unsigned int, unsigned int > > &aFeMajVec, unsigned int &aMajorityCounter, std::vector< unsigned int > &afedIds)
unsigned int maxFedBufferSize_
size_t size() const
Lenght of the data buffer in bytes.
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
static bool pairComparison(const std::pair< unsigned int, unsigned int > &pair1, const std::pair< unsigned int, unsigned int > &pair2)
edm::EDGetTokenT< EventWithHistory > heToken_
T const * product() const
void updateCabling(const edm::EventSetup &eventSetup)