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_
DQMStoredqmStore_
bool enableCleanup_
float expectedMean_
TProfile2D * h01_ [18]
TH2F * h02_ [18]
int ievt_
int jevt_
MonitorElementmea01_ [18]
float meanThreshold_
MonitorElementmeg01_ [18]
MonitorElementmeh01_ [18]
MonitorElementmeh02_ [18]
MonitorElementmep01_ [18]
MonitorElementmer01_ [18]
MonitorElementmeTimeSummaryMapProjEta_ [2]
MonitorElementmeTimeSummaryMapProjPhi_ [2]
int nHitThreshold_
std::string prefixME_
float rmsThreshold_
std::vector< int > superModules_
bool verbose_

Friends

class EESummaryClient

Detailed Description

Definition at line 38 of file EETimingClient.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 38 of file EETimingClient.cc.

References cloneME_, debug_, enableCleanup_, expectedMean_, edm::ParameterSet::getUntrackedParameter(), h01_, h02_, i, ecalpyutils::ism(), mea01_, meanThreshold_, meg01_, meh01_, meh02_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, nHitThreshold_, 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_);

  nHitThreshold_ = ps.getUntrackedParameter<int>("timingNHitThreshold", 5);

  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;

  }

  meTimeSummaryMapProjEta_[0] = 0;
  meTimeSummaryMapProjEta_[1] = 0;
  meTimeSummaryMapProjPhi_[0] = 0;
  meTimeSummaryMapProjPhi_[1] = 0;

  expectedMean_ = 0.;
  meanThreshold_ = 3.;
  rmsThreshold_ = 6.;
}
EETimingClient::~EETimingClient ( ) [virtual]

Destructor.

Definition at line 98 of file EETimingClient.cc.

                                {

}

Member Function Documentation

void EETimingClient::analyze ( void  ) [virtual]

Analyze.

Implements EEClient.

Definition at line 370 of file EETimingClient.cc.

References abs, cloneME_, gather_cfg::cout, debug_, dqmStore_, EcalEndcap, Numbers::eta(), expectedMean_, MonitorElement::Fill(), DQMStore::get(), UtilsClient::getBinStatistics(), getHisto(), MonitorElement::getRootObject(), h01_, h02_, i, Numbers::icEE(), errorMatrix2Lands_multiChannel::id, ievt_, Numbers::ix0EE(), Numbers::iy0EE(), jevt_, UtilsClient::maskBinContent(), Masks::maskChannel(), mea01_, meanThreshold_, meg01_, meh01_, meh02_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, nHitThreshold_, Numbers::phi(), EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, prefixME_, MonitorElement::Reset(), rmsThreshold_, Numbers::sEE(), MonitorElement::setBinContent(), MonitorElement::setBinError(), superModules_, EEDetId::validDetId(), 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;

  MonitorElement* me;

  if( meTimeSummaryMapProjEta_[0] && meTimeSummaryMapProjEta_[1] && meTimeSummaryMapProjPhi_[0] && meTimeSummaryMapProjPhi_[1] ){

    for(int iz=0; iz<2; iz++){
      int zside = -1 + iz * 2;
      me = dqmStore_->get(prefixME_ + "/EETimingTask/EETMT timing map EE " + (zside==0 ? "-" : "+"));
      TProfile2D *hmap = 0;
      if( me ) hmap = (TProfile2D *)me->getRootObject();
      if( hmap ){

        int nx = hmap->GetNbinsX();
        int ny = hmap->GetNbinsY();

        for(int jx=1; jx<=nx; jx++){
          for(int jy=1; jy<=ny; jy++){

            int ix = (jx-1)*5 + 1;
            int iy = (jy-1)*5 + 1;
            if( !EEDetId::validDetId(ix, iy, zside) ) continue;

            EEDetId id(ix, iy, zside);

            float yval = hmap->GetBinContent(jx,jy) - 50.;

            meTimeSummaryMapProjEta_[iz]->Fill(Numbers::eta(id), yval);
            meTimeSummaryMapProjPhi_[iz]->Fill(Numbers::phi(id), yval);
          }
        }
      }
    }

  }

  for(int i=0; i<2; i++){
    if( meTimeSummaryMapProjEta_[i] ) meTimeSummaryMapProjEta_[i]->Reset();
    if( meTimeSummaryMapProjPhi_[i] ) meTimeSummaryMapProjPhi_[i]->Reset();
  }

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

    int ism = superModules_[i];

    me = dqmStore_->get( prefixME_ + "/EETimingTask/EETMT timing " + Numbers::sEE(ism) );
    h01_[ism-1] = UtilsClient::getHisto( me, cloneME_, h01_[ism-1] );
    meh01_[ism-1] = me;

    me = dqmStore_->get( prefixME_ + "/EETimingTask/EETMT timing vs amplitude " + Numbers::sEE(ism) );
    h02_[ism-1] = UtilsClient::getHisto( 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();

    int iz = ism / 10;

    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, nHitThreshold_);
        // Task timing map is shifted of +50 ns for graphical reasons. Shift back it.
        mean01 -= 50.;

        if ( update01 ) {

          EEDetId id(jx, jy, -1 + iz * 2);

          float val(1.);

          if ( std::abs(mean01 - expectedMean_) > meanThreshold_ || 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( meTimeSummaryMapProjEta_[iz] ) meTimeSummaryMapProjEta_[iz]->Fill(Numbers::eta(id), mean01);
          if( meTimeSummaryMapProjPhi_[iz] ) meTimeSummaryMapProjPhi_[iz]->Fill(Numbers::phi(id), mean01);

        }

        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 102 of file EETimingClient.cc.

References gather_cfg::cout, debug_, dqmStore_, ievt_, jevt_, and 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 113 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 225 of file EETimingClient.cc.

References cloneME_, dqmStore_, enableCleanup_, edm::getName(), h01_, h02_, i, ecalpyutils::ism(), mea01_, meg01_, meh01_, meh02_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, 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;

  }

  for(int i=0; i<2; i++){
    if ( meTimeSummaryMapProjEta_[i] ) dqmStore_->removeElement( meTimeSummaryMapProjEta_[i]->getName() );
    meTimeSummaryMapProjEta_[i] = 0;

    if ( meTimeSummaryMapProjPhi_[i] ) dqmStore_->removeElement( meTimeSummaryMapProjPhi_[i]->getName() );
    meTimeSummaryMapProjPhi_[i] = 0;
  }

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

EndJob.

Implements EEClient.

Definition at line 123 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 131 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 77 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 78 of file EETimingClient.h.

References jevt_.

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

Setup.

Implements EEClient.

Definition at line 139 of file EETimingClient.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), dqmStore_, edm::getName(), i, ecalpyutils::ism(), Numbers::ix0EE(), Numbers::iy0EE(), M_PI, mea01_, meg01_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, 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_ + "/EETimingClient" );

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

    int ism = superModules_[i];

    if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
    name = "EETMT timing quality " + Numbers::sEE(ism);
    meg01_[ism-1] = dqmStore_->book2D(name, name, 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() );
    name = "EETMT timing " + Numbers::sEE(ism);
    mea01_[ism-1] = dqmStore_->book1D(name, name, 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() );
    name = "EETMT timing mean " + Numbers::sEE(ism);
    mep01_[ism-1] = dqmStore_->book1D(name, name, 100, -25., 25.);
    mep01_[ism-1]->setAxisTitle("mean (ns)", 1);

    if ( mer01_[ism-1] ) dqmStore_->removeElement( mer01_[ism-1]->getName() );
    name = "EETMT timing rms " + Numbers::sEE(ism);
    mer01_[ism-1] = dqmStore_->book1D(name, name, 100, 0.0, 10.);
    mer01_[ism-1]->setAxisTitle("rms (ns)", 1);

  }

  name = "EETMT timing projection eta EE -";
  meTimeSummaryMapProjEta_[0] = dqmStore_->bookProfile(name, name, 20, -3.0, -1.479, -20., 20.,"");
  meTimeSummaryMapProjEta_[0]->setAxisTitle("eta", 1);
  meTimeSummaryMapProjEta_[0]->setAxisTitle("time (ns)", 2);

  name = "EETMT timing projection eta EE +";
  meTimeSummaryMapProjEta_[1] = dqmStore_->bookProfile(name, name, 20, 1.479, 3.0, -20., 20.,"");
  meTimeSummaryMapProjEta_[1]->setAxisTitle("eta", 1);
  meTimeSummaryMapProjEta_[1]->setAxisTitle("time (ns)", 2);

  name = "EETMT timing projection phi EE -";
  meTimeSummaryMapProjPhi_[0] = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, -20., 20.,"");
  meTimeSummaryMapProjPhi_[0]->setAxisTitle("phi", 1);
  meTimeSummaryMapProjPhi_[0]->setAxisTitle("time (ns)", 2);

  name = "EETMT timing projection phi EE +";
  meTimeSummaryMapProjPhi_[1] = dqmStore_->bookProfile(name, name, 50, -M_PI, M_PI, -20., 20.,"");
  meTimeSummaryMapProjPhi_[1]->setAxisTitle("phi", 1);
  meTimeSummaryMapProjPhi_[1]->setAxisTitle("time (ns)", 2);

  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 40 of file EETimingClient.h.


Member Data Documentation

bool EETimingClient::cloneME_ [private]

Definition at line 85 of file EETimingClient.h.

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

bool EETimingClient::debug_ [private]

Definition at line 88 of file EETimingClient.h.

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

Definition at line 96 of file EETimingClient.h.

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

Definition at line 92 of file EETimingClient.h.

Referenced by cleanup(), and EETimingClient().

Definition at line 117 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

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

Definition at line 101 of file EETimingClient.h.

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

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

Definition at line 102 of file EETimingClient.h.

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

int EETimingClient::ievt_ [private]

Definition at line 82 of file EETimingClient.h.

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

int EETimingClient::jevt_ [private]

Definition at line 83 of file EETimingClient.h.

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

Definition at line 106 of file EETimingClient.h.

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

Definition at line 118 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

Definition at line 104 of file EETimingClient.h.

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

Definition at line 98 of file EETimingClient.h.

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

Definition at line 99 of file EETimingClient.h.

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

Definition at line 108 of file EETimingClient.h.

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

Definition at line 110 of file EETimingClient.h.

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

Definition at line 112 of file EETimingClient.h.

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

Definition at line 113 of file EETimingClient.h.

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

Definition at line 121 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

std::string EETimingClient::prefixME_ [private]

Definition at line 90 of file EETimingClient.h.

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

Definition at line 119 of file EETimingClient.h.

Referenced by analyze(), and EETimingClient().

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

Definition at line 94 of file EETimingClient.h.

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

bool EETimingClient::verbose_ [private]

Definition at line 87 of file EETimingClient.h.

Referenced by EETimingClient().