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);
244 bool lDataExist =
fedErrors_.checkDataPresent(fedData);
266 bool lFailUnpackerFEDcheck =
fedErrors_.failUnpackerFEDCheck();
269 unsigned int lSize = fedData.
size();
277 bool lFailMonitoringFEDcheck =
fedErrors_.failMonitoringFEDCheck();
278 if (lFailMonitoringFEDcheck) lNTotBadFeds++;
284 if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) {
286 std::ostringstream debugStream;
287 debugStream <<
" --- WARNING: FED " <<
fedId << std::endl
288 <<
" ------ Monitoring FED check " ;
289 if (lFailMonitoringFEDcheck) debugStream <<
"failed." << std::endl;
290 else debugStream <<
"passed." << std::endl ;
291 debugStream <<
" ------ Unpacker FED check " ;
292 if (lFailUnpackerFEDcheck) debugStream <<
"failed." << std::endl;
293 else debugStream <<
"passed." << std::endl ;
294 edm::LogError(
"SiStripMonitorHardware") << debugStream.str();
297 if (lFailMonitoringFEDcheck) lNFEDMonitoring++;
298 else if (lFailUnpackerFEDcheck) lNFEDUnpacker++;
307 <<
", TkHistoMap enabled but pointer is null." << std::endl;
314 lNTotBadActiveChannels);
319 for (
unsigned int iP(0); iP<nParts; ++iP){
322 if (lFeMajFrac[iP].
empty())
continue;
325 unsigned int lMajorityCounter = 0;
326 std::vector<unsigned int> lfedIds;
328 getMajority(lFeMajFrac[iP],lMajorityCounter,lfedIds);
330 fedHists_.fillMajorityHistograms(iP,static_cast<float>(lMajorityCounter)/lFeMajFrac[iP].
size(),lfedIds);
334 if ((lNTotBadFeds> 0 || lNTotBadChannels>0) &&
printDebug_>1) {
335 std::ostringstream debugStream;
336 debugStream <<
"[SiStripFEDMonitorPlugin] --- Total number of bad feds = " 337 << lNTotBadFeds << std::endl
338 <<
"[SiStripFEDMonitorPlugin] --- Total number of bad channels = " 339 << lNTotBadChannels << std::endl
340 <<
"[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " 341 << lNTotBadActiveChannels << std::endl;
342 edm::LogInfo(
"SiStripMonitorHardware") << debugStream.str();
345 if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) &&
printDebug_) {
346 std::ostringstream debugStream;
348 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
349 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
350 <<
"[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : " << std::endl
351 <<
"[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring << std::endl
352 <<
"[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker << std::endl
353 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
354 <<
"[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : " << std::endl
355 <<
"[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring << std::endl
356 <<
"[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker << std::endl
357 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl
358 <<
"[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl ;
359 edm::LogError(
"SiStripMonitorHardware") << debugStream.str();
363 fedErrors_.getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels;
364 fedErrors_.getFEDErrorsCounters().nTotalBadActiveChannels = lNTotBadActiveChannels;
369 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)