CMS 3D CMS Logo

CnBAnalyzer.cc

Go to the documentation of this file.
00001 #include "DQM/SiStripMonitorHardware/plugins/CnBAnalyzer.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00004 #include "DQM/SiStripMonitorHardware/interface/Fed9UEventAnalyzer.hh"
00005 #include "DQM/SiStripMonitorHardware/interface/Fed9UDebugEvent.hh"
00006 
00007 #include "DataFormats/SiStripCommon/interface/SiStripFedKey.h"
00008 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h" 
00009 
00010 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00011 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00012 
00013 #include "DQMServices/Core/interface/DQMStore.h"
00014 
00015 #include "FWCore/Framework/interface/ESHandle.h"
00016 #include "CondFormats/SiStripObjects/interface/FedChannelConnection.h"
00017 
00018 #include <iostream>
00019 #include <string>
00020 #include <sstream>
00021 
00022 CnBAnalyzer::CnBAnalyzer(const edm::ParameterSet& iConfig) {
00023 
00024   // Dqm private object
00025   dqm_ = NULL;
00026   
00027   // Parameters for working with S-link and dumping the hex buffer
00028   swapOn_ = iConfig.getUntrackedParameter<bool>("swapOn");
00029   preSwapOn_ = iConfig.getUntrackedParameter<bool>("preSwapOn", false);
00030 
00031   // Parameters to write a debug root file
00032   outputFileName_ = iConfig.getUntrackedParameter<string>("rootFile", "");
00033   outputFileDir_ = iConfig.getUntrackedParameter<string>("rootFileDirectory","");
00034   doDetailedHistos_ = iConfig.getUntrackedParameter<bool>("detailedHistograms",false);
00035 
00036   // Decides whether to build histograms also for FEDs without any error
00037 #ifdef CNBANALYZER_BUILD_ALL_HISTOS
00038   buildAllHistograms_ = iConfig.getUntrackedParameter<bool>("buildAllHistograms",false);
00039 #endif
00040   
00041   // FED address mapping is obtained through
00042   // FEDNumberting object: use and throw !
00043   FEDNumbering fedNum;
00044 
00045   // valid FedIds for the tracker
00046   fedIdBoundaries_ = fedNum.getSiStripFEDIds();
00047   totalNumberOfFeds_ = fedIdBoundaries_.second - fedIdBoundaries_.first + 1;
00048 
00049   // Whether we should use the cabling database
00050   useCablingDb_ = iConfig.getUntrackedParameter<bool>("useCablingDb",false);
00051   cabling_ = NULL;
00052 }
00053 
00054 CnBAnalyzer::~CnBAnalyzer() {
00055   // Go to top directory
00056   dqm()->cd();
00057   // and remove MEs at top directory
00058   dqm()->removeContents(); 
00059 }
00060 
00061 void CnBAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup){
00062 
00063   using namespace edm;
00064   using namespace std;
00065 
00066   // TODO: refuse to run if we are in Scope mode
00067 
00068   // Retrieve FED raw data ("source" label is now fixed by framework)
00069   edm::Handle<FEDRawDataCollection> buffers;
00070   iEvent.getByType( buffers );
00071 
00072   fedIds_.clear();
00073   for (uint16_t ifed = fedIdBoundaries_.first ; ifed <= fedIdBoundaries_.second; ifed++ ) {
00074     if ( buffers->FEDData( static_cast<int>(ifed) ).size() >= Fed9U::Fed9UDebugEvent::MinimumBufferSize ) {
00075       fedIds_.push_back(ifed);
00076     }
00077   }
00078   
00079 #ifdef CNBANALYZER_DEBUG
00080   LogInfo("FEDBuffer") << "Number of Tracker Fed Buffers:" << fedIds_.size();
00081   LogInfo("FEDBuffer") << "EVENTNUMB: " << iEvent.id().event();
00082 #endif
00083 
00084 
00085   /**************************/
00086   /*                        */
00087   /* Main cycle over FEDs   */
00088   /*                        */
00089   /**************************/
00090 
00091   // Counter for total number of enabled / faulty
00092   // channels in this event
00093   int total_enabled_channels = 0;
00094   int total_faulty_channels = 0;
00095 
00096   // Retrieve FED all found fedIds  and iterate through 
00097   vector<uint16_t>::const_iterator ifed;
00098   for (ifed = fedIds_.begin() ; ifed != fedIds_.end(); ifed++ ) {
00099 
00100 #ifdef CNBANALYZER_DEBUG
00101     LogInfo("FEDBuffer") << "A FED event: ";
00102 #endif
00103 #ifdef CNBANALYZER_BUILD_ALL_HISTOS
00104     if (buildAllHistograms_) createDetailedFedHistograms((*ifed));
00105 #endif
00106     
00107     // Retrieve FED raw data for given FED... there it is :)      
00108     const FEDRawData& input = buffers->FEDData( static_cast<int>(*ifed) );
00109     Fed9U::u32* data_u32 = 0;
00110     Fed9U::u32  size_u32 = 0;
00111     
00112     data_u32 = reinterpret_cast<Fed9U::u32*>( const_cast<unsigned char*>( input.data() ) );
00113     size_u32 = static_cast<Fed9U::u32>( input.size() / 4 ); // Number of words of 32 bits (=4*8) input.size() being the size of an unsigned char vector
00114     
00115     Fed9UEventAnalyzer myEventAnalyzer(fedIdBoundaries_, swapOn_, preSwapOn_);
00116     
00117     // The Initialize function is true if we have a good
00118     // non-corrupted tracker buffer
00119     if (myEventAnalyzer.Initialize(data_u32, size_u32)) {
00120       
00121 #ifdef CNBANALYZER_DEBUG
00122       LogInfo("FEDBuffer") << "FEDevent correctly initialized";
00123 #endif
00124       
00125       // The Fed9UErrorCondition structure may cointain all the relevant
00126       // errors specific to the event
00127       Fed9UErrorCondition thisFedEventErrs;
00128 
00129       // The actual checkout of the buffer:
00130       if (cabling_) {
00131         const std::vector<FedChannelConnection> conns = cabling_->connections(static_cast<int>(*ifed));
00132         // TODO: check here if the connections are actually there.
00133         //       if not you should fill a corresponding error
00134         
00135 #undef CNBANALYZER_CABLING_DEBUG
00136 #ifdef CNBANALYZER_CABLING_DEBUG
00137         // TODO: remove this bad debug :-)
00138         // ????????????????????????????????
00139         if ( iEvent.id().event() == 1 ) {
00140           std::cout << "analyzing event 1 with cabling for FED " << std::dec << (*ifed) << std::endl;
00141           for (int channelIndex=0; channelIndex<96; channelIndex++) {
00142             std::cout << std::dec << std::setfill('0') << std::setw(2)
00143                       << (channelIndex+1) << "  "
00144                       << ((conns.at(95-channelIndex)).isConnected() ? "-" : "X" )
00145                       << std::endl;
00146           }
00147         }
00148         // ????????????????????????????????
00149 #endif
00150         thisFedEventErrs = myEventAnalyzer.Analyze(true, &conns);
00151       } else {
00152         thisFedEventErrs = myEventAnalyzer.Analyze(false, NULL);
00153       }
00154 
00155       total_enabled_channels += thisFedEventErrs.totalChannels;
00156       total_faulty_channels  += thisFedEventErrs.problemsSeen;
00157 
00158       if (thisFedEventErrs.internalFreeze) fedFreeze_->Fill(*ifed);
00159       if (thisFedEventErrs.bxError) fedBx_->Fill(*ifed);
00160       if (thisFedEventErrs.qdrFull) fedQDRFull_->Fill(*ifed);
00161       if (thisFedEventErrs.qdrPartialFull) fedQDRPartialFull_->Fill(*ifed);
00162       if (thisFedEventErrs.qdrEmpty) fedQDREmpty_->Fill(*ifed);
00163       if (thisFedEventErrs.l1aFull) fedL1AFull_->Fill(*ifed);
00164       if (thisFedEventErrs.l1aPartialFull) fedL1APartialFull_->Fill(*ifed);
00165       if (thisFedEventErrs.l1aEmpty) fedL1AEmpty_->Fill(*ifed);
00166       if (thisFedEventErrs.slinkFull) fedSLinkFull_->Fill(*ifed);
00167       if (thisFedEventErrs.corruptBuffer) fedCorruptBuffers_->Fill(*ifed);
00168       if (thisFedEventErrs.problemsSeen) {
00169         // Update counters for FEDs
00170         fedGenericErrors_->Fill(*ifed, thisFedEventErrs.problemsSeen);
00171       }
00172       if (doDetailedHistos_ && thisFedEventErrs.problemsSeen) {
00173         createDetailedFedHistograms((*ifed));
00174         
00175         
00176 #ifdef CNBANALYZER_DEBUG
00177         LogInfo("FEDBuffer") << "FED number" << (*ifed) << std::endl
00178                              << "enabled        = " << thisFedEventErrs.totalChannels << std::endl
00179                              << "faulty         = " << thisFedEventErrs.problemsSeen << std::endl
00180                              << "internalFreeze = " << thisFedEventErrs.internalFreeze << std::endl
00181                              << "bxError        = " << thisFedEventErrs.bxError;
00182 #endif
00183         
00184         // Fill the Front-end failure counters 
00185         for (unsigned int iFrontEnd=0; iFrontEnd<8; iFrontEnd++) {
00186 #ifdef CNBANALYZER_DEBUG
00187           LogInfo("FEDBuffer") << "feOverflow[" << iFrontEnd << "] = " << thisFedEventErrs.feOverflow[iFrontEnd];
00188           LogInfo("FEDBuffer") << "apvAddressError[" << iFrontEnd << "] = " << thisFedEventErrs.apvAddressError[iFrontEnd];
00189 #endif
00190           
00191           if (thisFedEventErrs.feOverflow[iFrontEnd])
00192             feOverFlow_[*ifed]->Fill(iFrontEnd);
00193           if (thisFedEventErrs.apvAddressError[iFrontEnd])
00194             feAPVAddr_[*ifed]->Fill(iFrontEnd);
00195           
00196         }
00197         
00198         // Fill the channel failure counters 
00199         for (unsigned int iChannel=0; iChannel<96; iChannel++) {
00200           
00201 #ifdef CNBANALYZER_DEBUG
00202           LogInfo("FEDBuffer") << "channel[" << iChannel << "] = " << hex << thisFedEventErrs.channel[iChannel];
00203 #endif
00204           
00205           if (thisFedEventErrs.channel[iChannel]==Fed9UEventAnalyzer::FIBERUNLOCKED)
00206             chanErrUnlock_[*ifed]->Fill(iChannel);
00207           if (thisFedEventErrs.channel[iChannel]==Fed9UEventAnalyzer::FIBEROUTOFSYNCH)
00208             chanErrOOS_[*ifed]->Fill(iChannel); 
00209         }      
00210         
00211         
00212         // apv[96*2]
00213         for (unsigned int iApv=0; iApv<192; iApv++) {
00214 #ifdef CNBANALYZER_DEBUG
00215           LogInfo("FEDBuffer") << "apv[" << iApv << "] = " << hex << thisFedEventErrs.apv[iApv];
00216 #endif
00217           if (thisFedEventErrs.apv[iApv])
00218             badApv_[*ifed]->Fill(iApv);
00219         }
00220       }
00221     }
00222     
00223   } // End of the ifed loop
00224   
00225 #ifdef CNBANALYZER_DEBUG
00226   LogInfo("FEDBuffer") << "Event summary:" << std::endl
00227                        << "total_enabled = " << total_enabled_channels << std::endl
00228                        << "total_faulty  = " << total_faulty_channels;
00229 #endif
00230 
00231   // TODO: find a better solution to this (and remove the explicit 1000)
00232   if ( iEvent.id().event()<1000) {
00233     totalChannels_->Fill( iEvent.id().event(), total_enabled_channels);
00234     faultyChannels_->Fill( iEvent.id().event(), total_faulty_channels);
00235   }
00236 
00237 } // End of the Event Loop (analyze: called once per event)
00238 
00239 
00240 // ------------ method called once each job just before starting event loop  ------------
00241 void 
00242 CnBAnalyzer::beginJob(const edm::EventSetup& iSetup)
00243 {
00244   // ---------- DQM back-end interface ----------
00245   dqm_ = edm::Service<DQMStore>().operator->();
00246   dqm()->setVerbose(0);
00247 
00248   // Summary histograms
00249   createRootFedHistograms();
00250 }
00251 
00252 // ------------ method called once each job just before starting event loop  ------------
00253 void CnBAnalyzer::beginRun(const edm::Run& r, const edm::EventSetup& iSetup)
00254 {
00255   // Create and populate the FED cabling object if needed
00256   if (useCablingDb_) {
00257     edm::ESHandle<SiStripFedCabling> myCabling;
00258     iSetup.get<SiStripFedCablingRcd>().get(myCabling);
00259     cabling_ = new SiStripFedCabling (*myCabling);
00260   }
00261 }
00262 
00263 // The following method should be called
00264 // at the job initialization by beginJob()
00265 void CnBAnalyzer::createRootFedHistograms() {
00266 
00267   stringstream binNameS;
00268 
00269   SiStripFedKey thisFedKey(0, 0, 0, 0);
00270   std::string baseFolder = thisFedKey.path() + "FedMonitoringSummary";
00271   dqm()->setCurrentFolder(baseFolder);
00272 
00273   // This Histogram will be filled with 
00274   // problemsSeen / totalChannels
00275   fedGenericErrors_ = dqm()->book1D( "FedGenericErrors","Fed Generic Errors vs. FED #",
00276                                      totalNumberOfFeds_,
00277                                      fedIdBoundaries_.first,
00278                                      fedIdBoundaries_.second + 1 );
00279   fedGenericErrors_->setAxisTitle("Number of errors", 2);
00280   fedGenericErrors_->setAxisTitle("Front-End Driver", 1);
00281   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00282     binNameS.str(""); if (i%10==0) binNameS << i; fedGenericErrors_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00283   }
00284   
00285  
00286   // bool internalFreeze
00287   fedFreeze_ = dqm()->book1D( "FedFreeze","Fed Freeze vs. FED #",
00288                               totalNumberOfFeds_,
00289                               fedIdBoundaries_.first,
00290                               fedIdBoundaries_.second + 1 );
00291   fedFreeze_->setAxisTitle("Number of errors", 2);
00292   fedFreeze_->setAxisTitle("Front-End Driver", 1);
00293   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00294     binNameS.str(""); if (i%10==0) binNameS << i; fedFreeze_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00295   }
00296   
00297   // bool bxError
00298   fedBx_ = dqm()->book1D( "FedBxError","Fed Bx Error vs. FED #",
00299                           totalNumberOfFeds_,
00300                           fedIdBoundaries_.first,
00301                           fedIdBoundaries_.second + 1 );
00302   fedBx_->setAxisTitle("Number of errors", 2);
00303   fedBx_->setAxisTitle("Front-End Driver", 1);
00304   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00305     binNameS.str(""); if (i%10==0) binNameS << i; fedBx_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00306   }
00307 
00308   //corrupt buffers
00309   fedCorruptBuffers_ = dqm()->book1D( "FedCorruptBuffer","Corrupt buffers vs. FED #",
00310                                       totalNumberOfFeds_,
00311                                       fedIdBoundaries_.first,
00312                                       fedIdBoundaries_.second + 1 );
00313   fedCorruptBuffers_->setAxisTitle("Number of errors", 2);
00314   fedCorruptBuffers_->setAxisTitle("Front-End Driver", 1);
00315   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00316     binNameS.str(""); if (i%10==0) binNameS << i; fedCorruptBuffers_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00317   }
00318   
00319   //BE Buffer status
00320   //QDR Full
00321   fedQDRFull_ = dqm()->book1D( "FedQDRFull","Full QDR buffer events vs. FED #",
00322                                       totalNumberOfFeds_,
00323                                       fedIdBoundaries_.first,
00324                                       fedIdBoundaries_.second + 1 );
00325   fedQDRFull_->setAxisTitle("Number of events with full QDR buffer", 2);
00326   fedQDRFull_->setAxisTitle("Front-End Driver", 1);
00327   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00328     binNameS.str(""); if (i%10==0) binNameS << i; fedQDRFull_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00329   }
00330   //QDR Partial full
00331   fedQDRPartialFull_ = dqm()->book1D( "FedQDRPartialFull","Partialy full QDR buffer events vs. FED #",
00332                                       totalNumberOfFeds_,
00333                                       fedIdBoundaries_.first,
00334                                       fedIdBoundaries_.second + 1 );
00335   fedQDRPartialFull_->setAxisTitle("Number of events with partial full QDR buffer", 2);
00336   fedQDRPartialFull_->setAxisTitle("Front-End Driver", 1);
00337   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00338     binNameS.str(""); if (i%10==0) binNameS << i; fedQDRPartialFull_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00339   }
00340   //QDR Empty
00341   fedQDREmpty_ = dqm()->book1D( "FedQDREmpty","Empty QDR buffer events vs. FED #",
00342                                       totalNumberOfFeds_,
00343                                       fedIdBoundaries_.first,
00344                                       fedIdBoundaries_.second + 1 );
00345   fedQDREmpty_->setAxisTitle("Number of events with empty QDR buffer", 2);
00346   fedQDREmpty_->setAxisTitle("Front-End Driver", 1);
00347   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00348     binNameS.str(""); if (i%10==0) binNameS << i; fedQDREmpty_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00349   }
00350   //L1A Full
00351   fedL1AFull_ = dqm()->book1D( "FedL1AFull","Full L1A buffer events vs. FED #",
00352                                       totalNumberOfFeds_,
00353                                       fedIdBoundaries_.first,
00354                                       fedIdBoundaries_.second + 1 );
00355   fedL1AFull_->setAxisTitle("Number of events with full L1A buffer", 2);
00356   fedL1AFull_->setAxisTitle("Front-End Driver", 1);
00357   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00358     binNameS.str(""); if (i%10==0) binNameS << i; fedL1AFull_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00359   }
00360   //L1A Partial full
00361   fedL1APartialFull_ = dqm()->book1D( "FedL1APartialFull","Partialy full L1A buffer events vs. FED #",
00362                                       totalNumberOfFeds_,
00363                                       fedIdBoundaries_.first,
00364                                       fedIdBoundaries_.second + 1 );
00365   fedL1APartialFull_->setAxisTitle("Number of events with partial full L1A buffer", 2);
00366   fedL1APartialFull_->setAxisTitle("Front-End Driver", 1);
00367   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00368     binNameS.str(""); if (i%10==0) binNameS << i; fedL1APartialFull_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00369   }
00370   //L1A Empty
00371   fedL1AEmpty_ = dqm()->book1D( "FedL1AEmpty","Empty L1A buffer events vs. FED #",
00372                                       totalNumberOfFeds_,
00373                                       fedIdBoundaries_.first,
00374                                       fedIdBoundaries_.second + 1 );
00375   fedL1AEmpty_->setAxisTitle("Number of events with empty L1A buffer", 2);
00376   fedL1AEmpty_->setAxisTitle("Front-End Driver", 1);
00377   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00378     binNameS.str(""); if (i%10==0) binNameS << i; fedL1AEmpty_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00379   }
00380   //SLink Full
00381   fedSLinkFull_ = dqm()->book1D( "FedSLinkFull","Full SLink buffer events vs. FED #",
00382                                       totalNumberOfFeds_,
00383                                       fedIdBoundaries_.first,
00384                                       fedIdBoundaries_.second + 1 );
00385   fedSLinkFull_->setAxisTitle("Number of events with full SLink buffer", 2);
00386   fedSLinkFull_->setAxisTitle("Front-End Driver", 1);
00387   for (int i=fedIdBoundaries_.first; i<=fedIdBoundaries_.second; i++) {
00388     binNameS.str(""); if (i%10==0) binNameS << i; fedSLinkFull_->setBinLabel(i-fedIdBoundaries_.first+1, binNameS.str(), 1);
00389   }
00390   
00391   
00392   // TODO: missing connections ?
00393 
00394   // Trend plots:
00395   totalChannels_  = dqm()->book1D( "TotalChannelsVsEvent",
00396                                    "Total channels vs. Event for all FEDs",
00397                                    1001, 0.5, 1000.5);
00398 
00399   faultyChannels_ = dqm()->book1D( "FaultyChannelsVsEvent",
00400                                    "Faulty channels vs. Event for all FEDs",
00401                                    1001, 0.5, 1000.5);
00402 
00403 }
00404 
00405 void CnBAnalyzer::createDetailedFedHistograms( const uint16_t& fed_id ) {
00406 
00407   std::map<uint16_t, bool>::iterator itFeds;
00408 
00409   itFeds=foundFeds_.find(fed_id);
00410 
00411   if (itFeds==foundFeds_.end()) {
00412     
00413     SiStripFedKey thisFedKey(fed_id, 0, 0, 0);
00414 
00415     foundFeds_[fed_id]=true;
00416     
00417     stringstream fedNumber;
00418     fedNumber << fed_id;
00419     
00420     // Set working directory prior to booking histograms 
00421     std::string dir = thisFedKey.path();
00422     dqm()->setCurrentFolder( dir );
00423 
00424     std::stringstream binNameS;
00425 
00426     
00427     // All the following histograms are such that thay can be plot together
00428     // In fact the boundaries of the plots are 1, 192 (or actually 0.5, 192,5)
00429     // They have a different binning, though, which reflect the granularity of the system.
00430     
00431     // When filling these plots one can access directly the bin (for example feOverFlow, bin number 8
00432     // to address the front-end unit number 8) or one can make use of the x axis, which correspond
00433     // to the APV index (1, 192).
00434     
00435   
00436     //   bool feOverflow[8];
00437     feOverFlow_[fed_id]     = dqm()->book1D( "FeUnitOverflow_FED"+fedNumber.str(),
00438                                              "FeUnit Overflow for FED #"+fedNumber.str(),
00439                                              8, 0, 8 );
00440     feOverFlow_[fed_id]->setAxisTitle("Number of errors", 2);
00441     feOverFlow_[fed_id]->setAxisTitle("Front-End Unit", 1);
00442     for(unsigned int i=1; i<=8; i++) { binNameS.str(""); binNameS << i; feOverFlow_[fed_id]->setBinLabel(i, binNameS.str(), 1); }
00443     
00444     //   bool apvAddressError[8];
00445     feAPVAddr_[fed_id]      = dqm()->book1D( "APVAddresserror_FED"+fedNumber.str(),
00446                                              "FedUnit APV Address error for FED #"+fedNumber.str(),
00447                                              8, 0, 8 );
00448     feAPVAddr_[fed_id]->setAxisTitle("Number of errors", 2);
00449     feAPVAddr_[fed_id]->setAxisTitle("Front-End Unit", 1);
00450     for(unsigned int i=1; i<=8; i++) { binNameS.str(""); binNameS << i; feAPVAddr_[fed_id]->setBinLabel(i, binNameS.str(), 1); }
00451     
00452     // Channel[96]
00453     chanErrUnlock_[fed_id]  = dqm()->book1D( "UnlockError_FED"+fedNumber.str(),
00454                                              "Unlocked Fiber error for FED #"+fedNumber.str(),
00455                                              96, 0, 96);
00456     chanErrUnlock_[fed_id]->setAxisTitle("Number of errors", 2);
00457     chanErrUnlock_[fed_id]->setAxisTitle("Channel", 1);
00458     for(unsigned int i=1; i<=96; i++) { binNameS.str(""); if (i%6==0) binNameS << i; chanErrUnlock_[fed_id]->setBinLabel(i, binNameS.str(), 1); }
00459 
00460 
00461     chanErrOOS_[fed_id]     = dqm()->book1D( "OOSerror_FED"+fedNumber.str(),
00462                                              "OutOfSynch Fiber error for FED #"+fedNumber.str(),
00463                                              96, 0, 96);
00464     chanErrOOS_[fed_id]->setAxisTitle("Number of errors", 2);
00465     chanErrOOS_[fed_id]->setAxisTitle("Channel", 1);
00466     for(unsigned int i=1; i<=96; i++) { binNameS.str(""); if (i%6==0) binNameS << i; chanErrOOS_[fed_id]->setBinLabel(i, binNameS.str(), 1); }
00467     
00468     // apv[96*2]
00469     badApv_[fed_id]         = dqm()->book1D( "BadAPVerror_FED"+fedNumber.str(),
00470                                              "Bad APV error for FED #"+fedNumber.str(),
00471                                              192, 0, 192);
00472     badApv_[fed_id]->setAxisTitle("Number of errors", 2);
00473     badApv_[fed_id]->setAxisTitle("APV", 1);
00474     for(unsigned int i=1; i<=192; i++) { binNameS.str(""); if (i%12==0) binNameS << i; badApv_[fed_id]->setBinLabel(i, binNameS.str(), 1); }
00475     
00476 
00477   } // Otherwise we have nothing to do
00478   
00479 }
00480 
00481 
00482 // ------------ method called once each job just after ending the event loop  ------------
00483 void CnBAnalyzer::endJob() {
00484 
00485   if (outputFileName_!="") {
00486     dqm()->showDirStructure();
00487     std::string completeFileName = outputFileDir_ + std::string("/test_") + outputFileName_;
00488     dqm()->save(completeFileName);
00489   }
00490 
00491 }
00492 
00493 
00494 DQMStore* const CnBAnalyzer::dqm( std::string method ) const {
00495   if ( !dqm_ ) { 
00496     std::stringstream ss;
00497     if ( method != "" ) { ss << "[CnBAnalyzer::" << method << "]" << std::endl; }
00498     else { ss << "[CnBAnalyzer]" << std::endl; }
00499     ss << " NULL pointer to DQMStore";
00500     edm::LogWarning("SiStripMonitorHardware") << ss.str();
00501     return 0;
00502   } else { return dqm_; }
00503 }

Generated on Tue Jun 9 17:33:38 2009 for CMSSW by  doxygen 1.5.4