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/EBDetId.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/EcalBarrelMonitorTasks/interface/EBTrendTask.h"
00042 #include "DQM/EcalCommon/interface/UtilFunctions.h"
00043
00044 #include "TProfile.h"
00045
00046 EBTrendTask::EBTrendTask(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 EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");
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 EBDetIdCollection0_ = ps.getParameter<edm::InputTag>("EBDetIdCollection0");
00065 EBDetIdCollection1_ = ps.getParameter<edm::InputTag>("EBDetIdCollection1");
00066 EBDetIdCollection2_ = ps.getParameter<edm::InputTag>("EBDetIdCollection2");
00067 EBDetIdCollection3_ = ps.getParameter<edm::InputTag>("EBDetIdCollection3");
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 EBSRFlagCollection_ = ps.getParameter<edm::InputTag>("EBSRFlagCollection");
00076
00077
00078 nEBDigiMinutely_ = 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 nFEDEBRawDataMinutely_ = 0;
00088 nEBSRFlagMinutely_ = 0;
00089
00090 nEBDigiHourly_ = 0;
00091 nEcalPnDiodeDigiHourly_ = 0;
00092 nEcalRecHitHourly_ = 0;
00093 nEcalTrigPrimDigiHourly_ = 0;
00094 nBasicClusterHourly_ = 0;
00095 nBasicClusterSizeHourly_ = 0;
00096 nSuperClusterHourly_ = 0;
00097 nSuperClusterSizeHourly_ = 0;
00098 nIntegrityErrorHourly_ = 0;
00099 nFEDEBRawDataHourly_ = 0;
00100 nEBSRFlagHourly_ = 0;
00101 }
00102
00103
00104 EBTrendTask::~EBTrendTask(){
00105 }
00106
00107
00108 void EBTrendTask::beginJob(void){
00109
00110 ievt_ = 0;
00111
00112 if ( dqmStore_ ) {
00113 dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendTask");
00114 dqmStore_->rmdir(prefixME_ + "/EBTrendTask");
00115 }
00116
00117 }
00118
00119
00120 void EBTrendTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00121
00122 Numbers::initGeometry(c, false);
00123
00124 if ( ! mergeRuns_ ) this->reset();
00125
00126 start_time_ = time(NULL);
00127
00128 }
00129
00130
00131 void EBTrendTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00132
00133 }
00134
00135
00136 void EBTrendTask::reset(void) {
00137
00138 if(nEBDigiMinutely_) nEBDigiMinutely_->Reset();
00139 if(nEcalPnDiodeDigiMinutely_) nEcalPnDiodeDigiMinutely_->Reset();
00140 if(nEcalRecHitMinutely_) nEcalRecHitMinutely_->Reset();
00141 if(nEcalTrigPrimDigiMinutely_) nEcalTrigPrimDigiMinutely_->Reset();
00142 if(nBasicClusterMinutely_) nBasicClusterMinutely_->Reset();
00143 if(nBasicClusterSizeMinutely_) nBasicClusterSizeMinutely_->Reset();
00144 if(nSuperClusterMinutely_) nSuperClusterMinutely_->Reset();
00145 if(nSuperClusterSizeMinutely_) nSuperClusterSizeMinutely_->Reset();
00146 if(nIntegrityErrorMinutely_) nIntegrityErrorMinutely_->Reset();
00147 if(nFEDEBRawDataMinutely_) nFEDEBRawDataMinutely_->Reset();
00148 if(nEBSRFlagMinutely_) nEBSRFlagMinutely_->Reset();
00149
00150 if(nEBDigiHourly_) nEBDigiHourly_->Reset();
00151 if(nEcalPnDiodeDigiHourly_) nEcalPnDiodeDigiHourly_->Reset();
00152 if(nEcalRecHitHourly_) nEcalRecHitHourly_->Reset();
00153 if(nEcalTrigPrimDigiHourly_) nEcalTrigPrimDigiHourly_->Reset();
00154 if(nBasicClusterHourly_) nBasicClusterHourly_->Reset();
00155 if(nBasicClusterSizeHourly_) nBasicClusterSizeHourly_->Reset();
00156 if(nSuperClusterHourly_) nSuperClusterHourly_->Reset();
00157 if(nSuperClusterSizeHourly_) nSuperClusterSizeHourly_->Reset();
00158 if(nIntegrityErrorHourly_) nIntegrityErrorHourly_->Reset();
00159 if(nFEDEBRawDataHourly_) nFEDEBRawDataHourly_->Reset();
00160 if(nEBSRFlagHourly_) nEBSRFlagHourly_->Reset();
00161
00162 }
00163
00164
00165 void EBTrendTask::setup(void){
00166
00167 init_ = true;
00168
00169 char histo[200];
00170
00171 if ( dqmStore_ ) {
00172 dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendTask");
00173
00174
00175
00176 sprintf(histo, "AverageNumberOfEBDigiVs5Minutes");
00177 nEBDigiMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00178 nEBDigiMinutely_->setAxisTitle("Minutes", 1);
00179 nEBDigiMinutely_->setAxisTitle("Average Number of EBDigi / 5 minutes", 2);
00180
00181 sprintf(histo, "AverageNumberOfEcalPnDiodeDigiVs5Minutes");
00182 nEcalPnDiodeDigiMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00183 nEcalPnDiodeDigiMinutely_->setAxisTitle("Minutes", 1);
00184 nEcalPnDiodeDigiMinutely_->setAxisTitle("Average Number of EcalPnDiodeDigi / 5 minutes", 2);
00185
00186 sprintf(histo, "AverageNumberOfEcalRecHitVs5Minutes");
00187 nEcalRecHitMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00188 nEcalRecHitMinutely_->setAxisTitle("Minutes", 1);
00189 nEcalRecHitMinutely_->setAxisTitle("Average Number of EcalRecHit / 5 minutes", 2);
00190
00191 sprintf(histo, "AverageNumberOfEcalTrigPrimDigiVs5Minutes");
00192 nEcalTrigPrimDigiMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00193 nEcalTrigPrimDigiMinutely_->setAxisTitle("Minutes", 1);
00194 nEcalTrigPrimDigiMinutely_->setAxisTitle("Average Number of EcalTrigPrimDigi / 5 minutes", 2);
00195
00196 sprintf(histo, "AverageNumberOfBasicClusterVs5Minutes");
00197 nBasicClusterMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00198 nBasicClusterMinutely_->setAxisTitle("Minutes", 1);
00199 nBasicClusterMinutely_->setAxisTitle("Average Number of BasicClusters / 5 minutes", 2);
00200
00201 sprintf(histo, "AverageNumberOfBasicClusterSizeVs5Minutes");
00202 nBasicClusterSizeMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00203 nBasicClusterSizeMinutely_->setAxisTitle("Minutes", 1);
00204 nBasicClusterSizeMinutely_->setAxisTitle("Average Size of BasicClusters / 5 minutes", 2);
00205
00206 sprintf(histo, "AverageNumberOfSuperClusterVs5Minutes");
00207 nSuperClusterMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00208 nSuperClusterMinutely_->setAxisTitle("Minutes", 1);
00209 nSuperClusterMinutely_->setAxisTitle("Average Number of SuperClusters / 5 minutes", 2);
00210
00211 sprintf(histo, "AverageNumberOfSuperClusterSizeVs5Minutes");
00212 nSuperClusterSizeMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00213 nSuperClusterSizeMinutely_->setAxisTitle("Minutes", 1);
00214 nSuperClusterSizeMinutely_->setAxisTitle("Average Size of SuperClusters / 5 minutes", 2);
00215
00216 sprintf(histo, "AverageNumberOfIntegrityErrorVs5Minutes");
00217 nIntegrityErrorMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00218 nIntegrityErrorMinutely_->setAxisTitle("Minutes", 1);
00219 nIntegrityErrorMinutely_->setAxisTitle("Average IntegrityErrors / 5 minutes", 2);
00220
00221 sprintf(histo, "AverageNumberOfFEDEBRawDataVs5Minutes");
00222 nFEDEBRawDataMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00223 nFEDEBRawDataMinutely_->setAxisTitle("Minutes", 1);
00224 nFEDEBRawDataMinutely_->setAxisTitle("Average Number of FEDRawData in EB / 5 minutes", 2);
00225
00226 sprintf(histo, "AverageNumberOfEBSRFlagVs5Minutes");
00227 nEBSRFlagMinutely_ = dqmStore_->bookProfile(histo, histo, 12, 0.0, 60.0, 100, 0.0, 1.0e6, "s");
00228 nEBSRFlagMinutely_->setAxisTitle("Minutes", 1);
00229 nEBSRFlagMinutely_->setAxisTitle("Average Number of EBSRFlag / 5 minutes", 2);
00230
00231
00232
00233 sprintf(histo, "AverageNumberOfEBDigiVs1Hour");
00234 nEBDigiHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00235 nEBDigiHourly_->setAxisTitle("Hours", 1);
00236 nEBDigiHourly_->setAxisTitle("Average Number of EBDigi / hour", 2);
00237
00238 sprintf(histo, "AverageNumberOfEcalPnDiodeDigiVs1Hour");
00239 nEcalPnDiodeDigiHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00240 nEcalPnDiodeDigiHourly_->setAxisTitle("Hours", 1);
00241 nEcalPnDiodeDigiHourly_->setAxisTitle("Average Number of EcalPnDiodeDigi / hour", 2);
00242
00243 sprintf(histo, "AverageNumberOfEcalRecHitVs1Hour");
00244 nEcalRecHitHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00245 nEcalRecHitHourly_->setAxisTitle("Hours", 1);
00246 nEcalRecHitHourly_->setAxisTitle("Average Number of EcalRecHit / hour", 2);
00247
00248 sprintf(histo, "AverageNumberOfEcalTrigPrimDigiVs1Hour");
00249 nEcalTrigPrimDigiHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00250 nEcalTrigPrimDigiHourly_->setAxisTitle("Hours", 1);
00251 nEcalTrigPrimDigiHourly_->setAxisTitle("Average Number of EcalTrigPrimDigi / hour", 2);
00252
00253 sprintf(histo, "AverageNumberOfBasicClusterVs1Hour");
00254 nBasicClusterHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00255 nBasicClusterHourly_->setAxisTitle("Hours", 1);
00256 nBasicClusterHourly_->setAxisTitle("Average Number of BasicClusters / hour", 2);
00257
00258 sprintf(histo, "AverageNumberOfBasicClusterSizeVs1Hour");
00259 nBasicClusterSizeHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00260 nBasicClusterSizeHourly_->setAxisTitle("Hours", 1);
00261 nBasicClusterSizeHourly_->setAxisTitle("Average Size of BasicClusters / hour", 2);
00262
00263 sprintf(histo, "AverageNumberOfSuperClusterVs1Hour");
00264 nSuperClusterHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00265 nSuperClusterHourly_->setAxisTitle("Hours", 1);
00266 nSuperClusterHourly_->setAxisTitle("Average Number of SuperClusters / hour", 2);
00267
00268 sprintf(histo, "AverageNumberOfSuperClusterSizeVs1Hour");
00269 nSuperClusterSizeHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00270 nSuperClusterSizeHourly_->setAxisTitle("Hours", 1);
00271 nSuperClusterSizeHourly_->setAxisTitle("Average Size of SuperClusters / hour", 2);
00272
00273 sprintf(histo, "AverageNumberOfIntegrityErrorVs1Hour");
00274 nIntegrityErrorHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00275 nIntegrityErrorHourly_->setAxisTitle("Hours", 1);
00276 nIntegrityErrorHourly_->setAxisTitle("Average IntegrityErrors / hour", 2);
00277
00278 sprintf(histo, "AverageNumberOfFEDEBRawDataVs1Hour");
00279 nFEDEBRawDataHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00280 nFEDEBRawDataHourly_->setAxisTitle("Hours", 1);
00281 nFEDEBRawDataHourly_->setAxisTitle("Average Number of FEDRawData in EB / hour", 2);
00282
00283 sprintf(histo, "AverageNumberOfEBSRFlagVs1Hour");
00284 nEBSRFlagHourly_ = dqmStore_->bookProfile(histo, histo, 24, 0.0, 24.0, 100, 0.0, 1.0e6, "s");
00285 nEBSRFlagHourly_->setAxisTitle("Hours", 1);
00286 nEBSRFlagHourly_->setAxisTitle("Average Number of EBSRFlag / hour", 2);
00287
00288 }
00289
00290 }
00291
00292
00293 void EBTrendTask::cleanup(void){
00294
00295 if ( ! init_ ) return;
00296
00297 if ( dqmStore_ ) {
00298 dqmStore_->setCurrentFolder(prefixME_ + "/EBTrendTask");
00299
00300 if(nEBDigiMinutely_) dqmStore_->removeElement( nEBDigiMinutely_->getName());
00301 nEBDigiMinutely_ = 0;
00302 if(nEcalPnDiodeDigiMinutely_) dqmStore_->removeElement( nEcalPnDiodeDigiMinutely_->getName());
00303 nEcalPnDiodeDigiMinutely_ = 0;
00304 if(nEcalRecHitMinutely_) dqmStore_->removeElement( nEcalRecHitMinutely_->getName());
00305 nEcalRecHitMinutely_ = 0;
00306 if(nEcalTrigPrimDigiMinutely_) dqmStore_->removeElement( nEcalTrigPrimDigiMinutely_->getName());
00307 nEcalTrigPrimDigiMinutely_ = 0;
00308 if(nBasicClusterMinutely_) dqmStore_->removeElement( nBasicClusterMinutely_->getName());
00309 nBasicClusterMinutely_ = 0;
00310 if(nBasicClusterSizeMinutely_) dqmStore_->removeElement( nBasicClusterSizeMinutely_->getName());
00311 nBasicClusterSizeMinutely_ = 0;
00312 if(nSuperClusterMinutely_) dqmStore_->removeElement( nSuperClusterMinutely_->getName());
00313 nSuperClusterMinutely_ = 0;
00314 if(nSuperClusterSizeMinutely_) dqmStore_->removeElement( nSuperClusterSizeMinutely_->getName());
00315 nSuperClusterSizeMinutely_ = 0;
00316 if(nIntegrityErrorMinutely_) dqmStore_->removeElement( nIntegrityErrorMinutely_->getName());
00317 nIntegrityErrorMinutely_ = 0;
00318 if(nFEDEBRawDataMinutely_) dqmStore_->removeElement( nFEDEBRawDataMinutely_->getName());
00319 nFEDEBRawDataMinutely_ = 0;
00320 if(nEBSRFlagMinutely_) dqmStore_->removeElement( nEBSRFlagMinutely_->getName());
00321 nEBSRFlagMinutely_ =0;
00322
00323 if(nEBDigiHourly_) dqmStore_->removeElement( nEBDigiHourly_->getName());
00324 nEBDigiHourly_ = 0;
00325 if(nEcalPnDiodeDigiHourly_) dqmStore_->removeElement( nEcalPnDiodeDigiHourly_->getName());
00326 nEcalPnDiodeDigiHourly_ = 0;
00327 if(nEcalRecHitHourly_) dqmStore_->removeElement( nEcalRecHitHourly_->getName());
00328 nEcalRecHitHourly_ = 0;
00329 if(nEcalTrigPrimDigiHourly_) dqmStore_->removeElement( nEcalTrigPrimDigiHourly_->getName());
00330 nEcalTrigPrimDigiHourly_ = 0;
00331 if(nBasicClusterHourly_) dqmStore_->removeElement( nBasicClusterHourly_->getName());
00332 nBasicClusterHourly_ = 0;
00333 if(nBasicClusterSizeHourly_) dqmStore_->removeElement( nBasicClusterSizeHourly_->getName());
00334 nBasicClusterSizeHourly_ = 0;
00335 if(nSuperClusterHourly_) dqmStore_->removeElement( nSuperClusterHourly_->getName());
00336 nSuperClusterHourly_ = 0;
00337 if(nSuperClusterSizeHourly_) dqmStore_->removeElement( nSuperClusterSizeHourly_->getName());
00338 nSuperClusterSizeHourly_ = 0;
00339 if(nIntegrityErrorHourly_) dqmStore_->removeElement( nIntegrityErrorHourly_->getName());
00340 nIntegrityErrorHourly_ = 0;
00341 if(nFEDEBRawDataHourly_) dqmStore_->removeElement( nFEDEBRawDataHourly_->getName());
00342 nFEDEBRawDataHourly_ = 0;
00343 if(nEBSRFlagHourly_) dqmStore_->removeElement( nEBSRFlagHourly_->getName());
00344 nEBSRFlagHourly_ = 0;
00345
00346 }
00347
00348 init_ = false;
00349
00350 }
00351
00352
00353 void EBTrendTask::endJob(void){
00354
00355 edm::LogInfo("EBTrendTask") << "analyzed " << ievt_ << " events";
00356
00357 if ( enableCleanup_ ) this->cleanup();
00358
00359 }
00360
00361
00362 void EBTrendTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00363
00364 if ( ! init_ ) this->setup();
00365
00366 ievt_++;
00367
00368
00369
00370
00371
00372 updateTime();
00373
00374 long int minuteBinDiff = -1;
00375 long int minuteDiff = -1;
00376 ecaldqm::calcBins(5,60,start_time_,last_time_,current_time_,minuteBinDiff,minuteDiff);
00377
00378 long int hourBinDiff = -1;
00379 long int hourDiff = -1;
00380 ecaldqm::calcBins(1,3600,start_time_,last_time_,current_time_,hourBinDiff,hourDiff);
00381
00382
00383
00384
00385
00386 int ndc = 0;
00387 edm::Handle<EBDigiCollection> digis;
00388 if ( e.getByLabel(EBDigiCollection_, digis) ) ndc = digis->size();
00389 else edm::LogWarning("EBTrendTask") << EBDigiCollection_ << " is not available";
00390
00391 ecaldqm::shift2Right(nEBDigiMinutely_->getTProfile(), minuteBinDiff);
00392 nEBDigiMinutely_->Fill(minuteDiff,ndc);
00393
00394 ecaldqm::shift2Right(nEBDigiHourly_->getTProfile(), hourBinDiff);
00395 nEBDigiHourly_->Fill(hourDiff,ndc);
00396
00397
00398
00399
00400
00401 int npdc = 0;
00402 edm::Handle<EcalPnDiodeDigiCollection> pns;
00403 if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) npdc = pns->size();
00404 else edm::LogWarning("EBTrendTask") << EcalPnDiodeDigiCollection_ << " is not available";
00405
00406 ecaldqm::shift2Right(nEcalPnDiodeDigiMinutely_->getTProfile(), minuteBinDiff);
00407 nEcalPnDiodeDigiMinutely_->Fill(minuteDiff,npdc);
00408
00409 ecaldqm::shift2Right(nEcalPnDiodeDigiHourly_->getTProfile(), hourBinDiff);
00410 nEcalPnDiodeDigiHourly_->Fill(hourDiff,npdc);
00411
00412
00413
00414
00415
00416 int nrhc = 0;
00417 edm::Handle<EcalRecHitCollection> hits;
00418 if ( e.getByLabel(EcalRecHitCollection_, hits) ) nrhc = hits->size();
00419 else edm::LogWarning("EBTrendTask") << EcalRecHitCollection_ << " is not available";
00420
00421 ecaldqm::shift2Right(nEcalRecHitMinutely_->getTProfile(), minuteBinDiff);
00422 nEcalRecHitMinutely_->Fill(minuteDiff,nrhc);
00423
00424 ecaldqm::shift2Right(nEcalRecHitHourly_->getTProfile(), hourBinDiff);
00425 nEcalRecHitHourly_->Fill(hourDiff,nrhc);
00426
00427
00428
00429
00430 int ntpdc = 0;
00431 edm::Handle<EcalTrigPrimDigiCollection> tpdigis;
00432 if ( e.getByLabel(EcalTrigPrimDigiCollection_, tpdigis) ) ntpdc = tpdigis->size();
00433 else edm::LogWarning("EBTrendTask") << EcalTrigPrimDigiCollection_ << " is not available";
00434
00435 ecaldqm::shift2Right(nEcalTrigPrimDigiMinutely_->getTProfile(), minuteBinDiff);
00436 nEcalTrigPrimDigiMinutely_->Fill(minuteDiff,ntpdc);
00437
00438 ecaldqm::shift2Right(nEcalTrigPrimDigiHourly_->getTProfile(), hourBinDiff);
00439 nEcalTrigPrimDigiHourly_->Fill(hourDiff,ntpdc);
00440
00441
00442
00443
00444 int nbcc = 0;
00445 float nbcc_size = 0.0;
00446 edm::Handle<reco::BasicClusterCollection> pBasicClusters;
00447 if ( e.getByLabel(BasicClusterCollection_, pBasicClusters) ) {
00448 nbcc = pBasicClusters->size();
00449 for(reco::BasicClusterCollection::const_iterator it = pBasicClusters->begin();
00450 it != pBasicClusters->end(); it++){
00451 nbcc_size += it->size();
00452 }
00453 if(nbcc == 0) nbcc_size = 0;
00454 else nbcc_size = nbcc_size / nbcc;
00455 }
00456 else edm::LogWarning("EBTrendTask") << BasicClusterCollection_ << " is not available";
00457
00458 ecaldqm::shift2Right(nBasicClusterMinutely_->getTProfile(), minuteBinDiff);
00459 nBasicClusterMinutely_->Fill(minuteDiff,nbcc);
00460
00461 ecaldqm::shift2Right(nBasicClusterHourly_->getTProfile(), hourBinDiff);
00462 nBasicClusterHourly_->Fill(hourDiff,nbcc);
00463
00464 ecaldqm::shift2Right(nBasicClusterSizeMinutely_->getTProfile(), minuteBinDiff);
00465 nBasicClusterSizeMinutely_->Fill(minuteDiff,nbcc);
00466
00467 ecaldqm::shift2Right(nBasicClusterSizeHourly_->getTProfile(), hourBinDiff);
00468 nBasicClusterSizeHourly_->Fill(hourDiff,nbcc);
00469
00470
00471
00472
00473 int nscc = 0;
00474 float nscc_size = 0.0;
00475 edm::Handle<reco::SuperClusterCollection> pSuperClusters;
00476 if ( e.getByLabel(SuperClusterCollection_, pSuperClusters) ) {
00477 nscc = pSuperClusters->size();
00478 for(reco::SuperClusterCollection::const_iterator it = pSuperClusters->begin();
00479 it != pSuperClusters->end(); it++){
00480 nscc_size += it->clustersSize();
00481 }
00482 if(nscc == 0) nscc_size = 0;
00483 else nscc_size = nscc_size / nscc;
00484 }
00485 else edm::LogWarning("EBTrendTask") << SuperClusterCollection_ << " is not available";
00486
00487 ecaldqm::shift2Right(nSuperClusterMinutely_->getTProfile(), minuteBinDiff);
00488 nSuperClusterMinutely_->Fill(minuteDiff,nscc);
00489
00490 ecaldqm::shift2Right(nSuperClusterHourly_->getTProfile(), hourBinDiff);
00491 nSuperClusterHourly_->Fill(hourDiff,nscc);
00492
00493 ecaldqm::shift2Right(nSuperClusterSizeMinutely_->getTProfile(), minuteBinDiff);
00494 nSuperClusterSizeMinutely_->Fill(minuteDiff,nscc);
00495
00496 ecaldqm::shift2Right(nSuperClusterSizeHourly_->getTProfile(), hourBinDiff);
00497 nSuperClusterSizeHourly_->Fill(hourDiff,nscc);
00498
00499
00500
00501
00502
00503
00504
00505
00506
00507
00508 int ndic0 = 0;
00509 edm::Handle<EBDetIdCollection> ids0;
00510 if ( e.getByLabel(EBDetIdCollection0_, ids0) ) ndic0 = ids0->size();
00511 else edm::LogWarning("EBTrendTask") << EBDetIdCollection0_ << " is not available";
00512
00513
00514
00515
00516
00517 int ndic1 = 0;
00518 edm::Handle<EBDetIdCollection> ids1;
00519 if ( e.getByLabel(EBDetIdCollection1_, ids1) ) ndic1 = ids1->size();
00520 else edm::LogWarning("EBTrendTask") << EBDetIdCollection1_ << " is not available";
00521
00522
00523
00524
00525
00526 int ndic2 = 0;
00527 edm::Handle<EBDetIdCollection> ids2;
00528 if ( e.getByLabel(EBDetIdCollection2_, ids2) ) ndic2 = ids2->size();
00529 else edm::LogWarning("EBTrendTask") << EBDetIdCollection2_ << " is not available";
00530
00531
00532
00533
00534
00535 int ndic3 = 0;
00536 edm::Handle<EBDetIdCollection> ids3;
00537 if ( e.getByLabel(EBDetIdCollection3_, ids3) ) ndic3 = ids3->size();
00538 else edm::LogWarning("EBTrendTask") << EBDetIdCollection3_ << " is not available";
00539
00540
00541
00542
00543
00544 int neic1 = 0;
00545 edm::Handle<EcalElectronicsIdCollection> eids1;
00546 if ( e.getByLabel(EcalElectronicsIdCollection1_, eids1) ) neic1 = eids1->size();
00547 else edm::LogWarning("EBTrendTask") << EcalElectronicsIdCollection1_ << " is not available";
00548
00549
00550
00551
00552
00553 int neic2 = 0;
00554 edm::Handle<EcalElectronicsIdCollection> eids2;
00555 if ( e.getByLabel(EcalElectronicsIdCollection2_, eids2) ) neic2 = eids2->size();
00556 else edm::LogWarning("EBTrendTask") << EcalElectronicsIdCollection2_ << " is not available";
00557
00558
00559
00560
00561
00562 int neic3 = 0;
00563 edm::Handle<EcalElectronicsIdCollection> eids3;
00564 if ( e.getByLabel(EcalElectronicsIdCollection3_, eids3) ) neic3 = eids3->size();
00565 else edm::LogWarning("EBTrendTask") << EcalElectronicsIdCollection3_ << " is not available";
00566
00567
00568
00569
00570
00571 int neic4 = 0;
00572 edm::Handle<EcalElectronicsIdCollection> eids4;
00573 if ( e.getByLabel(EcalElectronicsIdCollection4_, eids4) ) neic4 = eids4->size();
00574 else edm::LogWarning("EBTrendTask") << EcalElectronicsIdCollection4_ << " is not available";
00575
00576
00577
00578
00579
00580 int neic5 = 0;
00581 edm::Handle<EcalElectronicsIdCollection> eids5;
00582 if ( e.getByLabel(EcalElectronicsIdCollection5_, eids5) ) neic5 = eids5->size();
00583 else edm::LogWarning("EBTrendTask") << EcalElectronicsIdCollection5_ << " is not available";
00584
00585
00586
00587
00588
00589 int neic6 = 0;
00590 edm::Handle<EcalElectronicsIdCollection> eids6;
00591 if ( e.getByLabel(EcalElectronicsIdCollection6_, eids6) ) neic6 = eids6->size();
00592 else edm::LogWarning("EBTrendTask") << EcalElectronicsIdCollection6_ << " is not available";
00593
00594
00595
00596
00597
00598 double errorSum = ndic0 + ndic1 + ndic2 + ndic3 +
00599 neic1 + neic2 + neic3 + neic4 + neic5 + neic6;
00600
00601 ecaldqm::shift2Right(nIntegrityErrorMinutely_->getTProfile(), minuteBinDiff);
00602 nIntegrityErrorMinutely_->Fill(minuteDiff,errorSum);
00603
00604 ecaldqm::shift2Right(nIntegrityErrorHourly_->getTProfile(), hourBinDiff);
00605 nIntegrityErrorHourly_->Fill(hourDiff,errorSum);
00606
00607
00608
00609
00610 int nfedEB = 0;
00611
00612
00613
00614 int eb1 = 610;
00615 int eb2 = 645;
00616 int kByte = 1024;
00617
00618 edm::Handle<FEDRawDataCollection> allFedRawData;
00619 if ( e.getByLabel(FEDRawDataCollection_, allFedRawData) ) {
00620 for ( int iDcc = eb1; iDcc <= eb2; ++iDcc ) {
00621 int sizeInKB = allFedRawData->FEDData(iDcc).size()/kByte;
00622 if(iDcc >= eb1 && iDcc <= eb2) nfedEB += sizeInKB;
00623 }
00624 }
00625 else edm::LogWarning("EBTrendTask") << FEDRawDataCollection_ << " is not available";
00626
00627 ecaldqm::shift2Right(nFEDEBRawDataMinutely_->getTProfile(), minuteBinDiff);
00628 nFEDEBRawDataMinutely_->Fill(minuteDiff,nfedEB);
00629
00630 ecaldqm::shift2Right(nFEDEBRawDataHourly_->getTProfile(), hourBinDiff);
00631 nFEDEBRawDataHourly_->Fill(hourDiff,nfedEB);
00632
00633
00634
00635
00636
00637 int nsfc = 0;
00638 edm::Handle<EBSrFlagCollection> ebSrFlags;
00639 if ( e.getByLabel(EBSRFlagCollection_,ebSrFlags) ) nsfc = ebSrFlags->size();
00640 else edm::LogWarning("EBTrendTask") << EBSRFlagCollection_ << " is not available";
00641
00642 ecaldqm::shift2Right(nEBSRFlagMinutely_->getTProfile(), minuteBinDiff);
00643 nEBSRFlagMinutely_->Fill(minuteDiff,nsfc);
00644
00645 ecaldqm::shift2Right(nEBSRFlagHourly_->getTProfile(), hourBinDiff);
00646 nEBSRFlagHourly_->Fill(hourDiff,nsfc);
00647
00648
00649 if(verbose_){
00650 printf("run(%d), event(%d), ndc(%d), npdc(%d), nrhc(%d), ntpdc(%d), nbcc(%d), ",
00651 e.id().run(),e.id().event(), ndc, npdc, nrhc, ntpdc, nbcc);
00652 printf("nscc(%d), ndic0(%d), ndic1(%d), ndic2(%d), ndic3(%d), neic1(%d), neic2(%d), neic3(%d), ",
00653 nscc, ndic0, ndic1, ndic2, ndic3, neic1, neic2, neic3);
00654 printf("neic4(%d), neic5(%d), neic6(%d), errorSum(%f), nsfc(%d), ",
00655 neic4, neic5, neic6, errorSum, nsfc);
00656 }
00657
00658 }
00659
00660
00661 void EBTrendTask::updateTime(){
00662
00663 last_time_ = current_time_;
00664 current_time_ = time(NULL);
00665
00666 }
00667