CMS 3D CMS Logo

EcalMonitorPrescaler.cc

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

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