00001 // -*- C++ -*- 00002 // 00003 // Package: HLXMonitor 00004 // Class: HLXMonitor 00005 // 00013 // 00014 // Original Author: Adam Hunt - Princeton University 00015 // email: ahunt@princeton.edu 00016 // Created: Thu Jul 19 02:29:59 EDT 2007 00017 // $Id: HLXMonitor.h,v 1.21 2010/07/21 04:23:20 wmtan Exp $ 00018 // 00019 // 00020 00021 #ifndef _HLXMONITOR_H_ 00022 #define _HLXMONITOR_H_ 00023 00024 // system include fileshlx_dqm_sourceclient-live.cfg 00025 #include <iostream> 00026 #include <string> 00027 #include <memory> 00028 #include <iomanip> 00029 #include <cstdlib> 00030 #include <sys/time.h> 00031 00032 // user include files 00033 #include "FWCore/Framework/interface/Frameworkfwd.h" // Not included in example 00034 00035 #include "FWCore/Framework/interface/Event.h" // Not included in example 00036 #include "FWCore/Framework/interface/MakerMacros.h" // Not included in example 00037 00038 #include "FWCore/Framework/interface/EDAnalyzer.h" 00039 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00040 00041 #include "DQMServices/Core/interface/DQMStore.h" 00042 #include "DQMServices/Core/interface/MonitorElement.h" 00043 00044 #include "FWCore/ServiceRegistry/interface/Service.h" 00045 00046 #include "RecoLuminosity/TCPReceiver/interface/TCPReceiver.h" 00047 #include "RecoLuminosity/TCPReceiver/interface/LumiStructures.hh" 00048 00049 // 00050 // class decleration 00051 // 00052 00053 00054 class HLXMonitor : public edm::EDAnalyzer 00055 { 00056 00057 public: 00058 typedef HCAL_HLX::LUMI_SECTION LUMI_SECTION; 00059 typedef HCAL_HLX::TCPReceiver TCPReceiver; 00060 explicit HLXMonitor(const edm::ParameterSet&); 00061 ~HLXMonitor(); 00062 00063 private: 00064 virtual void beginJob() ; 00065 virtual void analyze(const edm::Event&, const edm::EventSetup&); 00066 virtual void endJob(); 00067 //virtual void endRun(const edm::Run&, const edm::EventSetup&); 00068 00069 void SaveDQMFile(); 00070 00071 void SetupHists(); 00072 void SetupEventInfo(); 00073 00074 void FillHistograms(const LUMI_SECTION&); 00075 void FillHistoHFCompare(const LUMI_SECTION&); 00076 void FillReportSummary(); 00077 void FillEventInfo(const LUMI_SECTION&, const edm::Event& e); 00078 00079 void ResetAll(); 00080 00081 void EndRun( bool saveFile = true ); 00082 00083 double getUTCtime(timeval* a, timeval* b = NULL); 00084 00085 // void FillHistoHistory(const LUMI_SECTION&); 00086 00087 // ----------member data --------------------------- 00088 TCPReceiver HLXTCP; 00089 00090 MonitorElement * Set1Below[36]; 00091 MonitorElement * Set1Between[36]; 00092 MonitorElement * Set1Above[36]; 00093 MonitorElement * Set2Below[36]; 00094 MonitorElement * Set2Between[36]; 00095 MonitorElement * Set2Above[36]; 00096 MonitorElement * ETSum[36]; 00097 00098 MonitorElement * HFCompareEtSum; 00099 MonitorElement * HFCompareOccBelowSet1; 00100 MonitorElement * HFCompareOccBetweenSet1; 00101 MonitorElement * HFCompareOccAboveSet1; 00102 MonitorElement * HFCompareOccBelowSet2; 00103 MonitorElement * HFCompareOccBetweenSet2; 00104 MonitorElement * HFCompareOccAboveSet2; 00105 00106 MonitorElement * AvgEtSum; 00107 MonitorElement * AvgOccBelowSet1; 00108 MonitorElement * AvgOccBetweenSet1; 00109 MonitorElement * AvgOccAboveSet1; 00110 MonitorElement * AvgOccBelowSet2; 00111 MonitorElement * AvgOccBetweenSet2; 00112 MonitorElement * AvgOccAboveSet2; 00113 00114 // Luminosity Monitoring 00115 MonitorElement * LumiAvgEtSum; 00116 MonitorElement * LumiAvgOccSet1; 00117 MonitorElement * LumiAvgOccSet2; 00118 MonitorElement * LumiInstantEtSum; 00119 MonitorElement * LumiInstantOccSet1; 00120 MonitorElement * LumiInstantOccSet2; 00121 MonitorElement * LumiIntegratedEtSum; 00122 MonitorElement * LumiIntegratedOccSet1; 00123 MonitorElement * LumiIntegratedOccSet2; 00124 00125 // Sanity Check for Occupancy 00126 MonitorElement * SumAllOccSet1; 00127 MonitorElement * SumAllOccSet2; 00128 MonitorElement * MissingDQMDataCheck; 00129 00130 // Signal and Background Levels 00131 MonitorElement * MaxInstLumiBX1; 00132 MonitorElement * MaxInstLumiBX2; 00133 MonitorElement * MaxInstLumiBX3; 00134 MonitorElement * MaxInstLumiBX4; 00135 00136 MonitorElement * MaxInstLumiBXNum1; 00137 MonitorElement * MaxInstLumiBXNum2; 00138 MonitorElement * MaxInstLumiBXNum3; 00139 MonitorElement * MaxInstLumiBXNum4; 00140 00141 // History plots - fill once per LS 00142 MonitorElement * HistAvgEtSumHFP; 00143 MonitorElement * HistAvgEtSumHFM; 00144 MonitorElement * HistAvgOccBelowSet1HFP; 00145 MonitorElement * HistAvgOccBelowSet1HFM; 00146 MonitorElement * HistAvgOccBetweenSet1HFP; 00147 MonitorElement * HistAvgOccBetweenSet1HFM; 00148 MonitorElement * HistAvgOccAboveSet1HFP; 00149 MonitorElement * HistAvgOccAboveSet1HFM; 00150 MonitorElement * HistAvgOccBelowSet2HFP; 00151 MonitorElement * HistAvgOccBelowSet2HFM; 00152 MonitorElement * HistAvgOccBetweenSet2HFP; 00153 MonitorElement * HistAvgOccBetweenSet2HFM; 00154 MonitorElement * HistAvgOccAboveSet2HFP; 00155 MonitorElement * HistAvgOccAboveSet2HFM; 00156 MonitorElement * BXvsTimeAvgEtSumHFP; 00157 MonitorElement * BXvsTimeAvgEtSumHFM; 00158 00159 MonitorElement * HistAvgLumiEtSum; 00160 MonitorElement * HistAvgLumiOccSet1; 00161 MonitorElement * HistAvgLumiOccSet2; 00162 MonitorElement * HistInstantLumiEtSum; 00163 MonitorElement * HistInstantLumiOccSet1; 00164 MonitorElement * HistInstantLumiOccSet2; 00165 MonitorElement * HistInstantLumiEtSumError; 00166 MonitorElement * HistInstantLumiOccSet1Error; 00167 MonitorElement * HistInstantLumiOccSet2Error; 00168 MonitorElement * HistIntegratedLumiEtSum; 00169 MonitorElement * HistIntegratedLumiOccSet1; 00170 MonitorElement * HistIntegratedLumiOccSet2; 00171 00172 MonitorElement * RecentInstantLumiEtSum; 00173 MonitorElement * RecentInstantLumiOccSet1; 00174 MonitorElement * RecentInstantLumiOccSet2; 00175 MonitorElement * RecentIntegratedLumiEtSum; 00176 MonitorElement * RecentIntegratedLumiOccSet1; 00177 MonitorElement * RecentIntegratedLumiOccSet2; 00178 00179 00180 //EventInfo Clone 00185 MonitorElement * runId_; 00186 MonitorElement * runStartTimeStamp_; 00187 MonitorElement * eventId_; 00188 MonitorElement * lumisecId_; 00189 MonitorElement * eventTimeStamp_; 00190 00194 MonitorElement * nUpdates_; 00195 MonitorElement * processId_; 00196 MonitorElement * processStartTimeStamp_; 00197 MonitorElement * processTimeStamp_; 00198 MonitorElement * processLatency_; 00199 MonitorElement * processEventRate_; 00200 MonitorElement * processEvents_; 00201 MonitorElement * hostName_; 00202 MonitorElement * processName_; 00203 MonitorElement * workingDir_; 00204 MonitorElement * cmsswVer_; 00205 MonitorElement * dqmPatch_; 00206 MonitorElement * errSummary_; 00207 MonitorElement * errSummaryEtaPhi_; 00208 MonitorElement * errSummarySegment_[10]; 00209 00210 // Report Summary 00211 MonitorElement * reportSummary_; 00212 MonitorElement * reportSummaryMap_; 00213 00214 // DQM Store ... 00215 DQMStore* dbe_; 00216 00217 unsigned int numActiveTowersSet1; 00218 unsigned int numActiveTowersSet2; 00219 00220 unsigned int counter; 00221 unsigned char *rData; 00222 short int SectionComplete; 00223 00224 // Parameters 00225 int listenPort; 00226 double XMIN, XMAX; 00227 unsigned int NBINS; 00228 bool Accumulate; 00229 std::string OutputFilePrefix; 00230 std::string OutputDir; 00231 std::string Style; // BX, History, Distribution 00232 int SavePeriod; 00233 unsigned int NUM_HLX; 00234 unsigned int NUM_BUNCHES; 00235 unsigned int MAX_LS; 00236 unsigned int AquireMode; 00237 unsigned int TriggerBX; 00238 unsigned int MinLSBeforeSave; 00239 00240 std::string monitorName_; 00241 int prescaleEvt_; 00242 00243 unsigned int reconnTime; 00244 std::string DistribIP1; 00245 std::string DistribIP2; 00246 00247 unsigned int set1BelowIndex; 00248 unsigned int set1BetweenIndex; 00249 unsigned int set1AboveIndex; 00250 unsigned int set2BelowIndex; 00251 unsigned int set2BetweenIndex; 00252 unsigned int set2AboveIndex; 00253 00254 bool ResetAtNewRun; 00255 bool SaveAtEndJob; 00256 00257 std::string eventInfoFolderHLX_; 00258 std::string eventInfoFolder_; 00259 std::string subSystemName_; 00260 00261 unsigned int runNumLength; 00262 unsigned int secNumLength; 00263 00264 std::string OccXAxisTitle; 00265 std::string OccYAxisTitle; 00266 std::string EtXAxisTitle; 00267 std::string EtYAxisTitle; 00268 00269 HCAL_HLX::LUMI_SECTION lumiSection; 00270 00271 bool currentRunEnded_; 00272 unsigned int runNumber_; 00273 unsigned int expectedNibbles_; 00274 unsigned int totalNibbles_[36]; 00275 00276 unsigned int HLXHFMap[36]; 00277 00278 unsigned int previousSection; 00279 unsigned int lumiSectionCount; 00280 int lsBinOld; 00281 double sectionInstantSumEt; 00282 double sectionInstantErrSumEt; 00283 double sectionInstantSumOcc1; 00284 double sectionInstantErrSumOcc1; 00285 double sectionInstantSumOcc2; 00286 double sectionInstantErrSumOcc2; 00287 double sectionInstantNorm; 00288 00289 // EventInfo Parameters 00290 timeval currentTime_, lastUpdateTime_, lastAvgTime_; 00291 timeval runStartTime_; 00292 float evtRateWindow_; 00293 int evtRateCount_; 00294 int pEvent_; 00295 00296 // Lumi section info 00297 double num4NibblePerLS_; 00298 00299 }; 00300 00301 #endif