CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
SiStripFEDMonitorPlugin Class Reference

#include <DQM/SiStripMonitorHardware/plugins/SiStripFEDMonitor.cc>

Inheritance diagram for SiStripFEDMonitorPlugin:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 SiStripFEDMonitorPlugin (const edm::ParameterSet &)
 
 ~SiStripFEDMonitorPlugin () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void beginRun (edm::Run const &, edm::EventSetup const &) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () 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
 
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::vector< ModuleDescription const * > &modules, 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 updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void getMajority (const std::vector< std::pair< unsigned int, unsigned int > > &aFeMajVec, unsigned int &aMajorityCounter, std::vector< unsigned int > &afedIds)
 
void updateCabling (const edm::EventSetup &eventSetup)
 

Static Private Member Functions

static bool pairComparison (const std::pair< unsigned int, unsigned int > &pair1, const std::pair< unsigned int, unsigned int > &pair2)
 

Private Attributes

const SiStripFedCablingcabling_
 
uint32_t cablingCacheId_
 
bool doFEMajorityCheck_
 
bool doMedHists_
 
bool doTkHistoMap_
 
FEDErrors fedErrors_
 
FEDHistograms fedHists_
 
bool fillAllDetailedHistograms_
 
bool fillWithEvtNum_
 
std::string folderName_
 
bool fullDebugMode_
 
edm::EDGetTokenT< EventWithHistoryheToken_
 
unsigned int maxFedBufferSize_
 
unsigned int nEvt_
 
unsigned int printDebug_
 
edm::InputTag rawDataTag_
 
edm::EDGetTokenT< FEDRawDataCollectionrawDataToken_
 
std::string topFolderName_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::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)
 
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 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)
 

Detailed Description

Description: DQM source application to produce data integrety histograms for SiStrip data

Definition at line 61 of file SiStripFEDMonitor.cc.

Constructor & Destructor Documentation

SiStripFEDMonitorPlugin::SiStripFEDMonitorPlugin ( const edm::ParameterSet iConfig)
explicit

Definition at line 124 of file SiStripFEDMonitor.cc.

References doFEMajorityCheck_, doMedHists_, doTkHistoMap_, fedHists_, fillAllDetailedHistograms_, fillWithEvtNum_, folderName_, edm::ParameterSet::getUntrackedParameter(), heToken_, LogTrace, nEvt_, printDebug_, rawDataTag_, rawDataToken_, AlCaHLTBitMon_QueryRunRegistry::string, and topFolderName_.

125  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))),
126  topFolderName_(iConfig.getUntrackedParameter<std::string>("TopFolderName","SiStrip")),
127  fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms",false)),
128  fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber",false)),
129  printDebug_(iConfig.getUntrackedParameter<unsigned int>("PrintDebugMessages",1)),
130  cablingCacheId_(0),
132  fullDebugMode_(iConfig.getUntrackedParameter<bool>("FullDebugMode",false))
133 {
134  std::string subFolderName = iConfig.getUntrackedParameter<std::string>("HistogramFolderName","ReadoutView");
135  folderName_ = topFolderName_ + "/" + subFolderName;
136 
137 
138  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
139  heToken_ = consumes<EventWithHistory>(edm::InputTag("consecutiveHEs") );
140 
141  //print config to debug log
142  std::ostringstream debugStream;
143  if (printDebug_>1) {
144  debugStream << "[SiStripFEDMonitorPlugin]Configuration for SiStripFEDMonitorPlugin: " << std::endl
145  << "[SiStripFEDMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl
146  << "[SiStripFEDMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl
147  << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl
148  << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl
149  << "[SiStripFEDMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl;
150  }
151 
152  //don;t generate debug mesages if debug is disabled
153  std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : nullptr);
154 
155  fedHists_.initialise(iConfig,pDebugStream);
156 
157  doTkHistoMap_ = fedHists_.tkHistoMapEnabled();
158 
159  doMedHists_ = fedHists_.cmHistosEnabled();
160 
161  doFEMajorityCheck_ = fedHists_.feMajHistosEnabled();
162 
163  if (printDebug_) {
164  LogTrace("SiStripMonitorHardware") << debugStream.str();
165  }
166 
167  nEvt_ = 0;
168 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
#define LogTrace(id)
edm::EDGetTokenT< EventWithHistory > heToken_
SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin ( )
override

Definition at line 170 of file SiStripFEDMonitor.cc.

171 {
172 }

Member Function Documentation

void SiStripFEDMonitorPlugin::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 181 of file SiStripFEDMonitor.cc.

References begin, cabling_, EventWithHistory::deltaBX(), doFEMajorityCheck_, doMedHists_, doTkHistoMap_, relativeConstraints::empty, end, edm::EventID::event(), edm::HandleBase::failedToGet(), FEDRawDataCollection::FEDData(), fedErrors_, fedHists_, l1t::stage2::layer2::fedId, fillWithEvtNum_, fullDebugMode_, edm::EventSetup::get(), edm::Event::getByToken(), getMajority(), hcalSimParameters_cfi::he, heToken_, edm::EventBase::id(), edm::HandleBase::isValid(), maxFedBufferSize_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nEvt_, edm::EventBase::orbitNumber(), pairComparison(), printDebug_, edm::ESHandle< T >::product(), rawDataToken_, FEDRawData::size(), findQualityFiles::size, and updateCabling().

183 {
184  //Retrieve tracker topology from geometry
185  edm::ESHandle<TrackerTopology> tTopoHandle;
186  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
187  const TrackerTopology* const tTopo = tTopoHandle.product();
188 
189  //update cabling
190  updateCabling(iSetup);
191 
192  //get raw data
193  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
194  iEvent.getByToken(rawDataToken_,rawDataCollectionHandle);
195  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
196 
197  fedErrors_.initialiseEvent();
198 
199  //add the deltaBX value if the product exist
200 
202  iEvent.getByToken(heToken_,he);
203 
204  if(he.isValid() && !he.failedToGet()) {
205  fedErrors_.fillEventProperties(he->deltaBX());
206  }
207 
208  //initialise map of fedId/bad channel number
209  std::map<unsigned int,std::pair<unsigned short,unsigned short> > badChannelFraction;
210 
211  unsigned int lNFEDMonitoring = 0;
212  unsigned int lNFEDUnpacker = 0;
213  unsigned int lNChannelMonitoring = 0;
214  unsigned int lNChannelUnpacker = 0;
215 
216  unsigned int lNTotBadFeds = 0;
217  unsigned int lNTotBadChannels = 0;
218  unsigned int lNTotBadActiveChannels = 0;
219 
220  std::vector<std::vector<std::pair<unsigned int,unsigned int> > > lFeMajFrac;
221  const unsigned int nParts = 4;
222  if (doFEMajorityCheck_){
223  lFeMajFrac.resize(nParts);
224  //max nFE per partition
225  lFeMajFrac[0].reserve(912);
226  lFeMajFrac[1].reserve(1080);
227  lFeMajFrac[2].reserve(768);
228  lFeMajFrac[3].reserve(760);
229  }
230 
231  maxFedBufferSize_ = 0;
232 
233  //loop over siStrip FED IDs
234  for (unsigned int fedId = FEDNumbering::MINSiStripFEDID;
236  fedId++) {//loop over FED IDs
237  const FEDRawData& fedData = rawDataCollection.FEDData(fedId);
238 
239  //create an object to fill all errors
240  fedErrors_.initialiseFED(fedId,cabling_,tTopo);
241 
242  //Do detailed check
243  //first check if data exists
244  bool lDataExist = fedErrors_.checkDataPresent(fedData);
245  if (!lDataExist) {
246  fedHists_.fillFEDHistograms(fedErrors_,0,fullDebugMode_);
247  continue;
248  }
249 
250 
251 
252  //check for problems and fill detailed histograms
253  fedErrors_.fillFEDErrors(fedData,
255  printDebug_,
256  lNChannelMonitoring,
257  lNChannelUnpacker,
258  doMedHists_,
259  fedHists_.cmHistPointer(false),
260  fedHists_.cmHistPointer(true),
262  lFeMajFrac
263  );
264 
265  //check filled in previous method.
266  bool lFailUnpackerFEDcheck = fedErrors_.failUnpackerFEDCheck();
267 
268  fedErrors_.incrementFEDCounters();
269  unsigned int lSize = fedData.size();
270  if (lSize > maxFedBufferSize_){
271  maxFedBufferSize_ = lSize;
272  }
273  //std::cout << " -- " << fedId << " " << lSize << std::endl;
274 
275  fedHists_.fillFEDHistograms(fedErrors_,lSize,fullDebugMode_);
276 
277  bool lFailMonitoringFEDcheck = fedErrors_.failMonitoringFEDCheck();
278  if (lFailMonitoringFEDcheck) lNTotBadFeds++;
279 
280 
281  //sanity check: if something changed in the unpacking code
282  //but wasn't propagated here
283  //print only the summary, and more info if printDebug>1
284  if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) {
285  if (printDebug_>1) {
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();
295  }
296 
297  if (lFailMonitoringFEDcheck) lNFEDMonitoring++;
298  else if (lFailUnpackerFEDcheck) lNFEDUnpacker++;
299  }
300 
301 
302  //Fill TkHistoMap:
303  //add an entry for all channels (good = 0),
304  //so that tkHistoMap knows which channels should be there.
305  if (doTkHistoMap_ && !fedHists_.tkHistoMapPointer()) {
306  edm::LogWarning("SiStripMonitorHardware") << " -- Fedid " << fedId
307  << ", TkHistoMap enabled but pointer is null." << std::endl;
308  }
309 
310  fedErrors_.fillBadChannelList(doTkHistoMap_,
311  fedHists_.tkHistoMapPointer(),
312  fedHists_.getFedvsAPVpointer(),
313  lNTotBadChannels,
314  lNTotBadActiveChannels);
315  }//loop over FED IDs
316 
317 
318  if (doFEMajorityCheck_){
319  for (unsigned int iP(0); iP<nParts; ++iP){
320  //std::cout << " -- Partition " << iP << std::endl;
321  //std::cout << " --- Number of elements in vec = " << lFeMajFrac[iP].size() << std::endl;
322  if (lFeMajFrac[iP].empty()) continue;
323  std::sort(lFeMajFrac[iP].begin(),lFeMajFrac[iP].end(),SiStripFEDMonitorPlugin::pairComparison);
324 
325  unsigned int lMajorityCounter = 0;
326  std::vector<unsigned int> lfedIds;
327 
328  getMajority(lFeMajFrac[iP],lMajorityCounter,lfedIds);
329  //std::cout << " -- Found " << lfedIds.size() << " unique elements not matching the majority." << std::endl;
330  fedHists_.fillMajorityHistograms(iP,static_cast<float>(lMajorityCounter)/lFeMajFrac[iP].size(),lfedIds);
331  }
332  }
333 
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();
343  }
344 
345  if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) && printDebug_) {
346  std::ostringstream debugStream;
347  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();
360 
361  }
362 
363  fedErrors_.getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels;
364  fedErrors_.getFEDErrorsCounters().nTotalBadActiveChannels = lNTotBadActiveChannels;
365 
366  //time in seconds since beginning of the run or event number
367  if (fillWithEvtNum_) {
368  // explicitely casting the event number unsigned long long to double here
369  double eventNumber = static_cast<double>(iEvent.id().event());
370  fedHists_.fillCountersHistograms(
371  fedErrors_.getFEDErrorsCounters(),
372  fedErrors_.getChannelErrorsCounters(),
374  eventNumber);
375  } else {
376  double aTime = iEvent.orbitNumber()/11223.;
377  fedHists_.fillCountersHistograms(
378  fedErrors_.getFEDErrorsCounters(),
379  fedErrors_.getChannelErrorsCounters(),
381  aTime);
382  }
383 
384  nEvt_++;
385 
386 }//analyze method
size
Write out results.
EventNumber_t event() const
Definition: EventID.h:41
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
long long deltaBX(const unsigned int ev2, const unsigned int ev1) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
const SiStripFedCabling * cabling_
void getMajority(const std::vector< std::pair< unsigned int, unsigned int > > &aFeMajVec, unsigned int &aMajorityCounter, std::vector< unsigned int > &afedIds)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
#define end
Definition: vmac.h:37
int orbitNumber() const
Definition: EventBase.h:67
bool isValid() const
Definition: HandleBase.h:74
bool failedToGet() const
Definition: HandleBase.h:78
const T & get() const
Definition: EventSetup.h:55
edm::EventID id() const
Definition: EventBase.h:60
#define begin
Definition: vmac.h:30
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
Definition: ESHandle.h:86
void updateCabling(const edm::EventSetup &eventSetup)
void SiStripFEDMonitorPlugin::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivate

Definition at line 469 of file SiStripFEDMonitor.cc.

References fedErrors_.

471 {
472 
473  fedErrors_.initialiseLumiBlock();
474 
475 }
void SiStripFEDMonitorPlugin::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 461 of file SiStripFEDMonitor.cc.

References fedHists_, fillAllDetailedHistograms_, folderName_, fullDebugMode_, and DQMStore::IBooker::setCurrentFolder().

462 {
463  ibooker.setCurrentFolder(folderName_);
464  fedHists_.bookTopLevelHistograms(ibooker);
465  if (fillAllDetailedHistograms_) fedHists_.bookAllFEDHistograms(ibooker , fullDebugMode_ );
466 }
void SiStripFEDMonitorPlugin::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivate

Definition at line 479 of file SiStripFEDMonitor.cc.

References fedErrors_, and fedHists_.

481 {
482  fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors());
483 }
void SiStripFEDMonitorPlugin::getMajority ( const std::vector< std::pair< unsigned int, unsigned int > > &  aFeMajVec,
unsigned int &  aMajorityCounter,
std::vector< unsigned int > &  afedIds 
)
private

Definition at line 394 of file SiStripFEDMonitor.cc.

References gather_cfg::cout, and tier0::unique().

Referenced by analyze().

396  {
397 
398 
399  unsigned int lMajAddress = 0;
400  std::vector<std::pair<unsigned int,unsigned int> >::const_iterator lIter = aFeMajVec.begin();
401  unsigned int lMajAddr = (*lIter).second;
402  unsigned int lCounter = 0;
403 
404  //std::cout << " --- First element: addr = " << lMajAddr << " counter = " << lCounter << std::endl;
405  unsigned int iele=0;
406  //bool foundMaj = false;
407  for ( ; lIter != aFeMajVec.end(); ++lIter,++iele) {
408  //std::cout << " ---- Ele " << iele << " " << (*lIter).first << " " << (*lIter).second << " ref " << lMajAddr << std::endl;
409  if ((*lIter).second == lMajAddr) {
410  ++lCounter;
411  //std::cout << " ----- =ref: Counter = " << lCounter << std::endl;
412  }
413  else {
414  //std::cout << " ----- !=ref: Counter = " << lCounter << " Majority = " << aMajorityCounter << std::endl;
415  if (lCounter > aMajorityCounter) {
416  //std::cout << " ------ >Majority: " << std::endl;
417  aMajorityCounter = lCounter;
418  // AV bug here??
419  lMajAddress = lMajAddr;
420  // lMajAddress = (*lIter).second;
421  //foundMaj=true;
422  }
423  lCounter = 0;
424  lMajAddr = (*lIter).second;
425  --lIter;
426  --iele;
427  }
428  }
429  // AV Bug here? The check has to be done regardless foundMaj == false or true
430  // if (!foundMaj) {
431  if (lCounter > aMajorityCounter) {
432  //std::cout << " ------ >Majority: " << std::endl;
433  aMajorityCounter = lCounter;
434  lMajAddress = lMajAddr;
435  }
436  // }
437  //std::cout << " -- found majority value for " << aMajorityCounter << " elements out of " << aFeMajVec.size() << "." << std::endl;
438  //get list of feds with address different from majority in partition:
439  lIter = aFeMajVec.begin();
440  afedIds.reserve(135);
441  for ( ; lIter != aFeMajVec.end(); ++lIter ) {
442  if((*lIter).second != lMajAddress) {
443  afedIds.push_back((*lIter).first);
444  }
445  else {
446  lIter += aMajorityCounter-1;
447  if(lIter >= aFeMajVec.end()) {
448  std::cout << "Here it is a bug: " << aMajorityCounter << " " << aFeMajVec.size() << " " << lIter - aFeMajVec.end() << std::endl;
449  }
450  }
451  }
452  //std::cout << " -- Found " << lfedIds.size() << " elements not matching the majority." << std::endl;
453  if (!afedIds.empty()) {
454  std::sort(afedIds.begin(),afedIds.end());
455  std::vector<unsigned int>::iterator lIt = std::unique(afedIds.begin(),afedIds.end());
456  afedIds.erase(lIt,afedIds.end());
457  }
458 
459 }
def unique(seq, keepstr=True)
Definition: tier0.py:24
bool SiStripFEDMonitorPlugin::pairComparison ( const std::pair< unsigned int, unsigned int > &  pair1,
const std::pair< unsigned int, unsigned int > &  pair2 
)
staticprivate

Definition at line 389 of file SiStripFEDMonitor.cc.

Referenced by analyze().

390  {
391  return (pair1.second < pair2.second) ;
392 }
void SiStripFEDMonitorPlugin::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 488 of file SiStripFEDMonitor.cc.

References cabling_, cablingCacheId_, DEFINE_FWK_MODULE, edm::EventSetup::get(), and edm::ESHandle< T >::product().

Referenced by analyze().

489 {
490  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
491  if (cablingCacheId_ != currentCacheId) {
492  edm::ESHandle<SiStripFedCabling> cablingHandle;
493  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
494  cabling_ = cablingHandle.product();
495  cablingCacheId_ = currentCacheId;
496  }
497 }
const SiStripFedCabling * cabling_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_
private

Definition at line 102 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and updateCabling().

uint32_t SiStripFEDMonitorPlugin::cablingCacheId_
private

Definition at line 101 of file SiStripFEDMonitor.cc.

Referenced by updateCabling().

bool SiStripFEDMonitorPlugin::doFEMajorityCheck_
private

Definition at line 107 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doMedHists_
private

Definition at line 106 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doTkHistoMap_
private

Definition at line 105 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

FEDErrors SiStripFEDMonitorPlugin::fedErrors_
private

Definition at line 113 of file SiStripFEDMonitor.cc.

Referenced by analyze(), beginLuminosityBlock(), and endLuminosityBlock().

FEDHistograms SiStripFEDMonitorPlugin::fedHists_
private
bool SiStripFEDMonitorPlugin::fillAllDetailedHistograms_
private

Definition at line 95 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fillWithEvtNum_
private

Definition at line 97 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::folderName_
private

Definition at line 93 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fullDebugMode_
private

Definition at line 116 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and bookHistograms().

edm::EDGetTokenT<EventWithHistory> SiStripFEDMonitorPlugin::heToken_
private

Definition at line 87 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::maxFedBufferSize_
private

Definition at line 114 of file SiStripFEDMonitor.cc.

Referenced by analyze().

unsigned int SiStripFEDMonitorPlugin::nEvt_
private

Definition at line 109 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::printDebug_
private

Definition at line 99 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

edm::InputTag SiStripFEDMonitorPlugin::rawDataTag_
private

Definition at line 85 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

edm::EDGetTokenT<FEDRawDataCollection> SiStripFEDMonitorPlugin::rawDataToken_
private

Definition at line 86 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::topFolderName_
private

Definition at line 92 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().