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:
DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > > edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SiStripFEDMonitorPlugin (const edm::ParameterSet &)
 
 ~SiStripFEDMonitorPlugin () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void getMajority (const std::vector< std::pair< unsigned int, unsigned int > > &aFeMajVec, unsigned int &aMajorityCounter, std::vector< unsigned int > &afedIds)
 
std::shared_ptr< sifedmon::LumiErrorsglobalBeginLuminosityBlock (const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) const override
 
void globalEndLuminosityBlock (const edm::LuminosityBlock &lumi, const edm::EventSetup &iSetup) override
 
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_
 
bool enableFEDerrLumi_
 
FEDErrors fedErrors_
 
FEDHistograms fedHists_
 
bool fillAllDetailedHistograms_
 
bool fillWithEvtNum_
 
std::string folderName_
 
bool fullDebugMode_
 
edm::EDGetTokenT< EventWithHistoryheToken_
 
MonitorElementlumiErrfac_
 
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 DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > >
virtual void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)=0
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

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

Definition at line 69 of file SiStripFEDMonitor.cc.

Constructor & Destructor Documentation

◆ SiStripFEDMonitorPlugin()

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

Definition at line 135 of file SiStripFEDMonitor.cc.

136  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag", edm::InputTag("source", ""))),
137  topFolderName_(iConfig.getUntrackedParameter<std::string>("TopFolderName", "SiStrip")),
138  fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms", false)),
139  fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber", false)),
140  printDebug_(iConfig.getUntrackedParameter<unsigned int>("PrintDebugMessages", 1)),
141  cablingCacheId_(0),
143  fullDebugMode_(iConfig.getUntrackedParameter<bool>("FullDebugMode", false)) {
144  std::string subFolderName = iConfig.getUntrackedParameter<std::string>("HistogramFolderName", "ReadoutView");
145  folderName_ = topFolderName_ + "/" + subFolderName;
146 
147  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
148  heToken_ = consumes<EventWithHistory>(edm::InputTag("consecutiveHEs"));
149 
150  if (iConfig.exists("ErrorFractionByLumiBlockHistogramConfig")) {
151  const edm::ParameterSet& ps =
152  iConfig.getUntrackedParameter<edm::ParameterSet>("ErrorFractionByLumiBlockHistogramConfig");
153  enableFEDerrLumi_ = (ps.exists("Enabled") ? ps.getUntrackedParameter<bool>("Enabled") : true);
154  }
155  //print config to debug log
156  std::ostringstream debugStream;
157  if (printDebug_ > 1) {
158  debugStream << "[SiStripFEDMonitorPlugin]Configuration for SiStripFEDMonitorPlugin: " << std::endl
159  << "[SiStripFEDMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl
160  << "[SiStripFEDMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl
161  << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? "
162  << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl
163  << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl
164  << "[SiStripFEDMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl;
165  }
166 
167  //don;t generate debug mesages if debug is disabled
168  std::ostringstream* pDebugStream = (printDebug_ > 1 ? &debugStream : nullptr);
169 
170  fedHists_.initialise(iConfig, pDebugStream);
171 
172  doTkHistoMap_ = fedHists_.tkHistoMapEnabled();
173 
174  doMedHists_ = fedHists_.cmHistosEnabled();
175 
176  doFEMajorityCheck_ = fedHists_.feMajHistosEnabled();
177 
178  if (printDebug_) {
179  LogTrace("SiStripMonitorHardware") << debugStream.str();
180  }
181 
182  nEvt_ = 0;
183 }

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

◆ ~SiStripFEDMonitorPlugin()

SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin ( )
override

Definition at line 185 of file SiStripFEDMonitor.cc.

185 {}

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > >.

Definition at line 192 of file SiStripFEDMonitor.cc.

192  {
193  //Retrieve tracker topology from geometry
194  edm::ESHandle<TrackerTopology> tTopoHandle;
195  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
196  const TrackerTopology* const tTopo = tTopoHandle.product();
197 
198  //update cabling
199  updateCabling(iSetup);
200 
201  //get raw data
202  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
203  iEvent.getByToken(rawDataToken_, rawDataCollectionHandle);
204  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
205 
206  fedErrors_.initialiseEvent();
207 
208  //add the deltaBX value if the product exist
209 
211  iEvent.getByToken(heToken_, he);
212 
213  //get the fedErrors object for each LS
214  auto lumiErrors = luminosityBlockCache(iEvent.getLuminosityBlock().index());
215  auto& nToterr = lumiErrors->nTotal;
216  auto& nErr = lumiErrors->nErrors;
217 
218  if (he.isValid() && !he.failedToGet()) {
219  fedErrors_.fillEventProperties(he->deltaBX());
220  }
221 
222  //initialise map of fedId/bad channel number
223  std::map<unsigned int, std::pair<unsigned short, unsigned short> > badChannelFraction;
224 
225  unsigned int lNFEDMonitoring = 0;
226  unsigned int lNFEDUnpacker = 0;
227  unsigned int lNChannelMonitoring = 0;
228  unsigned int lNChannelUnpacker = 0;
229 
230  unsigned int lNTotBadFeds = 0;
231  unsigned int lNTotBadChannels = 0;
232  unsigned int lNTotBadActiveChannels = 0;
233 
234  std::vector<std::vector<std::pair<unsigned int, unsigned int> > > lFeMajFrac;
235  const unsigned int nParts = 4;
236  if (doFEMajorityCheck_) {
237  lFeMajFrac.resize(nParts);
238  //max nFE per partition
239  lFeMajFrac[0].reserve(912);
240  lFeMajFrac[1].reserve(1080);
241  lFeMajFrac[2].reserve(768);
242  lFeMajFrac[3].reserve(760);
243  }
244 
245  maxFedBufferSize_ = 0;
246 
247  //loop over siStrip FED IDs
249  fedId++) { //loop over FED IDs
250  unsigned int lNBadChannels_perFEDID = 0;
251  const FEDRawData& fedData = rawDataCollection.FEDData(fedId);
252 
253  //create an object to fill all errors
254  fedErrors_.initialiseFED(fedId, cabling_, tTopo);
255 
256  double aLumiSection = iEvent.orbitNumber() / 262144.0;
257 
258  //Do detailed check
259  //first check if data exists
260  bool lDataExist = fedErrors_.checkDataPresent(fedData);
261  if (!lDataExist) {
262  fedHists_.fillFEDHistograms(fedErrors_, 0, fullDebugMode_, aLumiSection, lNBadChannels_perFEDID);
263  continue;
264  }
265 
266  //check for problems and fill detailed histograms
267  fedErrors_.fillFEDErrors(fedData,
269  printDebug_,
270  lNChannelMonitoring,
271  lNChannelUnpacker,
272  doMedHists_,
273  fedHists_.cmHistPointer(false),
274  fedHists_.cmHistPointer(true),
276  lFeMajFrac);
277 
278  //check filled in previous method.
279  bool lFailUnpackerFEDcheck = fedErrors_.failUnpackerFEDCheck();
280 
281  fedErrors_.incrementFEDCounters();
282  unsigned int lSize = fedData.size();
283  if (lSize > maxFedBufferSize_) {
284  maxFedBufferSize_ = lSize;
285  }
286  //std::cout << " -- " << fedId << " " << lSize << std::endl;
287 
288  //fedHists_.fillFEDHistograms(fedErrors_,lSize,fullDebugMode_);
289 
290  bool lFailMonitoringFEDcheck = fedErrors_.failMonitoringFEDCheck();
291  if (lFailMonitoringFEDcheck)
292  lNTotBadFeds++;
293 
294  //sanity check: if something changed in the unpacking code
295  //but wasn't propagated here
296  //print only the summary, and more info if printDebug>1
297  if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) {
298  if (printDebug_ > 1) {
299  std::ostringstream debugStream;
300  debugStream << " --- WARNING: FED " << fedId << std::endl << " ------ Monitoring FED check ";
301  if (lFailMonitoringFEDcheck)
302  debugStream << "failed." << std::endl;
303  else
304  debugStream << "passed." << std::endl;
305  debugStream << " ------ Unpacker FED check ";
306  if (lFailUnpackerFEDcheck)
307  debugStream << "failed." << std::endl;
308  else
309  debugStream << "passed." << std::endl;
310  edm::LogError("SiStripMonitorHardware") << debugStream.str();
311  }
312 
313  if (lFailMonitoringFEDcheck)
314  lNFEDMonitoring++;
315  else if (lFailUnpackerFEDcheck)
316  lNFEDUnpacker++;
317  }
318 
319  //Fill TkHistoMap:
320  //add an entry for all channels (good = 0),
321  //so that tkHistoMap knows which channels should be there.
322  if (doTkHistoMap_ && !fedHists_.tkHistoMapPointer()) {
323  edm::LogWarning("SiStripMonitorHardware")
324  << " -- Fedid " << fedId << ", TkHistoMap enabled but pointer is null." << std::endl;
325  }
326 
327  fedErrors_.fillBadChannelList(doTkHistoMap_,
328  fedHists_.tkHistoMapPointer(),
329  fedHists_.getFedvsAPVpointer(),
330  lNTotBadChannels,
331  lNTotBadActiveChannels,
332  lNBadChannels_perFEDID,
333  nToterr,
334  nErr);
335  fedHists_.fillFEDHistograms(fedErrors_, lSize, fullDebugMode_, aLumiSection, lNBadChannels_perFEDID);
336  } //loop over FED IDs
337 
338  if (doFEMajorityCheck_) {
339  for (unsigned int iP(0); iP < nParts; ++iP) {
340  //std::cout << " -- Partition " << iP << std::endl;
341  //std::cout << " --- Number of elements in vec = " << lFeMajFrac[iP].size() << std::endl;
342  if (lFeMajFrac[iP].empty())
343  continue;
344  std::sort(lFeMajFrac[iP].begin(), lFeMajFrac[iP].end(), SiStripFEDMonitorPlugin::pairComparison);
345 
346  unsigned int lMajorityCounter = 0;
347  std::vector<unsigned int> lfedIds;
348 
349  getMajority(lFeMajFrac[iP], lMajorityCounter, lfedIds);
350  //std::cout << " -- Found " << lfedIds.size() << " unique elements not matching the majority." << std::endl;
351  fedHists_.fillMajorityHistograms(iP, static_cast<float>(lMajorityCounter) / lFeMajFrac[iP].size(), lfedIds);
352  }
353  }
354 
355  if ((lNTotBadFeds > 0 || lNTotBadChannels > 0) && printDebug_ > 1) {
356  std::ostringstream debugStream;
357  debugStream << "[SiStripFEDMonitorPlugin] --- Total number of bad feds = " << lNTotBadFeds << std::endl
358  << "[SiStripFEDMonitorPlugin] --- Total number of bad channels = " << lNTotBadChannels << std::endl
359  << "[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " << lNTotBadActiveChannels
360  << std::endl;
361  edm::LogInfo("SiStripMonitorHardware") << debugStream.str();
362  }
363 
364  if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) && printDebug_) {
365  std::ostringstream debugStream;
366  debugStream
367  << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------"
368  << std::endl
369  << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------"
370  << std::endl
371  << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : "
372  << std::endl
373  << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring
374  << std::endl
375  << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker
376  << std::endl
377  << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------"
378  << std::endl
379  << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : "
380  << std::endl
381  << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring
382  << std::endl
383  << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker
384  << std::endl
385  << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------"
386  << std::endl
387  << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------"
388  << std::endl;
389  edm::LogError("SiStripMonitorHardware") << debugStream.str();
390  }
391 
392  fedErrors_.getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels;
393  fedErrors_.getFEDErrorsCounters().nTotalBadActiveChannels = lNTotBadActiveChannels;
394 
395  //time in seconds since beginning of the run or event number
396  if (fillWithEvtNum_) {
397  // explicitely casting the event number unsigned long long to double here
398  double eventNumber = static_cast<double>(iEvent.id().event());
399  fedHists_.fillCountersHistograms(
400  fedErrors_.getFEDErrorsCounters(), fedErrors_.getChannelErrorsCounters(), maxFedBufferSize_, eventNumber);
401  } else {
402  double aTime = iEvent.orbitNumber() / 11223.;
403  fedHists_.fillCountersHistograms(
404  fedErrors_.getFEDErrorsCounters(), fedErrors_.getChannelErrorsCounters(), maxFedBufferSize_, aTime);
405  }
406 
407  nEvt_++;
408 
409 } //analyze method

References begin, cabling_, doFEMajorityCheck_, doMedHists_, doTkHistoMap_, relativeConstraints::empty, end, FEDRawDataCollection::FEDData(), fedErrors_, fedHists_, l1tstage2_dqm_sourceclient-live_cfg::fedId, fillWithEvtNum_, fullDebugMode_, edm::EventSetup::get(), get, getMajority(), hcalSimParameters_cfi::he, heToken_, iEvent, maxFedBufferSize_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nEvt_, pairComparison(), printDebug_, edm::ESHandle< T >::product(), rawDataToken_, FEDRawData::size(), findQualityFiles::size, and updateCabling().

◆ bookHistograms()

void SiStripFEDMonitorPlugin::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  eSetup 
)
overrideprivate

Definition at line 479 of file SiStripFEDMonitor.cc.

481  {
482  ibooker.setCurrentFolder(folderName_);
483 
484  edm::ESHandle<TkDetMap> tkDetMapHandle;
485  eSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
486  const TkDetMap* tkDetMap = tkDetMapHandle.product();
487 
488  fedHists_.bookTopLevelHistograms(ibooker, tkDetMap);
489 
491  fedHists_.bookAllFEDHistograms(ibooker, fullDebugMode_);
492 
493  if (enableFEDerrLumi_) {
494  ibooker.cd();
495  ibooker.setCurrentFolder("SiStrip/ReadoutView/PerLumiSection");
496  {
497  auto scope = DQMStore::IBooker::UseRunScope(ibooker);
498  lumiErrfac_ =
499  ibooker.book1D("lumiErrorFraction", "Fraction of error per lumi section vs subdetector", 6, 0.5, 6.5);
500  lumiErrfac_->setAxisTitle("SubDetId", 1);
501  lumiErrfac_->setBinLabel(1, "TECB");
502  lumiErrfac_->setBinLabel(2, "TECF");
503  lumiErrfac_->setBinLabel(3, "TIB");
504  lumiErrfac_->setBinLabel(4, "TIDB");
505  lumiErrfac_->setBinLabel(5, "TIDF");
506  lumiErrfac_->setBinLabel(6, "TOB");
507  }
508  } else {
509  lumiErrfac_ = nullptr;
510  }
511 }

References enableFEDerrLumi_, fedHists_, fillAllDetailedHistograms_, folderName_, fullDebugMode_, edm::EventSetup::get(), get, lumiErrfac_, edm::ESHandle< T >::product(), dqm::impl::MonitorElement::setAxisTitle(), and dqm::impl::MonitorElement::setBinLabel().

◆ getMajority()

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 416 of file SiStripFEDMonitor.cc.

418  {
419  unsigned int lMajAddress = 0;
420  std::vector<std::pair<unsigned int, unsigned int> >::const_iterator lIter = aFeMajVec.begin();
421  unsigned int lMajAddr = (*lIter).second;
422  unsigned int lCounter = 0;
423 
424  //std::cout << " --- First element: addr = " << lMajAddr << " counter = " << lCounter << std::endl;
425  unsigned int iele = 0;
426  //bool foundMaj = false;
427  for (; lIter != aFeMajVec.end(); ++lIter, ++iele) {
428  //std::cout << " ---- Ele " << iele << " " << (*lIter).first << " " << (*lIter).second << " ref " << lMajAddr << std::endl;
429  if ((*lIter).second == lMajAddr) {
430  ++lCounter;
431  //std::cout << " ----- =ref: Counter = " << lCounter << std::endl;
432  } else {
433  //std::cout << " ----- !=ref: Counter = " << lCounter << " Majority = " << aMajorityCounter << std::endl;
434  if (lCounter > aMajorityCounter) {
435  //std::cout << " ------ >Majority: " << std::endl;
436  aMajorityCounter = lCounter;
437  // AV bug here??
438  lMajAddress = lMajAddr;
439  // lMajAddress = (*lIter).second;
440  //foundMaj=true;
441  }
442  lCounter = 0;
443  lMajAddr = (*lIter).second;
444  --lIter;
445  --iele;
446  }
447  }
448  // AV Bug here? The check has to be done regardless foundMaj == false or true
449  // if (!foundMaj) {
450  if (lCounter > aMajorityCounter) {
451  //std::cout << " ------ >Majority: " << std::endl;
452  aMajorityCounter = lCounter;
453  lMajAddress = lMajAddr;
454  }
455  // }
456  //std::cout << " -- found majority value for " << aMajorityCounter << " elements out of " << aFeMajVec.size() << "." << std::endl;
457  //get list of feds with address different from majority in partition:
458  lIter = aFeMajVec.begin();
459  afedIds.reserve(135);
460  for (; lIter != aFeMajVec.end(); ++lIter) {
461  if ((*lIter).second != lMajAddress) {
462  afedIds.push_back((*lIter).first);
463  } else {
464  lIter += aMajorityCounter - 1;
465  if (lIter >= aFeMajVec.end()) {
466  std::cout << "Here it is a bug: " << aMajorityCounter << " " << aFeMajVec.size() << " "
467  << lIter - aFeMajVec.end() << std::endl;
468  }
469  }
470  }
471  //std::cout << " -- Found " << lfedIds.size() << " elements not matching the majority." << std::endl;
472  if (!afedIds.empty()) {
473  std::sort(afedIds.begin(), afedIds.end());
474  std::vector<unsigned int>::iterator lIt = std::unique(afedIds.begin(), afedIds.end());
475  afedIds.erase(lIt, afedIds.end());
476  }
477 }

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

Referenced by analyze().

◆ globalBeginLuminosityBlock()

std::shared_ptr< sifedmon::LumiErrors > SiStripFEDMonitorPlugin::globalBeginLuminosityBlock ( const edm::LuminosityBlock lumi,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 513 of file SiStripFEDMonitor.cc.

514  {
515  auto lumiErrors = std::make_shared<sifedmon::LumiErrors>();
516  lumiErrors->nTotal.resize(6, 0);
517  lumiErrors->nErrors.resize(6, 0);
518  return lumiErrors;
519 }

◆ globalEndLuminosityBlock()

void SiStripFEDMonitorPlugin::globalEndLuminosityBlock ( const edm::LuminosityBlock lumi,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 521 of file SiStripFEDMonitor.cc.

522  {
523  auto lumiErrors = luminosityBlockCache(lumi.index());
525  for (unsigned int iD(0); iD < lumiErrors->nTotal.size(); iD++) {
526  if (lumiErrors->nTotal[iD] > 0)
527  lumiErrfac_->Fill(iD + 1, static_cast<float>(lumiErrors->nErrors[iD]) / lumiErrors->nTotal[iD]);
528  }
529  }
530 }

References enableFEDerrLumi_, dqm::impl::MonitorElement::Fill(), and lumiErrfac_.

◆ pairComparison()

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

Definition at line 411 of file SiStripFEDMonitor.cc.

412  {
413  return (pair1.second < pair2.second);
414 }

Referenced by analyze().

◆ updateCabling()

void SiStripFEDMonitorPlugin::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 532 of file SiStripFEDMonitor.cc.

532  {
533  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
534  if (cablingCacheId_ != currentCacheId) {
535  edm::ESHandle<SiStripFedCabling> cablingHandle;
536  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
537  cabling_ = cablingHandle.product();
538  cablingCacheId_ = currentCacheId;
539  }
540 }

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

Referenced by analyze().

Member Data Documentation

◆ cabling_

const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_
private

Definition at line 112 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and updateCabling().

◆ cablingCacheId_

uint32_t SiStripFEDMonitorPlugin::cablingCacheId_
private

Definition at line 111 of file SiStripFEDMonitor.cc.

Referenced by updateCabling().

◆ doFEMajorityCheck_

bool SiStripFEDMonitorPlugin::doFEMajorityCheck_
private

Definition at line 117 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ doMedHists_

bool SiStripFEDMonitorPlugin::doMedHists_
private

Definition at line 116 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ doTkHistoMap_

bool SiStripFEDMonitorPlugin::doTkHistoMap_
private

Definition at line 115 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ enableFEDerrLumi_

bool SiStripFEDMonitorPlugin::enableFEDerrLumi_
private

◆ fedErrors_

FEDErrors SiStripFEDMonitorPlugin::fedErrors_
private

Definition at line 123 of file SiStripFEDMonitor.cc.

Referenced by analyze().

◆ fedHists_

FEDHistograms SiStripFEDMonitorPlugin::fedHists_
private

Definition at line 100 of file SiStripFEDMonitor.cc.

Referenced by analyze(), bookHistograms(), and SiStripFEDMonitorPlugin().

◆ fillAllDetailedHistograms_

bool SiStripFEDMonitorPlugin::fillAllDetailedHistograms_
private

Definition at line 105 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

◆ fillWithEvtNum_

bool SiStripFEDMonitorPlugin::fillWithEvtNum_
private

Definition at line 107 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ folderName_

std::string SiStripFEDMonitorPlugin::folderName_
private

Definition at line 103 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

◆ fullDebugMode_

bool SiStripFEDMonitorPlugin::fullDebugMode_
private

Definition at line 125 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and bookHistograms().

◆ heToken_

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

Definition at line 97 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ lumiErrfac_

MonitorElement* SiStripFEDMonitorPlugin::lumiErrfac_
private

Definition at line 128 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and globalEndLuminosityBlock().

◆ maxFedBufferSize_

unsigned int SiStripFEDMonitorPlugin::maxFedBufferSize_
private

Definition at line 124 of file SiStripFEDMonitor.cc.

Referenced by analyze().

◆ nEvt_

unsigned int SiStripFEDMonitorPlugin::nEvt_
private

Definition at line 119 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ printDebug_

unsigned int SiStripFEDMonitorPlugin::printDebug_
private

Definition at line 109 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ rawDataTag_

edm::InputTag SiStripFEDMonitorPlugin::rawDataTag_
private

Definition at line 95 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

◆ rawDataToken_

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

Definition at line 96 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ topFolderName_

std::string SiStripFEDMonitorPlugin::topFolderName_
private

Definition at line 102 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

SiStripFEDMonitorPlugin::updateCabling
void updateCabling(const edm::EventSetup &eventSetup)
Definition: SiStripFEDMonitor.cc:532
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SiStripFEDMonitorPlugin::rawDataToken_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
Definition: SiStripFEDMonitor.cc:96
SiStripFEDMonitorPlugin::fillAllDetailedHistograms_
bool fillAllDetailedHistograms_
Definition: SiStripFEDMonitor.cc:105
SiStripFEDMonitorPlugin::cablingCacheId_
uint32_t cablingCacheId_
Definition: SiStripFEDMonitor.cc:111
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
TrackerTopology
Definition: TrackerTopology.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripFEDMonitorPlugin::cabling_
const SiStripFedCabling * cabling_
Definition: SiStripFEDMonitor.cc:112
edm::LogInfo
Definition: MessageLogger.h:254
SiStripFEDMonitorPlugin::getMajority
void getMajority(const std::vector< std::pair< unsigned int, unsigned int > > &aFeMajVec, unsigned int &aMajorityCounter, std::vector< unsigned int > &afedIds)
Definition: SiStripFEDMonitor.cc:416
SiStripFEDMonitorPlugin::topFolderName_
std::string topFolderName_
Definition: SiStripFEDMonitor.cc:102
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
SiStripFEDMonitorPlugin::maxFedBufferSize_
unsigned int maxFedBufferSize_
Definition: SiStripFEDMonitor.cc:124
SiStripFEDMonitorPlugin::printDebug_
unsigned int printDebug_
Definition: SiStripFEDMonitor.cc:109
SiStripFEDMonitorPlugin::doFEMajorityCheck_
bool doFEMajorityCheck_
Definition: SiStripFEDMonitor.cc:117
edm::Handle
Definition: AssociativeIterator.h:50
end
#define end
Definition: vmac.h:39
FEDRawData
Definition: FEDRawData.h:19
SiStripFEDMonitorPlugin::fedErrors_
FEDErrors fedErrors_
Definition: SiStripFEDMonitor.cc:123
SiStripFEDMonitorPlugin::fillWithEvtNum_
bool fillWithEvtNum_
Definition: SiStripFEDMonitor.cc:107
SiStripFEDMonitorPlugin::doTkHistoMap_
bool doTkHistoMap_
Definition: SiStripFEDMonitor.cc:115
SiStripFedCablingRcd
Definition: SiStripCondDataRecords.h:22
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
edm::ESHandle< TrackerTopology >
TkDetMap
Definition: TkDetMap.h:175
SiStripFEDMonitorPlugin::doMedHists_
bool doMedHists_
Definition: SiStripFEDMonitor.cc:116
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
SiStripFEDMonitorPlugin::lumiErrfac_
MonitorElement * lumiErrfac_
Definition: SiStripFEDMonitor.cc:128
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::LogWarning
Definition: MessageLogger.h:141
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
FEDNumbering::MAXSiStripFEDID
Definition: FEDNumbering.h:30
SiStripFEDMonitorPlugin::fedHists_
FEDHistograms fedHists_
Definition: SiStripFEDMonitor.cc:100
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
iEvent
int iEvent
Definition: GenABIO.cc:224
dqm::impl::MonitorElement::setBinLabel
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:771
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:82
get
#define get
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
hcalSimParameters_cfi.he
he
Definition: hcalSimParameters_cfi.py:75
SiStripFEDMonitorPlugin::fullDebugMode_
bool fullDebugMode_
Definition: SiStripFEDMonitor.cc:125
SiStripFEDMonitorPlugin::pairComparison
static bool pairComparison(const std::pair< unsigned int, unsigned int > &pair1, const std::pair< unsigned int, unsigned int > &pair2)
Definition: SiStripFEDMonitor.cc:411
relativeConstraints.empty
bool empty
Definition: relativeConstraints.py:46
dqm::implementation::IBooker::UseRunScope
UseScope< MonitorElementData::Scope::RUN > UseRunScope
Definition: DQMStore.h:464
SiStripFEDMonitorPlugin::rawDataTag_
edm::InputTag rawDataTag_
Definition: SiStripFEDMonitor.cc:95
SiStripFEDMonitorPlugin::heToken_
edm::EDGetTokenT< EventWithHistory > heToken_
Definition: SiStripFEDMonitor.cc:97
SiStripFEDMonitorPlugin::nEvt_
unsigned int nEvt_
Definition: SiStripFEDMonitor.cc:119
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
SiStripFEDMonitorPlugin::enableFEDerrLumi_
bool enableFEDerrLumi_
Definition: SiStripFEDMonitor.cc:127
lumi
Definition: LumiSectionData.h:20
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
edm::InputTag
Definition: InputTag.h:15
begin
#define begin
Definition: vmac.h:32
SiStripFEDMonitorPlugin::folderName_
std::string folderName_
Definition: SiStripFEDMonitor.cc:103
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
FEDNumbering::MINSiStripFEDID
Definition: FEDNumbering.h:29