CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DQM/SiStripMonitorHardware/src/SiStripFEDMonitor.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    DQM/SiStripMonitorHardware
00004 // Class:      SiStripFEDMonitorPlugin
00005 // 
00010 //
00011 // Original Author:  Nicholas Cripps
00012 //         Created:  2008/09/16
00013 // $Id: SiStripFEDMonitor.cc,v 1.3 2013/01/03 18:59:36 wmtan Exp $
00014 //
00015 //Modified        :  Anne-Marie Magnan
00016 //   ---- 2009/04/21 : histogram management put in separate class
00017 //                     struct helper to simplify arguments of functions
00018 //   ---- 2009/04/22 : add TkHistoMap with % of bad channels per module
00019 //   ---- 2009/04/27 : create FEDErrors class 
00020 
00021 #include <sstream>
00022 #include <memory>
00023 #include <list>
00024 #include <algorithm>
00025 #include <cassert>
00026 
00027 #include "FWCore/Framework/interface/Frameworkfwd.h"
00028 #include "FWCore/Framework/interface/EDAnalyzer.h"
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/EventSetup.h"
00031 #include "FWCore/Framework/interface/ESHandle.h"
00032 #include "FWCore/Framework/interface/LuminosityBlock.h"
00033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00034 #include "FWCore/Utilities/interface/InputTag.h"
00035 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00036 #include "FWCore/ServiceRegistry/interface/Service.h"
00037 #include "FWCore/Utilities/interface/Exception.h"
00038 
00039 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00040 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00041 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00042 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
00043 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
00044 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00045 
00046 #include "CondFormats/DataRecord/interface/SiStripFedCablingRcd.h"
00047 #include "CondFormats/SiStripObjects/interface/SiStripFedCabling.h"
00048 
00049 #include "DQMServices/Core/interface/DQMStore.h"
00050 
00051 #include "DQM/SiStripMonitorHardware/interface/FEDHistograms.hh"
00052 #include "DQM/SiStripMonitorHardware/interface/FEDErrors.hh"
00053 
00054 #include "DPGAnalysis/SiStripTools/interface/EventWithHistory.h"
00055 
00056 
00057 //
00058 // Class declaration
00059 //
00060 
00061 class SiStripFEDMonitorPlugin : public edm::EDAnalyzer
00062 {
00063  public:
00064   explicit SiStripFEDMonitorPlugin(const edm::ParameterSet&);
00065   ~SiStripFEDMonitorPlugin();
00066  private:
00067   virtual void beginJob();
00068   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00069   virtual void endJob();
00070   virtual void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00071                                     const edm::EventSetup& context);
00072   virtual void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00073                                   const edm::EventSetup& context);
00074 
00075   //update the cabling if necessary
00076   void updateCabling(const edm::EventSetup& eventSetup);
00077 
00078   static bool pairComparison(const std::pair<unsigned int, unsigned int> & pair1,
00079                              const std::pair<unsigned int, unsigned int> & pair2);
00080 
00081   void getMajority(const std::vector<std::pair<unsigned int,unsigned int> > & aFeMajVec,
00082                    unsigned int & aMajorityCounter,
00083                    std::vector<unsigned int> & afedIds);
00084 
00085   //tag of FEDRawData collection
00086   edm::InputTag rawDataTag_;
00087   //histogram helper class
00088   FEDHistograms fedHists_;
00089   //folder name for histograms in DQMStore
00090   std::string folderName_;
00091   //book detailed histograms even if they will be empty (for merging)
00092   bool fillAllDetailedHistograms_;
00093   //do histos vs time with time=event number. Default time = orbit number (s)
00094   bool fillWithEvtNum_;
00095   //print debug messages when problems are found: 1=error debug, 2=light debug, 3=full debug
00096   unsigned int printDebug_;
00097   //bool printDebug_;
00098   //write the DQMStore to a root file at the end of the job
00099   bool writeDQMStore_;
00100   std::string dqmStoreFileName_;
00101   //the DQMStore
00102   DQMStore* dqm_;
00103   //FED cabling
00104   uint32_t cablingCacheId_;
00105   const SiStripFedCabling* cabling_;
00106 
00107   //add parameter to save computing time if TkHistoMap/Median/FeMajCheck are not enabled
00108   bool doTkHistoMap_;
00109   bool doMedHists_;
00110   bool doFEMajorityCheck_;
00111 
00112   unsigned int nEvt_;
00113 
00114   //FED errors
00115   //need class member for lumi histograms
00116   FEDErrors fedErrors_;
00117   unsigned int maxFedBufferSize_;
00118 };
00119 
00120 
00121 //
00122 // Constructors and destructor
00123 //
00124 
00125 SiStripFEDMonitorPlugin::SiStripFEDMonitorPlugin(const edm::ParameterSet& iConfig)
00126   : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))),
00127     folderName_(iConfig.getUntrackedParameter<std::string>("HistogramFolderName","SiStrip/ReadoutView/FedSummary")),
00128     fillAllDetailedHistograms_(iConfig.getUntrackedParameter<bool>("FillAllDetailedHistograms",false)),
00129     fillWithEvtNum_(iConfig.getUntrackedParameter<bool>("FillWithEventNumber",false)),
00130     printDebug_(iConfig.getUntrackedParameter<unsigned int>("PrintDebugMessages",1)),
00131     //printDebug_(iConfig.getUntrackedParameter<bool>("PrintDebugMessages",false)),
00132     writeDQMStore_(iConfig.getUntrackedParameter<bool>("WriteDQMStore",false)),
00133     dqmStoreFileName_(iConfig.getUntrackedParameter<std::string>("DQMStoreFileName","DQMStore.root")),
00134     dqm_(0),
00135     cablingCacheId_(0),
00136     maxFedBufferSize_(0)
00137 {
00138   //print config to debug log
00139   std::ostringstream debugStream;
00140   if (printDebug_>1) {
00141     debugStream << "[SiStripFEDMonitorPlugin]Configuration for SiStripFEDMonitorPlugin: " << std::endl
00142                 << "[SiStripFEDMonitorPlugin]\tRawDataTag: " << rawDataTag_ << std::endl
00143                 << "[SiStripFEDMonitorPlugin]\tHistogramFolderName: " << folderName_ << std::endl
00144                 << "[SiStripFEDMonitorPlugin]\tFillAllDetailedHistograms? " << (fillAllDetailedHistograms_ ? "yes" : "no") << std::endl
00145                 << "[SiStripFEDMonitorPlugin]\tFillWithEventNumber?" << (fillWithEvtNum_ ? "yes" : "no") << std::endl
00146                 << "[SiStripFEDMonitorPlugin]\tPrintDebugMessages? " << (printDebug_ ? "yes" : "no") << std::endl
00147                 << "[SiStripFEDMonitorPlugin]\tWriteDQMStore? " << (writeDQMStore_ ? "yes" : "no") << std::endl;
00148     if (writeDQMStore_) debugStream << "[SiStripFEDMonitorPlugin]\tDQMStoreFileName: " << dqmStoreFileName_ << std::endl;
00149   }
00150   
00151   //don;t generate debug mesages if debug is disabled
00152   std::ostringstream* pDebugStream = (printDebug_>1 ? &debugStream : NULL);
00153   
00154   fedHists_.initialise(iConfig,pDebugStream);
00155 
00156   doTkHistoMap_ = fedHists_.tkHistoMapEnabled();
00157 
00158   doMedHists_ = fedHists_.cmHistosEnabled();
00159 
00160   doFEMajorityCheck_ = fedHists_.feMajHistosEnabled();
00161 
00162   if (printDebug_) {
00163     LogTrace("SiStripMonitorHardware") << debugStream.str();
00164 
00165     //debugStream.str("");
00166 
00167     //debugStream << " -- Quelle est la difference entre un canard ? " << std::endl 
00168     //  << " -- Reponse: c'est qu'il a les deux pattes de la meme longueur, surtout la gauche." << std::endl;
00169 
00170     //edm::LogError("SiStripMonitorHardware") << debugStream.str();
00171   }
00172 
00173   nEvt_ = 0;
00174 
00175 }
00176 
00177 SiStripFEDMonitorPlugin::~SiStripFEDMonitorPlugin()
00178 {
00179 }
00180 
00181 
00182 //
00183 // Member functions
00184 //
00185 
00186 // ------------ method called to for each event  ------------
00187 void
00188 SiStripFEDMonitorPlugin::analyze(const edm::Event& iEvent, 
00189                                  const edm::EventSetup& iSetup)
00190 {
00191   //Retrieve tracker topology from geometry
00192   edm::ESHandle<TrackerTopology> tTopoHandle;
00193   iSetup.get<IdealGeometryRecord>().get(tTopoHandle);
00194   const TrackerTopology* const tTopo = tTopoHandle.product();
00195 
00196   //update cabling
00197   updateCabling(iSetup);
00198   
00199   //get raw data
00200   edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
00201   iEvent.getByLabel(rawDataTag_,rawDataCollectionHandle);
00202   const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
00203   
00204   fedErrors_.initialiseEvent();
00205 
00206   //add the deltaBX value if the product exist
00207 
00208   edm::Handle<EventWithHistory> he;
00209   iEvent.getByLabel("consecutiveHEs",he);
00210 
00211   if(he.isValid() && !he.failedToGet()) {
00212     fedErrors_.fillEventProperties(he->deltaBX());
00213   }
00214 
00215   //initialise map of fedId/bad channel number
00216   std::map<unsigned int,std::pair<unsigned short,unsigned short> > badChannelFraction;
00217 
00218   unsigned int lNFEDMonitoring = 0;
00219   unsigned int lNFEDUnpacker = 0;
00220   unsigned int lNChannelMonitoring = 0;
00221   unsigned int lNChannelUnpacker = 0;
00222 
00223   unsigned int lNTotBadFeds = 0;
00224   unsigned int lNTotBadChannels = 0;
00225   unsigned int lNTotBadActiveChannels = 0;
00226 
00227   std::vector<std::vector<std::pair<unsigned int,unsigned int> > > lFeMajFrac;
00228   const unsigned int nParts = 4;
00229   if (doFEMajorityCheck_){
00230     lFeMajFrac.resize(nParts);
00231     //max nFE per partition
00232     lFeMajFrac[0].reserve(912);
00233     lFeMajFrac[1].reserve(1080);
00234     lFeMajFrac[2].reserve(768);
00235     lFeMajFrac[3].reserve(760);
00236   }
00237 
00238   maxFedBufferSize_ = 0;
00239 
00240   //loop over siStrip FED IDs
00241   for (unsigned int fedId = FEDNumbering::MINSiStripFEDID; 
00242        fedId <= FEDNumbering::MAXSiStripFEDID; 
00243        fedId++) {//loop over FED IDs
00244     const FEDRawData& fedData = rawDataCollection.FEDData(fedId);
00245 
00246     //create an object to fill all errors
00247     fedErrors_.initialiseFED(fedId,cabling_,tTopo);
00248     bool lFullDebug = false;
00249  
00250     //Do detailed check
00251     //first check if data exists
00252     bool lDataExist = fedErrors_.checkDataPresent(fedData);
00253     if (!lDataExist) {
00254       fedHists_.fillFEDHistograms(fedErrors_,0,lFullDebug);
00255       continue;
00256     }
00257 
00258 
00259  
00260     //check for problems and fill detailed histograms
00261     fedErrors_.fillFEDErrors(fedData,
00262                              lFullDebug,
00263                              printDebug_,
00264                              lNChannelMonitoring,
00265                              lNChannelUnpacker,
00266                              doMedHists_,
00267                              fedHists_.cmHistPointer(false),
00268                              fedHists_.cmHistPointer(true),
00269                              doFEMajorityCheck_,
00270                              lFeMajFrac
00271                              );
00272 
00273     //check filled in previous method.
00274     bool lFailUnpackerFEDcheck = fedErrors_.failUnpackerFEDCheck();
00275 
00276     fedErrors_.incrementFEDCounters();
00277     unsigned int lSize = fedData.size();
00278     if (lSize > maxFedBufferSize_){
00279       maxFedBufferSize_ = lSize;
00280     }
00281     //std::cout << " -- " << fedId << " " << lSize << std::endl;
00282 
00283     fedHists_.fillFEDHistograms(fedErrors_,lSize,lFullDebug);
00284 
00285     bool lFailMonitoringFEDcheck = fedErrors_.failMonitoringFEDCheck();
00286     if (lFailMonitoringFEDcheck) lNTotBadFeds++;
00287 
00288 
00289     //sanity check: if something changed in the unpacking code 
00290     //but wasn't propagated here
00291     //print only the summary, and more info if printDebug>1
00292     if (lFailMonitoringFEDcheck != lFailUnpackerFEDcheck) {
00293       if (printDebug_>1) {
00294         std::ostringstream debugStream;
00295         debugStream << " --- WARNING: FED " << fedId << std::endl 
00296                     << " ------ Monitoring FED check " ;
00297         if (lFailMonitoringFEDcheck) debugStream << "failed." << std::endl;
00298         else debugStream << "passed." << std::endl ;
00299         debugStream << " ------ Unpacker FED check " ;
00300         if (lFailUnpackerFEDcheck) debugStream << "failed." << std::endl;
00301         else debugStream << "passed." << std::endl ;
00302         edm::LogError("SiStripMonitorHardware") << debugStream.str();
00303       }
00304 
00305       if (lFailMonitoringFEDcheck) lNFEDMonitoring++;
00306       else if (lFailUnpackerFEDcheck) lNFEDUnpacker++;
00307     }
00308 
00309 
00310     //Fill TkHistoMap:
00311     //add an entry for all channels (good = 0), 
00312     //so that tkHistoMap knows which channels should be there.
00313     if (doTkHistoMap_ && !fedHists_.tkHistoMapPointer()) {
00314       edm::LogWarning("SiStripMonitorHardware") << " -- Fedid " << fedId
00315                                                 << ", TkHistoMap enabled but pointer is null." << std::endl;
00316     }
00317 
00318     fedErrors_.fillBadChannelList(doTkHistoMap_,
00319                                   fedHists_.tkHistoMapPointer(),
00320                                   fedHists_.getFedvsAPVpointer(),
00321                                   lNTotBadChannels,
00322                                   lNTotBadActiveChannels);
00323   }//loop over FED IDs
00324 
00325 
00326   if (doFEMajorityCheck_){
00327     for (unsigned int iP(0); iP<nParts; ++iP){
00328       //std::cout << " -- Partition " << iP << std::endl;
00329       //std::cout << " --- Number of elements in vec = " << lFeMajFrac[iP].size() << std::endl;
00330       if (lFeMajFrac[iP].size()==0) continue;
00331       std::sort(lFeMajFrac[iP].begin(),lFeMajFrac[iP].end(),SiStripFEDMonitorPlugin::pairComparison);
00332 
00333       unsigned int lMajorityCounter = 0;
00334       std::vector<unsigned int> lfedIds;
00335 
00336       getMajority(lFeMajFrac[iP],lMajorityCounter,lfedIds);
00337       //std::cout << " -- Found " << lfedIds.size() << " unique elements not matching the majority." << std::endl;
00338       fedHists_.fillMajorityHistograms(iP,static_cast<float>(lMajorityCounter)/lFeMajFrac[iP].size(),lfedIds);
00339     }
00340   }
00341 
00342   if ((lNTotBadFeds> 0 || lNTotBadChannels>0) && printDebug_>1) {
00343     std::ostringstream debugStream;
00344     debugStream << "[SiStripFEDMonitorPlugin] --- Total number of bad feds = " 
00345                 << lNTotBadFeds << std::endl
00346                 << "[SiStripFEDMonitorPlugin] --- Total number of bad channels = " 
00347                 << lNTotBadChannels << std::endl
00348                 << "[SiStripFEDMonitorPlugin] --- Total number of bad active channels = " 
00349                 << lNTotBadActiveChannels << std::endl;
00350     edm::LogInfo("SiStripMonitorHardware") << debugStream.str();
00351   }
00352 
00353   if ((lNFEDMonitoring > 0 || lNFEDUnpacker > 0 || lNChannelMonitoring > 0 || lNChannelUnpacker > 0) && printDebug_) {
00354     std::ostringstream debugStream;
00355     debugStream
00356       << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl 
00357       << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl 
00358       << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at FED level : " << std::endl 
00359       << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNFEDMonitoring << std::endl 
00360       << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNFEDUnpacker << std::endl
00361       << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl 
00362       << "[SiStripFEDMonitorPlugin]-- Summary of differences between unpacker and monitoring at Channel level : " << std::endl 
00363       << "[SiStripFEDMonitorPlugin] ---- Number of times monitoring fails but not unpacking = " << lNChannelMonitoring << std::endl 
00364       << "[SiStripFEDMonitorPlugin] ---- Number of times unpacking fails but not monitoring = " << lNChannelUnpacker << std::endl
00365       << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl 
00366       << "[SiStripFEDMonitorPlugin]-------------------------------------------------------------------------" << std::endl ;
00367     edm::LogError("SiStripMonitorHardware") << debugStream.str();
00368 
00369   }
00370 
00371   FEDErrors::getFEDErrorsCounters().nTotalBadChannels = lNTotBadChannels;
00372   FEDErrors::getFEDErrorsCounters().nTotalBadActiveChannels = lNTotBadActiveChannels;
00373 
00374   //fedHists_.fillCountersHistograms(FEDErrors::getFEDErrorsCounters(), nEvt_);
00375   //time in seconds since beginning of the run or event number
00376   if (fillWithEvtNum_) fedHists_.fillCountersHistograms(FEDErrors::getFEDErrorsCounters(),FEDErrors::getChannelErrorsCounters(),maxFedBufferSize_,iEvent.id().event());
00377   else fedHists_.fillCountersHistograms(FEDErrors::getFEDErrorsCounters(),FEDErrors::getChannelErrorsCounters(),maxFedBufferSize_,iEvent.orbitNumber()/11223.);
00378 
00379   nEvt_++;
00380 
00381 }//analyze method
00382 
00383 
00384 bool SiStripFEDMonitorPlugin::pairComparison(const std::pair<unsigned int, unsigned int> & pair1,
00385                                              const std::pair<unsigned int, unsigned int> & pair2){
00386   return (pair1.second < pair2.second) ;
00387 }
00388 
00389 void SiStripFEDMonitorPlugin::getMajority(const std::vector<std::pair<unsigned int,unsigned int> > & aFeMajVec,
00390                                           unsigned int & aMajorityCounter,
00391                                           std::vector<unsigned int> & afedIds) {
00392   
00393   
00394   unsigned int lMajAddress = 0;
00395   std::vector<std::pair<unsigned int,unsigned int> >::const_iterator lIter = aFeMajVec.begin();
00396   unsigned int lMajAddr = (*lIter).second;
00397   unsigned int lCounter = 0;
00398   
00399   //std::cout << " --- First element: addr = " << lMajAddr << " counter = " << lCounter << std::endl;
00400   unsigned int iele=0;
00401   //bool foundMaj = false;
00402   for ( ; lIter != aFeMajVec.end(); ++lIter,++iele) {
00403     //std::cout << " ---- Ele " << iele << " " << (*lIter).first << " " << (*lIter).second << " ref " << lMajAddr << std::endl;
00404     if ((*lIter).second == lMajAddr) {
00405       ++lCounter;
00406       //std::cout << " ----- =ref: Counter = " << lCounter << std::endl;
00407     }
00408     else {
00409       //std::cout << " ----- !=ref: Counter = " << lCounter << " Majority = " << aMajorityCounter << std::endl;
00410       if (lCounter > aMajorityCounter) {
00411         //std::cout << " ------ >Majority: " << std::endl;
00412         aMajorityCounter = lCounter;
00413         // AV bug here??
00414         lMajAddress = lMajAddr;
00415         //      lMajAddress = (*lIter).second;
00416         //foundMaj=true;
00417       }
00418       lCounter = 0;
00419       lMajAddr = (*lIter).second;
00420       --lIter;
00421       --iele;
00422     }
00423   }
00424   // AV Bug here? The check has to be done regardless foundMaj == false or true 
00425   //  if (!foundMaj) {
00426     if (lCounter > aMajorityCounter) {
00427       //std::cout << " ------ >Majority: " << std::endl;
00428       aMajorityCounter = lCounter;
00429       lMajAddress = lMajAddr;
00430     }
00431     //  }
00432   //std::cout << " -- found majority value for " << aMajorityCounter << " elements out of " << aFeMajVec.size() << "." << std::endl;
00433   //get list of feds with address different from majority in partition:      
00434   lIter = aFeMajVec.begin();
00435   afedIds.reserve(135);
00436   for ( ; lIter != aFeMajVec.end(); ++lIter ) {
00437     if((*lIter).second != lMajAddress) {
00438       afedIds.push_back((*lIter).first);
00439     }
00440     else {
00441       lIter += aMajorityCounter-1;
00442       if(lIter >= aFeMajVec.end()) {
00443         std::cout << "Here it is a bug: " << aMajorityCounter << " " << aFeMajVec.size() << " " << lIter - aFeMajVec.end() << std::endl;
00444       }
00445     }
00446   }
00447   //std::cout << " -- Found " << lfedIds.size() << " elements not matching the majority." << std::endl;
00448   if (afedIds.size()>0) {
00449     std::sort(afedIds.begin(),afedIds.end());
00450     std::vector<unsigned int>::iterator lIt = std::unique(afedIds.begin(),afedIds.end());
00451     afedIds.erase(lIt,afedIds.end());
00452   }
00453 
00454 }
00455 
00456 // ------------ method called once each job just before starting event loop  ------------
00457 void 
00458 SiStripFEDMonitorPlugin::beginJob()
00459 {
00460   //get DQM store
00461   dqm_ = &(*edm::Service<DQMStore>());
00462   dqm_->setCurrentFolder(folderName_);
00463   
00464   //this propagates dqm_ to the histoclass, must be called !
00465   fedHists_.bookTopLevelHistograms(dqm_);
00466   
00467   if (fillAllDetailedHistograms_) fedHists_.bookAllFEDHistograms();
00468 
00469   nEvt_ = 0;
00470 
00471   //const unsigned int siStripFedIdMin = FEDNumbering::MINSiStripFEDID;
00472   //const unsigned int siStripFedIdMax = FEDNumbering::MAXSiStripFEDID;
00473 
00474   //mark all channels as inactive until they have been 'locked' at least once
00475   //   activeChannels_.resize(siStripFedIdMax+1);
00476   //   for (unsigned int fedId = siStripFedIdMin; 
00477   //        fedId <= siStripFedIdMax; 
00478   //        fedId++) {
00479   //     activeChannels_[fedId].resize(sistrip::FEDCH_PER_FED,false);
00480   //   }
00481   
00482 
00483 
00484 
00485 }
00486 
00487 // ------------ method called once each job just after ending the event loop  ------------
00488 void 
00489 SiStripFEDMonitorPlugin::endJob()
00490 {
00491   if (writeDQMStore_) dqm_->save(dqmStoreFileName_);
00492 }
00493 
00494 
00495 
00496 void 
00497 SiStripFEDMonitorPlugin::beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00498                                               const edm::EventSetup& context)
00499 {
00500 
00501   fedErrors_.initialiseLumiBlock();
00502 
00503 }
00504 
00505 
00506 void 
00507 SiStripFEDMonitorPlugin::endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00508                                             const edm::EventSetup& context)
00509 {
00510   fedHists_.fillLumiHistograms(fedErrors_.getLumiErrors());
00511 }
00512 
00513 
00514 
00515 
00516 void SiStripFEDMonitorPlugin::updateCabling(const edm::EventSetup& eventSetup)
00517 {
00518   uint32_t currentCacheId = eventSetup.get<SiStripFedCablingRcd>().cacheIdentifier();
00519   if (cablingCacheId_ != currentCacheId) {
00520     edm::ESHandle<SiStripFedCabling> cablingHandle;
00521     eventSetup.get<SiStripFedCablingRcd>().get(cablingHandle);
00522     cabling_ = cablingHandle.product();
00523     cablingCacheId_ = currentCacheId;
00524   }
00525 }
00526 
00527 
00528 //
00529 // Define as a plug-in
00530 //
00531 
00532 #include "FWCore/Framework/interface/MakerMacros.h"
00533 DEFINE_FWK_MODULE(SiStripFEDMonitorPlugin);