CMS 3D CMS Logo

EBRawDataTask.cc

Go to the documentation of this file.
00001 /*
00002  * \file EBRawDataTask.cc
00003  *
00004  * $Date: 2008/12/03 15:46:39 $
00005  * $Revision: 1.19 $
00006  * \author E. Di Marco
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/EcalBarrelMonitorTasks/interface/EBRawDataTask.h"
00031 
00032 using namespace cms;
00033 using namespace edm;
00034 using namespace std;
00035 
00036 EBRawDataTask::EBRawDataTask(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   meEBEventTypePreCalibrationBX_ = 0;
00053   meEBEventTypeCalibrationBX_ = 0;
00054   meEBEventTypePostCalibrationBX_ = 0;
00055   meEBCRCErrors_ = 0;
00056   meEBRunNumberErrors_ = 0;
00057   meEBL1AErrors_ = 0;
00058   meEBOrbitNumberErrors_ = 0;
00059   meEBBunchCrossingErrors_ = 0;
00060   meEBTriggerTypeErrors_ = 0;
00061   meEBGapErrors_ = 0;
00062 
00063   calibrationBX_ = 3490;
00064 
00065 }
00066 
00067 EBRawDataTask::~EBRawDataTask() {
00068 }
00069 
00070 void EBRawDataTask::beginJob(const EventSetup& c){
00071 
00072   ievt_ = 0;
00073 
00074   if ( dqmStore_ ) {
00075     dqmStore_->setCurrentFolder(prefixME_ + "/EBRawDataTask");
00076     dqmStore_->rmdir(prefixME_ + "/EBRawDataTask");
00077   }
00078 
00079   Numbers::initGeometry(c, false);
00080 
00081 }
00082 
00083 void EBRawDataTask::beginRun(const Run& r, const EventSetup& c) {
00084 
00085   if ( ! mergeRuns_ ) this->reset();
00086 
00087 }
00088 
00089 void EBRawDataTask::endRun(const Run& r, const EventSetup& c) {
00090 
00091 }
00092 
00093 void EBRawDataTask::reset(void) {
00094 
00095   if ( meEBEventTypePreCalibrationBX_ ) meEBEventTypePreCalibrationBX_->Reset();
00096   if ( meEBEventTypeCalibrationBX_ ) meEBEventTypeCalibrationBX_->Reset();
00097   if ( meEBEventTypePostCalibrationBX_ ) meEBEventTypePostCalibrationBX_->Reset();
00098   if ( meEBCRCErrors_ ) meEBCRCErrors_->Reset();
00099   if ( meEBRunNumberErrors_ ) meEBRunNumberErrors_->Reset();
00100   if ( meEBL1AErrors_ ) meEBL1AErrors_->Reset();
00101   if ( meEBOrbitNumberErrors_ ) meEBOrbitNumberErrors_->Reset();
00102   if ( meEBBunchCrossingErrors_ ) meEBBunchCrossingErrors_->Reset();
00103   if ( meEBTriggerTypeErrors_ ) meEBTriggerTypeErrors_->Reset();
00104   if ( meEBGapErrors_ ) meEBGapErrors_->Reset();
00105 
00106 }
00107 
00108 void EBRawDataTask::setup(void){
00109 
00110   init_ = true;
00111 
00112   char histo[200];
00113 
00114   if ( dqmStore_ ) {
00115     dqmStore_->setCurrentFolder(prefixME_ + "/EBRawDataTask");
00116 
00117     sprintf(histo, "EBRDT event type pre calibration BX");
00118     meEBEventTypePreCalibrationBX_ = dqmStore_->book1D(histo, histo, 31, -1., 30.);
00119     meEBEventTypePreCalibrationBX_->setBinLabel(1, "UNKNOWN", 1);
00120     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
00121     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
00122     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
00123     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
00124     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
00125     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
00126     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
00127     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
00128     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
00129     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
00130     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
00131     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
00132     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
00133     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
00134     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
00135     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
00136     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
00137     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
00138     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
00139     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
00140     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
00141     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
00142     meEBEventTypePreCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
00143 
00144     sprintf(histo, "EBRDT event type calibration BX");
00145     meEBEventTypeCalibrationBX_ = dqmStore_->book1D(histo, histo, 31, -1., 30.);
00146     meEBEventTypeCalibrationBX_->setBinLabel(1, "UNKNOWN", 1);
00147     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
00148     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
00149     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
00150     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
00151     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
00152     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
00153     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
00154     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
00155     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
00156     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
00157     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
00158     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
00159     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
00160     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
00161     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
00162     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
00163     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
00164     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
00165     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
00166     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
00167     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
00168     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
00169     meEBEventTypeCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
00170 
00171     sprintf(histo, "EBRDT event type post calibration BX");
00172     meEBEventTypePostCalibrationBX_ = dqmStore_->book1D(histo, histo, 31, -1., 30.);
00173     meEBEventTypePostCalibrationBX_->setBinLabel(1, "UNKNOWN", 1);
00174     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMIC, "COSMIC", 1);
00175     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH4, "BEAMH4", 1);
00176     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::BEAMH2, "BEAMH2", 1);
00177     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::MTCC, "MTCC", 1);
00178     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_STD, "LASER_STD", 1);
00179     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_POWER_SCAN, "LASER_POWER_SCAN", 1);
00180     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_DELAY_SCAN, "LASER_DELAY_SCAN", 1);
00181     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_SCAN_MEM, "TESTPULSE_SCAN_MEM", 1);
00182     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_MGPA, "TESTPULSE_MGPA", 1);
00183     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_STD, "PEDESTAL_STD", 1);
00184     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN, "PEDESTAL_OFFSET_SCAN", 1);
00185     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_25NS_SCAN, "PEDESTAL_25NS_SCAN", 1);
00186     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_STD, "LED_STD", 1);
00187     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_GLOBAL, "PHYSICS_GLOBAL", 1);
00188     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_GLOBAL, "COSMICS_GLOBAL", 1);
00189     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_GLOBAL, "HALO_GLOBAL", 1);
00190     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LASER_GAP, "LASER_GAP", 1);
00191     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::TESTPULSE_GAP, "TESTPULSE_GAP");
00192     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PEDESTAL_GAP, "PEDESTAL_GAP");
00193     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::LED_GAP, "LED_GAP", 1);
00194     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::PHYSICS_LOCAL, "PHYSICS_LOCAL", 1);
00195     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::COSMICS_LOCAL, "COSMICS_LOCAL", 1);
00196     meEBEventTypePostCalibrationBX_->setBinLabel(2+EcalDCCHeaderBlock::HALO_LOCAL, "HALO_LOCAL", 1);
00197 
00198     sprintf(histo, "EBRDT CRC errors");
00199     meEBCRCErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00200     for (int i = 0; i < 36; i++) {
00201       meEBCRCErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00202     }
00203 
00204     sprintf(histo, "EBRDT run number errors");
00205     meEBRunNumberErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00206     for (int i = 0; i < 36; i++) {
00207       meEBRunNumberErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00208     }
00209 
00210     sprintf(histo, "EBRDT L1A errors");
00211     meEBL1AErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00212     for (int i = 0; i < 36; i++) {
00213       meEBL1AErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00214     }
00215 
00216     sprintf(histo, "EBRDT orbit number errors");
00217     meEBOrbitNumberErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00218     for (int i = 0; i < 36; i++) {
00219       meEBOrbitNumberErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00220     }
00221 
00222     sprintf(histo, "EBRDT bunch crossing errors");
00223     meEBBunchCrossingErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00224     for (int i = 0; i < 36; i++) {
00225       meEBBunchCrossingErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00226     }
00227 
00228     sprintf(histo, "EBRDT trigger type errors");
00229     meEBTriggerTypeErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00230     for (int i = 0; i < 36; i++) {
00231       meEBTriggerTypeErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00232     }
00233 
00234     sprintf(histo, "EBRDT gap errors");
00235     meEBGapErrors_ = dqmStore_->book1D(histo, histo, 36, 1, 37);
00236     for (int i = 0; i < 36; i++) {
00237       meEBGapErrors_->setBinLabel(i+1, Numbers::sEB(i+1).c_str(), 1);
00238     }
00239 
00240   }
00241 
00242 }
00243 
00244 void EBRawDataTask::cleanup(void){
00245 
00246   if ( ! init_ ) return;
00247 
00248   if ( dqmStore_ ) {
00249     dqmStore_->setCurrentFolder(prefixME_ + "/EBRawDataTask");
00250 
00251     if ( meEBEventTypePreCalibrationBX_ ) dqmStore_->removeElement( meEBEventTypePreCalibrationBX_->getName() );
00252     meEBEventTypePreCalibrationBX_ = 0;
00253 
00254     if ( meEBEventTypeCalibrationBX_ ) dqmStore_->removeElement( meEBEventTypeCalibrationBX_->getName() );
00255     meEBEventTypeCalibrationBX_ = 0;
00256 
00257     if ( meEBEventTypePostCalibrationBX_ ) dqmStore_->removeElement( meEBEventTypePostCalibrationBX_->getName() );
00258     meEBEventTypePostCalibrationBX_ = 0;
00259 
00260     if ( meEBCRCErrors_ ) dqmStore_->removeElement( meEBCRCErrors_->getName() );
00261     meEBCRCErrors_ = 0;
00262 
00263     if ( meEBRunNumberErrors_ ) dqmStore_->removeElement( meEBRunNumberErrors_->getName() );
00264     meEBRunNumberErrors_ = 0;
00265 
00266     if ( meEBL1AErrors_ ) dqmStore_->removeElement( meEBL1AErrors_->getName() );
00267     meEBL1AErrors_ = 0;
00268 
00269     if ( meEBOrbitNumberErrors_ ) dqmStore_->removeElement( meEBOrbitNumberErrors_->getName() );
00270     meEBOrbitNumberErrors_ = 0;
00271 
00272     if ( meEBBunchCrossingErrors_ ) dqmStore_->removeElement( meEBBunchCrossingErrors_->getName() );
00273     meEBBunchCrossingErrors_ = 0;
00274 
00275     if ( meEBTriggerTypeErrors_ ) dqmStore_->removeElement( meEBTriggerTypeErrors_->getName() );
00276     meEBTriggerTypeErrors_ = 0;
00277 
00278     if ( meEBGapErrors_ ) dqmStore_->removeElement( meEBGapErrors_->getName() );
00279     meEBGapErrors_ = 0;
00280 
00281   }
00282 
00283   init_ = false;
00284 
00285 }
00286 
00287 void EBRawDataTask::endJob(void) {
00288 
00289   LogInfo("EBRawDataTask") << "analyzed " << ievt_ << " events";
00290 
00291   if ( enableCleanup_ ) this->cleanup();
00292 
00293 }
00294 
00295 void EBRawDataTask::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     // GT FED data
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) ) { // if TCS present in the record
00340 
00341         GT_OrbitNumber_Present = true;
00342 
00343         L1TcsWord tcsWord = GTEvmReadoutRecord->tcsWord();
00344 
00345         GT_OrbitNumber = tcsWord.orbitNr();
00346 
00347       }
00348     } else {
00349       LogWarning("EBRawDataTask") << GTEvmSource_ << " not available";
00350     }
00351 
00352     if ( gtFedDataSize == 0 || !GT_OrbitNumber_Present ) {
00353 
00354       // use the most frequent among the ECAL FEDs
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 ) != EcalBarrel ) 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("EBRawDataTask") << EcalRawDataCollection_ << " not available";
00408       }
00409 
00410     }
00411 
00412     // ECAL barrel FEDs
00413     int EBFirstFED=610;
00414     for(int i=0; i<36; i++) {
00415 
00416       const FEDRawData& fedData = allFedRawData->FEDData(EBFirstFED+i);
00417 
00418       int length = fedData.size()/sizeof(uint64_t);
00419 
00420       if ( length > 0 ) {
00421 
00422         uint64_t * pData = (uint64_t *)(fedData.data());
00423         uint64_t * fedTrailer = pData + (length - 1);
00424         bool crcError = (*fedTrailer >> 2 ) & 0x1;
00425 
00426         if (crcError) meEBCRCErrors_->Fill( i+1 );
00427 
00428       }
00429 
00430     }
00431 
00432 
00433   } else {
00434     LogWarning("EBRawDataTask") << FEDRawDataCollection_ << " not available";
00435   }
00436 
00437   Handle<EcalRawDataCollection> dcchs;
00438 
00439   if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00440 
00441     for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00442 
00443       if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;
00444 
00445       int ism = Numbers::iSM( *dcchItr, EcalBarrel );
00446       float xism = ism+0.5;
00447 
00448       int ECALDCC_runNumber = dcchItr->getRunNumber();
00449       int ECALDCC_L1A = dcchItr->getLV1();
00450       int ECALDCC_OrbitNumber = dcchItr->getOrbit();
00451       int ECALDCC_BunchCrossing = dcchItr->getBX();
00452       int ECALDCC_TriggerType = dcchItr->getBasicTriggerType();
00453 
00454       if ( evt_runNumber != ECALDCC_runNumber ) meEBRunNumberErrors_->Fill( xism );
00455 
00456       if ( gtFedDataSize > 0 ) {
00457 
00458         if ( GT_L1A != ECALDCC_L1A ) meEBL1AErrors_->Fill( xism );
00459 
00460         if ( GT_BunchCrossing != ECALDCC_BunchCrossing ) meEBBunchCrossingErrors_->Fill( xism );
00461 
00462         if ( GT_TriggerType != ECALDCC_TriggerType ) meEBTriggerTypeErrors_->Fill ( xism );
00463 
00464       } else {
00465 
00466         if ( ECALDCC_L1A_MostFreqId != ECALDCC_L1A ) meEBL1AErrors_->Fill( xism );
00467 
00468         if ( ECALDCC_BunchCrossing_MostFreqId != ECALDCC_BunchCrossing ) meEBBunchCrossingErrors_->Fill( xism );
00469 
00470         if ( ECALDCC_TriggerType_MostFreqId != ECALDCC_TriggerType ) meEBTriggerTypeErrors_->Fill ( xism );
00471 
00472       }
00473 
00474       if ( GT_OrbitNumber_Present ) {
00475 
00476         if ( GT_OrbitNumber != ECALDCC_OrbitNumber ) meEBOrbitNumberErrors_->Fill ( xism );
00477 
00478       } else {
00479 
00480         if ( ECALDCC_OrbitNumber_MostFreqId != ECALDCC_OrbitNumber ) meEBOrbitNumberErrors_->Fill ( xism );
00481 
00482       }
00483 
00484       float evtType = dcchItr->getRunType();
00485 
00486       if ( evtType < 0 || evtType > 22 ) evtType = -1;
00487 
00488       if ( ECALDCC_BunchCrossing < calibrationBX_ ) meEBEventTypePreCalibrationBX_->Fill( evtType+0.5, 1./36. );
00489       if ( ECALDCC_BunchCrossing == calibrationBX_ ) meEBEventTypeCalibrationBX_->Fill( evtType+0.5, 1./36. );
00490       if ( ECALDCC_BunchCrossing > calibrationBX_ ) meEBEventTypePostCalibrationBX_->Fill ( evtType+0.5, 1./36. );
00491 
00492       if ( ECALDCC_BunchCrossing != calibrationBX_ ) {
00493         if ( evtType != EcalDCCHeaderBlock::COSMIC &&
00494              evtType != EcalDCCHeaderBlock::MTCC &&
00495              evtType != EcalDCCHeaderBlock::COSMICS_GLOBAL &&
00496              evtType != EcalDCCHeaderBlock::PHYSICS_GLOBAL &&
00497              evtType != EcalDCCHeaderBlock::COSMICS_LOCAL &&
00498              evtType != EcalDCCHeaderBlock::PHYSICS_LOCAL &&
00499              evtType != -1 ) meEBGapErrors_->Fill( xism );
00500       } else {
00501         if ( evtType == EcalDCCHeaderBlock::COSMIC ||
00502              evtType == EcalDCCHeaderBlock::MTCC ||
00503              evtType == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00504              evtType == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00505              evtType == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00506              evtType == EcalDCCHeaderBlock::PHYSICS_LOCAL ) meEBGapErrors_->Fill( xism );
00507       }
00508 
00509     }
00510 
00511   } else {
00512     LogWarning("EBRawDataTask") << EcalRawDataCollection_ << " not available";
00513   }
00514 
00515 }
00516 

Generated on Tue Jun 9 17:32:47 2009 for CMSSW by  doxygen 1.5.4