CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

EETimingClient Class Reference

#include <EETimingClient.h>

Inheritance diagram for EETimingClient:
EEClient

List of all members.

Public Member Functions

void analyze (void)
 Analyze.
void beginJob (void)
 BeginJob.
void beginRun (void)
 BeginRun.
void cleanup (void)
 Cleanup.
 EETimingClient (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 ~EETimingClient ()
 Destructor.

Private Attributes

bool cloneME_
bool debug_
float discrepancyMean_
DQMStoredqmStore_
bool enableCleanup_
float expectedMean_
TProfile2D * h01_ [18]
TH2F * h02_ [18]
int ievt_
int jevt_
MonitorElementmea01_ [18]
MonitorElementmeg01_ [18]
MonitorElementmeh01_ [18]
MonitorElementmeh02_ [18]
MonitorElementmep01_ [18]
MonitorElementmer01_ [18]
std::string prefixME_
float RMSThreshold_
std::vector< int > superModules_
bool verbose_

Friends

class EESummaryClient

Detailed Description

Definition at line 32 of file EETimingClient.h.


Constructor & Destructor Documentation

EETimingClient::EETimingClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 37 of file EETimingClient.cc.

References cloneME_, debug_, discrepancyMean_, enableCleanup_, expectedMean_, edm::ParameterSet::getUntrackedParameter(), h01_, h02_, i, ecalpyutils::ism(), mea01_, meg01_, meh01_, meh02_, mep01_, mer01_, prefixME_, RMSThreshold_, 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];

    h01_[ism-1] = 0;
    h02_[ism-1] = 0;

    meh01_[ism-1] = 0;
    meh02_[ism-1] = 0;

  }

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

    int ism = superModules_[i];

    meg01_[ism-1] = 0;

    mea01_[ism-1] = 0;

    mep01_[ism-1] = 0;

    mer01_[ism-1] = 0;

  }

  expectedMean_ = 0.0;
  discrepancyMean_ = 25.0;
  RMSThreshold_ = 125.;

}
EETimingClient::~EETimingClient ( ) [virtual]

Destructor.

Definition at line 91 of file EETimingClient.cc.

                                {

}

Member Function Documentation

void EETimingClient::analyze ( void  ) [virtual]

Analyze.

Implements EEClient.

Definition at line 335 of file EETimingClient.cc.

References abs, cloneME_, gather_cfg::cout, debug_, discrepancyMean_, dqmStore_, EcalEndcap, expectedMean_, MonitorElement::Fill(), DQMStore::get(), UtilsClient::getBinStatistics(), h01_, h02_, trackerHits::histo, i, Numbers::icEE(), ievt_, Numbers::ix0EE(), Numbers::iy0EE(), jevt_, UtilsClient::maskBinContent(), Masks::maskChannel(), mea01_, meg01_, meh01_, meh02_, mep01_, mer01_, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, prefixME_, MonitorElement::Reset(), RMSThreshold_, Numbers::sEE(), MonitorElement::setBinContent(), MonitorElement::setBinError(), superModules_, and Numbers::validEE().

                                 {

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

  uint32_t bits01 = 0;
  bits01 |= 1 << EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING;

  char histo[200];

  MonitorElement* me;

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

    int ism = superModules_[i];

    sprintf(histo, (prefixME_ + "/EETimingTask/EETMT timing %s").c_str(), Numbers::sEE(ism).c_str());
    me = dqmStore_->get(histo);
    h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
    meh01_[ism-1] = me;

    sprintf(histo, (prefixME_ + "/EETimingTask/EETMT timing vs amplitude %s").c_str(), Numbers::sEE(ism).c_str());
    me = dqmStore_->get(histo);
    h02_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, h02_[ism-1] );
    meh02_[ism-1] = me;

    if ( meg01_[ism-1] ) meg01_[ism-1]->Reset();
    if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
    if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
    if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();

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

        if ( meg01_[ism-1] ) meg01_[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 ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2. );
        }

        bool update01;

        float num01;
        float mean01;
        float rms01;

        update01 = UtilsClient::getBinStatistics(h01_[ism-1], ix, iy, num01, mean01, rms01);
        // Task timing map is shifted of +50 ns for graphical reasons. Shift back it.
        mean01 -= 50.;

        if ( update01 ) {

          float val;

          val = 1.;
          if ( std::abs(mean01 - expectedMean_) > discrepancyMean_ )
            val = 0.;
          if ( rms01 > RMSThreshold_ )
            val = 0.;
          if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ix, iy, val);

          int ic = Numbers::icEE(ism, jx, jy);

          if ( ic != -1 ) {
            if ( mea01_[ism-1] ) {
              mea01_[ism-1]->setBinContent(ic, mean01);
              mea01_[ism-1]->setBinError(ic, rms01);
            }

            if ( mep01_[ism-1] ) mep01_[ism-1]->Fill(mean01);
            if ( mer01_[ism-1] ) mer01_[ism-1]->Fill(rms01);
          }

        }

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

      }
    }

  }

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

BeginJob.

Implements EEClient.

Definition at line 95 of file EETimingClient.cc.

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

                                  {

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

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

  ievt_ = 0;
  jevt_ = 0;

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

BeginRun.

Implements EEClient.

Definition at line 106 of file EETimingClient.cc.

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

                                  {

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

  jevt_ = 0;

  this->setup();

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

Cleanup.

Implements EEClient.

Definition at line 198 of file EETimingClient.cc.

References cloneME_, dqmStore_, enableCleanup_, edm::getName(), h01_, h02_, i, ecalpyutils::ism(), mea01_, meg01_, meh01_, meh02_, mep01_, mer01_, 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 ( h01_[ism-1] ) delete h01_[ism-1];
      if ( h02_[ism-1] ) delete h02_[ism-1];
    }

    h01_[ism-1] = 0;
    h02_[ism-1] = 0;

    meh01_[ism-1] = 0;
    meh02_[ism-1] = 0;

  }

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

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

    int ism = superModules_[i];

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

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

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

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

  }

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

EndJob.

Implements EEClient.

Definition at line 116 of file EETimingClient.cc.

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

                                {

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

  this->cleanup();

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

EndRun.

Implements EEClient.

Definition at line 124 of file EETimingClient.cc.

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

                                {

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

  this->cleanup();

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

Get Functions.

Implements EEClient.

Definition at line 71 of file EETimingClient.h.

References ievt_.

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

Returns the number of processed events in this Run.

Implements EEClient.

Definition at line 72 of file EETimingClient.h.

References jevt_.

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

Setup.

Implements EEClient.

Definition at line 132 of file EETimingClient.cc.

References DQMStore::book1D(), DQMStore::book2D(), dqmStore_, edm::getName(), trackerHits::histo, i, ecalpyutils::ism(), Numbers::ix0EE(), Numbers::iy0EE(), mea01_, meg01_, mep01_, mer01_, prefixME_, DQMStore::removeElement(), MonitorElement::Reset(), Numbers::sEE(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), DQMStore::setCurrentFolder(), superModules_, and Numbers::validEE().

Referenced by beginRun().

                               {

  char histo[200];

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

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

    int ism = superModules_[i];

    if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
    sprintf(histo, "EETMT timing quality %s", Numbers::sEE(ism).c_str());
    meg01_[ism-1] = dqmStore_->book2D(histo, histo, 50, Numbers::ix0EE(ism)+0., Numbers::ix0EE(ism)+50., 50, Numbers::iy0EE(ism)+0., Numbers::iy0EE(ism)+50.);
    meg01_[ism-1]->setAxisTitle("ix", 1);
    if ( ism >= 1 && ism <= 9 ) meg01_[ism-1]->setAxisTitle("101-ix", 1);
    meg01_[ism-1]->setAxisTitle("iy", 2);

    if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );
    sprintf(histo, "EETMT timing %s", Numbers::sEE(ism).c_str());
    mea01_[ism-1] = dqmStore_->book1D(histo, histo, 850, 0., 850.);
    mea01_[ism-1]->setAxisTitle("channel", 1);
    mea01_[ism-1]->setAxisTitle("time (ns)", 2);

    if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
    sprintf(histo, "EETMT timing mean %s", Numbers::sEE(ism).c_str());
    mep01_[ism-1] = dqmStore_->book1D(histo, histo, 100, -50., 50.);
    mep01_[ism-1]->setAxisTitle("mean (ns)", 1);

    if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
    sprintf(histo, "EETMT timing rms %s", Numbers::sEE(ism).c_str());
    mer01_[ism-1] = dqmStore_->book1D(histo, histo, 100, 0.0, 150.0);
    mer01_[ism-1]->setAxisTitle("rms (ns)", 1);

  }

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

    int ism = superModules_[i];

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

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

        if ( meg01_[ism-1] ) meg01_[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 ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ix, iy, 2. );
        }

      }
    }

    if ( mea01_[ism-1] ) mea01_[ism-1]->Reset();
    if ( mep01_[ism-1] ) mep01_[ism-1]->Reset();
    if ( mer01_[ism-1] ) mer01_[ism-1]->Reset();

  }

}

Friends And Related Function Documentation

friend class EESummaryClient [friend]

Definition at line 34 of file EETimingClient.h.


Member Data Documentation

bool EETimingClient::cloneME_ [private]

Definition at line 79 of file EETimingClient.h.

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

bool EETimingClient::debug_ [private]

Definition at line 82 of file EETimingClient.h.

Referenced by analyze(), beginJob(), beginRun(), EETimingClient(), endJob(), and endRun().

Definition at line 109 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

Definition at line 90 of file EETimingClient.h.

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

Definition at line 86 of file EETimingClient.h.

Referenced by cleanup(), and EETimingClient().

Definition at line 108 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

TProfile2D* EETimingClient::h01_[18] [private]

Definition at line 95 of file EETimingClient.h.

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

TH2F* EETimingClient::h02_[18] [private]

Definition at line 96 of file EETimingClient.h.

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

int EETimingClient::ievt_ [private]

Definition at line 76 of file EETimingClient.h.

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

int EETimingClient::jevt_ [private]

Definition at line 77 of file EETimingClient.h.

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

Definition at line 100 of file EETimingClient.h.

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

Definition at line 98 of file EETimingClient.h.

Referenced by analyze(), EESummaryClient::analyze(), cleanup(), EETimingClient(), and setup().

Definition at line 92 of file EETimingClient.h.

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

Definition at line 93 of file EETimingClient.h.

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

Definition at line 102 of file EETimingClient.h.

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

Definition at line 104 of file EETimingClient.h.

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

std::string EETimingClient::prefixME_ [private]

Definition at line 84 of file EETimingClient.h.

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

Definition at line 110 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

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

Definition at line 88 of file EETimingClient.h.

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

bool EETimingClient::verbose_ [private]

Definition at line 81 of file EETimingClient.h.

Referenced by EETimingClient().