CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 SiStripFEDMonitorPlugin (const edm::ParameterSet &)
 
 ~SiStripFEDMonitorPlugin ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
virtual void endJob () override
 
virtual 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_
 
DQMStoredqm_
 
std::string dqmStoreFileName_
 
FEDErrors fedErrors_
 
FEDHistograms fedHists_
 
bool fillAllDetailedHistograms_
 
bool fillWithEvtNum_
 
std::string folderName_
 
edm::EDGetTokenT
< EventWithHistory
heToken_
 
unsigned int maxFedBufferSize_
 
unsigned int nEvt_
 
unsigned int printDebug_
 
edm::InputTag rawDataTag_
 
edm::EDGetTokenT
< FEDRawDataCollection
rawDataToken_
 
std::string topFolderName_
 
bool writeDQMStore_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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

Definition at line 61 of file SiStripFEDMonitor.cc.

Constructor & Destructor Documentation

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

Definition at line 129 of file SiStripFEDMonitor.cc.

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

130  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))),
131  topFolderName_(iConfig.getUntrackedParameter<std::string>("TopFolderName","SiStrip")),
132  fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms",false)),
133  fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber",false)),
134  printDebug_(iConfig.getUntrackedParameter<unsigned int>("PrintDebugMessages",1)),
135  //printDebug_(iConfig.getUntrackedParameter<bool>("PrintDebugMessages",false)),
136  writeDQMStore_(iConfig.getUntrackedParameter<bool>("WriteDQMStore",false)),
137  dqmStoreFileName_(iConfig.getUntrackedParameter<std::string>("DQMStoreFileName","DQMStore.root")),
138  dqm_(0),
139  cablingCacheId_(0),
141 {
142  std::string subFolderName = iConfig.getUntrackedParameter<std::string>("HistogramFolderName","ReadoutView");
143  folderName_ = topFolderName_ + "/" + subFolderName;
144 
145 
146  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
147  heToken_ = consumes<EventWithHistory>(edm::InputTag("consecutiveHEs") );
148 
149  //print config to debug log
150  std::ostringstream debugStream;
151  if (printDebug_>1) {
152  debugStream << "[SiStripFEDMonitorPlugin]Configuration for SiStripFEDMonitorPlugin: " << std::endl
153  << "[SiStripFEDMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl
154  << "[SiStripFEDMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl
155  << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl
156  << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl
157  << "[SiStripFEDMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl
158  << "[SiStripFEDMonitorPlugin]\tWriteDQMStore? " << (writeDQMStore_ ? "yes" : "no") << std::endl;
159  if (writeDQMStore_) debugStream << "[SiStripFEDMonitorPlugin]\tDQMStoreFileName: " << dqmStoreFileName_ << std::endl;
160  }
161 
162  //don;t generate debug mesages if debug is disabled
163  std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : NULL);
164 
165  fedHists_.initialise(iConfig,pDebugStream);
166 
167  doTkHistoMap_ = fedHists_.tkHistoMapEnabled();
168 
169  doMedHists_ = fedHists_.cmHistosEnabled();
170 
171  doFEMajorityCheck_ = fedHists_.feMajHistosEnabled();
172 
173  if (printDebug_) {
174  LogTrace("SiStripMonitorHardware") << debugStream.str();
175 
176  //debugStream.str("");
177 
178  //debugStream << " -- Quelle est la difference entre un canard ? " << std::endl
179  // << " -- Reponse: c'est qu'il a les deux pattes de la meme longueur, surtout la gauche." << std::endl;
180 
181  //edm::LogError("SiStripMonitorHardware") << debugStream.str();
182  }
183 
184  nEvt_ = 0;
185 
186 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
#define NULL
Definition: scimark2.h:8
#define LogTrace(id)
edm::EDGetTokenT< EventWithHistory > heToken_
SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin ( )

Definition at line 188 of file SiStripFEDMonitor.cc.

189 {
190 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 199 of file SiStripFEDMonitor.cc.

References begin, cabling_, doFEMajorityCheck_, doMedHists_, doTkHistoMap_, end, edm::EventID::event(), edm::HandleBase::failedToGet(), FEDRawDataCollection::FEDData(), fedErrors_, fedHists_, fillWithEvtNum_, edm::EventSetup::get(), edm::Event::getByToken(), getMajority(), heToken_, edm::EventBase::id(), edm::HandleBase::isValid(), maxFedBufferSize_, FEDNumbering::MAXSiStripFEDID, FEDNumbering::MINSiStripFEDID, nEvt_, edm::EventBase::orbitNumber(), pairComparison(), printDebug_, edm::ESHandle< class >::product(), rawDataToken_, FEDRawData::size(), findQualityFiles::size, python.multivaluedict::sort(), and updateCabling().

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

Reimplemented from edm::EDAnalyzer.

Definition at line 471 of file SiStripFEDMonitor.cc.

References dqm_, fedHists_, fillAllDetailedHistograms_, folderName_, nEvt_, and DQMStore::setCurrentFolder().

472 {
473  //get DQM store
476 
477  //this propagates dqm_ to the histoclass, must be called !
478  fedHists_.bookTopLevelHistograms(dqm_);
479 
480  if (fillAllDetailedHistograms_) fedHists_.bookAllFEDHistograms();
481 
482  nEvt_ = 0;
483 
484  //const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
485  //const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
486 
487  //mark all channels as inactive until they have been 'locked' at least once
488  // activeChannels_.resize(siStripFedIdMax+1);
489  // for (unsigned int fedId = siStripFedIdMin;
490  // fedId <= siStripFedIdMax;
491  // fedId++) {
492  // activeChannels_[fedId].resize(sistrip::FEDCH_PER_FED,false);
493  // }
494 
495 
496 
497 
498 }
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void SiStripFEDMonitorPlugin::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 510 of file SiStripFEDMonitor.cc.

References fedErrors_.

512 {
513 
514  fedErrors_.initialiseLumiBlock();
515 
516 }
void SiStripFEDMonitorPlugin::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 502 of file SiStripFEDMonitor.cc.

References dqm_, dqmStoreFileName_, DQMStore::save(), and writeDQMStore_.

503 {
505 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
void SiStripFEDMonitorPlugin::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 520 of file SiStripFEDMonitor.cc.

References fedErrors_, and fedHists_.

522 {
523  fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors());
524 }
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 402 of file SiStripFEDMonitor.cc.

References gather_cfg::cout, and python.multivaluedict::sort().

Referenced by analyze().

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

Definition at line 397 of file SiStripFEDMonitor.cc.

Referenced by analyze().

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

Definition at line 529 of file SiStripFEDMonitor.cc.

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

Referenced by analyze().

530 {
531  uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
532  if (cablingCacheId_ != currentCacheId) {
533  edm::ESHandle<SiStripFedCabling> cablingHandle;
534  eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
535  cabling_ = cablingHandle.product();
536  cablingCacheId_ = currentCacheId;
537  }
538 }
const SiStripFedCabling * cabling_
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62

Member Data Documentation

const SiStripFedCabling* SiStripFEDMonitorPlugin::cabling_
private

Definition at line 109 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and updateCabling().

uint32_t SiStripFEDMonitorPlugin::cablingCacheId_
private

Definition at line 108 of file SiStripFEDMonitor.cc.

Referenced by updateCabling().

bool SiStripFEDMonitorPlugin::doFEMajorityCheck_
private

Definition at line 114 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doMedHists_
private

Definition at line 113 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::doTkHistoMap_
private

Definition at line 112 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

DQMStore* SiStripFEDMonitorPlugin::dqm_
private

Definition at line 106 of file SiStripFEDMonitor.cc.

Referenced by beginJob(), and endJob().

std::string SiStripFEDMonitorPlugin::dqmStoreFileName_
private

Definition at line 104 of file SiStripFEDMonitor.cc.

Referenced by endJob(), and SiStripFEDMonitorPlugin().

FEDErrors SiStripFEDMonitorPlugin::fedErrors_
private

Definition at line 120 of file SiStripFEDMonitor.cc.

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

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

Definition at line 96 of file SiStripFEDMonitor.cc.

Referenced by beginJob(), and SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::fillWithEvtNum_
private

Definition at line 98 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::folderName_
private

Definition at line 94 of file SiStripFEDMonitor.cc.

Referenced by beginJob(), and SiStripFEDMonitorPlugin().

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

Definition at line 88 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

unsigned int SiStripFEDMonitorPlugin::maxFedBufferSize_
private

Definition at line 121 of file SiStripFEDMonitor.cc.

Referenced by analyze().

unsigned int SiStripFEDMonitorPlugin::nEvt_
private

Definition at line 116 of file SiStripFEDMonitor.cc.

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

unsigned int SiStripFEDMonitorPlugin::printDebug_
private

Definition at line 100 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

edm::InputTag SiStripFEDMonitorPlugin::rawDataTag_
private

Definition at line 86 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

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

Definition at line 87 of file SiStripFEDMonitor.cc.

Referenced by analyze(), and SiStripFEDMonitorPlugin().

std::string SiStripFEDMonitorPlugin::topFolderName_
private

Definition at line 93 of file SiStripFEDMonitor.cc.

Referenced by SiStripFEDMonitorPlugin().

bool SiStripFEDMonitorPlugin::writeDQMStore_
private

Definition at line 103 of file SiStripFEDMonitor.cc.

Referenced by endJob(), and SiStripFEDMonitorPlugin().