00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <iostream>
00011
00012 #include "FWCore/ServiceRegistry/interface/Service.h"
00013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00014
00015 #include "DQMServices/Core/interface/MonitorElement.h"
00016
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018
00019 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
00020 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
00021 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
00022 #include "DataFormats/FEDRawData/interface/FEDTrailer.h"
00023 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
00024 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00025 #include "DataFormats/FEDRawData/src/fed_header.h"
00026 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerEvmReadoutRecord.h"
00027
00028 #include <DQM/EcalCommon/interface/Numbers.h>
00029
00030 #include "DQM/EcalEndcapMonitorTasks/interface/EERawDataTask.h"
00031
00032 using namespace cms;
00033 using namespace edm;
00034 using namespace std;
00035
00036 EERawDataTask::EERawDataTask(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 FEDRawDataCollection_ = ps.getParameter<edm::InputTag>("FEDRawDataCollection");
00049 EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00050 GTEvmSource_ = ps.getParameter<edm::InputTag>("GTEvmSource");
00051
00052 meEEEventTypePreCalibrationBX_ = 0;
00053 meEEEventTypeCalibrationBX_ = 0;
00054 meEEEventTypePostCalibrationBX_ = 0;
00055 meEECRCErrors_ = 0;
00056 meEERunNumberErrors_ = 0;
00057 meEEL1AErrors_ = 0;
00058 meEEOrbitNumberErrors_ = 0;
00059 meEEBunchCrossingErrors_ = 0;
00060 meEETriggerTypeErrors_ = 0;
00061 meEEGapErrors_ = 0;
00062
00063 calibrationBX_ = 3490;
00064
00065 }
00066
00067 EERawDataTask::~EERawDataTask() {
00068 }
00069
00070 void EERawDataTask::beginJob(const EventSetup& c){
00071
00072 ievt_ = 0;
00073
00074 if ( dqmStore_ ) {
00075 dqmStore_->setCurrentFolder(prefixME_ + "/EERawDataTask");
00076 dqmStore_->rmdir(prefixME_ + "/EERawDataTask");
00077 }
00078
00079 Numbers::initGeometry(c, false);
00080
00081 }
00082
00083 void EERawDataTask::beginRun(const Run& r, const EventSetup& c) {
00084
00085 if ( ! mergeRuns_ ) this->reset();
00086
00087 }
00088
00089 void EERawDataTask::endRun(const Run& r, const EventSetup& c) {
00090
00091 }
00092
00093 void EERawDataTask::reset(void) {
00094
00095 if ( meEEEventTypePreCalibrationBX_ ) meEEEventTypePreCalibrationBX_->Reset();
00096 if ( meEEEventTypeCalibrationBX_ ) meEEEventTypeCalibrationBX_->Reset();
00097 if ( meEEEventTypePostCalibrationBX_ ) meEEEventTypePostCalibrationBX_->Reset();
00098 if ( meEECRCErrors_ ) meEECRCErrors_->Reset();
00099 if ( meEERunNumberErrors_ ) meEERunNumberErrors_->Reset();
00100 if ( meEEL1AErrors_ ) meEEL1AErrors_->Reset();
00101 if ( meEEOrbitNumberErrors_ ) meEEOrbitNumberErrors_->Reset();
00102 if ( meEEBunchCrossingErrors_ ) meEEBunchCrossingErrors_->Reset();
00103 if ( meEETriggerTypeErrors_ ) meEETriggerTypeErrors_->Reset();
00104 if ( meEEGapErrors_ ) meEEGapErrors_->Reset();
00105
00106 }
00107
00108 void EERawDataTask::setup(void){
00109
00110 init_ = true;
00111
00112 char histo[200];
00113
00114 if ( dqmStore_ ) {
00115 dqmStore_->setCurrentFolder(prefixME_ + "/EERawDataTask");
00116
00117 sprintf(histo, "EERDT event type pre calibration BX");
00118 meEEEventTypePreCalibrationBX_ = dqmStore_->book1D(histo, histo, 31, -1., 30.);
00119 meEEEventTypePreCalibrationBX_->setBinLabel(1, "UNKNOWN", 1);
00120 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
00121 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
00122 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
00123 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
00124 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
00125 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
00126 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
00127 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
00128 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
00129 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
00130 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
00131 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
00132 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
00133 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
00134 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
00135 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
00136 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
00137 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
00138 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
00139 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
00140 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
00141 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
00142 meEEEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
00143
00144 sprintf(histo, "EERDT event type calibration BX");
00145 meEEEventTypeCalibrationBX_ = dqmStore_->book1D(histo, histo, 31, -1., 30.);
00146 meEEEventTypeCalibrationBX_->setBinLabel(1, "UNKNOWN", 1);
00147 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
00148 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
00149 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
00150 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
00151 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
00152 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
00153 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
00154 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
00155 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
00156 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
00157 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
00158 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
00159 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
00160 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
00161 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
00162 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
00163 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
00164 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
00165 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
00166 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
00167 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
00168 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
00169 meEEEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
00170
00171 sprintf(histo, "EERDT event type post calibration BX");
00172 meEEEventTypePostCalibrationBX_ = dqmStore_->book1D(histo, histo, 31, -1., 30.);
00173 meEEEventTypePostCalibrationBX_->setBinLabel(1, "UNKNOWN", 1);
00174 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
00175 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
00176 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
00177 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
00178 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
00179 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
00180 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
00181 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
00182 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
00183 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
00184 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
00185 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
00186 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
00187 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
00188 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
00189 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
00190 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
00191 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
00192 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
00193 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
00194 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
00195 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
00196 meEEEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
00197
00198 sprintf(histo, "EERDT CRC errors");
00199 meEECRCErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00200 for (int i = 0; i < 18; i++) {
00201 meEECRCErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00202 }
00203
00204 sprintf(histo, "EERDT run number errors");
00205 meEERunNumberErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00206 for (int i = 0; i < 18; i++) {
00207 meEERunNumberErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00208 }
00209
00210 sprintf(histo, "EERDT L1A errors");
00211 meEEL1AErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00212 for (int i = 0; i < 18; i++) {
00213 meEEL1AErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00214 }
00215
00216 sprintf(histo, "EERDT orbit number errors");
00217 meEEOrbitNumberErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00218 for (int i = 0; i < 18; i++) {
00219 meEEOrbitNumberErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00220 }
00221
00222 sprintf(histo, "EERDT bunch crossing errors");
00223 meEEBunchCrossingErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00224 for (int i = 0; i < 18; i++) {
00225 meEEBunchCrossingErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00226 }
00227
00228 sprintf(histo, "EERDT trigger type errors");
00229 meEETriggerTypeErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00230 for (int i = 0; i < 18; i++) {
00231 meEETriggerTypeErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00232 }
00233
00234 sprintf(histo, "EERDT gap errors");
00235 meEEGapErrors_ = dqmStore_->book1D(histo, histo, 18, 1, 19);
00236 for (int i = 0; i < 18; i++) {
00237 meEEGapErrors_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
00238 }
00239
00240 }
00241
00242 }
00243
00244 void EERawDataTask::cleanup(void){
00245
00246 if ( ! init_ ) return;
00247
00248 if ( dqmStore_ ) {
00249 dqmStore_->setCurrentFolder(prefixME_ + "/EERawDataTask");
00250
00251 if ( meEEEventTypePreCalibrationBX_ ) dqmStore_->removeElement( meEEEventTypePreCalibrationBX_->getName() );
00252 meEEEventTypePreCalibrationBX_ = 0;
00253
00254 if ( meEEEventTypeCalibrationBX_ ) dqmStore_->removeElement( meEEEventTypeCalibrationBX_->getName() );
00255 meEEEventTypeCalibrationBX_ = 0;
00256
00257 if ( meEEEventTypePostCalibrationBX_ ) dqmStore_->removeElement( meEEEventTypePostCalibrationBX_->getName() );
00258 meEEEventTypePostCalibrationBX_ = 0;
00259
00260 if ( meEECRCErrors_ ) dqmStore_->removeElement( meEECRCErrors_->getName() );
00261 meEECRCErrors_ = 0;
00262
00263 if ( meEERunNumberErrors_ ) dqmStore_->removeElement( meEERunNumberErrors_->getName() );
00264 meEERunNumberErrors_ = 0;
00265
00266 if ( meEEL1AErrors_ ) dqmStore_->removeElement( meEEL1AErrors_->getName() );
00267 meEEL1AErrors_ = 0;
00268
00269 if ( meEEOrbitNumberErrors_ ) dqmStore_->removeElement( meEEOrbitNumberErrors_->getName() );
00270 meEEOrbitNumberErrors_ = 0;
00271
00272 if ( meEEBunchCrossingErrors_ ) dqmStore_->removeElement( meEEBunchCrossingErrors_->getName() );
00273 meEEBunchCrossingErrors_ = 0;
00274
00275 if ( meEETriggerTypeErrors_ ) dqmStore_->removeElement( meEETriggerTypeErrors_->getName() );
00276 meEETriggerTypeErrors_ = 0;
00277
00278 if ( meEEGapErrors_ ) dqmStore_->removeElement( meEEGapErrors_->getName() );
00279 meEEGapErrors_ = 0;
00280
00281 }
00282
00283 init_ = false;
00284
00285 }
00286
00287 void EERawDataTask::endJob(void) {
00288
00289 LogInfo("EERawDataTask") << "analyzed " << ievt_ << " events";
00290
00291 if ( enableCleanup_ ) this->cleanup();
00292
00293 }
00294
00295 void EERawDataTask::analyze(const Event& e, const EventSetup& c){
00296
00297 if ( ! init_ ) this->setup();
00298
00299 ievt_++;
00300
00301 int evt_runNumber = e.id().run();
00302
00303 int GT_L1A=0, GT_OrbitNumber=0, GT_BunchCrossing=0, GT_TriggerType=0;
00304
00305 edm::Handle<FEDRawDataCollection> allFedRawData;
00306
00307 int gtFedDataSize = 0;
00308 bool GT_OrbitNumber_Present = false;
00309
00310 int ECALDCC_L1A_MostFreqId = -1;
00311 int ECALDCC_OrbitNumber_MostFreqId = -1;
00312 int ECALDCC_BunchCrossing_MostFreqId = -1;
00313 int ECALDCC_TriggerType_MostFreqId = -1;
00314
00315 if ( e.getByLabel(FEDRawDataCollection_, allFedRawData) ) {
00316
00317
00318 const FEDRawData& gtFedData = allFedRawData->FEDData(812);
00319
00320 gtFedDataSize = gtFedData.size()/sizeof(uint64_t);
00321
00322 if ( gtFedDataSize > 0 ) {
00323
00324 FEDHeader header(gtFedData.data());
00325
00326 GT_L1A = header.lvl1ID();
00327 GT_BunchCrossing = header.bxID();
00328 GT_TriggerType = header.triggerType();
00329
00330 }
00331
00332 Handle<L1GlobalTriggerEvmReadoutRecord> GTEvmReadoutRecord;
00333
00334 if ( e.getByLabel(GTEvmSource_, GTEvmReadoutRecord) ) {
00335
00336 L1GtfeWord gtfeEvmWord = GTEvmReadoutRecord->gtfeWord();
00337 int gtfeEvmActiveBoards = gtfeEvmWord.activeBoards();
00338
00339 if( gtfeEvmActiveBoards & (1<<TCS) ) {
00340
00341 GT_OrbitNumber_Present = true;
00342
00343 L1TcsWord tcsWord = GTEvmReadoutRecord->tcsWord();
00344
00345 GT_OrbitNumber = tcsWord.orbitNr();
00346
00347 }
00348 } else {
00349 LogWarning("EERawDataTask") << GTEvmSource_ << " not available";
00350 }
00351
00352 if ( gtFedDataSize == 0 || !GT_OrbitNumber_Present ) {
00353
00354
00355
00356 map<int,int> ECALDCC_L1A_FreqMap;
00357 map<int,int> ECALDCC_OrbitNumber_FreqMap;
00358 map<int,int> ECALDCC_BunchCrossing_FreqMap;
00359 map<int,int> ECALDCC_TriggerType_FreqMap;
00360
00361 int ECALDCC_L1A_MostFreqCounts = 0;
00362 int ECALDCC_OrbitNumber_MostFreqCounts = 0;
00363 int ECALDCC_BunchCrossing_MostFreqCounts = 0;
00364 int ECALDCC_TriggerType_MostFreqCounts = 0;
00365
00366 Handle<EcalRawDataCollection> dcchs;
00367
00368 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00369
00370 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00371
00372 if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
00373
00374 int ECALDCC_L1A = dcchItr->getLV1();
00375 int ECALDCC_OrbitNumber = dcchItr->getOrbit();
00376 int ECALDCC_BunchCrossing = dcchItr->getBX();
00377 int ECALDCC_TriggerType = dcchItr->getBasicTriggerType();
00378
00379 ++ECALDCC_L1A_FreqMap[ECALDCC_L1A];
00380 ++ECALDCC_OrbitNumber_FreqMap[ECALDCC_OrbitNumber];
00381 ++ECALDCC_BunchCrossing_FreqMap[ECALDCC_BunchCrossing];
00382 ++ECALDCC_TriggerType_FreqMap[ECALDCC_TriggerType];
00383
00384 if ( ECALDCC_L1A_FreqMap[ECALDCC_L1A] > ECALDCC_L1A_MostFreqCounts ) {
00385 ECALDCC_L1A_MostFreqCounts = ECALDCC_L1A_FreqMap[ECALDCC_L1A];
00386 ECALDCC_L1A_MostFreqId = ECALDCC_L1A;
00387 }
00388
00389 if ( ECALDCC_OrbitNumber_FreqMap[ECALDCC_OrbitNumber] > ECALDCC_OrbitNumber_MostFreqCounts ) {
00390 ECALDCC_OrbitNumber_MostFreqCounts = ECALDCC_OrbitNumber_FreqMap[ECALDCC_OrbitNumber];
00391 ECALDCC_OrbitNumber_MostFreqId = ECALDCC_OrbitNumber;
00392 }
00393
00394 if ( ECALDCC_BunchCrossing_FreqMap[ECALDCC_BunchCrossing] > ECALDCC_BunchCrossing_MostFreqCounts ) {
00395 ECALDCC_BunchCrossing_MostFreqCounts = ECALDCC_BunchCrossing_FreqMap[ECALDCC_BunchCrossing];
00396 ECALDCC_BunchCrossing_MostFreqId = ECALDCC_BunchCrossing;
00397 }
00398
00399 if ( ECALDCC_TriggerType_FreqMap[ECALDCC_TriggerType] > ECALDCC_TriggerType_MostFreqCounts ) {
00400 ECALDCC_TriggerType_MostFreqCounts = ECALDCC_TriggerType_FreqMap[ECALDCC_TriggerType];
00401 ECALDCC_TriggerType_MostFreqId = ECALDCC_TriggerType;
00402 }
00403
00404 }
00405
00406 } else {
00407 LogWarning("EERawDataTask") << EcalRawDataCollection_ << " not available";
00408 }
00409
00410 }
00411
00412
00413 int EEFirstFED[2];
00414 EEFirstFED[0] = 601;
00415 EEFirstFED[1] = 646;
00416 for(int zside=0; zside<2; zside++) {
00417
00418 int firstFedOnSide=EEFirstFED[zside];
00419
00420 for(int i=0; i<9; i++) {
00421
00422 const FEDRawData& fedData = allFedRawData->FEDData(firstFedOnSide+i);
00423
00424 int length = fedData.size()/sizeof(uint64_t);
00425
00426 if ( length > 0 ) {
00427
00428 uint64_t * pData = (uint64_t *)(fedData.data());
00429 uint64_t * fedTrailer = pData + (length - 1);
00430 bool crcError = (*fedTrailer >> 2 ) & 0x1;
00431
00432 if (crcError) meEECRCErrors_->Fill( i+1 );
00433
00434 }
00435
00436 }
00437
00438 }
00439
00440 } else {
00441 LogWarning("EERawDataTask") << FEDRawDataCollection_ << " not available";
00442 }
00443
00444 Handle<EcalRawDataCollection> dcchs;
00445
00446 if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00447
00448 for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00449
00450 if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
00451
00452 int ism = Numbers::iSM( *dcchItr, EcalEndcap );
00453 float xism = ism+0.5;
00454
00455 int ECALDCC_runNumber = dcchItr->getRunNumber();
00456 int ECALDCC_L1A = dcchItr->getLV1();
00457 int ECALDCC_OrbitNumber = dcchItr->getOrbit();
00458 int ECALDCC_BunchCrossing = dcchItr->getBX();
00459 int ECALDCC_TriggerType = dcchItr->getBasicTriggerType();
00460
00461 if ( evt_runNumber != ECALDCC_runNumber ) meEERunNumberErrors_->Fill( xism );
00462
00463 if ( gtFedDataSize > 0 ) {
00464
00465 if ( GT_L1A != ECALDCC_L1A ) meEEL1AErrors_->Fill( xism );
00466
00467 if ( GT_BunchCrossing != ECALDCC_BunchCrossing ) meEEBunchCrossingErrors_->Fill( xism );
00468
00469 if ( GT_TriggerType != ECALDCC_TriggerType ) meEETriggerTypeErrors_->Fill ( xism );
00470
00471 } else {
00472
00473 if ( ECALDCC_L1A_MostFreqId != ECALDCC_L1A ) meEEL1AErrors_->Fill( xism );
00474
00475 if ( ECALDCC_BunchCrossing_MostFreqId != ECALDCC_BunchCrossing ) meEEBunchCrossingErrors_->Fill( xism );
00476
00477 if ( ECALDCC_TriggerType_MostFreqId != ECALDCC_TriggerType ) meEETriggerTypeErrors_->Fill ( xism );
00478
00479 }
00480
00481 if ( GT_OrbitNumber_Present ) {
00482
00483 if ( GT_OrbitNumber != ECALDCC_OrbitNumber ) meEEOrbitNumberErrors_->Fill ( xism );
00484
00485 } else {
00486
00487 if ( ECALDCC_OrbitNumber_MostFreqId != ECALDCC_OrbitNumber ) meEEOrbitNumberErrors_->Fill ( xism );
00488
00489 }
00490
00491 float evtType = dcchItr->getRunType();
00492
00493 if ( evtType < 0 || evtType > 22 ) evtType = -1;
00494
00495 if ( ECALDCC_BunchCrossing < calibrationBX_ ) meEEEventTypePreCalibrationBX_->Fill( evtType+0.5, 1./18. );
00496 if ( ECALDCC_BunchCrossing == calibrationBX_ ) meEEEventTypeCalibrationBX_->Fill( evtType+0.5, 1./18. );
00497 if ( ECALDCC_BunchCrossing > calibrationBX_ ) meEEEventTypePostCalibrationBX_->Fill ( evtType+0.5, 1./18. );
00498
00499 if ( ECALDCC_BunchCrossing != calibrationBX_ ) {
00500 if ( evtType != EcalDCCHeaderBlock::COSMIC &&
00501 evtType != EcalDCCHeaderBlock::MTCC &&
00502 evtType != EcalDCCHeaderBlock::COSMICS_GLOBAL &&
00503 evtType != EcalDCCHeaderBlock::PHYSICS_GLOBAL &&
00504 evtType != EcalDCCHeaderBlock::COSMICS_LOCAL &&
00505 evtType != EcalDCCHeaderBlock::PHYSICS_LOCAL &&
00506 evtType != -1 ) meEEGapErrors_->Fill( xism );
00507 } else {
00508 if ( evtType == EcalDCCHeaderBlock::COSMIC ||
00509 evtType == EcalDCCHeaderBlock::MTCC ||
00510 evtType == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00511 evtType == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00512 evtType == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00513 evtType == EcalDCCHeaderBlock::PHYSICS_LOCAL ) meEEGapErrors_->Fill( xism );
00514 }
00515
00516 }
00517
00518 } else {
00519 LogWarning("EERawDataTask") << EcalRawDataCollection_ << " not available";
00520 }
00521
00522 }
00523