00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <iostream>
00012 #include <fstream>
00013 #include <vector>
00014 #include <math.h>
00015
00016 #include "FWCore/ServiceRegistry/interface/Service.h"
00017 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00018
00019 #include "DQMServices/Core/interface/MonitorElement.h"
00020
00021 #include "DQMServices/Core/interface/DQMStore.h"
00022
00023 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00024 #include "DataFormats/EgammaReco/interface/BasicCluster.h"
00025 #include "DataFormats/EgammaReco/interface/BasicClusterFwd.h"
00026 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00027 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00028 #include "FWCore/Framework/interface/ESHandle.h"
00029 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterTools.h"
00030 #include "Geometry/CaloTopology/interface/CaloTopology.h"
00031 #include "Geometry/CaloEventSetup/interface/CaloTopologyRecord.h"
00032 #include "DataFormats/Math/interface/Point3D.h"
00033 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00034 #include "CondFormats/EcalObjects/interface/EcalADCToGeVConstant.h"
00035 #include "CondFormats/DataRecord/interface/EcalADCToGeVConstantRcd.h"
00036
00037 #include "DQM/EcalCommon/interface/Numbers.h"
00038
00039 #include "DQM/EcalEndcapMonitorTasks/interface/EEClusterTask.h"
00040
00041 #include "TLorentzVector.h"
00042
00043 EEClusterTask::EEClusterTask(const edm::ParameterSet& ps){
00044
00045 init_ = false;
00046
00047 dqmStore_ = edm::Service<DQMStore>().operator->();
00048
00049 prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
00050
00051 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00052
00053 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00054
00055
00056 EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00057 BasicClusterCollection_ = ps.getParameter<edm::InputTag>("BasicClusterCollection");
00058 SuperClusterCollection_ = ps.getParameter<edm::InputTag>("SuperClusterCollection");
00059 EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection");
00060
00061
00062 meBCEne_ = 0;
00063 meBCNum_ = 0;
00064 meBCSiz_ = 0;
00065
00066 meBCEneFwdMap_ = 0;
00067 meBCNumFwdMap_ = 0;
00068 meBCETFwdMap_ = 0;
00069 meBCSizFwdMap_ = 0;
00070
00071 meBCEneFwdMapProjEta_ = 0;
00072 meBCEneFwdMapProjPhi_ = 0;
00073 meBCNumFwdMapProjEta_ = 0;
00074 meBCNumFwdMapProjPhi_ = 0;
00075 meBCETFwdMapProjEta_ = 0;
00076 meBCETFwdMapProjPhi_ = 0;
00077 meBCSizFwdMapProjEta_ = 0;
00078 meBCSizFwdMapProjPhi_ = 0;
00079
00080 meBCEneBwdMap_ = 0;
00081 meBCNumBwdMap_ = 0;
00082 meBCETBwdMap_ = 0;
00083 meBCSizBwdMap_ = 0;
00084
00085 meBCEneBwdMapProjEta_ = 0;
00086 meBCEneBwdMapProjPhi_ = 0;
00087 meBCNumBwdMapProjEta_ = 0;
00088 meBCNumBwdMapProjPhi_ = 0;
00089 meBCETBwdMapProjEta_ = 0;
00090 meBCETBwdMapProjPhi_ = 0;
00091 meBCSizBwdMapProjEta_ = 0;
00092 meBCSizBwdMapProjPhi_ = 0;
00093
00094 meSCEne_ = 0;
00095 meSCNum_ = 0;
00096 meSCSiz_ = 0;
00097
00098 meSCCrystalSiz_ = 0;
00099 meSCSeedEne_ = 0;
00100 meSCEne2_ = 0;
00101 meSCEneVsEMax_ = 0;
00102 meSCEneLowScale_ = 0;
00103 meSCSeedMapOcc_[0] = 0;
00104 meSCSeedMapOcc_[1] = 0;
00105 meSCMapSingleCrystal_[0] = 0;
00106 meSCMapSingleCrystal_[1] = 0;
00107
00108 mes1s9_ = 0;
00109 mes1s9thr_ = 0;
00110 mes9s25_ = 0;
00111
00112 meInvMassPi0_ = 0;
00113 meInvMassJPsi_ = 0;
00114 meInvMassZ0_ = 0;
00115 meInvMassHigh_ = 0;
00116
00117 meInvMassPi0Sel_ = 0;
00118 meInvMassJPsiSel_ = 0;
00119 meInvMassZ0Sel_ = 0;
00120 meInvMassHighSel_ = 0;
00121
00122 thrS4S9_ = 0.85;
00123 thrClusEt_ = 0.250;
00124 thrCandEt_ = 0.800;
00125
00126 }
00127
00128 EEClusterTask::~EEClusterTask(){
00129
00130 }
00131
00132 void EEClusterTask::beginJob(void){
00133
00134 ievt_ = 0;
00135
00136 if ( dqmStore_ ) {
00137 dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
00138 dqmStore_->rmdir(prefixME_ + "/EEClusterTask");
00139 }
00140
00141 }
00142
00143 void EEClusterTask::beginRun(const edm::Run& r, const edm::EventSetup& c) {
00144
00145 Numbers::initGeometry(c, false);
00146
00147 if ( ! mergeRuns_ ) this->reset();
00148
00149 }
00150
00151 void EEClusterTask::endRun(const edm::Run& r, const edm::EventSetup& c) {
00152
00153 }
00154
00155 void EEClusterTask::reset(void) {
00156
00157 if ( meBCEne_ ) meBCEne_->Reset();
00158
00159 if ( meBCNum_ ) meBCNum_->Reset();
00160
00161 if ( meBCSiz_ ) meBCSiz_->Reset();
00162
00163 if ( meBCEneFwdMap_ ) meBCEneFwdMap_->Reset();
00164
00165 if ( meBCNumFwdMap_ ) meBCNumFwdMap_->Reset();
00166
00167 if ( meBCETFwdMap_ ) meBCETFwdMap_->Reset();
00168
00169 if ( meBCSizFwdMap_ ) meBCSizFwdMap_->Reset();
00170
00171 if ( meBCEneFwdMapProjEta_ ) meBCEneFwdMapProjEta_->Reset();
00172
00173 if ( meBCEneFwdMapProjPhi_ ) meBCEneFwdMapProjPhi_->Reset();
00174
00175 if ( meBCNumFwdMapProjEta_ ) meBCNumFwdMapProjEta_->Reset();
00176
00177 if ( meBCNumFwdMapProjPhi_ ) meBCNumFwdMapProjPhi_->Reset();
00178
00179 if ( meBCETFwdMapProjEta_ ) meBCETFwdMapProjEta_->Reset();
00180
00181 if ( meBCETFwdMapProjPhi_ ) meBCETFwdMapProjPhi_->Reset();
00182
00183 if ( meBCSizFwdMapProjEta_ ) meBCSizFwdMapProjEta_->Reset();
00184
00185 if ( meBCSizFwdMapProjPhi_ ) meBCSizFwdMapProjPhi_->Reset();
00186
00187 if ( meBCEneBwdMap_ ) meBCEneBwdMap_->Reset();
00188
00189 if ( meBCNumBwdMap_ ) meBCNumBwdMap_->Reset();
00190
00191 if ( meBCETBwdMap_ ) meBCETBwdMap_->Reset();
00192
00193 if ( meBCSizBwdMap_ ) meBCSizBwdMap_->Reset();
00194
00195 if ( meBCEneBwdMapProjEta_ ) meBCEneBwdMapProjEta_->Reset();
00196
00197 if ( meBCEneBwdMapProjPhi_ ) meBCEneBwdMapProjPhi_->Reset();
00198
00199 if ( meBCNumBwdMapProjEta_ ) meBCNumBwdMapProjEta_->Reset();
00200
00201 if ( meBCNumBwdMapProjPhi_ ) meBCNumBwdMapProjPhi_->Reset();
00202
00203 if ( meBCETBwdMapProjEta_ ) meBCETBwdMapProjEta_->Reset();
00204
00205 if ( meBCETBwdMapProjPhi_ ) meBCETBwdMapProjPhi_->Reset();
00206
00207 if ( meBCSizBwdMapProjEta_ ) meBCSizBwdMapProjEta_->Reset();
00208
00209 if ( meBCSizBwdMapProjPhi_ ) meBCSizBwdMapProjPhi_->Reset();
00210
00211 if ( meSCEne_ ) meSCEne_->Reset();
00212
00213 if ( meSCNum_ ) meSCNum_->Reset();
00214
00215 if ( meSCSiz_ ) meSCSiz_->Reset();
00216
00217 if ( meSCCrystalSiz_ ) meSCCrystalSiz_->Reset();
00218
00219 if ( meSCSeedEne_ ) meSCSeedEne_->Reset();
00220
00221 if ( meSCEne2_ ) meSCEne2_->Reset();
00222
00223 if ( meSCEneVsEMax_ ) meSCEneVsEMax_->Reset();
00224
00225 if ( meSCEneLowScale_ ) meSCEneLowScale_->Reset();
00226
00227 if ( meSCSeedMapOcc_[0] ) meSCSeedMapOcc_[0]->Reset();
00228
00229 if ( meSCSeedMapOcc_[1] ) meSCSeedMapOcc_[1]->Reset();
00230
00231 if ( meSCMapSingleCrystal_[0] ) meSCMapSingleCrystal_[0]->Reset();
00232
00233 if ( meSCMapSingleCrystal_[1] ) meSCMapSingleCrystal_[1]->Reset();
00234
00235 if ( mes1s9_ ) mes1s9_->Reset();
00236
00237 if ( mes1s9thr_ ) mes1s9thr_->Reset();
00238
00239 if ( mes9s25_ ) mes9s25_->Reset();
00240
00241 if ( meInvMassPi0_ ) meInvMassPi0_->Reset();
00242
00243 if ( meInvMassJPsi_ ) meInvMassJPsi_->Reset();
00244
00245 if ( meInvMassZ0_ ) meInvMassZ0_->Reset();
00246
00247 if ( meInvMassHigh_ ) meInvMassHigh_->Reset();
00248
00249 if ( meInvMassPi0Sel_ ) meInvMassPi0Sel_->Reset();
00250
00251 if ( meInvMassJPsiSel_ ) meInvMassJPsiSel_->Reset();
00252
00253 if ( meInvMassZ0Sel_ ) meInvMassZ0Sel_->Reset();
00254
00255 if ( meInvMassHighSel_ ) meInvMassHighSel_->Reset();
00256
00257 }
00258
00259 void EEClusterTask::setup(void){
00260
00261 init_ = true;
00262
00263 std::string name;
00264
00265 if ( dqmStore_ ) {
00266 dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
00267
00268 name = "EECLT BC energy";
00269 meBCEne_ = dqmStore_->book1D(name, name, 100, 0., 150.);
00270 meBCEne_->setAxisTitle("energy (GeV)", 1);
00271
00272 name = "EECLT BC number";
00273 meBCNum_ = dqmStore_->book1D(name, name, 100, 0., 150.);
00274 meBCNum_->setAxisTitle("number of clusters", 1);
00275
00276 name = "EECLT BC size";
00277 meBCSiz_ = dqmStore_->book1D(name, name, 100, 0., 150.);
00278 meBCSiz_->setAxisTitle("cluster size", 1);
00279
00280 name = "EECLT BC energy map EE +";
00281 meBCEneFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
00282 meBCEneFwdMap_->setAxisTitle("x", 1);
00283 meBCEneFwdMap_->setAxisTitle("y", 2);
00284
00285 name = "EECLT BC number map EE +";
00286 meBCNumFwdMap_ = dqmStore_->book2D(name, name, 20, -150., 150., 20, -150., 150.);
00287 meBCNumFwdMap_->setAxisTitle("x", 1);
00288 meBCNumFwdMap_->setAxisTitle("y", 2);
00289
00290 name = "EECLT BC ET map EE +";
00291 meBCETFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
00292 meBCETFwdMap_->setAxisTitle("x", 1);
00293 meBCETFwdMap_->setAxisTitle("y", 2);
00294
00295 name = "EECLT BC size map EE +";
00296 meBCSizFwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 100., "s");
00297 meBCSizFwdMap_->setAxisTitle("x", 1);
00298 meBCSizFwdMap_->setAxisTitle("y", 2);
00299
00300 name = "EECLT BC energy projection eta EE +";
00301 meBCEneFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 500., "s");
00302 meBCEneFwdMapProjEta_->setAxisTitle("eta", 1);
00303 meBCEneFwdMapProjEta_->setAxisTitle("energy (GeV)", 2);
00304
00305 name = "EECLT BC energy projection phi EE +";
00306 meBCEneFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
00307 meBCEneFwdMapProjPhi_->setAxisTitle("phi", 1);
00308 meBCEneFwdMapProjPhi_->setAxisTitle("energy (GeV)", 2);
00309
00310 name = "EECLT BC number projection eta EE +";
00311 meBCNumFwdMapProjEta_ = dqmStore_->book1D(name, name, 20, 1.479, 3.0);
00312 meBCNumFwdMapProjEta_->setAxisTitle("eta", 1);
00313 meBCNumFwdMapProjEta_->setAxisTitle("number of clusters", 2);
00314
00315 name = "EECLT BC number projection phi EE +";
00316 meBCNumFwdMapProjPhi_ = dqmStore_->book1D(name, name, 50, -M_PI, M_PI);
00317 meBCNumFwdMapProjPhi_->setAxisTitle("phi", 1);
00318 meBCNumFwdMapProjPhi_->setAxisTitle("number of clusters", 2);
00319
00320 name = "EECLT BC ET projection eta EE +";
00321 meBCETFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 500., "s");
00322 meBCETFwdMapProjEta_->setAxisTitle("eta", 1);
00323 meBCETFwdMapProjEta_->setAxisTitle("transverse energy (GeV)", 2);
00324
00325 name = "EECLT BC ET projection phi EE +";
00326 meBCETFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
00327 meBCETFwdMapProjPhi_->setAxisTitle("phi", 1);
00328 meBCETFwdMapProjPhi_->setAxisTitle("transverse energy (GeV)", 2);
00329
00330 name = "EECLT BC size projection eta EE +";
00331 meBCSizFwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, 100, 0., 100., "s");
00332 meBCSizFwdMapProjEta_->setAxisTitle("eta", 1);
00333 meBCSizFwdMapProjEta_->setAxisTitle("cluster size", 2);
00334
00335 name = "EECLT BC size projection phi EE +";
00336 meBCSizFwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 100., "s");
00337 meBCSizFwdMapProjPhi_->setAxisTitle("phi", 1);
00338 meBCSizFwdMapProjPhi_->setAxisTitle("cluster size", 2);
00339
00340 name = "EECLT BC energy map EE -";
00341 meBCEneBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
00342 meBCEneBwdMap_->setAxisTitle("x", 1);
00343 meBCEneBwdMap_->setAxisTitle("y", 2);
00344
00345 name = "EECLT BC number map EE -";
00346 meBCNumBwdMap_ = dqmStore_->book2D(name, name, 20, -150., 150., 20, -150., 150.);
00347 meBCNumBwdMap_->setAxisTitle("x", 1);
00348 meBCNumBwdMap_->setAxisTitle("y", 2);
00349
00350 name = "EECLT BC ET map EE -";
00351 meBCETBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 500., "s");
00352 meBCETBwdMap_->setAxisTitle("x", 1);
00353 meBCETBwdMap_->setAxisTitle("y", 2);
00354
00355 name = "EECLT BC size map EE -";
00356 meBCSizBwdMap_ = dqmStore_->bookProfile2D(name, name, 20, -150., 150., 20, -150., 150., 100, 0., 100., "s");
00357 meBCSizBwdMap_->setAxisTitle("x", 1);
00358 meBCSizBwdMap_->setAxisTitle("y", 2);
00359
00360 name = "EECLT BC energy projection eta EE -";
00361 meBCEneBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 500., "s");
00362 meBCEneBwdMapProjEta_->setAxisTitle("eta", 1);
00363 meBCEneBwdMapProjEta_->setAxisTitle("energy (GeV)", 2);
00364
00365 name = "EECLT BC energy projection phi EE -";
00366 meBCEneBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
00367 meBCEneBwdMapProjPhi_->setAxisTitle("phi", 1);
00368 meBCEneBwdMapProjPhi_->setAxisTitle("energy (GeV)", 2);
00369
00370 name = "EECLT BC number projection eta EE -";
00371 meBCNumBwdMapProjEta_ = dqmStore_->book1D(name, name, 20, -3.0, -1.479);
00372 meBCNumBwdMapProjEta_->setAxisTitle("eta", 1);
00373 meBCNumBwdMapProjEta_->setAxisTitle("number of clusters", 2);
00374
00375 name = "EECLT BC number projection phi EE -";
00376 meBCNumBwdMapProjPhi_ = dqmStore_->book1D(name, name, 50, -M_PI, M_PI);
00377 meBCNumBwdMapProjPhi_->setAxisTitle("phi", 1);
00378 meBCNumBwdMapProjPhi_->setAxisTitle("number of clusters", 2);
00379
00380 name = "EECLT BC ET projection eta EE -";
00381 meBCETBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 500., "s");
00382 meBCETBwdMapProjEta_->setAxisTitle("eta", 1);
00383 meBCETBwdMapProjEta_->setAxisTitle("transverse energy (GeV)", 2);
00384
00385 name = "EECLT BC ET projection phi EE -";
00386 meBCETBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 500., "s");
00387 meBCETBwdMapProjPhi_->setAxisTitle("phi", 1);
00388 meBCETBwdMapProjPhi_->setAxisTitle("transverse energy (GeV)", 2);
00389
00390 name = "EECLT BC size projection eta EE -";
00391 meBCSizBwdMapProjEta_ = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, 100, 0., 100., "s");
00392 meBCSizBwdMapProjEta_->setAxisTitle("eta", 1);
00393 meBCSizBwdMapProjEta_->setAxisTitle("cluster size", 2);
00394
00395 name = "EECLT BC size projection phi EE -";
00396 meBCSizBwdMapProjPhi_ = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, 100, 0., 100., "s");
00397 meBCSizBwdMapProjPhi_->setAxisTitle("phi", 1);
00398 meBCSizBwdMapProjPhi_->setAxisTitle("cluster size", 2);
00399
00400 name = "EECLT SC energy";
00401 meSCEne_ = dqmStore_->book1D(name, name, 100, 0., 150.);
00402 meSCEne_->setAxisTitle("energy (GeV)", 1);
00403
00404 name = "EECLT SC number";
00405 meSCNum_ = dqmStore_->book1D(name, name, 50, 0., 50.);
00406 meSCNum_->setAxisTitle("number of clusters", 1);
00407
00408 name = "EECLT SC size";
00409 meSCSiz_ = dqmStore_->book1D(name, name, 50, 0., 50.);
00410 meSCSiz_->setAxisTitle("cluster size", 1);
00411
00412 name = "EECLT SC size (crystal)";
00413 meSCCrystalSiz_ = dqmStore_->book1D(name, name, 150, 0, 150);
00414 meSCCrystalSiz_->setAxisTitle("cluster size in crystals", 1);
00415
00416 name = "EECLT SC seed crystal energy";
00417 meSCSeedEne_ = dqmStore_->book1D(name, name, 100, 0., 10.);
00418 meSCSeedEne_->setAxisTitle("seed crystal energy (GeV)", 1);
00419
00420 name = "EECLT SC e2";
00421 meSCEne2_ = dqmStore_->book1D(name, name, 100, 0., 10.);
00422 meSCEne2_->setAxisTitle("seed + highest neighbor crystal energy (GeV)", 1);
00423
00424 name = "EECLT SC energy vs seed crystal energy";
00425 meSCEneVsEMax_ = dqmStore_->book2D(name, name, 50, 0., 10., 50, 0., 10.);
00426 meSCEneVsEMax_->setAxisTitle("seed crystal energy (GeV)", 1);
00427 meSCEneVsEMax_->setAxisTitle("cluster energy (GeV)", 2);
00428
00429 name = "EECLT SC energy (low scale)";
00430 meSCEneLowScale_ = dqmStore_->book1D(name, name, 100, 0., 10.);
00431 meSCEneLowScale_->setAxisTitle("cluster energy (GeV)", 1);
00432
00433 name = "EECLT SC seed occupancy map EE -";
00434 meSCSeedMapOcc_[0] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
00435 meSCSeedMapOcc_[0]->setAxisTitle("jx'", 1);
00436 meSCSeedMapOcc_[0]->setAxisTitle("jy'", 2);
00437
00438 name = "EECLT SC seed occupancy map EE +";
00439 meSCSeedMapOcc_[1] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
00440 meSCSeedMapOcc_[1]->setAxisTitle("jx'", 1);
00441 meSCSeedMapOcc_[1]->setAxisTitle("jy'", 2);
00442
00443 name = "EECLT SC single crystal cluster seed occupancy map EE -";
00444 meSCMapSingleCrystal_[0] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
00445 meSCMapSingleCrystal_[0]->setAxisTitle("jx'", 1);
00446 meSCMapSingleCrystal_[0]->setAxisTitle("jy'", 2);
00447
00448 name = "EECLT SC single crystal cluster seed occupancy map EE +";
00449 meSCMapSingleCrystal_[1] = dqmStore_->book2D(name, name, 20, 0., 100., 20, 0., 100.);
00450 meSCMapSingleCrystal_[1]->setAxisTitle("jx'", 1);
00451 meSCMapSingleCrystal_[1]->setAxisTitle("jy'", 2);
00452
00453 name = "EECLT s1s9";
00454 mes1s9_ = dqmStore_->book1D(name, name, 50, 0., 1.5);
00455 mes1s9_->setAxisTitle("s1/s9", 1);
00456
00457 name = "EECLT s1s9 thr";
00458 mes1s9thr_ = dqmStore_->book1D(name, name, 50, 0., 1.5);
00459 mes1s9thr_->setAxisTitle("s1/s9", 1);
00460
00461 name = "EECLT s9s25";
00462 mes9s25_ = dqmStore_->book1D(name, name, 75, 0., 1.5);
00463 mes9s25_->setAxisTitle("s9/s25", 1);
00464
00465 name = "EECLT dicluster invariant mass Pi0";
00466 meInvMassPi0_ = dqmStore_->book1D(name, name, 50, 0.0, 0.500);
00467 meInvMassPi0_->setAxisTitle("mass (GeV)", 1);
00468
00469 name = "EECLT dicluster invariant mass JPsi";
00470 meInvMassJPsi_ = dqmStore_->book1D(name, name, 50, 2.9, 3.3);
00471 meInvMassJPsi_->setAxisTitle("mass (GeV)", 1);
00472
00473 name = "EECLT dicluster invariant mass Z0";
00474 meInvMassZ0_ = dqmStore_->book1D(name, name, 50, 40, 110);
00475 meInvMassZ0_->setAxisTitle("mass (GeV)", 1);
00476
00477 name = "EECLT dicluster invariant mass high";
00478 meInvMassHigh_ = dqmStore_->book1D(name, name, 500, 110, 3000);
00479 meInvMassHigh_->setAxisTitle("mass (GeV)", 1);
00480
00481 name = "EECLT dicluster invariant mass Pi0 sel";
00482 meInvMassPi0Sel_ = dqmStore_->book1D(name, name, 50, 0.00, 0.500);
00483 meInvMassPi0Sel_->setAxisTitle("mass (GeV)", 1);
00484
00485 name = "EECLT dicluster invariant mass JPsi sel";
00486 meInvMassJPsiSel_ = dqmStore_->book1D(name, name, 50, 2.9, 3.3);
00487 meInvMassJPsiSel_->setAxisTitle("mass (GeV)", 1);
00488
00489 name = "EECLT dicluster invariant mass Z0 sel";
00490 meInvMassZ0Sel_ = dqmStore_->book1D(name, name, 50, 40, 110);
00491 meInvMassZ0Sel_->setAxisTitle("mass (GeV)", 1);
00492
00493 name = "EECLT dicluster invariant mass high sel";
00494 meInvMassHighSel_ = dqmStore_->book1D(name, name, 500, 110, 3000);
00495 meInvMassHighSel_->setAxisTitle("mass (GeV)", 1);
00496
00497 }
00498
00499 }
00500
00501 void EEClusterTask::cleanup(void){
00502
00503 if ( ! init_ ) return;
00504
00505 if ( dqmStore_ ) {
00506 dqmStore_->setCurrentFolder(prefixME_ + "/EEClusterTask");
00507
00508 if ( meBCEne_ ) dqmStore_->removeElement( meBCEne_->getName() );
00509 meBCEne_ = 0;
00510
00511 if ( meBCNum_ ) dqmStore_->removeElement( meBCNum_->getName() );
00512 meBCNum_ = 0;
00513
00514 if ( meBCSiz_ ) dqmStore_->removeElement( meBCSiz_->getName() );
00515 meBCSiz_ = 0;
00516
00517 if ( meBCEneFwdMap_ ) dqmStore_->removeElement( meBCEneFwdMap_->getName() );
00518 meBCEneFwdMap_ = 0;
00519
00520 if ( meBCNumFwdMap_ ) dqmStore_->removeElement( meBCNumFwdMap_->getName() );
00521 meBCNumFwdMap_ = 0;
00522
00523 if ( meBCETFwdMap_ ) dqmStore_->removeElement( meBCETFwdMap_->getName() );
00524 meBCETFwdMap_ = 0;
00525
00526 if ( meBCSizFwdMap_ ) dqmStore_->removeElement( meBCSizFwdMap_->getName() );
00527 meBCSizFwdMap_ = 0;
00528
00529 if ( meBCEneFwdMapProjEta_ ) dqmStore_->removeElement( meBCEneFwdMapProjEta_->getName() );
00530 meBCEneFwdMapProjEta_ = 0;
00531
00532 if ( meBCEneFwdMapProjPhi_ ) dqmStore_->removeElement( meBCEneFwdMapProjPhi_->getName() );
00533 meBCEneFwdMapProjPhi_ = 0;
00534
00535 if ( meBCNumFwdMapProjEta_ ) dqmStore_->removeElement( meBCNumFwdMapProjEta_->getName() );
00536 meBCNumFwdMapProjEta_ = 0;
00537
00538 if ( meBCNumFwdMapProjPhi_ ) dqmStore_->removeElement( meBCNumFwdMapProjPhi_->getName() );
00539 meBCNumFwdMapProjPhi_ = 0;
00540
00541 if ( meBCETFwdMapProjEta_ ) dqmStore_->removeElement( meBCETFwdMapProjEta_->getName() );
00542 meBCETFwdMapProjEta_ = 0;
00543
00544 if ( meBCETFwdMapProjPhi_ ) dqmStore_->removeElement( meBCETFwdMapProjPhi_->getName() );
00545 meBCETFwdMapProjPhi_ = 0;
00546
00547 if ( meBCSizFwdMapProjEta_ ) dqmStore_->removeElement( meBCSizFwdMapProjEta_->getName() );
00548 meBCSizFwdMapProjEta_ = 0;
00549
00550 if ( meBCSizFwdMapProjPhi_ ) dqmStore_->removeElement( meBCSizFwdMapProjPhi_->getName() );
00551 meBCSizFwdMapProjPhi_ = 0;
00552
00553 if ( meBCEneBwdMap_ ) dqmStore_->removeElement( meBCEneBwdMap_->getName() );
00554 meBCEneBwdMap_ = 0;
00555
00556 if ( meBCNumBwdMap_ ) dqmStore_->removeElement( meBCNumBwdMap_->getName() );
00557 meBCNumBwdMap_ = 0;
00558
00559 if ( meBCETBwdMap_ ) dqmStore_->removeElement( meBCETBwdMap_->getName() );
00560 meBCETBwdMap_ = 0;
00561
00562 if ( meBCSizBwdMap_ ) dqmStore_->removeElement( meBCSizBwdMap_->getName() );
00563 meBCSizBwdMap_ = 0;
00564
00565 if ( meBCEneBwdMapProjEta_ ) dqmStore_->removeElement( meBCEneBwdMapProjEta_->getName() );
00566 meBCEneBwdMapProjEta_ = 0;
00567
00568 if ( meBCEneBwdMapProjPhi_ ) dqmStore_->removeElement( meBCEneBwdMapProjPhi_->getName() );
00569 meBCEneBwdMapProjPhi_ = 0;
00570
00571 if ( meBCNumBwdMapProjEta_ ) dqmStore_->removeElement( meBCNumBwdMapProjEta_->getName() );
00572 meBCNumBwdMapProjEta_ = 0;
00573
00574 if ( meBCNumBwdMapProjPhi_ ) dqmStore_->removeElement( meBCNumBwdMapProjPhi_->getName() );
00575 meBCNumBwdMapProjPhi_ = 0;
00576
00577 if ( meBCETBwdMapProjEta_ ) dqmStore_->removeElement( meBCETBwdMapProjEta_->getName() );
00578 meBCETBwdMapProjEta_ = 0;
00579
00580 if ( meBCETBwdMapProjPhi_ ) dqmStore_->removeElement( meBCETBwdMapProjPhi_->getName() );
00581 meBCETBwdMapProjPhi_ = 0;
00582
00583 if ( meBCSizBwdMapProjEta_ ) dqmStore_->removeElement( meBCSizBwdMapProjEta_->getName() );
00584 meBCSizBwdMapProjEta_ = 0;
00585
00586 if ( meBCSizBwdMapProjPhi_ ) dqmStore_->removeElement( meBCSizBwdMapProjPhi_->getName() );
00587 meBCSizBwdMapProjPhi_ = 0;
00588
00589 if ( meSCEne_ ) dqmStore_->removeElement( meSCEne_->getName() );
00590 meSCEne_ = 0;
00591
00592 if ( meSCNum_ ) dqmStore_->removeElement( meSCNum_->getName() );
00593 meSCNum_ = 0;
00594
00595 if ( meSCSiz_ ) dqmStore_->removeElement( meSCSiz_->getName() );
00596 meSCSiz_ = 0;
00597
00598 if ( meSCCrystalSiz_ ) dqmStore_->removeElement( meSCCrystalSiz_->getName() );
00599 meSCCrystalSiz_ = 0;
00600
00601 if ( meSCSeedEne_ ) dqmStore_->removeElement( meSCSeedEne_->getName() );
00602 meSCSeedEne_ = 0;
00603
00604 if ( meSCEne2_ ) dqmStore_->removeElement( meSCEne2_->getName() );
00605 meSCEne2_ = 0;
00606
00607 if ( meSCEneVsEMax_ ) dqmStore_->removeElement( meSCEneVsEMax_->getName() );
00608 meSCEneVsEMax_ = 0;
00609
00610 if ( meSCEneLowScale_ ) dqmStore_->removeElement( meSCEneLowScale_->getName() );
00611 meSCEneLowScale_ = 0;
00612
00613 if ( meSCSeedMapOcc_[0] ) dqmStore_->removeElement( meSCSeedMapOcc_[0]->getName() );
00614 meSCSeedMapOcc_[0] = 0;
00615
00616 if ( meSCSeedMapOcc_[1] ) dqmStore_->removeElement( meSCSeedMapOcc_[1]->getName() );
00617 meSCSeedMapOcc_[1] = 0;
00618
00619 if ( meSCMapSingleCrystal_[0] ) dqmStore_->removeElement( meSCMapSingleCrystal_[0]->getName() );
00620 meSCMapSingleCrystal_[0] = 0;
00621
00622 if ( meSCMapSingleCrystal_[1] ) dqmStore_->removeElement( meSCMapSingleCrystal_[1]->getName() );
00623 meSCMapSingleCrystal_[1] = 0;
00624
00625 if ( mes1s9_ ) dqmStore_->removeElement( mes1s9_->getName() );
00626 mes1s9_ = 0;
00627
00628 if ( mes1s9thr_ ) dqmStore_->removeElement( mes1s9thr_->getName() );
00629 mes1s9thr_ = 0;
00630
00631 if ( mes9s25_ ) dqmStore_->removeElement( mes9s25_->getName() );
00632 mes9s25_ = 0;
00633
00634 if ( meInvMassPi0_ ) dqmStore_->removeElement( meInvMassPi0_->getName() );
00635 meInvMassPi0_ = 0;
00636
00637 if ( meInvMassJPsi_ ) dqmStore_->removeElement( meInvMassJPsi_->getName() );
00638 meInvMassJPsi_ = 0;
00639
00640 if ( meInvMassZ0_ ) dqmStore_->removeElement( meInvMassZ0_->getName() );
00641 meInvMassZ0_ = 0;
00642
00643 if ( meInvMassHigh_ ) dqmStore_->removeElement( meInvMassHigh_->getName() );
00644 meInvMassHigh_ = 0;
00645
00646 if ( meInvMassPi0Sel_ ) dqmStore_->removeElement( meInvMassPi0Sel_->getName() );
00647 meInvMassPi0Sel_ = 0;
00648
00649 if ( meInvMassJPsiSel_ ) dqmStore_->removeElement( meInvMassJPsiSel_->getName() );
00650 meInvMassJPsiSel_ = 0;
00651
00652 if ( meInvMassZ0Sel_ ) dqmStore_->removeElement( meInvMassZ0Sel_->getName() );
00653 meInvMassZ0Sel_ = 0;
00654
00655 if ( meInvMassHighSel_ ) dqmStore_->removeElement( meInvMassHighSel_->getName() );
00656 meInvMassHighSel_ = 0;
00657
00658 }
00659
00660 init_ = false;
00661
00662 }
00663
00664 void EEClusterTask::endJob(void){
00665
00666 edm::LogInfo("EEClusterTask") << "analyzed " << ievt_ << " events";
00667
00668 if ( enableCleanup_ ) this->cleanup();
00669
00670 }
00671
00672 void EEClusterTask::analyze(const edm::Event& e, const edm::EventSetup& c){
00673
00674 bool enable = false;
00675
00676 edm::Handle<EcalRawDataCollection> dcchs;
00677
00678 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00679
00680 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00681
00682 if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
00683
00684 if ( dcchItr->getRunType() == EcalDCCHeaderBlock::BEAMH4 ||
00685 dcchItr->getRunType() == EcalDCCHeaderBlock::BEAMH2 ) enable = true;
00686
00687 if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC ||
00688 dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC ||
00689 dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00690 dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00691 dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00692 dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) enable = true;
00693
00694 break;
00695
00696 }
00697
00698 } else {
00699
00700 enable = true;
00701 edm::LogWarning("EEClusterTask") << EcalRawDataCollection_ << " not available";
00702
00703 }
00704
00705 if ( ! enable ) return;
00706
00707 if ( ! init_ ) this->setup();
00708
00709 ievt_++;
00710
00711
00712 edm::ESHandle<CaloTopology> pTopology;
00713 c.get<CaloTopologyRecord>().get(pTopology);
00714 if ( !pTopology.isValid() ) {
00715 edm::LogWarning("EEClusterTask") << "Topology not valid";
00716 return;
00717 }
00718 const CaloTopology* topology = pTopology.product();
00719
00720
00721 edm::Handle< EcalRecHitCollection > pEERecHits;
00722 e.getByLabel( EcalRecHitCollection_, pEERecHits );
00723 if ( !pEERecHits.isValid() ) {
00724 edm::LogWarning("EEClusterTask") << "RecHit collection " << EcalRecHitCollection_ << " not available.";
00725 return;
00726 }
00727 const EcalRecHitCollection* eeRecHits = pEERecHits.product();
00728
00729 reco::BasicClusterCollection bcSel;
00730
00731
00732 edm::Handle<reco::BasicClusterCollection> pBasicClusters;
00733 if ( e.getByLabel(BasicClusterCollection_, pBasicClusters) ) {
00734
00735 int nbcc = pBasicClusters->size();
00736 if (nbcc>0) meBCNum_->Fill(float(nbcc));
00737
00738 for ( reco::BasicClusterCollection::const_iterator bCluster = pBasicClusters->begin(); bCluster != pBasicClusters->end(); ++bCluster ) {
00739
00740 meBCEne_->Fill(bCluster->energy());
00741 meBCSiz_->Fill(float(bCluster->size()));
00742
00743 if ( bCluster->eta() > 0 ) {
00744 meBCEneFwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy());
00745 meBCEneFwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() );
00746 meBCEneFwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() );
00747
00748 meBCNumFwdMap_->Fill(bCluster->x(), bCluster->y());
00749 meBCNumFwdMapProjEta_->Fill( bCluster->eta() );
00750 meBCNumFwdMapProjPhi_->Fill( bCluster->phi() );
00751
00752 meBCETFwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy() * sin(bCluster->position().theta()) );
00753 meBCETFwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() * sin(bCluster->position().theta()) );
00754 meBCETFwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() * sin(bCluster->position().theta()) );
00755
00756 meBCSizFwdMap_->Fill(bCluster->x(), bCluster->y(), float(bCluster->size()) );
00757 meBCSizFwdMapProjEta_->Fill( bCluster->eta(), float(bCluster->size()) );
00758 meBCSizFwdMapProjPhi_->Fill( bCluster->phi(), float(bCluster->size()) );
00759 } else {
00760 meBCEneBwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy());
00761 meBCEneBwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() );
00762 meBCEneBwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() );
00763
00764 meBCNumBwdMap_->Fill(bCluster->x(), bCluster->y());
00765 meBCNumBwdMapProjEta_->Fill( bCluster->eta() );
00766 meBCNumBwdMapProjPhi_->Fill( bCluster->phi() );
00767
00768 meBCETBwdMap_->Fill(bCluster->x(), bCluster->y(), bCluster->energy() * sin(bCluster->position().theta()) );
00769 meBCETBwdMapProjEta_->Fill( bCluster->eta(), bCluster->energy() * sin(bCluster->position().theta()) );
00770 meBCETBwdMapProjPhi_->Fill( bCluster->phi(), bCluster->energy() * sin(bCluster->position().theta()) );
00771
00772 meBCSizBwdMap_->Fill(bCluster->x(), bCluster->y(), float(bCluster->size()) );
00773 meBCSizBwdMapProjEta_->Fill( bCluster->eta(), float(bCluster->size()) );
00774 meBCSizBwdMapProjPhi_->Fill( bCluster->phi(), float(bCluster->size()) );
00775
00776 float e2x2 = EcalClusterTools::e2x2( *bCluster, eeRecHits, topology );
00777 float e3x3 = EcalClusterTools::e3x3( *bCluster, eeRecHits, topology );
00778
00779
00780 float pt = std::abs( bCluster->energy()*sin(bCluster->position().theta()) );
00781 if ( pt > thrClusEt_ && e2x2/e3x3 > thrS4S9_ ) bcSel.push_back(*bCluster);
00782 }
00783
00784 }
00785
00786 } else {
00787
00788 edm::LogWarning("EEClusterTask") << BasicClusterCollection_ << " not available";
00789
00790 }
00791
00792 for ( reco::BasicClusterCollection::const_iterator bc1 = bcSel.begin(); bc1 != bcSel.end(); ++bc1 ) {
00793 TLorentzVector bc1P;
00794 bc1P.SetPtEtaPhiE(std::abs(bc1->energy()*sin(bc1->position().theta())),
00795 bc1->eta(), bc1->phi(), bc1->energy());
00796 for ( reco::BasicClusterCollection::const_iterator bc2 = bc1+1; bc2 != bcSel.end(); ++bc2 ) {
00797 TLorentzVector bc2P;
00798 bc2P.SetPtEtaPhiE(std::abs(bc2->energy()*sin(bc2->position().theta())),
00799 bc2->eta(), bc2->phi(), bc2->energy());
00800
00801 TLorentzVector candP = bc1P + bc2P;
00802
00803 if ( candP.Pt() > thrCandEt_ ) {
00804 float mass = candP.M();
00805 if ( mass < 0.500 ) {
00806 meInvMassPi0Sel_->Fill( mass );
00807 } else if ( mass > 2.9 && mass < 3.3 ) {
00808 meInvMassJPsiSel_->Fill( mass );
00809 } else if ( mass > 40 && mass < 110 ) {
00810 meInvMassZ0Sel_->Fill( mass );
00811 } else if ( mass > 110 ) {
00812 meInvMassHighSel_->Fill( mass );
00813 }
00814
00815 }
00816
00817 }
00818 }
00819
00820
00821 edm::Handle<reco::SuperClusterCollection> pSuperClusters;
00822 if ( e.getByLabel(SuperClusterCollection_, pSuperClusters) ) {
00823
00824 int nscc = pSuperClusters->size();
00825 if ( nscc > 0 ) meSCNum_->Fill(float(nscc));
00826
00827 TLorentzVector sc1_p(0,0,0,0);
00828 TLorentzVector sc2_p(0,0,0,0);
00829
00830 reco::SuperClusterCollection scSel;
00831
00832 for ( reco::SuperClusterCollection::const_iterator sCluster = pSuperClusters->begin(); sCluster != pSuperClusters->end(); sCluster++ ) {
00833
00834
00835 meSCEne_->Fill(sCluster->energy());
00836 meSCSiz_->Fill(float(sCluster->clustersSize()));
00837
00838 reco::CaloClusterPtr theSeed = sCluster->seed();
00839
00840
00841 std::vector< std::pair<DetId,float> > sIds = sCluster->hitsAndFractions();
00842
00843 float eMax, e2nd;
00844 EcalRecHitCollection::const_iterator seedItr = eeRecHits->begin();
00845 EcalRecHitCollection::const_iterator secondItr = eeRecHits->begin();
00846
00847 for(std::vector< std::pair<DetId,float> >::const_iterator idItr = sIds.begin(); idItr != sIds.end(); ++idItr) {
00848 DetId id = idItr->first;
00849 if(id.det() != DetId::Ecal) { continue; }
00850 EcalRecHitCollection::const_iterator hitItr = eeRecHits->find(id);
00851 if(hitItr == eeRecHits->end()) { continue; }
00852 if(hitItr->energy() > secondItr->energy()) { secondItr = hitItr; }
00853 if(hitItr->energy() > seedItr->energy()) { std::swap(seedItr,secondItr); }
00854 }
00855
00856 eMax = seedItr->energy();
00857 e2nd = secondItr->energy();
00858 EEDetId seedId = (EEDetId) seedItr->id();
00859
00860 float e3x3 = EcalClusterTools::e3x3( *theSeed, eeRecHits, topology );
00861 float e5x5 = EcalClusterTools::e5x5( *theSeed, eeRecHits, topology );
00862
00863 meSCCrystalSiz_->Fill(sIds.size());
00864 meSCSeedEne_->Fill(eMax);
00865 meSCEne2_->Fill(eMax+e2nd);
00866 meSCEneVsEMax_->Fill(eMax,sCluster->energy());
00867 meSCEneLowScale_->Fill(sCluster->energy());
00868
00869
00870 int ism = Numbers::iSM(seedId);
00871 int eeSide;
00872 if( ism >= 1 && ism <= 9)
00873 eeSide = 0;
00874 else
00875 eeSide = 1;
00876 int eex = seedId.ix();
00877 int eey = seedId.iy();
00878 float xeex = eex - 0.5;
00879 float xeey = eey - 0.5;
00880
00881 meSCSeedMapOcc_[eeSide]->Fill(xeex, xeey);
00882
00883 if(sIds.size() == 1) meSCMapSingleCrystal_[eeSide]->Fill(xeex, xeey);
00884
00885 mes1s9_->Fill( eMax/e3x3 );
00886 if ( eMax > 3.0 ) mes1s9thr_->Fill( eMax/e3x3 );
00887 mes9s25_->Fill( e3x3/e5x5 );
00888
00889
00890 if ( sCluster->energy() > sc1_p.Energy() ) {
00891 sc2_p=sc1_p;
00892 sc1_p.SetPtEtaPhiE(sCluster->energy()*sin(sCluster->position().theta()),
00893 sCluster->eta(), sCluster->phi(), sCluster->energy());
00894 } else if ( sCluster->energy() > sc2_p.Energy() ) {
00895 sc2_p.SetPtEtaPhiE(sCluster->energy()*sin(sCluster->position().theta()),
00896 sCluster->eta(), sCluster->phi(), sCluster->energy());
00897 }
00898
00899 }
00900
00901 if ( nscc >= 2) {
00902 TLorentzVector sum = sc1_p+sc2_p;
00903 float mass = sum.M();
00904 if ( mass < 0.500 ) {
00905 meInvMassPi0_->Fill( mass );
00906 } else if ( mass > 2.9 && mass < 3.3 ) {
00907 meInvMassJPsi_->Fill( mass );
00908 } else if ( mass > 40 && mass < 110 ) {
00909 meInvMassZ0_->Fill( mass );
00910 } else if ( mass > 110 ) {
00911 meInvMassHigh_->Fill( mass );
00912 }
00913 }
00914
00915 } else {
00916
00917 edm::LogWarning("EEClusterTask") << SuperClusterCollection_ << " not available";
00918
00919 }
00920
00921 }