CMS 3D CMS Logo

HcalMonitorModule.h

Go to the documentation of this file.
00001 #ifndef HcalMonitorModule_H
00002 #define HcalMonitorModule_H
00003 
00004 /*
00005  * \file HcalMonitorModule.h
00006  *
00007  * $Date: 2009/04/05 13:31:15 $
00008  * $Revision: 1.42.2.1 $
00009  * \author W. Fisher
00010  *
00011 */
00012 
00013 #include "FWCore/Framework/interface/Frameworkfwd.h"
00014 #include "FWCore/Framework/interface/EDAnalyzer.h"
00015 #include "FWCore/Framework/interface/Event.h"
00016 #include "FWCore/Framework/interface/MakerMacros.h"
00017 #include "FWCore/Framework/interface/ESHandle.h"
00018 #include "FWCore/Framework/interface/Run.h"
00019 #include "FWCore/ServiceRegistry/interface/Service.h"
00020 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00021 
00022 
00023 #include "DQMServices/Core/interface/DQMStore.h"
00024 #include "DQMServices/Core/interface/MonitorElement.h"
00025 //#include "DQMServices/Components/interface/DQMAnalyzer.h"
00026 
00027 #include "Geometry/Records/interface/IdealGeometryRecord.h"
00028 #include "Geometry/CaloGeometry/interface/CaloGeometry.h"
00029 #include "FWCore/Utilities/interface/CPUTimer.h"
00030 
00031 #include "DataFormats/Provenance/interface/EventID.h"  
00032 #include "DataFormats/HcalDigi/interface/HcalUnpackerReport.h"
00033 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetup.h"
00034 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00035 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutSetupFwd.h"
00036 #include "CalibCalorimetry/HcalAlgos/interface/HcalDbASCIIIO.h"
00037 
00038 #include "DataFormats/DetId/interface/DetId.h"
00039 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00040 #include "DQM/HcalMonitorModule/interface/HcalMonitorSelector.h"
00041 #include "DQM/HcalMonitorTasks/interface/HcalDigiMonitor.h"
00042 #include "DQM/HcalMonitorTasks/interface/HcalDataFormatMonitor.h"
00043 #include "DQM/HcalMonitorTasks/interface/HcalDataIntegrityTask.h"
00044 #include "DQM/HcalMonitorTasks/interface/HcalRecHitMonitor.h"
00045 #include "DQM/HcalMonitorTasks/interface/HcalBeamMonitor.h"
00046 #include "DQM/HcalMonitorTasks/interface/HcalExpertMonitor.h"
00047 #include "DQM/HcalMonitorTasks/interface/HcalPedestalMonitor.h"
00048 #include "DQM/HcalMonitorTasks/interface/HcalLEDMonitor.h"
00049 #include "DQM/HcalMonitorTasks/interface/HcalLaserMonitor.h"
00050 #include "DQM/HcalMonitorTasks/interface/HcalMTCCMonitor.h"
00051 #include "DQM/HcalMonitorTasks/interface/HcalHotCellMonitor.h"
00052 #include "DQM/HcalMonitorTasks/interface/HcalDeadCellMonitor.h"
00053 #include "DQM/HcalMonitorTasks/interface/HcalCaloTowerMonitor.h"
00054 #include "DQM/HcalMonitorTasks/interface/HcalTrigPrimMonitor.h"
00055 #include "DQM/HcalMonitorTasks/interface/HcalTemplateAnalysis.h"
00056 #include "DQM/HcalMonitorTasks/interface/HcalEEUSMonitor.h"
00057 #include "TBDataFormats/HcalTBObjects/interface/HcalTBRunData.h"
00058 
00059 // Use to hold/get channel status
00060 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
00061 #include "CondFormats/HcalObjects/interface/HcalCondObjectContainer.h"
00062 
00063 #include <memory>
00064 #include <iostream>
00065 #include <fstream>
00066 #include <vector>
00067 #include <string>
00068 #include <sys/time.h>
00069 
00070 using namespace edm;
00071 
00072 class HcalMonitorModule : public EDAnalyzer{
00073 
00074 public:
00075   
00076   // Constructor
00077   HcalMonitorModule(const edm::ParameterSet& ps);
00078 
00079   // Destructor
00080   ~HcalMonitorModule();
00081   
00082  protected:
00083   
00084   // Analyze
00085   void analyze(const edm::Event& e, const edm::EventSetup& c);
00086   
00087   // BeginJob
00088   void beginJob(const edm::EventSetup& c);
00089   
00090   // BeginRun
00091   void beginRun(const edm::Run& run, const edm::EventSetup& c);
00092 
00093   // Begin LumiBlock
00094   void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00095                             const edm::EventSetup& c) ;
00096 
00097   // End LumiBlock
00098   void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00099                           const edm::EventSetup& c);
00100 
00101   // EndJob
00102   void endJob(void);
00103   
00104   // EndRun
00105   void endRun(const edm::Run& run, const edm::EventSetup& c);
00106 
00107   // Reset
00108   void reset(void);
00109 
00111   bool prescale();
00112 
00113   // Check which subdetectors have FED data
00114   void CheckSubdetectorStatus(const FEDRawDataCollection& rawraw, 
00115                               const HcalUnpackerReport& report, 
00116                               const HcalElectronicsMap& emap,
00117                               const HBHEDigiCollection& hbhedigi,
00118                               const HODigiCollection& hodigi,
00119                               const HFDigiCollection& hfdigi
00120                               //const ZDCDigiCollection& zdcdigi,
00121                               );
00122     
00123  private:
00124   /********************************************************/
00125   //  The following member variables can be specified in  //
00126   //  the configuration input file for the process.       //
00127   /********************************************************/
00128 
00132   int prescaleEvt_;    
00133   int prescaleLS_;     
00134   int prescaleTime_;   
00135   int prescaleUpdate_; 
00136 
00139   std::string monitorName_;
00140 
00142   int debug_;  // make debug an int in order to allow different levels of messaging
00143 
00144   // control whether or not to display time used by each module
00145   bool showTiming_; 
00146   edm::CPUTimer cpu_timer; // 
00147 
00148   // counters and flags
00149   int nevt_;
00150   int nlumisecs_;
00151   bool saved_;
00152 
00153   struct{
00154     timeval startTV,updateTV;
00155     double elapsedTime; 
00156     double vetoTime; 
00157     double updateTime;
00158   } psTime_;    
00159 
00161   DQMStore* dbe_;  
00162   
00163   // environment variables
00164   int irun_,ilumisec_,ievent_,itime_;
00165   bool actonLS_ ;
00166   std::string rootFolder_;
00167 
00168   int ievt_;
00169   int ievt_pre_; // copy of counter used for prescale purposes
00170   bool fedsListed_;
00171   
00172   edm::InputTag inputLabelGT_;
00173   edm::InputTag inputLabelDigi_;
00174   edm::InputTag inputLabelRecHitHBHE_;
00175   edm::InputTag inputLabelRecHitHF_;
00176   edm::InputTag inputLabelRecHitHO_;
00177   edm::InputTag inputLabelRecHitZDC_;
00178 
00179   edm::InputTag inputLabelCaloTower_;
00180   edm::InputTag inputLabelLaser_;
00181   edm::InputTag FEDRawDataCollection_;
00182 
00183   // Maps of readout hardware unit to calorimeter channel
00184   std::map<uint32_t, std::vector<HcalDetId> > DCCtoCell;
00185   std::map<uint32_t, std::vector<HcalDetId> > ::iterator thisDCC;
00186   std::map<pair <int,int> , std::vector<HcalDetId> > HTRtoCell;
00187   std::map<pair <int,int> , std::vector<HcalDetId> > ::iterator thisHTR;
00188 
00189   MonitorElement* meFEDS_;
00190   MonitorElement* meStatus_;
00191   MonitorElement* meRunType_;
00192   MonitorElement* meEvtMask_;
00193   MonitorElement* meTrigger_;
00194   MonitorElement* meLatency_;
00195   MonitorElement* meQuality_;
00196   
00197   HcalMonitorSelector*    evtSel_;
00198   HcalDigiMonitor*        digiMon_;
00199   HcalDataFormatMonitor*  dfMon_;
00200   HcalDataIntegrityTask*  diTask_;
00201   HcalRecHitMonitor*      rhMon_;
00202   HcalBeamMonitor*        beamMon_;
00203   HcalExpertMonitor*      expertMon_;
00204   HcalPedestalMonitor*    pedMon_;
00205   HcalLEDMonitor*         ledMon_;
00206   HcalLaserMonitor*       laserMon_;
00207   HcalMTCCMonitor*        mtccMon_;
00208   HcalHotCellMonitor*     hotMon_;
00209   HcalDeadCellMonitor*    deadMon_;
00210   HcalCaloTowerMonitor*   ctMon_;
00211   HcalTrigPrimMonitor*    tpMon_;
00212   HcalTemplateAnalysis*   tempAnalysis_;
00213   HcalEEUSMonitor*        eeusMon_;
00214 
00215   edm::ESHandle<HcalDbService> conditions_;
00216   const HcalElectronicsMap*    readoutMap_;
00217 
00218   ofstream m_logFile;
00219 
00220   // Decide whether individual subdetectors should be checked
00221   bool checkHB_;
00222   bool checkHE_;
00223   bool checkHO_;
00224   bool checkHF_;
00225   bool checkZDC_; // not yet implemented 
00226 
00227   // Determine which subdetectors are in the run (using FED info)
00228   int HBpresent_;
00229   int HEpresent_;
00230   int HOpresent_;
00231   int HFpresent_;
00232   int ZDCpresent_; // need to implement
00233   MonitorElement* meHB_;
00234   MonitorElement* meHE_;
00235   MonitorElement* meHO_;
00236   MonitorElement* meHF_;
00237   MonitorElement* meZDC_;
00238 
00239   // myquality_ will store status values for each det ID I find
00240   bool dump2database_;
00241   std::map<HcalDetId, unsigned int> myquality_;
00242   HcalChannelQuality* chanquality_;
00243 };
00244 
00245 #endif

Generated on Tue Jun 9 17:32:57 2009 for CMSSW by  doxygen 1.5.4