CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

EEPedestalOnlineClient Class Reference

#include <EEPedestalOnlineClient.h>

Inheritance diagram for EEPedestalOnlineClient:
EEClient

List of all members.

Public Member Functions

void analyze (void)
 Analyze.
void beginJob (void)
 BeginJob.
void beginRun (void)
 BeginRun.
void cleanup (void)
 Cleanup.
 EEPedestalOnlineClient (const edm::ParameterSet &ps)
 Constructor.
void endJob (void)
 EndJob.
void endRun (void)
 EndRun.
int getEvtPerJob ()
 Get Functions.
int getEvtPerRun ()
 Returns the number of processed events in this Run.
void setup (void)
 Setup.
virtual ~EEPedestalOnlineClient ()
 Destructor.

Private Attributes

bool cloneME_
bool debug_
float discrepancyMean_
DQMStoredqmStore_
bool enableCleanup_
float expectedMean_
TProfile2D * h03_ [18]
int ievt_
int jevt_
MonitorElementmeg03_ [18]
MonitorElementmep03_ [18]
MonitorElementmer03_ [18]
std::string prefixME_
float RMSThreshold_
float RMSThresholdInternal_
std::vector< int > superModules_
bool verbose_

Friends

class EESummaryClient

Detailed Description

Definition at line 33 of file EEPedestalOnlineClient.h.


Constructor & Destructor Documentation

EEPedestalOnlineClient::EEPedestalOnlineClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 39 of file EEPedestalOnlineClient.cc.

References cloneME_, debug_, discrepancyMean_, enableCleanup_, expectedMean_, edm::ParameterSet::getUntrackedParameter(), h03_, i, ecalpyutils::ism(), meg03_, mep03_, mer03_, prefixME_, RMSThreshold_, RMSThresholdInternal_, superModules_, and verbose_.

                                                                        {

  // cloneME switch
  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);

  // verbose switch
  verbose_ = ps.getUntrackedParameter<bool>("verbose", true);

  // debug switch
  debug_ = ps.getUntrackedParameter<bool>("debug", false);

  // prefixME path
  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");

  // enableCleanup_ switch
  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);

  // vector of selected Super Modules (Defaults to all 18).
  superModules_.reserve(18);
  for ( unsigned int i = 1; i <= 18; i++ ) superModules_.push_back(i);
  superModules_ = ps.getUntrackedParameter<std::vector<int> >("superModules", superModules_);

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    h03_[ism-1] = 0;

  }

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    meg03_[ism-1] = 0;

    mep03_[ism-1] = 0;

    mer03_[ism-1] = 0;

  }

  expectedMean_ = 200.0;
  discrepancyMean_ = 25.0;
  RMSThreshold_ = 4.0;
  RMSThresholdInternal_ = 8.0;

}
EEPedestalOnlineClient::~EEPedestalOnlineClient ( ) [virtual]

Destructor.

Definition at line 88 of file EEPedestalOnlineClient.cc.

                                                {

}

Member Function Documentation

void EEPedestalOnlineClient::analyze ( void  ) [virtual]

Analyze.

Implements EEClient.

Definition at line 315 of file EEPedestalOnlineClient.cc.

References abs, cloneME_, gather_cfg::cout, debug_, discrepancyMean_, dqmStore_, EcalEndcap, expectedMean_, MonitorElement::Fill(), DQMStore::get(), UtilsClient::getBinStatistics(), getHisto(), h03_, i, ievt_, Numbers::ix0EE(), Numbers::iy0EE(), jevt_, UtilsClient::maskBinContent(), Masks::maskChannel(), meg03_, mep03_, mer03_, EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR, EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR, prefixME_, CosmicsPD_Skims::radius, MonitorElement::Reset(), RMSThreshold_, RMSThresholdInternal_, Numbers::sEE(), MonitorElement::setBinContent(), mathSSE::sqrt(), superModules_, and Numbers::validEE().

                                         {

  ievt_++;
  jevt_++;
  if ( ievt_ % 10 == 0 ) {
    if ( debug_ ) std::cout << "EEPedestalOnlineClient: ievt/jevt = " << ievt_ << "/" << jevt_ << std::endl;
  }

  uint32_t bits03 = 0;
  bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_MEAN_ERROR;
  bits03 |= 1 << EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR;

  MonitorElement* me;

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    me = dqmStore_->get( prefixME_ + "/EEPedestalOnlineTask/Gain12/EEPOT pedestal " + Numbers::sEE(ism) + " G12" );
    h03_[ism-1] = UtilsClient::getHisto( me, cloneME_, h03_[ism-1] );

    if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();
    if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
    if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();

    for ( int ix = 1; ix <= 50; ix++ ) {
      for ( int iy = 1; iy <= 50; iy++ ) {

        if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ix, iy, 6.);

        int jx = ix + Numbers::ix0EE(ism);
        int jy = iy + Numbers::iy0EE(ism);

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

        if ( Numbers::validEE(ism, jx, jy) ) {
          if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent( ix, iy, 2. );
        }

        // OOT pileup affects the region near beam pipe mostly. Use higher threshold for these crystals
        float radius = std::sqrt((jx-50.)*(jx-50.)+(jy-50.)*(jy-50.));

        bool update03;

        float num03;
        float mean03;
        float rms03;

        update03 = UtilsClient::getBinStatistics(h03_[ism-1], ix, iy, num03, mean03, rms03);

        if ( update03 ) {

          float val;

          val = 1.;
          if ( std::abs(mean03 - expectedMean_) > discrepancyMean_ )
            val = 0.;
          if ( (radius >= 20. && rms03 > RMSThreshold_) || (radius < 20. && rms03 > RMSThresholdInternal_) )
            val = 0.;
          if ( meg03_[ism-1] ) meg03_[ism-1]->setBinContent(ix, iy, val);

          if ( mep03_[ism-1] ) mep03_[ism-1]->Fill(mean03);
          if ( mer03_[ism-1] ) mer03_[ism-1]->Fill(rms03);

        }

        if ( Masks::maskChannel(ism, ix, iy, bits03, EcalEndcap) ) UtilsClient::maskBinContent( meg03_[ism-1], ix, iy );

      }
    }

  }

}
void EEPedestalOnlineClient::beginJob ( void  ) [virtual]

BeginJob.

Implements EEClient.

Definition at line 92 of file EEPedestalOnlineClient.cc.

References gather_cfg::cout, debug_, dqmStore_, ievt_, jevt_, and cmsCodeRules::cppFunctionSkipper::operator.

                                          {

  dqmStore_ = edm::Service<DQMStore>().operator->();

  if ( debug_ ) std::cout << "EEPedestalOnlineClient: beginJob" << std::endl;

  ievt_ = 0;
  jevt_ = 0;

}
void EEPedestalOnlineClient::beginRun ( void  ) [virtual]

BeginRun.

Implements EEClient.

Definition at line 103 of file EEPedestalOnlineClient.cc.

References gather_cfg::cout, debug_, jevt_, and setup().

                                          {

  if ( debug_ ) std::cout << "EEPedestalOnlineClient: beginRun" << std::endl;

  jevt_ = 0;

  this->setup();

}
void EEPedestalOnlineClient::cleanup ( void  ) [virtual]

Cleanup.

Implements EEClient.

Definition at line 188 of file EEPedestalOnlineClient.cc.

References cloneME_, dqmStore_, enableCleanup_, edm::getName(), h03_, i, ecalpyutils::ism(), meg03_, mep03_, mer03_, prefixME_, DQMStore::removeElement(), DQMStore::setCurrentFolder(), and superModules_.

Referenced by endJob(), and endRun().

                                         {

  if ( ! enableCleanup_ ) return;

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    if ( cloneME_ ) {
      if ( h03_[ism-1] ) delete h03_[ism-1];
    }

    h03_[ism-1] = 0;

  }

  dqmStore_->setCurrentFolder( prefixME_ + "/EEPedestalOnlineClient" );

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
    meg03_[ism-1] = 0;

    if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
    mep03_[ism-1] = 0;

    if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
    mer03_[ism-1] = 0;

  }

}
void EEPedestalOnlineClient::endJob ( void  ) [virtual]

EndJob.

Implements EEClient.

Definition at line 113 of file EEPedestalOnlineClient.cc.

References cleanup(), gather_cfg::cout, debug_, and ievt_.

                                        {

  if ( debug_ ) std::cout << "EEPedestalOnlineClient: endJob, ievt = " << ievt_ << std::endl;

  this->cleanup();

}
void EEPedestalOnlineClient::endRun ( void  ) [virtual]

EndRun.

Implements EEClient.

Definition at line 121 of file EEPedestalOnlineClient.cc.

References cleanup(), gather_cfg::cout, debug_, and jevt_.

                                        {

  if ( debug_ ) std::cout << "EEPedestalOnlineClient: endRun, jevt = " << jevt_ << std::endl;

  this->cleanup();

}
int EEPedestalOnlineClient::getEvtPerJob ( void  ) [inline, virtual]

Get Functions.

Implements EEClient.

Definition at line 72 of file EEPedestalOnlineClient.h.

References ievt_.

{ return ievt_; }
int EEPedestalOnlineClient::getEvtPerRun ( void  ) [inline, virtual]

Returns the number of processed events in this Run.

Implements EEClient.

Definition at line 73 of file EEPedestalOnlineClient.h.

References jevt_.

{ return jevt_; }
void EEPedestalOnlineClient::setup ( void  ) [virtual]

Setup.

Implements EEClient.

Definition at line 129 of file EEPedestalOnlineClient.cc.

References DQMStore::book1D(), DQMStore::book2D(), dqmStore_, edm::getName(), i, ecalpyutils::ism(), Numbers::ix0EE(), Numbers::iy0EE(), meg03_, mep03_, mer03_, mergeVDriftHistosByStation::name, prefixME_, DQMStore::removeElement(), MonitorElement::Reset(), Numbers::sEE(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), DQMStore::setCurrentFolder(), superModules_, and Numbers::validEE().

Referenced by beginRun().

                                       {

  std::string name;

  dqmStore_->setCurrentFolder( prefixME_ + "/EEPedestalOnlineClient" );

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    if ( meg03_[ism-1] ) dqmStore_->removeElement( meg03_[ism-1]->getName() );
    name = "EEPOT pedestal quality G12 " + Numbers::sEE(ism);
    meg03_[ism-1] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
    meg03_[ism-1]->setAxisTitle("ix", 1);
    if ( ism >= 1 && ism <= 9 ) meg03_[ism-1]->setAxisTitle("101-ix", 1);
    meg03_[ism-1]->setAxisTitle("iy", 2);

    if ( mep03_[ism-1] ) dqmStore_->removeElement( mep03_[ism-1]->getName() );
    name = "EEPOT pedestal mean G12 " + Numbers::sEE(ism);
    mep03_[ism-1] = dqmStore_->book1D(name, name, 100, 150., 250.);
    mep03_[ism-1]->setAxisTitle("mean", 1);

    if ( mer03_[ism-1] ) dqmStore_->removeElement( mer03_[ism-1]->getName() );
    name = "EEPOT pedestal rms G12 " + Numbers::sEE(ism);
    mer03_[ism-1] = dqmStore_->book1D(name, name, 100, 0.,  10.);
    mer03_[ism-1]->setAxisTitle("rms", 1);

  }

  for ( unsigned int i=0; i<superModules_.size(); i++ ) {

    int ism = superModules_[i];

    if ( meg03_[ism-1] ) meg03_[ism-1]->Reset();

    for ( int ix = 1; ix <= 50; ix++ ) {
      for ( int iy = 1; iy <= 50; iy++ ) {

        meg03_[ism-1]->setBinContent( ix, iy, 6. );

        int jx = ix + Numbers::ix0EE(ism);
        int jy = iy + Numbers::iy0EE(ism);

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

        if ( Numbers::validEE(ism, jx, jy) ) {
          meg03_[ism-1]->setBinContent( ix, iy, 2. );
        }

      }
    }

    if ( mep03_[ism-1] ) mep03_[ism-1]->Reset();
    if ( mer03_[ism-1] ) mer03_[ism-1]->Reset();

  }

}

Friends And Related Function Documentation

friend class EESummaryClient [friend]

Definition at line 35 of file EEPedestalOnlineClient.h.


Member Data Documentation

Definition at line 80 of file EEPedestalOnlineClient.h.

Referenced by analyze(), cleanup(), and EEPedestalOnlineClient().

Definition at line 104 of file EEPedestalOnlineClient.h.

Referenced by analyze(), and EEPedestalOnlineClient().

Definition at line 91 of file EEPedestalOnlineClient.h.

Referenced by analyze(), beginJob(), cleanup(), and setup().

Definition at line 87 of file EEPedestalOnlineClient.h.

Referenced by cleanup(), and EEPedestalOnlineClient().

Definition at line 103 of file EEPedestalOnlineClient.h.

Referenced by analyze(), and EEPedestalOnlineClient().

TProfile2D* EEPedestalOnlineClient::h03_[18] [private]

Definition at line 93 of file EEPedestalOnlineClient.h.

Referenced by analyze(), cleanup(), and EEPedestalOnlineClient().

Definition at line 77 of file EEPedestalOnlineClient.h.

Referenced by analyze(), beginJob(), endJob(), and getEvtPerJob().

Definition at line 78 of file EEPedestalOnlineClient.h.

Referenced by analyze(), beginJob(), beginRun(), endRun(), and getEvtPerRun().

Definition at line 97 of file EEPedestalOnlineClient.h.

Referenced by analyze(), cleanup(), EEPedestalOnlineClient(), and setup().

Definition at line 99 of file EEPedestalOnlineClient.h.

Referenced by analyze(), cleanup(), EEPedestalOnlineClient(), and setup().

std::string EEPedestalOnlineClient::prefixME_ [private]

Definition at line 85 of file EEPedestalOnlineClient.h.

Referenced by analyze(), cleanup(), EEPedestalOnlineClient(), and setup().

Definition at line 105 of file EEPedestalOnlineClient.h.

Referenced by analyze(), and EEPedestalOnlineClient().

Definition at line 105 of file EEPedestalOnlineClient.h.

Referenced by analyze(), and EEPedestalOnlineClient().

std::vector<int> EEPedestalOnlineClient::superModules_ [private]

Definition at line 89 of file EEPedestalOnlineClient.h.

Referenced by analyze(), cleanup(), EEPedestalOnlineClient(), and setup().

Definition at line 82 of file EEPedestalOnlineClient.h.

Referenced by EEPedestalOnlineClient().