00001 #ifndef HcalMonitorModule_H
00002 #define HcalMonitorModule_H
00003
00004
00005
00006
00007
00008
00009
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
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
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
00077 HcalMonitorModule(const edm::ParameterSet& ps);
00078
00079
00080 ~HcalMonitorModule();
00081
00082 protected:
00083
00084
00085 void analyze(const edm::Event& e, const edm::EventSetup& c);
00086
00087
00088 void beginJob(const edm::EventSetup& c);
00089
00090
00091 void beginRun(const edm::Run& run, const edm::EventSetup& c);
00092
00093
00094 void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00095 const edm::EventSetup& c) ;
00096
00097
00098 void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00099 const edm::EventSetup& c);
00100
00101
00102 void endJob(void);
00103
00104
00105 void endRun(const edm::Run& run, const edm::EventSetup& c);
00106
00107
00108 void reset(void);
00109
00111 bool prescale();
00112
00113
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
00121 );
00122
00123 private:
00124
00125
00126
00127
00128
00132 int prescaleEvt_;
00133 int prescaleLS_;
00134 int prescaleTime_;
00135 int prescaleUpdate_;
00136
00139 std::string monitorName_;
00140
00142 int debug_;
00143
00144
00145 bool showTiming_;
00146 edm::CPUTimer cpu_timer;
00147
00148
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
00164 int irun_,ilumisec_,ievent_,itime_;
00165 bool actonLS_ ;
00166 std::string rootFolder_;
00167
00168 int ievt_;
00169 int ievt_pre_;
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
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
00221 bool checkHB_;
00222 bool checkHE_;
00223 bool checkHO_;
00224 bool checkHF_;
00225 bool checkZDC_;
00226
00227
00228 int HBpresent_;
00229 int HEpresent_;
00230 int HOpresent_;
00231 int HFpresent_;
00232 int ZDCpresent_;
00233 MonitorElement* meHB_;
00234 MonitorElement* meHE_;
00235 MonitorElement* meHO_;
00236 MonitorElement* meHF_;
00237 MonitorElement* meZDC_;
00238
00239
00240 bool dump2database_;
00241 std::map<HcalDetId, unsigned int> myquality_;
00242 HcalChannelQuality* chanquality_;
00243 };
00244
00245 #endif