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.10 2008/10/24 20:15:02 neadam 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 00031 // user include files 00032 #include "FWCore/Framework/interface/Frameworkfwd.h" // Not included in example 00033 00034 #include "FWCore/Framework/interface/Event.h" // Not included in example 00035 #include "FWCore/Framework/interface/MakerMacros.h" // Not included in example 00036 00037 #include "FWCore/Framework/interface/EDAnalyzer.h" 00038 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00039 00040 #include "DQMServices/Core/interface/DQMStore.h" 00041 #include "DQMServices/Core/interface/MonitorElement.h" 00042 00043 #include "FWCore/ServiceRegistry/interface/Service.h" 00044 00045 #include "RecoLuminosity/TCPReceiver/interface/TCPReceiver.h" 00046 00047 using namespace HCAL_HLX; 00048 00049 // 00050 // class decleration 00051 // 00052 00053 00054 00055 class HLXMonitor : public edm::EDAnalyzer 00056 { 00057 00058 public: 00059 explicit HLXMonitor(const edm::ParameterSet&); 00060 ~HLXMonitor(); 00061 00062 private: 00063 virtual void beginJob(const edm::EventSetup&) ; 00064 virtual void analyze(const edm::Event&, const edm::EventSetup&); 00065 virtual void endJob(); 00066 //virtual void endRun(const edm::Run&, const edm::EventSetup&); 00067 00068 void SaveDQMFile(); 00069 00070 void SetupHists(); 00071 void SetupEventInfo(); 00072 00073 void FillHistograms(const LUMI_SECTION&); 00074 void FillHistoHFCompare(const LUMI_SECTION&); 00075 void FillEventInfo(const LUMI_SECTION&); 00076 00077 void ResetAll(); 00078 00079 void EndRun( bool saveFile = true ); 00080 00081 // void FillHistoHistory(const LUMI_SECTION&); 00082 00083 // ----------member data --------------------------- 00084 TCPReceiver HLXTCP; 00085 00086 MonitorElement * Set1Below[36]; 00087 MonitorElement * Set1Between[36]; 00088 MonitorElement * Set1Above[36]; 00089 MonitorElement * Set2Below[36]; 00090 MonitorElement * Set2Between[36]; 00091 MonitorElement * Set2Above[36]; 00092 MonitorElement * ETSum[36]; 00093 00094 MonitorElement * HFCompareEtSum; 00095 MonitorElement * HFCompareOccBelowSet1; 00096 MonitorElement * HFCompareOccBetweenSet1; 00097 MonitorElement * HFCompareOccAboveSet1; 00098 MonitorElement * HFCompareOccBelowSet2; 00099 MonitorElement * HFCompareOccBetweenSet2; 00100 MonitorElement * HFCompareOccAboveSet2; 00101 00102 MonitorElement * AvgEtSum; 00103 MonitorElement * AvgOccBelowSet1; 00104 MonitorElement * AvgOccBetweenSet1; 00105 MonitorElement * AvgOccAboveSet1; 00106 MonitorElement * AvgOccBelowSet2; 00107 MonitorElement * AvgOccBetweenSet2; 00108 MonitorElement * AvgOccAboveSet2; 00109 00110 // Luminosity Monitoring 00111 MonitorElement * LumiAvgEtSum; 00112 MonitorElement * LumiAvgOccSet1; 00113 MonitorElement * LumiAvgOccSet2; 00114 MonitorElement * LumiInstantEtSum; 00115 MonitorElement * LumiInstantOccSet1; 00116 MonitorElement * LumiInstantOccSet2; 00117 MonitorElement * LumiIntegratedEtSum; 00118 MonitorElement * LumiIntegratedOccSet1; 00119 MonitorElement * LumiIntegratedOccSet2; 00120 00121 // Sanity Check for Occupancy 00122 MonitorElement * SumAllOccSet1; 00123 MonitorElement * SumAllOccSet2; 00124 00125 // History plots - fill once per LS 00126 MonitorElement * HistAvgEtSumHFP; 00127 MonitorElement * HistAvgEtSumHFM; 00128 MonitorElement * HistAvgOccBelowSet1HFP; 00129 MonitorElement * HistAvgOccBelowSet1HFM; 00130 MonitorElement * HistAvgOccBetweenSet1HFP; 00131 MonitorElement * HistAvgOccBetweenSet1HFM; 00132 MonitorElement * HistAvgOccAboveSet1HFP; 00133 MonitorElement * HistAvgOccAboveSet1HFM; 00134 MonitorElement * HistAvgOccBelowSet2HFP; 00135 MonitorElement * HistAvgOccBelowSet2HFM; 00136 MonitorElement * HistAvgOccBetweenSet2HFP; 00137 MonitorElement * HistAvgOccBetweenSet2HFM; 00138 MonitorElement * HistAvgOccAboveSet2HFP; 00139 MonitorElement * HistAvgOccAboveSet2HFM; 00140 MonitorElement * BXvsTimeAvgEtSumHFP; 00141 MonitorElement * BXvsTimeAvgEtSumHFM; 00142 00143 MonitorElement * HistAvgLumiEtSum; 00144 MonitorElement * HistAvgLumiOccSet1; 00145 MonitorElement * HistAvgLumiOccSet2; 00146 MonitorElement * HistInstantLumiEtSum; 00147 MonitorElement * HistInstantLumiOccSet1; 00148 MonitorElement * HistInstantLumiOccSet2; 00149 MonitorElement * HistIntegratedLumiEtSum; 00150 MonitorElement * HistIntegratedLumiOccSet1; 00151 MonitorElement * HistIntegratedLumiOccSet2; 00152 00153 MonitorElement * RecentInstantLumiEtSum; 00154 MonitorElement * RecentInstantLumiOccSet1; 00155 MonitorElement * RecentInstantLumiOccSet2; 00156 MonitorElement * RecentIntegratedLumiEtSum; 00157 MonitorElement * RecentIntegratedLumiOccSet1; 00158 MonitorElement * RecentIntegratedLumiOccSet2; 00159 00160 00161 //EventInfo Clone 00166 MonitorElement * runId_; 00167 MonitorElement * lumisecId_; 00168 00169 // Report Summary 00170 MonitorElement * reportSummary_; 00171 MonitorElement * reportSummaryMap_; 00172 00173 // DQM Store ... 00174 DQMStore* dbe_; 00175 00176 unsigned int numActiveTowersSet1; 00177 unsigned int numActiveTowersSet2; 00178 00179 unsigned int counter; 00180 unsigned char *rData; 00181 short int SectionComplete; 00182 00183 // Parameters 00184 int listenPort; 00185 double XMIN, XMAX; 00186 unsigned int NBINS; 00187 bool Accumulate; 00188 std::string OutputFilePrefix; 00189 std::string OutputDir; 00190 std::string Style; // BX, History, Distribution 00191 int SavePeriod; 00192 unsigned int NUM_HLX; 00193 unsigned int NUM_BUNCHES; 00194 unsigned int MAX_LS; 00195 unsigned int AquireMode; 00196 unsigned int TriggerBX; 00197 00198 std::string monitorName_; 00199 int prescaleEvt_; 00200 00201 unsigned int reconnTime; 00202 std::string DistribIP1; 00203 std::string DistribIP2; 00204 00205 unsigned int set1BelowIndex; 00206 unsigned int set1BetweenIndex; 00207 unsigned int set1AboveIndex; 00208 unsigned int set2BelowIndex; 00209 unsigned int set2BetweenIndex; 00210 unsigned int set2AboveIndex; 00211 00212 bool ResetAtNewRun; 00213 bool SaveAtEndJob; 00214 00215 std::string eventInfoFolder_; 00216 std::string subSystemName_; 00217 00218 unsigned int runNumLength; 00219 unsigned int secNumLength; 00220 00221 std::string OccXAxisTitle; 00222 std::string OccYAxisTitle; 00223 std::string EtXAxisTitle; 00224 std::string EtYAxisTitle; 00225 00226 HCAL_HLX::LUMI_SECTION lumiSection; 00227 00228 unsigned int runNumber_; 00229 unsigned int expectedNibbles_; 00230 unsigned int totalNibbles_[36]; 00231 00232 unsigned int HLXHFMap[36]; 00233 00234 unsigned int lumiSectionCount; 00235 int lsBinOld; 00236 double sectionInstantSumEt; 00237 double sectionInstantErrSumEt; 00238 double sectionInstantSumOcc1; 00239 double sectionInstantErrSumOcc1; 00240 double sectionInstantSumOcc2; 00241 double sectionInstantErrSumOcc2; 00242 double sectionInstantNorm; 00243 00244 }; 00245 00246 #endif