00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <iostream>
00011 #include <fstream>
00012 #include <vector>
00013
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020
00021 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00022 #include "DataFormats/EcalDetId/interface/EEDetId.h"
00023 #include "DataFormats/EcalDigi/interface/EEDataFrame.h"
00024 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
00025 #include "DataFormats/EcalRecHit/interface/EcalUncalibratedRecHit.h"
00026 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00027
00028 #include <DQM/EcalCommon/interface/Numbers.h>
00029
00030 #include <DQM/EcalEndcapMonitorTasks/interface/EELedTask.h>
00031
00032 using namespace cms;
00033 using namespace edm;
00034 using namespace std;
00035
00036 EELedTask::EELedTask(const ParameterSet& ps){
00037
00038 init_ = false;
00039
00040 dqmStore_ = Service<DQMStore>().operator->();
00041
00042 prefixME_ = ps.getUntrackedParameter<string>("prefixME", "");
00043
00044 enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
00045
00046 mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
00047
00048 EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00049 EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
00050 EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
00051 EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection");
00052
00053 for (int i = 0; i < 18; i++) {
00054 meShapeMapL1A_[i] = 0;
00055 meAmplMapL1A_[i] = 0;
00056 meTimeMapL1A_[i] = 0;
00057 meAmplPNMapL1A_[i] = 0;
00058 meShapeMapL1B_[i] = 0;
00059 meAmplMapL1B_[i] = 0;
00060 meTimeMapL1B_[i] = 0;
00061 meAmplPNMapL1B_[i] = 0;
00062 mePnAmplMapG01L1_[i] = 0;
00063 mePnPedMapG01L1_[i] = 0;
00064 mePnAmplMapG16L1_[i] = 0;
00065 mePnPedMapG16L1_[i] = 0;
00066
00067 meShapeMapL2A_[i] = 0;
00068 meAmplMapL2A_[i] = 0;
00069 meTimeMapL2A_[i] = 0;
00070 meAmplPNMapL2A_[i] = 0;
00071 meShapeMapL2B_[i] = 0;
00072 meAmplMapL2B_[i] = 0;
00073 meTimeMapL2B_[i] = 0;
00074 meAmplPNMapL2B_[i] = 0;
00075 mePnAmplMapG01L2_[i] = 0;
00076 mePnPedMapG01L2_[i] = 0;
00077 mePnAmplMapG16L2_[i] = 0;
00078 mePnPedMapG16L2_[i] = 0;
00079 }
00080
00081 }
00082
00083 EELedTask::~EELedTask(){
00084
00085 }
00086
00087 void EELedTask::beginJob(const EventSetup& c){
00088
00089 ievt_ = 0;
00090
00091 if ( dqmStore_ ) {
00092 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
00093 dqmStore_->rmdir(prefixME_ + "/EELedTask");
00094 }
00095
00096 Numbers::initGeometry(c, false);
00097
00098 }
00099
00100 void EELedTask::beginRun(const Run& r, const EventSetup& c) {
00101
00102 if ( ! mergeRuns_ ) this->reset();
00103
00104 }
00105
00106 void EELedTask::endRun(const Run& r, const EventSetup& c) {
00107
00108 for (int i = 0; i < 18; i++) {
00109 if ( meShapeMapL1A_[i] ) meShapeMapL1A_[i]->Reset();
00110 if ( meAmplMapL1A_[i] ) meAmplMapL1A_[i]->Reset();
00111 if ( meTimeMapL1A_[i] ) meTimeMapL1A_[i]->Reset();
00112 if ( meAmplPNMapL1A_[i] ) meAmplPNMapL1A_[i]->Reset();
00113
00114 if ( meShapeMapL1B_[i] ) meShapeMapL1B_[i]->Reset();
00115 if ( meAmplMapL1B_[i] ) meAmplMapL1B_[i]->Reset();
00116 if ( meTimeMapL1B_[i] ) meTimeMapL1B_[i]->Reset();
00117 if ( meAmplPNMapL1B_[i] ) meAmplPNMapL1B_[i]->Reset();
00118
00119 if ( meShapeMapL2A_[i] ) meShapeMapL2A_[i]->Reset();
00120 if ( meAmplMapL2A_[i] ) meAmplMapL2A_[i]->Reset();
00121 if ( meTimeMapL2A_[i] ) meTimeMapL2A_[i]->Reset();
00122 if ( meAmplPNMapL2A_[i] ) meAmplPNMapL2A_[i]->Reset();
00123
00124 if ( meShapeMapL2B_[i] ) meShapeMapL2B_[i]->Reset();
00125 if ( meAmplMapL2B_[i] ) meAmplMapL2B_[i]->Reset();
00126 if ( meTimeMapL2B_[i] ) meTimeMapL2B_[i]->Reset();
00127 if ( meAmplPNMapL2B_[i] ) meAmplPNMapL2B_[i]->Reset();
00128
00129 if ( mePnAmplMapG01L1_[i] ) mePnAmplMapG01L1_[i]->Reset();
00130 if ( mePnPedMapG01L1_[i] ) mePnPedMapG01L1_[i]->Reset();
00131
00132 if ( mePnAmplMapG16L1_[i] ) mePnAmplMapG16L1_[i]->Reset();
00133 if ( mePnPedMapG16L1_[i] ) mePnPedMapG16L1_[i]->Reset();
00134
00135 if ( mePnAmplMapG01L2_[i] ) mePnAmplMapG01L2_[i]->Reset();
00136 if ( mePnPedMapG01L2_[i] ) mePnPedMapG01L2_[i]->Reset();
00137
00138 if ( mePnAmplMapG16L2_[i] ) mePnAmplMapG16L2_[i]->Reset();
00139 if ( mePnPedMapG16L2_[i] ) mePnPedMapG16L2_[i]->Reset();
00140 }
00141
00142 }
00143
00144 void EELedTask::reset(void) {
00145
00146 }
00147
00148 void EELedTask::setup(void){
00149
00150 init_ = true;
00151
00152 char histo[200];
00153
00154 if ( dqmStore_ ) {
00155 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
00156
00157 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1");
00158 for (int i = 0; i < 18; i++) {
00159 sprintf(histo, "EELDT shape %s L1A", Numbers::sEE(i+1).c_str());
00160 meShapeMapL1A_[i] = dqmStore_->bookProfile2D(histo, histo, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00161 meShapeMapL1A_[i]->setAxisTitle("channel", 1);
00162 meShapeMapL1A_[i]->setAxisTitle("sample", 2);
00163 meShapeMapL1A_[i]->setAxisTitle("amplitude", 3);
00164 dqmStore_->tag(meShapeMapL1A_[i], i+1);
00165 sprintf(histo, "EELDT amplitude %s L1A", Numbers::sEE(i+1).c_str());
00166 meAmplMapL1A_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00167 meAmplMapL1A_[i]->setAxisTitle("jx", 1);
00168 meAmplMapL1A_[i]->setAxisTitle("jy", 2);
00169 dqmStore_->tag(meAmplMapL1A_[i], i+1);
00170 sprintf(histo, "EELDT timing %s L1A", Numbers::sEE(i+1).c_str());
00171 meTimeMapL1A_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00172 meTimeMapL1A_[i]->setAxisTitle("jx", 1);
00173 meTimeMapL1A_[i]->setAxisTitle("jy", 2);
00174 dqmStore_->tag(meTimeMapL1A_[i], i+1);
00175 sprintf(histo, "EELDT amplitude over PN %s L1A", Numbers::sEE(i+1).c_str());
00176 meAmplPNMapL1A_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00177 meAmplPNMapL1A_[i]->setAxisTitle("jx", 1);
00178 meAmplPNMapL1A_[i]->setAxisTitle("jy", 2);
00179 dqmStore_->tag(meAmplPNMapL1A_[i], i+1);
00180
00181 sprintf(histo, "EELDT shape %s L1B", Numbers::sEE(i+1).c_str());
00182 meShapeMapL1B_[i] = dqmStore_->bookProfile2D(histo, histo, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00183 meShapeMapL1B_[i]->setAxisTitle("channel", 1);
00184 meShapeMapL1B_[i]->setAxisTitle("sample", 2);
00185 meShapeMapL1B_[i]->setAxisTitle("amplitude", 3);
00186 dqmStore_->tag(meShapeMapL1B_[i], i+1);
00187 sprintf(histo, "EELDT amplitude %s L1B", Numbers::sEE(i+1).c_str());
00188 meAmplMapL1B_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00189 meAmplMapL1B_[i]->setAxisTitle("jx", 1);
00190 meAmplMapL1B_[i]->setAxisTitle("jy", 2);
00191 dqmStore_->tag(meAmplMapL1B_[i], i+1);
00192 sprintf(histo, "EELDT timing %s L1B", Numbers::sEE(i+1).c_str());
00193 meTimeMapL1B_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00194 meTimeMapL1B_[i]->setAxisTitle("jx", 1);
00195 meTimeMapL1B_[i]->setAxisTitle("jy", 2);
00196 dqmStore_->tag(meTimeMapL1B_[i], i+1);
00197 sprintf(histo, "EELDT amplitude over PN %s L1B", Numbers::sEE(i+1).c_str());
00198 meAmplPNMapL1B_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00199 meAmplPNMapL1B_[i]->setAxisTitle("jx", 1);
00200 meAmplPNMapL1B_[i]->setAxisTitle("jy", 2);
00201 dqmStore_->tag(meAmplPNMapL1B_[i], i+1);
00202 }
00203
00204 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2");
00205 for (int i = 0; i < 18; i++) {
00206 sprintf(histo, "EELDT shape %s L2A", Numbers::sEE(i+1).c_str());
00207 meShapeMapL2A_[i] = dqmStore_->bookProfile2D(histo, histo, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00208 meShapeMapL2A_[i]->setAxisTitle("channel", 1);
00209 meShapeMapL2A_[i]->setAxisTitle("sample", 2);
00210 meShapeMapL2A_[i]->setAxisTitle("amplitude", 3);
00211 dqmStore_->tag(meShapeMapL2A_[i], i+1);
00212 sprintf(histo, "EELDT amplitude %s L2A", Numbers::sEE(i+1).c_str());
00213 meAmplMapL2A_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00214 meAmplMapL2A_[i]->setAxisTitle("jx", 1);
00215 meAmplMapL2A_[i]->setAxisTitle("jy", 2);
00216 dqmStore_->tag(meAmplMapL2A_[i], i+1);
00217 sprintf(histo, "EELDT timing %s L2A", Numbers::sEE(i+1).c_str());
00218 meTimeMapL2A_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00219 meTimeMapL2A_[i]->setAxisTitle("jx", 1);
00220 meTimeMapL2A_[i]->setAxisTitle("jy", 2);
00221 dqmStore_->tag(meTimeMapL2A_[i], i+1);
00222 sprintf(histo, "EELDT amplitude over PN %s L2A", Numbers::sEE(i+1).c_str());
00223 meAmplPNMapL2A_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00224 meAmplPNMapL2A_[i]->setAxisTitle("jx", 1);
00225 meAmplPNMapL2A_[i]->setAxisTitle("jy", 2);
00226 dqmStore_->tag(meAmplPNMapL2A_[i], i+1);
00227
00228 sprintf(histo, "EELDT shape %s L2B", Numbers::sEE(i+1).c_str());
00229 meShapeMapL2B_[i] = dqmStore_->bookProfile2D(histo, histo, 850, 0., 850., 10, 0., 10., 4096, 0., 4096., "s");
00230 meShapeMapL2B_[i]->setAxisTitle("channel", 1);
00231 meShapeMapL2B_[i]->setAxisTitle("sample", 2);
00232 meShapeMapL2B_[i]->setAxisTitle("amplitude", 3);
00233 dqmStore_->tag(meShapeMapL2B_[i], i+1);
00234 sprintf(histo, "EELDT amplitude %s L2B", Numbers::sEE(i+1).c_str());
00235 meAmplMapL2B_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00236 meAmplMapL2B_[i]->setAxisTitle("jx", 1);
00237 meAmplMapL2B_[i]->setAxisTitle("jy", 2);
00238 dqmStore_->tag(meAmplMapL2B_[i], i+1);
00239 sprintf(histo, "EELDT timing %s L2B", Numbers::sEE(i+1).c_str());
00240 meTimeMapL2B_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 250, 0., 10., "s");
00241 meTimeMapL2B_[i]->setAxisTitle("jx", 1);
00242 meTimeMapL2B_[i]->setAxisTitle("jy", 2);
00243 dqmStore_->tag(meTimeMapL2B_[i], i+1);
00244 sprintf(histo, "EELDT amplitude over PN %s L2B", Numbers::sEE(i+1).c_str());
00245 meAmplPNMapL2B_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096.*12., "s");
00246 meAmplPNMapL2B_[i]->setAxisTitle("jx", 1);
00247 meAmplPNMapL2B_[i]->setAxisTitle("jy", 2);
00248 dqmStore_->tag(meAmplPNMapL2B_[i], i+1);
00249 }
00250
00251 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN");
00252
00253 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain01");
00254 for (int i = 0; i < 18; i++) {
00255 sprintf(histo, "EEPDT PNs amplitude %s G01 L1", Numbers::sEE(i+1).c_str());
00256 mePnAmplMapG01L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00257 mePnAmplMapG01L1_[i]->setAxisTitle("channel", 1);
00258 mePnAmplMapG01L1_[i]->setAxisTitle("amplitude", 2);
00259 dqmStore_->tag(mePnAmplMapG01L1_[i], i+1);
00260 sprintf(histo, "EEPDT PNs pedestal %s G01 L1", Numbers::sEE(i+1).c_str());
00261 mePnPedMapG01L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00262 mePnPedMapG01L1_[i]->setAxisTitle("channel", 1);
00263 mePnPedMapG01L1_[i]->setAxisTitle("pedestal", 2);
00264 dqmStore_->tag(mePnPedMapG01L1_[i], i+1);
00265 }
00266
00267 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain16");
00268 for (int i = 0; i < 18; i++) {
00269 sprintf(histo, "EEPDT PNs amplitude %s G16 L1", Numbers::sEE(i+1).c_str());
00270 mePnAmplMapG16L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00271 mePnAmplMapG16L1_[i]->setAxisTitle("channel", 1);
00272 mePnAmplMapG16L1_[i]->setAxisTitle("amplitude", 2);
00273 dqmStore_->tag(mePnAmplMapG16L1_[i], i+1);
00274 sprintf(histo, "EEPDT PNs pedestal %s G16 L1", Numbers::sEE(i+1).c_str());
00275 mePnPedMapG16L1_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00276 mePnPedMapG16L1_[i]->setAxisTitle("channel", 1);
00277 mePnPedMapG16L1_[i]->setAxisTitle("pedestal", 2);
00278 dqmStore_->tag(mePnPedMapG16L1_[i], i+1);
00279 }
00280
00281 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN");
00282
00283 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain01");
00284 for (int i = 0; i < 18; i++) {
00285 sprintf(histo, "EEPDT PNs amplitude %s G01 L2", Numbers::sEE(i+1).c_str());
00286 mePnAmplMapG01L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00287 mePnAmplMapG01L2_[i]->setAxisTitle("amplitude", 2);
00288 mePnAmplMapG01L2_[i]->setAxisTitle("channel", 1);
00289 dqmStore_->tag(mePnAmplMapG01L2_[i], i+1);
00290 sprintf(histo, "EEPDT PNs pedestal %s G01 L2", Numbers::sEE(i+1).c_str());
00291 mePnPedMapG01L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00292 mePnPedMapG01L2_[i]->setAxisTitle("channel", 1);
00293 mePnPedMapG01L2_[i]->setAxisTitle("pedestal", 2);
00294 dqmStore_->tag(mePnPedMapG01L2_[i], i+1);
00295 }
00296
00297 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain16");
00298 for (int i = 0; i < 18; i++) {
00299 sprintf(histo, "EEPDT PNs amplitude %s G16 L2", Numbers::sEE(i+1).c_str());
00300 mePnAmplMapG16L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00301 mePnAmplMapG16L2_[i]->setAxisTitle("channel", 1);
00302 mePnAmplMapG16L2_[i]->setAxisTitle("amplitude", 2);
00303 dqmStore_->tag(mePnAmplMapG16L2_[i], i+1);
00304 sprintf(histo, "EEPDT PNs pedestal %s G16 L2", Numbers::sEE(i+1).c_str());
00305 mePnPedMapG16L2_[i] = dqmStore_->bookProfile(histo, histo, 10, 0., 10., 4096, 0., 4096., "s");
00306 mePnPedMapG16L2_[i]->setAxisTitle("channel", 1);
00307 mePnPedMapG16L2_[i]->setAxisTitle("pedestal", 2);
00308 dqmStore_->tag(mePnPedMapG16L2_[i], i+1);
00309 }
00310
00311 }
00312
00313 }
00314
00315 void EELedTask::cleanup(void){
00316
00317 if ( ! init_ ) return;
00318
00319 if ( dqmStore_ ) {
00320 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask");
00321
00322 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1");
00323 for (int i = 0; i < 18; i++) {
00324 if ( meShapeMapL1A_[i] ) dqmStore_->removeElement( meShapeMapL1A_[i]->getName() );
00325 meShapeMapL1A_[i] = 0;
00326 if ( meAmplMapL1A_[i] ) dqmStore_->removeElement( meAmplMapL1A_[i]->getName() );
00327 meAmplMapL1A_[i] = 0;
00328 if ( meTimeMapL1A_[i] ) dqmStore_->removeElement( meTimeMapL1A_[i]->getName() );
00329 meTimeMapL1A_[i] = 0;
00330 if ( meAmplPNMapL1A_[i] ) dqmStore_->removeElement( meAmplPNMapL1A_[i]->getName() );
00331 meAmplPNMapL1A_[i] = 0;
00332
00333 if ( meShapeMapL1B_[i] ) dqmStore_->removeElement( meShapeMapL1B_[i]->getName() );
00334 meShapeMapL1B_[i] = 0;
00335 if ( meAmplMapL1B_[i] ) dqmStore_->removeElement( meAmplMapL1B_[i]->getName() );
00336 meAmplMapL1B_[i] = 0;
00337 if ( meTimeMapL1B_[i] ) dqmStore_->removeElement( meTimeMapL1B_[i]->getName() );
00338 meTimeMapL1B_[i] = 0;
00339 if ( meAmplPNMapL1B_[i] ) dqmStore_->removeElement( meAmplPNMapL1B_[i]->getName() );
00340 meAmplPNMapL1B_[i] = 0;
00341 }
00342
00343 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2");
00344 for (int i = 0; i < 18; i++) {
00345 if ( meShapeMapL2A_[i] ) dqmStore_->removeElement( meShapeMapL2A_[i]->getName() );
00346 meShapeMapL2A_[i] = 0;
00347 if ( meAmplMapL2A_[i] ) dqmStore_->removeElement( meAmplMapL2A_[i]->getName() );
00348 meAmplMapL2A_[i] = 0;
00349 if ( meTimeMapL2A_[i] ) dqmStore_->removeElement( meTimeMapL2A_[i]->getName() );
00350 meTimeMapL2A_[i] = 0;
00351 if ( meAmplPNMapL2A_[i] ) dqmStore_->removeElement( meAmplPNMapL2A_[i]->getName() );
00352 meAmplPNMapL2A_[i] = 0;
00353
00354 if ( meShapeMapL2B_[i] ) dqmStore_->removeElement( meShapeMapL2B_[i]->getName() );
00355 meShapeMapL2B_[i] = 0;
00356 if ( meAmplMapL2B_[i] ) dqmStore_->removeElement( meAmplMapL2B_[i]->getName() );
00357 meAmplMapL2B_[i] = 0;
00358 if ( meTimeMapL2B_[i] ) dqmStore_->removeElement( meTimeMapL2B_[i]->getName() );
00359 meTimeMapL2B_[i] = 0;
00360 if ( meAmplPNMapL2B_[i] ) dqmStore_->removeElement( meAmplPNMapL2B_[i]->getName() );
00361 meAmplPNMapL2B_[i] = 0;
00362 }
00363
00364 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN");
00365
00366 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain01");
00367 for (int i = 0; i < 18; i++) {
00368 if ( mePnAmplMapG01L1_[i] ) dqmStore_->removeElement( mePnAmplMapG01L1_[i]->getName() );
00369 mePnAmplMapG01L1_[i] = 0;
00370 if ( mePnPedMapG01L1_[i] ) dqmStore_->removeElement( mePnPedMapG01L1_[i]->getName() );
00371 mePnPedMapG01L1_[i] = 0;
00372 }
00373
00374 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led1/PN/Gain16");
00375 for (int i = 0; i < 18; i++) {
00376 if ( mePnAmplMapG16L1_[i] ) dqmStore_->removeElement( mePnAmplMapG16L1_[i]->getName() );
00377 mePnAmplMapG16L1_[i] = 0;
00378 if ( mePnPedMapG16L1_[i] ) dqmStore_->removeElement( mePnPedMapG16L1_[i]->getName() );
00379 mePnPedMapG16L1_[i] = 0;
00380 }
00381
00382 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN");
00383
00384 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain01");
00385 for (int i = 0; i < 18; i++) {
00386 if ( mePnAmplMapG01L2_[i] ) dqmStore_->removeElement( mePnAmplMapG01L2_[i]->getName() );
00387 mePnAmplMapG01L2_[i] = 0;
00388 if ( mePnPedMapG01L2_[i] ) dqmStore_->removeElement( mePnPedMapG01L2_[i]->getName() );
00389 mePnPedMapG01L2_[i] = 0;
00390 }
00391
00392 dqmStore_->setCurrentFolder(prefixME_ + "/EELedTask/Led2/PN/Gain16");
00393 for (int i = 0; i < 18; i++) {
00394 if ( mePnAmplMapG16L2_[i] ) dqmStore_->removeElement( mePnAmplMapG16L2_[i]->getName() );
00395 mePnAmplMapG16L2_[i] = 0;
00396 if ( mePnPedMapG16L2_[i] ) dqmStore_->removeElement( mePnPedMapG16L2_[i]->getName() );
00397 mePnPedMapG16L2_[i] = 0;
00398 }
00399
00400 }
00401
00402 init_ = false;
00403
00404 }
00405
00406 void EELedTask::endJob(void){
00407
00408 LogInfo("EELedTask") << "analyzed " << ievt_ << " events";
00409
00410 if ( enableCleanup_ ) this->cleanup();
00411
00412 }
00413
00414 void EELedTask::analyze(const Event& e, const EventSetup& c){
00415
00416 bool enable = false;
00417 int runType[18] = { -1 };
00418 int rtHalf[18] = { -1 };
00419 int waveLength[18] = { -1 };
00420
00421 Handle<EcalRawDataCollection> dcchs;
00422
00423 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00424
00425 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00426
00427 if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
00428
00429 int ism = Numbers::iSM( *dcchItr, EcalEndcap );
00430
00431 runType[ism-1] = dcchItr->getRunType();
00432 rtHalf[ism-1] = dcchItr->getRtHalf();
00433 waveLength[ism-1] = dcchItr->getEventSettings().wavelength;
00434
00435 if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LED_STD ||
00436 dcchItr->getRunType() == EcalDCCHeaderBlock::LED_GAP ) enable = true;
00437
00438 }
00439
00440 } else {
00441
00442 LogWarning("EELedTask") << EcalRawDataCollection_ << " not available";
00443
00444 }
00445
00446 if ( ! enable ) return;
00447
00448 if ( ! init_ ) this->setup();
00449
00450 ievt_++;
00451
00452 Handle<EEDigiCollection> digis;
00453
00454 if ( e.getByLabel(EEDigiCollection_, digis) ) {
00455
00456 int need = digis->size();
00457 LogDebug("EELedTask") << "event " << ievt_ << " digi collection size " << need;
00458
00459 for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
00460
00461 EEDetId id = digiItr->id();
00462
00463 int ix = id.ix();
00464 int iy = id.iy();
00465
00466 int ism = Numbers::iSM( id );
00467
00468 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
00469 runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
00470
00471 if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
00472 rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
00473
00474 LogDebug("EELedTask") << " det id = " << id;
00475 LogDebug("EELedTask") << " sm, ix, iy " << ism << " " << ix << " " << iy;
00476
00477 int ic = Numbers::icEE(ism, ix, iy);
00478
00479 EEDataFrame dataframe = (*digiItr);
00480
00481 for (int i = 0; i < 10; i++) {
00482
00483 int adc = dataframe.sample(i).adc();
00484 float gain = 1.;
00485
00486 MonitorElement* meShapeMap = 0;
00487
00488 if ( dataframe.sample(i).gainId() == 1 ) gain = 1./12.;
00489 if ( dataframe.sample(i).gainId() == 2 ) gain = 1./ 6.;
00490 if ( dataframe.sample(i).gainId() == 3 ) gain = 1./ 1.;
00491
00492 if ( Numbers::RtHalf(id) == 0 ) {
00493
00494 if ( waveLength[ism-1] == 0 ) meShapeMap = meShapeMapL1A_[ism-1];
00495 if ( waveLength[ism-1] == 1 ) meShapeMap = meShapeMapL2A_[ism-1];
00496
00497 } else if ( Numbers::RtHalf(id) == 1 ) {
00498
00499 if ( waveLength[ism-1] == 0 ) meShapeMap = meShapeMapL1B_[ism-1];
00500 if ( waveLength[ism-1] == 1 ) meShapeMap = meShapeMapL2B_[ism-1];
00501
00502 } else {
00503
00504 LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
00505
00506 }
00507
00508
00509 float xval = float(adc);
00510
00511 if ( meShapeMap ) meShapeMap->Fill(ic - 0.5, i + 0.5, xval);
00512
00513 }
00514
00515 }
00516
00517 } else {
00518
00519 LogWarning("EELedTask") << EEDigiCollection_ << " not available";
00520
00521 }
00522
00523 float adcA[18];
00524 float adcB[18];
00525
00526 for ( int i = 0; i < 18; i++ ) {
00527 adcA[i] = 0.;
00528 adcB[i] = 0.;
00529 }
00530
00531 Handle<EcalPnDiodeDigiCollection> pns;
00532
00533 if ( e.getByLabel(EcalPnDiodeDigiCollection_, pns) ) {
00534
00535 int nep = pns->size();
00536 LogDebug("EELedTask") << "event " << ievt_ << " pns collection size " << nep;
00537
00538 for ( EcalPnDiodeDigiCollection::const_iterator pnItr = pns->begin(); pnItr != pns->end(); ++pnItr ) {
00539
00540 if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
00541
00542 int ism = Numbers::iSM( pnItr->id() );
00543
00544 int num = pnItr->id().iPnId();
00545
00546 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
00547 runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
00548
00549 LogDebug("EELedTask") << " det id = " << pnItr->id();
00550 LogDebug("EELedTask") << " sm, num " << ism << " " << num;
00551
00552 float xvalped = 0.;
00553
00554 for (int i = 0; i < 4; i++) {
00555
00556 int adc = pnItr->sample(i).adc();
00557
00558 MonitorElement* mePNPed = 0;
00559
00560 if ( pnItr->sample(i).gainId() == 0 ) {
00561 if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG01L1_[ism-1];
00562 if ( waveLength[ism-1] == 1 ) mePNPed = mePnPedMapG01L2_[ism-1];
00563 }
00564 if ( pnItr->sample(i).gainId() == 1 ) {
00565 if ( waveLength[ism-1] == 0 ) mePNPed = mePnPedMapG16L1_[ism-1];
00566 if ( waveLength[ism-1] == 1 ) mePNPed = mePnPedMapG16L2_[ism-1];
00567 }
00568
00569 float xval = float(adc);
00570
00571 if ( mePNPed ) mePNPed->Fill(num - 0.5, xval);
00572
00573 xvalped = xvalped + xval;
00574
00575 }
00576
00577 xvalped = xvalped / 4;
00578
00579 float xvalmax = 0.;
00580
00581 MonitorElement* mePN = 0;
00582
00583 for (int i = 0; i < 50; i++) {
00584
00585 int adc = pnItr->sample(i).adc();
00586
00587 float xval = float(adc);
00588
00589 if ( xval >= xvalmax ) xvalmax = xval;
00590
00591 }
00592
00593 xvalmax = xvalmax - xvalped;
00594
00595 if ( pnItr->sample(0).gainId() == 0 ) {
00596 if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG01L1_[ism-1];
00597 if ( waveLength[ism-1] == 1 ) mePN = mePnAmplMapG01L2_[ism-1];
00598 }
00599 if ( pnItr->sample(0).gainId() == 1 ) {
00600 if ( waveLength[ism-1] == 0 ) mePN = mePnAmplMapG16L1_[ism-1];
00601 if ( waveLength[ism-1] == 1 ) mePN = mePnAmplMapG16L2_[ism-1];
00602 }
00603
00604 if ( mePN ) mePN->Fill(num - 0.5, xvalmax);
00605
00606 if ( num == 1 ) adcA[ism-1] = xvalmax;
00607 if ( num == 6 ) adcB[ism-1] = xvalmax;
00608
00609 }
00610
00611 } else {
00612
00613 LogWarning("EELedTask") << EcalPnDiodeDigiCollection_ << " not available";
00614
00615 }
00616
00617 Handle<EcalUncalibratedRecHitCollection> hits;
00618
00619 if ( e.getByLabel(EcalUncalibratedRecHitCollection_, hits) ) {
00620
00621 int neh = hits->size();
00622 LogDebug("EELedTask") << "event " << ievt_ << " hits collection size " << neh;
00623
00624 for ( EcalUncalibratedRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {
00625
00626 EEDetId id = hitItr->id();
00627
00628 int ix = id.ix();
00629 int iy = id.iy();
00630
00631 int ism = Numbers::iSM( id );
00632
00633 if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
00634
00635 float xix = ix - 0.5;
00636 float xiy = iy - 0.5;
00637
00638 if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::LED_STD ||
00639 runType[ism-1] == EcalDCCHeaderBlock::LED_GAP ) ) continue;
00640
00641 if ( runType[ism-1] == EcalDCCHeaderBlock::LED_GAP &&
00642 rtHalf[ism-1] != Numbers::RtHalf(id) ) continue;
00643
00644 LogDebug("EELedTask") << " det id = " << id;
00645 LogDebug("EELedTask") << " sm, ix, iy " << ism << " " << ix << " " << iy;
00646
00647 MonitorElement* meAmplMap = 0;
00648 MonitorElement* meTimeMap = 0;
00649 MonitorElement* meAmplPNMap = 0;
00650
00651 if ( Numbers::RtHalf(id) == 0 ) {
00652
00653 if ( waveLength[ism-1] == 0 ) {
00654 meAmplMap = meAmplMapL1A_[ism-1];
00655 meTimeMap = meTimeMapL1A_[ism-1];
00656 meAmplPNMap = meAmplPNMapL1A_[ism-1];
00657 }
00658 if ( waveLength[ism-1] == 1 ) {
00659 meAmplMap = meAmplMapL2A_[ism-1];
00660 meTimeMap = meTimeMapL2A_[ism-1];
00661 meAmplPNMap = meAmplPNMapL2A_[ism-1];
00662 }
00663
00664 } else if ( Numbers::RtHalf(id) == 1 ) {
00665
00666 if ( waveLength[ism-1] == 0 ) {
00667 meAmplMap = meAmplMapL1B_[ism-1];
00668 meTimeMap = meTimeMapL1B_[ism-1];
00669 meAmplPNMap = meAmplPNMapL1B_[ism-1];
00670 }
00671 if ( waveLength[ism-1] == 1 ) {
00672 meAmplMap = meAmplMapL2B_[ism-1];
00673 meTimeMap = meTimeMapL2B_[ism-1];
00674 meAmplPNMap = meAmplPNMapL2B_[ism-1];
00675 }
00676
00677 } else {
00678
00679 LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
00680
00681 }
00682
00683 float xval = hitItr->amplitude();
00684 if ( xval <= 0. ) xval = 0.0;
00685 float yval = hitItr->jitter() + 6.0;
00686 if ( yval <= 0. ) yval = 0.0;
00687 float zval = hitItr->pedestal();
00688 if ( zval <= 0. ) zval = 0.0;
00689
00690 LogDebug("EELedTask") << " hit amplitude " << xval;
00691 LogDebug("EELedTask") << " hit jitter " << yval;
00692 LogDebug("EELedTask") << " hit pedestal " << zval;
00693
00694 if ( meAmplMap ) meAmplMap->Fill(xix, xiy, xval);
00695
00696 if ( xval > 16. ) {
00697 if ( meTimeMap ) meTimeMap->Fill(xix, xiy, yval);
00698 }
00699
00700 float wval = 0.;
00701
00702 if ( Numbers::RtHalf(id) == 0 ) {
00703
00704 if ( adcA[ism-1] != 0. ) wval = xval / adcA[ism-1];
00705
00706 } else if ( Numbers::RtHalf(id) == 1 ) {
00707
00708 if ( adcB[ism-1] != 0. ) wval = xval / adcB[ism-1];
00709
00710 } else {
00711
00712 LogWarning("EELedTask") << " RtHalf = " << Numbers::RtHalf(id);
00713
00714 }
00715
00716 LogDebug("EELedTask") << " hit amplitude over PN " << wval;
00717
00718 if ( meAmplPNMap ) meAmplPNMap->Fill(xix, xiy, wval);
00719
00720 }
00721
00722 } else {
00723
00724 LogWarning("EELedTask") << EcalUncalibratedRecHitCollection_ << " not available";
00725
00726 }
00727
00728 }
00729