00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <iostream>
00011 #include <fstream>
00012 #include <math.h>
00013
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019
00020 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00021 #include "FWCore/Framework/interface/ESHandle.h"
00022 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
00023 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00024 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00025 #include "DataFormats/Math/interface/Point3D.h"
00026 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
00027 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
00028
00029 #include "DQM/EcalCommon/interface/Numbers.h"
00030 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00031 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00032 #include "DataFormats/EcalDetId/interface/EcalDetIdCollections.h"
00033 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00034 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00035 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00036 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00037 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00038 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00039 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
00040
00041 #include "DQM/EcalEndcapMonitorTasks/interface/EETrendTask.h"
00042 #include "DQM/EcalCommon/interface/UtilFunctions.h"
00043
00044 #include "TProfile.h"
00045
00046 EETrendTask::EETrendTask(const edm::ParameterSet& ps){
00047
00048 init_ = false;
00049
00050 dqmStore_ = edm::Service<DQMStore>().operator->();
00051
00052 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00053 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00054 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00055 verbose_ = ps.getUntrackedParameter<bool>("verbose", false);
00056
00057
00058 EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
00059 EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
00060 EcalTrigPrimDigiCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollection");
00061 EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection");
00062 BasicClusterCollection_ = ps.getParameter<edm::InputTag>("BasicClusterCollection");
00063 SuperClusterCollection_ = ps.getParameter<edm::InputTag>("SuperClusterCollection");
00064 EEDetIdCollection0_ = ps.getParameter<edm::InputTag>("EEDetIdCollection0");
00065 EEDetIdCollection1_ = ps.getParameter<edm::InputTag>("EEDetIdCollection1");
00066 EEDetIdCollection2_ = ps.getParameter<edm::InputTag>("EEDetIdCollection2");
00067 EEDetIdCollection3_ = ps.getParameter<edm::InputTag>("EEDetIdCollection3");
00068 EcalElectronicsIdCollection1_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection1");
00069 EcalElectronicsIdCollection2_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection2");
00070 EcalElectronicsIdCollection3_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection3");
00071 EcalElectronicsIdCollection4_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection4");
00072 EcalElectronicsIdCollection5_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection5");
00073 EcalElectronicsIdCollection6_ = ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection6");
00074 FEDRawDataCollection_ = ps.getParameter<edm::InputTag>("FEDRawDataCollection");
00075 EESRFlagCollection_ = ps.getParameter<edm::InputTag>("EESRFlagCollection");
00076
00077
00078 nEEDigiMinutely_ = 0;
00079 nEcalPnDiodeDigiMinutely_ = 0;
00080 nEcalRecHitMinutely_ = 0;
00081 nEcalTrigPrimDigiMinutely_ = 0;
00082 nBasicClusterMinutely_ = 0;
00083 nBasicClusterSizeMinutely_ = 0;
00084 nSuperClusterMinutely_ = 0;
00085 nSuperClusterSizeMinutely_ = 0;
00086 nIntegrityErrorMinutely_ = 0;
00087 nFEDEEminusRawDataMinutely_ = 0;
00088 nFEDEEplusRawDataMinutely_ = 0;
00089 nEESRFlagMinutely_ = 0;
00090
00091 nEEDigiHourly_ = 0;
00092 nEcalPnDiodeDigiHourly_ = 0;
00093 nEcalRecHitHourly_ = 0;
00094 nEcalTrigPrimDigiHourly_ = 0;
00095 nBasicClusterHourly_ = 0;
00096 nBasicClusterSizeHourly_ = 0;
00097 nSuperClusterHourly_ = 0;
00098 nSuperClusterSizeHourly_ = 0;
00099 nIntegrityErrorHourly_ = 0;
00100 nFEDEEminusRawDataHourly_ = 0;
00101 nFEDEEplusRawDataHourly_ = 0;
00102 nEESRFlagHourly_ = 0;
00103 }
00104
00105
00106 EETrendTask::~EETrendTask(){
00107 }
00108
00109
00110 void EETrendTask::beginJob(void){
00111
00112 ievt_ = 0;
00113
00114 if ( dqmStore_ ) {
00115 dqmStore_->setCurrentFolder(prefixME_ + "/EETrendTask");
00116 dqmStore_->rmdir(prefixME_ + "/EETrendTask");
00117 }
00118
00119 }
00120
00121
00122 void EETrendTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00123
00124 Numbers::initGeometry(c, false);
00125
00126 if ( ! mergeRuns_ ) this->reset();
00127
00128 start_time_ = time(NULL);
00129
00130 }
00131
00132
00133 void EETrendTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00134
00135 }
00136
00137
00138 void EETrendTask::reset(void) {
00139
00140 if(nEEDigiMinutely_) nEEDigiMinutely_->Reset();
00141 if(nEcalPnDiodeDigiMinutely_) nEcalPnDiodeDigiMinutely_->Reset();
00142 if(nEcalRecHitMinutely_) nEcalRecHitMinutely_->Reset();
00143 if(nEcalTrigPrimDigiMinutely_) nEcalTrigPrimDigiMinutely_->Reset();
00144 if(nBasicClusterMinutely_) nBasicClusterMinutely_->Reset();
00145 if(nBasicClusterSizeMinutely_) nBasicClusterSizeMinutely_->Reset();
00146 if(nSuperClusterMinutely_) nSuperClusterMinutely_->Reset();
00147 if(nSuperClusterSizeMinutely_) nSuperClusterSizeMinutely_->Reset();
00148 if(nIntegrityErrorMinutely_) nIntegrityErrorMinutely_->Reset();
00149 if(nFEDEEminusRawDataMinutely_) nFEDEEminusRawDataMinutely_->Reset();
00150 if(nFEDEEplusRawDataMinutely_) nFEDEEplusRawDataMinutely_->Reset();
00151 if(nEESRFlagMinutely_) nEESRFlagMinutely_->Reset();
00152
00153 if(nEEDigiHourly_) nEEDigiHourly_->Reset();
00154 if(nEcalPnDiodeDigiHourly_) nEcalPnDiodeDigiHourly_->Reset();
00155 if(nEcalRecHitHourly_) nEcalRecHitHourly_->Reset();
00156 if(nEcalTrigPrimDigiHourly_) nEcalTrigPrimDigiHourly_->Reset();
00157 if(nBasicClusterHourly_) nBasicClusterHourly_->Reset();
00158 if(nBasicClusterSizeHourly_) nBasicClusterSizeHourly_->Reset();
00159 if(nSuperClusterHourly_) nSuperClusterHourly_->Reset();
00160 if(nSuperClusterSizeHourly_) nSuperClusterSizeHourly_->Reset();
00161 if(nIntegrityErrorHourly_) nIntegrityErrorHourly_->Reset();
00162 if(nFEDEEminusRawDataHourly_) nFEDEEminusRawDataHourly_->Reset();
00163 if(nFEDEEplusRawDataHourly_) nFEDEEplusRawDataHourly_->Reset();
00164 if(nEESRFlagHourly_) nEESRFlagHourly_->Reset();
00165
00166 }
00167
00168
00169 void EETrendTask::setup(void){
00170
00171 init_ = true;
00172
00173 std::string name;
00174
00175 if ( dqmStore_ ) {
00176 dqmStore_->setCurrentFolder(prefixME_ + "/EETrendTask");
00177
00178
00179
00180 name = "AverageNumberOfEEDigiVs5Minutes";
00181 nEEDigiMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00182 nEEDigiMinutely_->setAxisTitle("Minutes", 1);
00183 nEEDigiMinutely_->setAxisTitle("Average Number of EEDigi / 5 minutes", 2);
00184
00185 name = "AverageNumberOfEcalPnDiodeDigiVs5Minutes";
00186 nEcalPnDiodeDigiMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00187 nEcalPnDiodeDigiMinutely_->setAxisTitle("Minutes", 1);
00188 nEcalPnDiodeDigiMinutely_->setAxisTitle("Average Number of EcalPnDiodeDigi / 5 minutes", 2);
00189
00190 name = "AverageNumberOfEcalRecHitVs5Minutes";
00191 nEcalRecHitMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00192 nEcalRecHitMinutely_->setAxisTitle("Minutes", 1);
00193 nEcalRecHitMinutely_->setAxisTitle("Average Number of EcalRecHit / 5 minutes", 2);
00194
00195 name = "AverageNumberOfEcalTrigPrimDigiVs5Minutes";
00196 nEcalTrigPrimDigiMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00197 nEcalTrigPrimDigiMinutely_->setAxisTitle("Minutes", 1);
00198 nEcalTrigPrimDigiMinutely_->setAxisTitle("Average Number of EcalTrigPrimDigi / 5 minutes", 2);
00199
00200 name = "AverageNumberOfBasicClusterVs5Minutes";
00201 nBasicClusterMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00202 nBasicClusterMinutely_->setAxisTitle("Minutes", 1);
00203 nBasicClusterMinutely_->setAxisTitle("Average Number of BasicClusters / 5 minutes", 2);
00204
00205 name = "AverageNumberOfBasicClusterSizeVs5Minutes";
00206 nBasicClusterSizeMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00207 nBasicClusterSizeMinutely_->setAxisTitle("Minutes", 1);
00208 nBasicClusterSizeMinutely_->setAxisTitle("Average Size of BasicClusters / 5 minutes", 2);
00209
00210 name = "AverageNumberOfSuperClusterVs5Minutes";
00211 nSuperClusterMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00212 nSuperClusterMinutely_->setAxisTitle("Minutes", 1);
00213 nSuperClusterMinutely_->setAxisTitle("Average Number of SuperClusters / 5 minutes", 2);
00214
00215 name = "AverageNumberOfSuperClusterSizeVs5Minutes";
00216 nSuperClusterSizeMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00217 nSuperClusterSizeMinutely_->setAxisTitle("Minutes", 1);
00218 nSuperClusterSizeMinutely_->setAxisTitle("Average Size of SuperClusters / 5 minutes", 2);
00219
00220 name = "AverageNumberOfIntegrityErrorVs5Minutes";
00221 nIntegrityErrorMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00222 nIntegrityErrorMinutely_->setAxisTitle("Minutes", 1);
00223 nIntegrityErrorMinutely_->setAxisTitle("Average IntegrityErrors / 5 minutes", 2);
00224
00225 name = "AverageNumberOfFEDEEminusRawDataVs5Minutes";
00226 nFEDEEminusRawDataMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00227 nFEDEEminusRawDataMinutely_->setAxisTitle("Minutes", 1);
00228 nFEDEEminusRawDataMinutely_->setAxisTitle("Average Number of FEDRawData in EE- / 5 minutes", 2);
00229
00230 name = "AverageNumberOfFEDEEplusRawDataVs5Minutes";
00231 nFEDEEplusRawDataMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00232 nFEDEEplusRawDataMinutely_->setAxisTitle("Minutes", 1);
00233 nFEDEEplusRawDataMinutely_->setAxisTitle("Average Number of FEDRawData in EE+ / 5 minutes", 2);
00234
00235 name = "AverageNumberOfEESRFlagVs5Minutes";
00236 nEESRFlagMinutely_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00237 nEESRFlagMinutely_->setAxisTitle("Minutes", 1);
00238 nEESRFlagMinutely_->setAxisTitle("Average Number of EESRFlag / 5 minutes", 2);
00239
00240
00241
00242
00243 name = "AverageNumberOfEEDigiVs1Hour";
00244 nEEDigiHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00245 nEEDigiHourly_->setAxisTitle("Hours", 1);
00246 nEEDigiHourly_->setAxisTitle("Average Number of EEDigi / hour", 2);
00247
00248 name = "AverageNumberOfEcalPnDiodeDigiVs1Hour";
00249 nEcalPnDiodeDigiHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00250 nEcalPnDiodeDigiHourly_->setAxisTitle("Hours", 1);
00251 nEcalPnDiodeDigiHourly_->setAxisTitle("Average Number of EcalPnDiodeDigi / hour", 2);
00252
00253 name = "AverageNumberOfEcalRecHitVs1Hour";
00254 nEcalRecHitHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00255 nEcalRecHitHourly_->setAxisTitle("Hours", 1);
00256 nEcalRecHitHourly_->setAxisTitle("Average Number of EcalRecHit / hour", 2);
00257
00258 name = "AverageNumberOfEcalTrigPrimDigiVs1Hour";
00259 nEcalTrigPrimDigiHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00260 nEcalTrigPrimDigiHourly_->setAxisTitle("Hours", 1);
00261 nEcalTrigPrimDigiHourly_->setAxisTitle("Average Number of EcalTrigPrimDigi / hour", 2);
00262
00263 name = "AverageNumberOfBasicClusterVs1Hour";
00264 nBasicClusterHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00265 nBasicClusterHourly_->setAxisTitle("Hours", 1);
00266 nBasicClusterHourly_->setAxisTitle("Average Number of BasicClusters / hour", 2);
00267
00268 name = "AverageNumberOfBasicClusterSizeVs1Hour";
00269 nBasicClusterSizeHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00270 nBasicClusterSizeHourly_->setAxisTitle("Hours", 1);
00271 nBasicClusterSizeHourly_->setAxisTitle("Average Size of BasicClusters / hour", 2);
00272
00273 name = "AverageNumberOfSuperClusterVs1Hour";
00274 nSuperClusterHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00275 nSuperClusterHourly_->setAxisTitle("Hours", 1);
00276 nSuperClusterHourly_->setAxisTitle("Average Number of SuperClusters / hour", 2);
00277
00278 name = "AverageNumberOfSuperClusterSizeVs1Hour";
00279 nSuperClusterSizeHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00280 nSuperClusterSizeHourly_->setAxisTitle("Hours", 1);
00281 nSuperClusterSizeHourly_->setAxisTitle("Average Size of SuperClusters / hour", 2);
00282
00283 name = "AverageNumberOfIntegrityErrorVs1Hour";
00284 nIntegrityErrorHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00285 nIntegrityErrorHourly_->setAxisTitle("Hours", 1);
00286 nIntegrityErrorHourly_->setAxisTitle("Average IntegrityErrors / hour", 2);
00287
00288 name = "AverageNumberOfFEDEEminusRawDataVs1Hour";
00289 nFEDEEminusRawDataHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00290 nFEDEEminusRawDataHourly_->setAxisTitle("Hours", 1);
00291 nFEDEEminusRawDataHourly_->setAxisTitle("Average Number of FEDRawData in EE- / hour", 2);
00292
00293 name = "AverageNumberOfFEDEEplusRawDataVs1Hour";
00294 nFEDEEplusRawDataHourly_ = dqmStore_->bookProfile(name, name, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00295 nFEDEEplusRawDataHourly_->setAxisTitle("Hours", 1);
00296 nFEDEEplusRawDataHourly_->setAxisTitle("Average Number of FEDRawData in EE+ / hour", 2);
00297
00298 name = "AverageNumberOfEESRFlagVs1Hour";
00299 nEESRFlagHourly_ = dqmStore_->bookProfile(name, name, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00300 nEESRFlagHourly_->setAxisTitle("Hours", 1);
00301 nEESRFlagHourly_->setAxisTitle("Average Number of EESRFlag / hour", 2);
00302
00303 }
00304
00305 }
00306
00307
00308 void EETrendTask::cleanup(void){
00309
00310 if ( ! init_ ) return;
00311
00312 if ( dqmStore_ ) {
00313 dqmStore_->setCurrentFolder(prefixME_ + "/EETrendTask");
00314
00315 if(nEEDigiMinutely_) dqmStore_->removeElement( nEEDigiMinutely_->getName());
00316 nEEDigiMinutely_ = 0;
00317 if(nEcalPnDiodeDigiMinutely_) dqmStore_->removeElement( nEcalPnDiodeDigiMinutely_->getName());
00318 nEcalPnDiodeDigiMinutely_ = 0;
00319 if(nEcalRecHitMinutely_) dqmStore_->removeElement( nEcalRecHitMinutely_->getName());
00320 nEcalRecHitMinutely_ = 0;
00321 if(nEcalTrigPrimDigiMinutely_) dqmStore_->removeElement( nEcalTrigPrimDigiMinutely_->getName());
00322 nEcalTrigPrimDigiMinutely_ = 0;
00323 if(nBasicClusterMinutely_) dqmStore_->removeElement( nBasicClusterMinutely_->getName());
00324 nBasicClusterMinutely_ = 0;
00325 if(nBasicClusterSizeMinutely_) dqmStore_->removeElement( nBasicClusterSizeMinutely_->getName());
00326 nBasicClusterSizeMinutely_ = 0;
00327 if(nSuperClusterMinutely_) dqmStore_->removeElement( nSuperClusterMinutely_->getName());
00328 nSuperClusterMinutely_ = 0;
00329 if(nSuperClusterSizeMinutely_) dqmStore_->removeElement( nSuperClusterSizeMinutely_->getName());
00330 nSuperClusterSizeMinutely_ = 0;
00331 if(nIntegrityErrorMinutely_) dqmStore_->removeElement( nIntegrityErrorMinutely_->getName());
00332 nIntegrityErrorMinutely_ = 0;
00333 if(nFEDEEminusRawDataMinutely_) dqmStore_->removeElement( nFEDEEminusRawDataMinutely_->getName());
00334 nFEDEEminusRawDataMinutely_ = 0;
00335 if(nFEDEEplusRawDataMinutely_) dqmStore_->removeElement( nFEDEEplusRawDataMinutely_->getName());
00336 nFEDEEplusRawDataMinutely_ = 0;
00337 if(nEESRFlagMinutely_) dqmStore_->removeElement( nEESRFlagMinutely_->getName());
00338 nEESRFlagMinutely_ = 0;
00339
00340 if(nEEDigiHourly_) dqmStore_->removeElement( nEEDigiHourly_->getName());
00341 nEEDigiHourly_ = 0;
00342 if(nEcalPnDiodeDigiHourly_) dqmStore_->removeElement( nEcalPnDiodeDigiHourly_->getName());
00343 nEcalPnDiodeDigiHourly_ = 0;
00344 if(nEcalRecHitHourly_) dqmStore_->removeElement( nEcalRecHitHourly_->getName());
00345 nEcalRecHitHourly_ = 0;
00346 if(nEcalTrigPrimDigiHourly_) dqmStore_->removeElement( nEcalTrigPrimDigiHourly_->getName());
00347 nEcalTrigPrimDigiHourly_ = 0;
00348 if(nBasicClusterHourly_) dqmStore_->removeElement( nBasicClusterHourly_->getName());
00349 nBasicClusterHourly_ = 0;
00350 if(nBasicClusterSizeHourly_) dqmStore_->removeElement( nBasicClusterSizeHourly_->getName());
00351 nBasicClusterSizeHourly_ = 0;
00352 if(nSuperClusterHourly_) dqmStore_->removeElement( nSuperClusterHourly_->getName());
00353 nSuperClusterHourly_ = 0;
00354 if(nSuperClusterSizeHourly_) dqmStore_->removeElement( nSuperClusterSizeHourly_->getName());
00355 nSuperClusterSizeHourly_ = 0;
00356 if(nIntegrityErrorHourly_) dqmStore_->removeElement( nIntegrityErrorHourly_->getName());
00357 nIntegrityErrorHourly_ = 0;
00358 if(nFEDEEminusRawDataHourly_) dqmStore_->removeElement( nFEDEEminusRawDataHourly_->getName());
00359 nFEDEEminusRawDataHourly_ = 0;
00360 if(nFEDEEplusRawDataHourly_) dqmStore_->removeElement( nFEDEEplusRawDataHourly_->getName());
00361 nFEDEEplusRawDataHourly_ = 0;
00362 if(nEESRFlagHourly_) dqmStore_->removeElement( nEESRFlagHourly_->getName());
00363 nEESRFlagHourly_ = 0;
00364
00365 }
00366
00367 init_ = false;
00368
00369 }
00370
00371
00372 void EETrendTask::endJob(void){
00373
00374 edm::LogInfo("EETrendTask") << "analyzed " << ievt_ << " events";
00375
00376 if ( enableCleanup_ ) this->cleanup();
00377
00378 }
00379
00380
00381 void EETrendTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00382
00383 if ( ! init_ ) this->setup();
00384
00385 ievt_++;
00386
00387
00388
00389
00390
00391 updateTime();
00392
00393 long int minuteBinDiff = -1;
00394 long int minuteDiff = -1;
00395 ecaldqm::calcBins(5,60,start_time_,last_time_,current_time_,minuteBinDiff,minuteDiff);
00396
00397 long int hourBinDiff = -1;
00398 long int hourDiff = -1;
00399 ecaldqm::calcBins(1,3600,start_time_,last_time_,current_time_,hourBinDiff,hourDiff);
00400
00401
00402
00403
00404
00405 int ndc = 0;
00406 edm::Handle<EEDigiCollection> digis;
00407 if ( e.getByLabel(EEDigiCollection_, digis) ) ndc = digis->size();
00408 else edm::LogWarning("EETrendTask") << EEDigiCollection_ << " is not available";
00409
00410 ecaldqm::shift2Right(nEEDigiMinutely_->getTProfile(), minuteBinDiff);
00411 nEEDigiMinutely_->Fill(minuteDiff,ndc);
00412
00413 ecaldqm::shift2Right(nEEDigiHourly_->getTProfile(), hourBinDiff);
00414 nEEDigiHourly_->Fill(hourDiff,ndc);
00415
00416
00417
00418
00419
00420 int npdc = 0;
00421 edm::Handle<EcalPnDiodeDigiCollection> pns;
00422 if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) npdc = pns->size();
00423 else edm::LogWarning("EETrendTask") << EcalPnDiodeDigiCollection_ << " is not available";
00424
00425 ecaldqm::shift2Right(nEcalPnDiodeDigiMinutely_->getTProfile(), minuteBinDiff);
00426 nEcalPnDiodeDigiMinutely_->Fill(minuteDiff,npdc);
00427
00428 ecaldqm::shift2Right(nEcalPnDiodeDigiHourly_->getTProfile(), hourBinDiff);
00429 nEcalPnDiodeDigiHourly_->Fill(hourDiff,npdc);
00430
00431
00432
00433
00434
00435 int nrhc = 0;
00436 edm::Handle<EcalRecHitCollection> hits;
00437 if ( e.getByLabel(EcalRecHitCollection_, hits) ) nrhc = hits->size();
00438 else edm::LogWarning("EETrendTask") << EcalRecHitCollection_ << " is not available";
00439
00440 ecaldqm::shift2Right(nEcalRecHitMinutely_->getTProfile(), minuteBinDiff);
00441 nEcalRecHitMinutely_->Fill(minuteDiff,nrhc);
00442
00443 ecaldqm::shift2Right(nEcalRecHitHourly_->getTProfile(), hourBinDiff);
00444 nEcalRecHitHourly_->Fill(hourDiff,nrhc);
00445
00446
00447
00448
00449
00450 int ntpdc = 0;
00451 edm::Handle<EcalTrigPrimDigiCollection> tpdigis;
00452 if ( e.getByLabel(EcalTrigPrimDigiCollection_, tpdigis) ) ntpdc = tpdigis->size();
00453 else edm::LogWarning("EETrendTask") << EcalTrigPrimDigiCollection_ << " is not available";
00454
00455 ecaldqm::shift2Right(nEcalTrigPrimDigiMinutely_->getTProfile(), minuteBinDiff);
00456 nEcalTrigPrimDigiMinutely_->Fill(minuteDiff,ntpdc);
00457
00458 ecaldqm::shift2Right(nEcalTrigPrimDigiHourly_->getTProfile(), hourBinDiff);
00459 nEcalTrigPrimDigiHourly_->Fill(hourDiff,ntpdc);
00460
00461
00462
00463
00464
00465 int nbcc = 0;
00466 float nbcc_size = 0.0;
00467 edm::Handle<reco::BasicClusterCollection> pBasicClusters;
00468 if ( e.getByLabel(BasicClusterCollection_, pBasicClusters) ) {
00469 nbcc = pBasicClusters->size();
00470 for(reco::BasicClusterCollection::const_iterator it = pBasicClusters->begin();
00471 it != pBasicClusters->end(); it++){
00472 nbcc_size += it->size();
00473 }
00474 if(nbcc == 0) nbcc_size = 0;
00475 else nbcc_size = nbcc_size / nbcc;
00476 }
00477 else edm::LogWarning("EETrendTask") << BasicClusterCollection_ << " is not available";
00478
00479 ecaldqm::shift2Right(nBasicClusterMinutely_->getTProfile(), minuteBinDiff);
00480 nBasicClusterMinutely_->Fill(minuteDiff,nbcc);
00481
00482 ecaldqm::shift2Right(nBasicClusterHourly_->getTProfile(), hourBinDiff);
00483 nBasicClusterHourly_->Fill(hourDiff,nbcc);
00484
00485 ecaldqm::shift2Right(nBasicClusterSizeMinutely_->getTProfile(), minuteBinDiff);
00486 nBasicClusterSizeMinutely_->Fill(minuteDiff,nbcc);
00487
00488 ecaldqm::shift2Right(nBasicClusterSizeHourly_->getTProfile(), hourBinDiff);
00489 nBasicClusterSizeHourly_->Fill(hourDiff,nbcc);
00490
00491
00492
00493
00494 int nscc = 0;
00495 float nscc_size = 0.0;
00496 edm::Handle<reco::SuperClusterCollection> pSuperClusters;
00497 if ( e.getByLabel(SuperClusterCollection_, pSuperClusters) ) {
00498 nscc = pSuperClusters->size();
00499 for(reco::SuperClusterCollection::const_iterator it = pSuperClusters->begin();
00500 it != pSuperClusters->end(); it++){
00501 nscc_size += it->clustersSize();
00502 }
00503 if(nscc == 0) nscc_size = 0;
00504 else nscc_size = nscc_size / nscc;
00505 }
00506 else edm::LogWarning("EETrendTask") << SuperClusterCollection_ << " is not available";
00507
00508 ecaldqm::shift2Right(nSuperClusterMinutely_->getTProfile(), minuteBinDiff);
00509 nSuperClusterMinutely_->Fill(minuteDiff,nscc);
00510
00511 ecaldqm::shift2Right(nSuperClusterHourly_->getTProfile(), hourBinDiff);
00512 nSuperClusterHourly_->Fill(hourDiff,nscc);
00513
00514 ecaldqm::shift2Right(nSuperClusterSizeMinutely_->getTProfile(), minuteBinDiff);
00515 nSuperClusterSizeMinutely_->Fill(minuteDiff,nscc);
00516
00517 ecaldqm::shift2Right(nSuperClusterSizeHourly_->getTProfile(), hourBinDiff);
00518 nSuperClusterSizeHourly_->Fill(hourDiff,nscc);
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529 int ndic0 = 0;
00530 edm::Handle<EEDetIdCollection> ids0;
00531 if ( e.getByLabel(EEDetIdCollection0_, ids0) ) ndic0 = ids0->size();
00532 else edm::LogWarning("EETrendTask") << EEDetIdCollection0_ << " is not available";
00533
00534
00535
00536
00537
00538 int ndic1 = 0;
00539 edm::Handle<EEDetIdCollection> ids1;
00540 if ( e.getByLabel(EEDetIdCollection1_, ids1) ) ndic1 = ids1->size();
00541 else edm::LogWarning("EETrendTask") << EEDetIdCollection1_ << " is not available";
00542
00543
00544
00545
00546
00547 int ndic2 = 0;
00548 edm::Handle<EEDetIdCollection> ids2;
00549 if ( e.getByLabel(EEDetIdCollection2_, ids2) ) ndic2 = ids2->size();
00550 else edm::LogWarning("EETrendTask") << EEDetIdCollection2_ << " is not available";
00551
00552
00553
00554
00555
00556 int ndic3 = 0;
00557 edm::Handle<EEDetIdCollection> ids3;
00558 if ( e.getByLabel(EEDetIdCollection3_, ids3) ) ndic3 = ids3->size();
00559 else edm::LogWarning("EETrendTask") << EEDetIdCollection3_ << " is not available";
00560
00561
00562
00563
00564
00565 int neic1 = 0;
00566 edm::Handle<EcalElectronicsIdCollection> eids1;
00567 if ( e.getByLabel(EcalElectronicsIdCollection1_, eids1) ) neic1 = eids1->size();
00568 else edm::LogWarning("EETrendTask") << EcalElectronicsIdCollection1_ << " is not available";
00569
00570
00571
00572
00573
00574 int neic2 = 0;
00575 edm::Handle<EcalElectronicsIdCollection> eids2;
00576 if ( e.getByLabel(EcalElectronicsIdCollection2_, eids2) ) neic2 = eids2->size();
00577 else edm::LogWarning("EETrendTask") << EcalElectronicsIdCollection2_ << " is not available";
00578
00579
00580
00581
00582
00583 int neic3 = 0;
00584 edm::Handle<EcalElectronicsIdCollection> eids3;
00585 if ( e.getByLabel(EcalElectronicsIdCollection3_, eids3) ) neic3 = eids3->size();
00586 else edm::LogWarning("EETrendTask") << EcalElectronicsIdCollection3_ << " is not available";
00587
00588
00589
00590
00591
00592 int neic4 = 0;
00593 edm::Handle<EcalElectronicsIdCollection> eids4;
00594 if ( e.getByLabel(EcalElectronicsIdCollection4_, eids4) ) neic4 = eids4->size();
00595 else edm::LogWarning("EETrendTask") << EcalElectronicsIdCollection4_ << " is not available";
00596
00597
00598
00599
00600
00601 int neic5 = 0;
00602 edm::Handle<EcalElectronicsIdCollection> eids5;
00603 if ( e.getByLabel(EcalElectronicsIdCollection5_, eids5) ) neic5 = eids5->size();
00604 else edm::LogWarning("EETrendTask") << EcalElectronicsIdCollection5_ << " is not available";
00605
00606
00607
00608
00609
00610 int neic6 = 0;
00611 edm::Handle<EcalElectronicsIdCollection> eids6;
00612 if ( e.getByLabel(EcalElectronicsIdCollection6_, eids6) ) neic6 = eids6->size();
00613 else edm::LogWarning("EETrendTask") << EcalElectronicsIdCollection6_ << " is not available";
00614
00615
00616
00617
00618
00619 double errorSum = ndic0 + ndic1 + ndic2 + ndic3 +
00620 neic1 + neic2 + neic3 + neic4 + neic5 + neic6;
00621
00622 ecaldqm::shift2Right(nIntegrityErrorMinutely_->getTProfile(), minuteBinDiff);
00623 nIntegrityErrorMinutely_->Fill(minuteDiff,errorSum);
00624
00625 ecaldqm::shift2Right(nIntegrityErrorHourly_->getTProfile(), hourBinDiff);
00626 nIntegrityErrorHourly_->Fill(hourDiff,errorSum);
00627
00628
00629
00630
00631
00632 int nfedEEminus = 0;
00633 int nfedEEplus = 0;
00634
00635
00636
00637 int eem1 = 601;
00638 int eem2 = 609;
00639 int eep1 = 646;
00640 int eep2 = 654;
00641 int kByte = 1024;
00642
00643 edm::Handle<FEDRawDataCollection> allFedRawData;
00644 if ( e.getByLabel(FEDRawDataCollection_, allFedRawData) ) {
00645 for ( int iDcc = eem1; iDcc <= eep2; ++iDcc ) {
00646 int sizeInKB = allFedRawData->FEDData(iDcc).size()/kByte;
00647 if(iDcc >= eem1 && iDcc <= eem2) nfedEEminus += sizeInKB;
00648 if(iDcc >= eep1 && iDcc <= eep2) nfedEEplus += sizeInKB;
00649 }
00650 }
00651 else edm::LogWarning("EETrendTask") << FEDRawDataCollection_ << " is not available";
00652
00653 ecaldqm::shift2Right(nFEDEEminusRawDataMinutely_->getTProfile(), minuteBinDiff);
00654 nFEDEEminusRawDataMinutely_->Fill(minuteDiff,nfedEEminus);
00655
00656 ecaldqm::shift2Right(nFEDEEplusRawDataMinutely_->getTProfile(), minuteBinDiff);
00657 nFEDEEplusRawDataMinutely_->Fill(minuteDiff,nfedEEplus);
00658
00659 ecaldqm::shift2Right(nFEDEEminusRawDataHourly_->getTProfile(), hourBinDiff);
00660 nFEDEEminusRawDataHourly_->Fill(hourDiff,nfedEEminus);
00661
00662 ecaldqm::shift2Right(nFEDEEplusRawDataHourly_->getTProfile(), hourBinDiff);
00663 nFEDEEplusRawDataHourly_->Fill(hourDiff,nfedEEplus);
00664
00665
00666
00667
00668 int nsfc = 0;
00669 edm::Handle<EESrFlagCollection> eeSrFlags;
00670 if ( e.getByLabel(EESRFlagCollection_,eeSrFlags) ) nsfc = eeSrFlags->size();
00671 else edm::LogWarning("EETrendTask") << EESRFlagCollection_ << " is not available";
00672
00673 ecaldqm::shift2Right(nEESRFlagMinutely_->getTProfile(), minuteBinDiff);
00674 nEESRFlagMinutely_->Fill(minuteDiff,nsfc);
00675
00676 ecaldqm::shift2Right(nEESRFlagHourly_->getTProfile(), hourBinDiff);
00677 nEESRFlagHourly_->Fill(hourDiff,nsfc);
00678
00679 }
00680
00681
00682 void EETrendTask::updateTime(){
00683
00684 last_time_ = current_time_;
00685 current_time_ = time(NULL);
00686
00687 }
00688