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
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 SiStripFedCablingRcd &cablingRcd)
 

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_
 
bool doFEMajorityCheck_
 
bool doMedHists_
 
bool doTkHistoMap_
 
bool enableFEDerrLumi_
 
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcdfedCablingToken_
 
edm::ESWatcher< SiStripFedCablingRcdfedCablingWatcher_
 
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_
 
edm::ESGetToken< TkDetMap, TrackerTopologyRcdtkDetMapToken_
 
std::string topFolderName_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken_
 

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 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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 139 of file SiStripFEDMonitor.cc.

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

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

192 {}

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

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

References cabling_, edm::ESWatcher< T >::check(), doFEMajorityCheck_, doMedHists_, doTkHistoMap_, relativeConstraints::empty, mps_fire::end, fedCablingWatcher_, FEDRawDataCollection::FEDData(), fedErrors_, fedHists_, l1tstage2_dqm_sourceclient-live_cfg::fedId, fillWithEvtNum_, fullDebugMode_, edm::EventSetup::getData(), getMajority(), hcalSimParameters_cfi::he, heToken_, iEvent, maxFedBufferSize_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nEvt_, pairComparison(), printDebug_, rawDataToken_, FEDRawData::size(), findQualityFiles::size, jetUpdater_cfi::sort, and tTopoToken_.

◆ bookHistograms()

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

Implements DQMOneEDAnalyzer< edm::LuminosityBlockCache< sifedmon::LumiErrors > >.

Definition at line 481 of file SiStripFEDMonitor.cc.

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

References dqm::implementation::IBooker::book1D(), dqm::implementation::NavigatorBase::cd(), enableFEDerrLumi_, fedHists_, fillAllDetailedHistograms_, folderName_, fullDebugMode_, edm::EventSetup::getData(), lumiErrfac_, dqm::impl::MonitorElement::setAxisTitle(), dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::setCurrentFolder(), and tkDetMapToken_.

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

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

References gather_cfg::cout, jetUpdater_cfi::sort, 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 512 of file SiStripFEDMonitor.cc.

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

◆ globalEndLuminosityBlock()

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

Definition at line 520 of file SiStripFEDMonitor.cc.

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

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

414  {
415  return (pair1.second < pair2.second);
416 }

Referenced by analyze().

◆ updateCabling()

void SiStripFEDMonitorPlugin::updateCabling ( const SiStripFedCablingRcd cablingRcd)
private

Definition at line 531 of file SiStripFEDMonitor.cc.

531  {
532  cabling_ = &cablingRcd.get(fedCablingToken_);
533 }

References cabling_, fedCablingToken_, and edm::eventsetup::EventSetupRecordImplementation< T >::get().

Member Data Documentation

◆ cabling_

const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_
private

Definition at line 111 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and updateCabling().

◆ doFEMajorityCheck_

bool SiStripFEDMonitorPlugin::doFEMajorityCheck_
private

Definition at line 121 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ doMedHists_

bool SiStripFEDMonitorPlugin::doMedHists_
private

Definition at line 120 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ doTkHistoMap_

bool SiStripFEDMonitorPlugin::doTkHistoMap_
private

Definition at line 119 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

◆ enableFEDerrLumi_

bool SiStripFEDMonitorPlugin::enableFEDerrLumi_
private

◆ fedCablingToken_

edm::ESGetToken<SiStripFedCabling, SiStripFedCablingRcd> SiStripFEDMonitorPlugin::fedCablingToken_
private

Definition at line 114 of file SiStripFEDMonitor.cc.

Referenced by updateCabling().

◆ fedCablingWatcher_

edm::ESWatcher<SiStripFedCablingRcd> SiStripFEDMonitorPlugin::fedCablingWatcher_
private

Definition at line 113 of file SiStripFEDMonitor.cc.

Referenced by analyze().

◆ fedErrors_

FEDErrors SiStripFEDMonitorPlugin::fedErrors_
private

Definition at line 127 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 129 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 132 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and globalEndLuminosityBlock().

◆ maxFedBufferSize_

unsigned int SiStripFEDMonitorPlugin::maxFedBufferSize_
private

Definition at line 128 of file SiStripFEDMonitor.cc.

Referenced by analyze().

◆ nEvt_

unsigned int SiStripFEDMonitorPlugin::nEvt_
private

Definition at line 123 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().

◆ tkDetMapToken_

edm::ESGetToken<TkDetMap, TrackerTopologyRcd> SiStripFEDMonitorPlugin::tkDetMapToken_
private

Definition at line 116 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms().

◆ topFolderName_

std::string SiStripFEDMonitorPlugin::topFolderName_
private

Definition at line 102 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

◆ tTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiStripFEDMonitorPlugin::tTopoToken_
private

Definition at line 115 of file SiStripFEDMonitor.cc.

Referenced by analyze().

SiStripFEDMonitorPlugin::fedCablingToken_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
Definition: SiStripFEDMonitor.cc:114
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
SiStripFEDMonitorPlugin::rawDataToken_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
Definition: SiStripFEDMonitor.cc:96
SiStripFEDMonitorPlugin::fillAllDetailedHistograms_
bool fillAllDetailedHistograms_
Definition: SiStripFEDMonitor.cc:105
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
gather_cfg.cout
cout
Definition: gather_cfg.py:144
SiStripFEDMonitorPlugin::cabling_
const SiStripFedCabling * cabling_
Definition: SiStripFEDMonitor.cc:111
SiStripFEDMonitorPlugin::updateCabling
void updateCabling(const SiStripFedCablingRcd &cablingRcd)
Definition: SiStripFEDMonitor.cc:531
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
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:418
SiStripFEDMonitorPlugin::topFolderName_
std::string topFolderName_
Definition: SiStripFEDMonitor.cc:102
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
SiStripFEDMonitorPlugin::maxFedBufferSize_
unsigned int maxFedBufferSize_
Definition: SiStripFEDMonitor.cc:128
SiStripFEDMonitorPlugin::printDebug_
unsigned int printDebug_
Definition: SiStripFEDMonitor.cc:109
SiStripFEDMonitorPlugin::doFEMajorityCheck_
bool doFEMajorityCheck_
Definition: SiStripFEDMonitor.cc:121
edm::Handle< FEDRawDataCollection >
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
SiStripFEDMonitorPlugin::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripFEDMonitor.cc:115
FEDRawData
Definition: FEDRawData.h:19
SiStripFEDMonitorPlugin::fedErrors_
FEDErrors fedErrors_
Definition: SiStripFEDMonitor.cc:127
SiStripFEDMonitorPlugin::fillWithEvtNum_
bool fillWithEvtNum_
Definition: SiStripFEDMonitor.cc:107
SiStripFEDMonitorPlugin::doTkHistoMap_
bool doTkHistoMap_
Definition: SiStripFEDMonitor.cc:119
FEDNumbering::MINSiStripFEDID
Definition: FEDNumbering.h:29
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
mps_fire.end
end
Definition: mps_fire.py:242
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
SiStripFEDMonitorPlugin::doMedHists_
bool doMedHists_
Definition: SiStripFEDMonitor.cc:120
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
SiStripFEDMonitorPlugin::lumiErrfac_
MonitorElement * lumiErrfac_
Definition: SiStripFEDMonitor.cc:132
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:681
SiStripFEDMonitorPlugin::fedHists_
FEDHistograms fedHists_
Definition: SiStripFEDMonitor.cc:100
edm::ParameterSet
Definition: ParameterSet.h:47
SiStripFEDMonitorPlugin::tkDetMapToken_
edm::ESGetToken< TkDetMap, TrackerTopologyRcd > tkDetMapToken_
Definition: SiStripFEDMonitor.cc:116
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
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:762
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:89
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:127
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
hcalSimParameters_cfi.he
he
Definition: hcalSimParameters_cfi.py:79
SiStripFEDMonitorPlugin::fullDebugMode_
bool fullDebugMode_
Definition: SiStripFEDMonitor.cc:129
SiStripFEDMonitorPlugin::pairComparison
static bool pairComparison(const std::pair< unsigned int, unsigned int > &pair1, const std::pair< unsigned int, unsigned int > &pair2)
Definition: SiStripFEDMonitor.cc:413
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
FEDNumbering::MAXSiStripFEDID
Definition: FEDNumbering.h:30
SiStripFEDMonitorPlugin::heToken_
edm::EDGetTokenT< EventWithHistory > heToken_
Definition: SiStripFEDMonitor.cc:97
SiStripFEDMonitorPlugin::nEvt_
unsigned int nEvt_
Definition: SiStripFEDMonitor.cc:123
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition: EventSetupRecordImplementation.h:74
SiStripFEDMonitorPlugin::fedCablingWatcher_
edm::ESWatcher< SiStripFedCablingRcd > fedCablingWatcher_
Definition: SiStripFEDMonitor.cc:113
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
SiStripFEDMonitorPlugin::enableFEDerrLumi_
bool enableFEDerrLumi_
Definition: SiStripFEDMonitor.cc:131
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:791
edm::InputTag
Definition: InputTag.h:15
SiStripFEDMonitorPlugin::folderName_
std::string folderName_
Definition: SiStripFEDMonitor.cc:103
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443