CMS 3D CMS Logo

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

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

Inheritance diagram for SiStripFEDMonitorPlugin:
DQMEDAnalyzer edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 SiStripFEDMonitorPlugin (const edm::ParameterSet &)
 
 ~SiStripFEDMonitorPlugin () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Static Private Member Functions

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

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::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 edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
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 124 of file SiStripFEDMonitor.cc.

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

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

Definition at line 170 of file SiStripFEDMonitor.cc.

171 {
172 }

Member Function Documentation

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

Definition at line 181 of file SiStripFEDMonitor.cc.

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

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

Definition at line 481 of file SiStripFEDMonitor.cc.

References fedErrors_.

483 {
484 
485  fedErrors_.initialiseLumiBlock();
486 
487 }
void SiStripFEDMonitorPlugin::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Implements DQMEDAnalyzer.

Definition at line 467 of file SiStripFEDMonitor.cc.

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

468 {
469  ibooker.setCurrentFolder(folderName_);
470 
471  edm::ESHandle<TkDetMap> tkDetMapHandle;
472  eSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
473  const TkDetMap* tkDetMap = tkDetMapHandle.product();
474 
475  fedHists_.bookTopLevelHistograms(ibooker, tkDetMap);
476 
477  if (fillAllDetailedHistograms_) fedHists_.bookAllFEDHistograms(ibooker , fullDebugMode_ );
478 }
T const * product() const
Definition: ESHandle.h:86
void SiStripFEDMonitorPlugin::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivate

Definition at line 491 of file SiStripFEDMonitor.cc.

References fedErrors_, and fedHists_.

493 {
494  fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors());
495 }
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 400 of file SiStripFEDMonitor.cc.

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

Referenced by analyze().

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

Referenced by analyze().

396  {
397  return (pair1.second < pair2.second) ;
398 }
void SiStripFEDMonitorPlugin::updateCabling ( const edm::EventSetup eventSetup)
private

Definition at line 500 of file SiStripFEDMonitor.cc.

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

Referenced by analyze().

501 {
502  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
503  if (cablingCacheId_ != currentCacheId) {
504  edm::ESHandle<SiStripFedCabling> cablingHandle;
505  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
506  cabling_ = cablingHandle.product();
507  cablingCacheId_ = currentCacheId;
508  }
509 }
const SiStripFedCabling * cabling_
T get() const
Definition: EventSetup.h:63
T const * product() const
Definition: ESHandle.h:86

Member Data Documentation

const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_
private

Definition at line 102 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and updateCabling().

uint32_t SiStripFEDMonitorPlugin::cablingCacheId_
private

Definition at line 101 of file SiStripFEDMonitor.cc.

Referenced by updateCabling().

bool SiStripFEDMonitorPlugin::doFEMajorityCheck_
private

Definition at line 107 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doMedHists_
private

Definition at line 106 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doTkHistoMap_
private

Definition at line 105 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

FEDErrors SiStripFEDMonitorPlugin::fedErrors_
private

Definition at line 113 of file SiStripFEDMonitor.cc.

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

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

Definition at line 95 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fillWithEvtNum_
private

Definition at line 97 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::folderName_
private

Definition at line 93 of file SiStripFEDMonitor.cc.

Referenced by bookHistograms(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fullDebugMode_
private

Definition at line 116 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and bookHistograms().

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

Definition at line 87 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::maxFedBufferSize_
private

Definition at line 114 of file SiStripFEDMonitor.cc.

Referenced by analyze().

unsigned int SiStripFEDMonitorPlugin::nEvt_
private

Definition at line 109 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::printDebug_
private

Definition at line 99 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

edm::InputTag SiStripFEDMonitorPlugin::rawDataTag_
private

Definition at line 85 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

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

Definition at line 86 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::topFolderName_
private

Definition at line 92 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().