CMS 3D CMS Logo

Static Public Member Functions | Private Member Functions | Static Private Attributes

Masks Class Reference

#include <Masks.h>

List of all members.

Static Public Member Functions

static void initMasking (const edm::EventSetup &setup, bool verbose=false)
static bool maskChannel (int ism, int i1, int i2, uint32_t bits, const EcalSubdetector subdet) throw ( std::runtime_error )
static bool maskPn (int ism, int i1, uint32_t bits, const EcalSubdetector subdet) throw ( std::runtime_error )

Private Member Functions

 Masks ()
 ~Masks ()

Static Private Attributes

static const EcalDQMChannelStatuschannelStatus = 0
static bool init = false
static const EcalDQMTowerStatustowerStatus = 0

Detailed Description

Definition at line 25 of file Masks.h.


Constructor & Destructor Documentation

Masks::Masks ( ) [inline, private]

Definition at line 37 of file Masks.h.

{}; // Hidden to force static use
Masks::~Masks ( ) [inline, private]

Definition at line 38 of file Masks.h.

{}; // Hidden to force static use

Member Function Documentation

void Masks::initMasking ( const edm::EventSetup setup,
bool  verbose = false 
) [static]

Definition at line 34 of file Masks.cc.

References gather_cfg::cout, edm::EventSetup::find(), edm::EventSetup::get(), patZpeak::handle, init, edm::ESHandleBase::isValid(), and edm::ESHandle< T >::product().

Referenced by EcalBarrelMonitorClient::beginRun(), and EcalEndcapMonitorClient::beginRun().

                                                                  {

  if ( Masks::init ) return;

  if ( verbose ) std::cout << "Initializing EcalDQMChannelStatus and EcalDQMTowerStatus ..." << std::endl;

  Masks::init = true;

  if ( setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMChannelStatusRcd>() ) ) {
    edm::ESHandle<EcalDQMChannelStatus> handle;
    setup.get<EcalDQMChannelStatusRcd>().get(handle);
    if ( handle.isValid() ) Masks::channelStatus = handle.product();
  }

  if ( setup.find( edm::eventsetup::EventSetupRecordKey::makeKey<EcalDQMTowerStatusRcd>() ) ) {
    edm::ESHandle<EcalDQMTowerStatus> handle;
    setup.get<EcalDQMTowerStatusRcd>().get(handle);
    if ( handle.isValid() ) Masks::towerStatus = handle.product();
  }

  if ( verbose ) std::cout << "done." << std::endl;

}
bool Masks::maskChannel ( int  ism,
int  i1,
int  i2,
uint32_t  bits,
const EcalSubdetector  subdet 
) throw ( std::runtime_error ) [static]

Definition at line 60 of file Masks.cc.

References bits, EcalBarrel, EcalEndcap, end, EcalCondObjectContainer< T >::find(), EcalCondTowerObjectContainer< T >::find(), Numbers::iSM(), ecalpyutils::ism(), Numbers::ix0EE(), Numbers::iy0EE(), asciidump::s, EBDetId::SMCRYSTALMODE, and Numbers::validEE().

Referenced by EEPedestalClient::analyze(), EETimingClient::analyze(), EBTimingClient::analyze(), EELaserClient::analyze(), EEIntegrityClient::analyze(), EEStatusFlagsClient::analyze(), EETestPulseClient::analyze(), EBStatusFlagsClient::analyze(), EEPedestalOnlineClient::analyze(), EBLaserClient::analyze(), EBTestPulseClient::analyze(), EELedClient::analyze(), EBIntegrityClient::analyze(), EBPedestalClient::analyze(), and EBPedestalOnlineClient::analyze().

                                                                                                                        {

  bool mask = false;

  if ( subdet == EcalBarrel ) {

    int jsm = Numbers::iSM(ism, EcalBarrel);
    int ic = 20*(i1-1)+(i2-1)+1;

    EBDetId id(jsm, ic, EBDetId::SMCRYSTALMODE);
    if ( Masks::channelStatus ) {
      EcalDQMChannelStatus::const_iterator it = Masks::channelStatus->find( id.rawId() );
      if ( it != Masks::channelStatus->end() ) mask |= it->getStatusCode() & bits;
    }
    if ( Masks::towerStatus ) {
      EcalDQMTowerStatus::const_iterator it = Masks::towerStatus->find( id.tower().rawId() );
      if ( it != Masks::towerStatus->end() ) mask |= it->getStatusCode() & bits;
    }

  } else if ( subdet == EcalEndcap ) {

    int jx = i1 + Numbers::ix0EE(ism);
    int jy = i2 + Numbers::iy0EE(ism);

    if ( ism >= 1 && ism <= 9 ) jx = 101 - jx;

    if ( Numbers::validEE(ism, jx, jy) ) {
      EEDetId id(jx, jy, (ism>=1&&ism<=9)?-1:+1);
      if ( Masks::channelStatus ) {
        EcalDQMChannelStatus::const_iterator it = Masks::channelStatus->find( id.rawId() );
        if ( it != Masks::channelStatus->end() ) mask |= it->getStatusCode() & bits;
      }
      if ( Masks::towerStatus ) {
        EcalDQMTowerStatus::const_iterator it = Masks::towerStatus->find( id.sc().rawId() );
        if ( it != Masks::towerStatus->end() ) mask |= it->getStatusCode() & bits;
      }
   }

  } else {

    std::ostringstream s;
    s << "Invalid subdetector: subdet = " << subdet;
    throw( std::runtime_error( s.str() ) );

  }

  return ( mask );

}
bool Masks::maskPn ( int  ism,
int  i1,
uint32_t  bits,
const EcalSubdetector  subdet 
) throw ( std::runtime_error ) [static]

Definition at line 112 of file Masks.cc.

References bits, EcalBarrel, EcalEndcap, ecalpyutils::ism(), EcalDQMStatusHelper::LASER_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR, asciidump::s, EcalDQMStatusHelper::STATUS_FLAG_ERROR, and EcalDQMStatusHelper::TT_SIZE_ERROR.

Referenced by EEPedestalClient::analyze(), EELaserClient::analyze(), EEIntegrityClient::analyze(), EETestPulseClient::analyze(), EEStatusFlagsClient::analyze(), EBStatusFlagsClient::analyze(), EELedClient::analyze(), EBTestPulseClient::analyze(), EBLaserClient::analyze(), EBPedestalClient::analyze(), and EBIntegrityClient::analyze().

                                                                                                           {

  bool mask = false;

  if ( subdet == EcalBarrel ) {

    // EB-03
    if ( ism ==  3 && i1 ==  1 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;

    // EB-07
    if ( ism ==  7 && i1 ==  4 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;

    // EB-15
    if ( ism == 15 && i1 ==  6 && (bits & (1 << EcalDQMStatusHelper::TT_SIZE_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  6 && (bits & (1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  6 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  6 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  6 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  7 && (bits & (1 << EcalDQMStatusHelper::TT_SIZE_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  7 && (bits & (1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  7 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  7 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  7 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  8 && (bits & (1 << EcalDQMStatusHelper::TT_SIZE_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  8 && (bits & (1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  8 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  8 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  8 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  9 && (bits & (1 << EcalDQMStatusHelper::TT_SIZE_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  9 && (bits & (1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  9 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  9 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 ==  9 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::TT_SIZE_ERROR)) ) mask = true;
    if ( ism == 15 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR)) ) mask = true;
    if ( ism == 15 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 15 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;

    // EB+07
    if ( ism == 25 && i1 ==  4 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;

    // EB+12
    if ( ism == 30 && i1 ==  9 && (bits & (1 << EcalDQMStatusHelper::LASER_MEAN_ERROR)) ) mask = true;

  } else if ( subdet == EcalEndcap ) {

    // EE-02
    if ( ism == 5 && i1 ==  3 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 5 && i1 ==  3 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 5 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 5 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;

    // EE-03
    if ( ism == 6 && i1 ==  5 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 6 && i1 ==  5 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;

    // EE-07
    if ( ism == 1 && i1 ==  4 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 1 && i1 ==  4 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 1 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 1 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;

    // EE-08
    if ( ism == 2 && i1 ==  1 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 2 && i1 ==  1 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 2 && i1 ==  4 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 2 && i1 ==  4 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 2 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_LOW_GAIN_MEAN_ERROR)) ) mask = true;
    if ( ism == 2 && i1 == 10 && (bits & (1 << EcalDQMStatusHelper::PEDESTAL_HIGH_GAIN_MEAN_ERROR)) ) mask = true;

  } else {

    std::ostringstream s;
    s << "Invalid subdetector: subdet = " << subdet;
    throw( std::runtime_error( s.str() ) );

  }

  return ( mask );

}

Member Data Documentation

const EcalDQMChannelStatus * Masks::channelStatus = 0 [static, private]

Definition at line 42 of file Masks.h.

bool Masks::init = false [static, private]

Definition at line 38 of file Masks.h.

Referenced by initMasking().

const EcalDQMTowerStatus * Masks::towerStatus = 0 [static, private]

Definition at line 43 of file Masks.h.