CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/DQM/EcalCommon/src/EcalMonitorPrescaler.cc

Go to the documentation of this file.
00001 // $Id: EcalMonitorPrescaler.cc,v 1.16 2010/08/08 08:46:05 dellaric Exp $
00002 
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 
00013 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
00014 
00015 #include "DQM/EcalCommon/interface/EcalMonitorPrescaler.h"
00016 
00017 EcalMonitorPrescaler::EcalMonitorPrescaler(const edm::ParameterSet& ps) {
00018 
00019   count_ = 0;
00020 
00021   EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
00022 
00023   occupancyPrescaleFactor_ = ps.getUntrackedParameter<int>("occupancyPrescaleFactor" , 0);
00024   integrityPrescaleFactor_ = ps.getUntrackedParameter<int>("integrityPrescaleFactor", 0);
00025   statusflagsPrescaleFactor_ = ps.getUntrackedParameter<int>("statusflagsPrescaleFactor" , 0);
00026 
00027   pedestalonlinePrescaleFactor_ = ps.getUntrackedParameter<int>("pedestalonlinePrescaleFactor", 0);
00028 
00029   laserPrescaleFactor_ = ps.getUntrackedParameter<int>("laserPrescaleFactor", 0);
00030   ledPrescaleFactor_ = ps.getUntrackedParameter<int>("ledPrescaleFactor", 0);
00031   pedestalPrescaleFactor_ = ps.getUntrackedParameter<int>("pedestalPrescaleFactor", 0);
00032   testpulsePrescaleFactor_ = ps.getUntrackedParameter<int>("testpulsePrescaleFactor", 0);
00033 
00034   pedestaloffsetPrescaleFactor_ = ps.getUntrackedParameter<int>("pedestaloffsetPrescaleFactor", 0);
00035 
00036   triggertowerPrescaleFactor_ = ps.getUntrackedParameter<int>("triggertowerPrescaleFactor" , 0);
00037   timingPrescaleFactor_ = ps.getUntrackedParameter<int>("timingPrescaleFactor" , 0);
00038 
00039   cosmicPrescaleFactor_ = ps.getUntrackedParameter<int>("cosmicPrescaleFactor", 0);
00040 
00041   physicsPrescaleFactor_ = ps.getUntrackedParameter<int>("physicsPrescaleFactor", 0);
00042 
00043   clusterPrescaleFactor_ = ps.getUntrackedParameter<int>("clusterPrescaleFactor", 0);
00044 
00045 }
00046     
00047 EcalMonitorPrescaler::~EcalMonitorPrescaler() { }
00048 
00049 bool EcalMonitorPrescaler::filter(edm::Event &e, const edm::EventSetup &c) {
00050 
00051   count_++;
00052 
00053   bool status = false;
00054 
00055   if ( occupancyPrescaleFactor_ ) {
00056     if ( count_ % occupancyPrescaleFactor_ == 0 ) status = true;
00057   }
00058   if ( integrityPrescaleFactor_ ) {
00059     if ( count_ % integrityPrescaleFactor_ == 0 ) status = true;
00060   }
00061   if ( statusflagsPrescaleFactor_ ) {
00062     if ( count_ % statusflagsPrescaleFactor_ == 0 ) status = true;
00063   }
00064 
00065   if ( pedestalonlinePrescaleFactor_ ) {
00066     if ( count_ % pedestalonlinePrescaleFactor_ == 0 ) status = true;
00067   }
00068 
00069   if ( triggertowerPrescaleFactor_ ) {
00070     if ( count_ % triggertowerPrescaleFactor_ == 0 ) status = true;
00071   }
00072   if ( timingPrescaleFactor_ ) {
00073     if ( count_ % timingPrescaleFactor_ == 0 ) status = true;
00074   }
00075 
00076   edm::Handle<EcalRawDataCollection> dcchs;
00077 
00078   if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
00079 
00080     for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
00081 
00082       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LASER_STD ||
00083            dcchItr->getRunType() == EcalDCCHeaderBlock::LASER_GAP ) {
00084         if ( laserPrescaleFactor_ ) { 
00085           if ( count_ % laserPrescaleFactor_ == 0 ) status = true;
00086         }
00087       }
00088       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::LED_STD ||
00089            dcchItr->getRunType() == EcalDCCHeaderBlock::LED_GAP ) {
00090         if ( ledPrescaleFactor_ ) {
00091           if ( count_ % ledPrescaleFactor_ == 0 ) status = true;
00092         }
00093       }
00094       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_STD ||
00095            dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_GAP ) {
00096         if ( pedestalPrescaleFactor_ ) { 
00097           if ( count_ % pedestalPrescaleFactor_ == 0 ) status = true;
00098         }
00099       }
00100       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
00101            dcchItr->getRunType() == EcalDCCHeaderBlock::TESTPULSE_GAP ) {
00102         if ( testpulsePrescaleFactor_ ) { 
00103           if ( count_ % testpulsePrescaleFactor_ == 0 ) status = true;
00104         }
00105       }
00106 
00107       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::PEDESTAL_OFFSET_SCAN ) {
00108         if ( pedestaloffsetPrescaleFactor_ ) {
00109           if ( count_ % pedestaloffsetPrescaleFactor_ == 0 ) status = true;
00110         }
00111       }
00112 
00113       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC ||
00114            dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00115            dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL ) {
00116         if ( cosmicPrescaleFactor_ ) {
00117           if ( count_ % cosmicPrescaleFactor_ == 0 ) status = true;
00118         }
00119       }
00120 
00121       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC ||
00122            dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00123            dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) {
00124         if ( physicsPrescaleFactor_ ) {
00125           if ( count_ % physicsPrescaleFactor_ == 0 ) status = true;
00126         }
00127       }
00128 
00129       if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC ||
00130            dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC ||
00131            dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
00132            dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
00133            dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL ||
00134            dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) {
00135         if ( clusterPrescaleFactor_ ) {
00136           if ( count_ % clusterPrescaleFactor_ == 0 ) status = true;
00137         }
00138       }
00139 
00140     }
00141 
00142   } else {
00143 
00144     edm::LogWarning("EcalMonitorPrescaler") << EcalRawDataCollection_ << " not available";
00145 
00146   }
00147 
00148   return status;
00149 
00150 }
00151