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:
DQMOneLumiEDAnalyzer<> DQMOneEDAnalyzer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args... > 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 DQMOneLumiEDAnalyzer<>
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
 DQMOneLumiEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
bool getCanSaveByLumi () override
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args... >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
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
 
- 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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 dqmBeginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void dqmEndLuminosityBlock (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 DQMOneEDAnalyzer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args... >
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 DQMOneLumiEDAnalyzer<>
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args... >
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
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
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMOneLumiEDAnalyzer<>
edm::EDPutTokenT< DQMTokenlumiToken_
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args... >
edm::EDPutTokenT< DQMTokenrunToken_
 

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

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

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

166 {}

Member Function Documentation

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

Definition at line 173 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_, l1tstage2_dqm_sourceclient-live_cfg::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().

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

Implements DQMOneEDAnalyzer< edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, Args... >.

Definition at line 453 of file SiStripFEDMonitor.cc.

References fedHists_, fillAllDetailedHistograms_, folderName_, fullDebugMode_, edm::EventSetup::get(), edm::ESHandle< T >::product(), and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

455  {
456  ibooker.setCurrentFolder(folderName_);
457 
458  edm::ESHandle<TkDetMap> tkDetMapHandle;
459  eSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
460  const TkDetMap* tkDetMap = tkDetMapHandle.product();
461 
462  fedHists_.bookTopLevelHistograms(ibooker, tkDetMap);
463 
465  fedHists_.bookAllFEDHistograms(ibooker, fullDebugMode_);
466 }
T const * product() const
Definition: ESHandle.h:86
void SiStripFEDMonitorPlugin::dqmBeginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivate

Definition at line 468 of file SiStripFEDMonitor.cc.

References fedErrors_.

469  {
470  fedErrors_.initialiseLumiBlock();
471 }
void SiStripFEDMonitorPlugin::dqmEndLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivate

Definition at line 473 of file SiStripFEDMonitor.cc.

References fedErrors_, and fedHists_.

474  {
475  fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors());
476 }
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 390 of file SiStripFEDMonitor.cc.

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

Referenced by analyze().

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

Referenced by analyze().

386  {
387  return (pair1.second < pair2.second);
388 }
void SiStripFEDMonitorPlugin::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 478 of file SiStripFEDMonitor.cc.

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

Referenced by analyze().

478  {
479  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
480  if (cablingCacheId_ != currentCacheId) {
481  edm::ESHandle<SiStripFedCabling> cablingHandle;
482  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
483  cabling_ = cablingHandle.product();
484  cablingCacheId_ = currentCacheId;
485  }
486 }
const SiStripFedCabling * cabling_
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_
private

Definition at line 100 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and updateCabling().

uint32_t SiStripFEDMonitorPlugin::cablingCacheId_
private

Definition at line 99 of file SiStripFEDMonitor.cc.

Referenced by updateCabling().

bool SiStripFEDMonitorPlugin::doFEMajorityCheck_
private

Definition at line 105 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doMedHists_
private

Definition at line 104 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doTkHistoMap_
private

Definition at line 103 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

FEDErrors SiStripFEDMonitorPlugin::fedErrors_
private

Definition at line 111 of file SiStripFEDMonitor.cc.

Referenced by analyze(), dqmBeginLuminosityBlock(), and dqmEndLuminosityBlock().

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

Definition at line 93 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fillWithEvtNum_
private

Definition at line 95 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::folderName_
private

Definition at line 91 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fullDebugMode_
private

Definition at line 114 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 85 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::maxFedBufferSize_
private

Definition at line 112 of file SiStripFEDMonitor.cc.

Referenced by analyze().

unsigned int SiStripFEDMonitorPlugin::nEvt_
private

Definition at line 107 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::printDebug_
private

Definition at line 97 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

edm::InputTag SiStripFEDMonitorPlugin::rawDataTag_
private

Definition at line 83 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

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

Definition at line 84 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::topFolderName_
private

Definition at line 90 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().