CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

EBTimingClient Class Reference

#include <EBTimingClient.h>

Inheritance diagram for EBTimingClient:
EBClient

List of all members.

Public Member Functions

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

Private Attributes

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

Friends

class EBSummaryClient

Detailed Description

Definition at line 32 of file EBTimingClient.h.


Constructor & Destructor Documentation

EBTimingClient::EBTimingClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 36 of file EBTimingClient.cc.

References cloneME_, debug_, discrepancyMean_, dqmStore_, enableCleanup_, expectedMean_, edm::ParameterSet::getUntrackedParameter(), h01_, h02_, i, ievt_, ecalpyutils::ism(), jevt_, mea01_, meg01_, meh01_, meh02_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, nHitThreshold_, prefixME_, RMSThreshold_, AlCaHLTBitMon_QueryRunRegistry::string, 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 36).
  superModules_.reserve(36);
  for ( unsigned int i = 1; i <= 36; 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;

  }

  meTimeSummaryMapProjEta_ = 0;
  meTimeSummaryMapProjPhi_ = 0;

  expectedMean_ = 0.0;
  discrepancyMean_ = 2.0;
  RMSThreshold_ = 6.0;

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

  ievt_ = 0;
  jevt_ = 0;
  dqmStore_ = 0;
}
EBTimingClient::~EBTimingClient ( ) [virtual]

Destructor.

Definition at line 98 of file EBTimingClient.cc.

                                {

}

Member Function Documentation

void EBTimingClient::analyze ( void  ) [virtual]

Analyze.

Implements EBClient.

Definition at line 338 of file EBTimingClient.cc.

References abs, cloneME_, gather_cfg::cout, debug_, discrepancyMean_, dqmStore_, EcalBarrel, eta(), expectedMean_, MonitorElement::Fill(), DQMStore::get(), UtilsClient::getBinStatistics(), h01_, h02_, i, Numbers::icEB(), ievt_, jevt_, UtilsClient::maskBinContent(), Masks::maskChannel(), mea01_, meg01_, meh01_, meh02_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, nHitThreshold_, phi, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, prefixME_, MonitorElement::Reset(), RMSThreshold_, Numbers::sEB(), MonitorElement::setBinContent(), MonitorElement::setBinError(), and superModules_.

                                 {

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

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

  MonitorElement* me;

  if( meTimeSummaryMapProjEta_ ) meTimeSummaryMapProjEta_->Reset();
  if( meTimeSummaryMapProjPhi_ ) meTimeSummaryMapProjPhi_->Reset();

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

    int ism = superModules_[i];

    me = dqmStore_->get( prefixME_ + "/EBTimingTask/EBTMT timing " + Numbers::sEB(ism) );
    h01_[ism-1] = UtilsClient::getHisto<TProfile2D*>( me, cloneME_, h01_[ism-1] );
    meh01_[ism-1] = me;

    me = dqmStore_->get( prefixME_ + "/EBTimingTask/EBTMT timing vs amplitude " + Numbers::sEB(ism) );
    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 ie = 1; ie <= 85; ie++ ) {
      for ( int ip = 1; ip <= 20; ip++ ) {

        if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent(ie, ip, 2.);

        bool update01;

        float num01;
        float mean01;
        float rms01;

        update01 = UtilsClient::getBinStatistics(h01_[ism-1], ie, ip, num01, mean01, rms01, nHitThreshold_);
        // 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(ie, ip, val);

          int ic = Numbers::icEB(ism, ie, ip);

          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);

          float eta, phi;

          if ( ism <= 18 ) {
            eta = -ie+0.5;
            phi = ip+20*(ism-1)-0.5;
          } else {
            eta = ie-0.5;
            phi = (20-ip)+20*(ism-19)+0.5;
          }

          if( meTimeSummaryMapProjEta_ ) meTimeSummaryMapProjEta_->Fill(eta, mean01);
          if( meTimeSummaryMapProjPhi_ ) meTimeSummaryMapProjPhi_->Fill(phi, mean01);

        }

        if ( Masks::maskChannel(ism, ie, ip, bits01, EcalBarrel) ) UtilsClient::maskBinContent( meg01_[ism-1], ie, ip );



      }
    }

  }

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

BeginJob.

Implements EBClient.

Definition at line 102 of file EBTimingClient.cc.

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

                                  {

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

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

  ievt_ = 0;
  jevt_ = 0;

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

BeginRun.

Implements EBClient.

Definition at line 113 of file EBTimingClient.cc.

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

                                  {

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

  jevt_ = 0;

  this->setup();

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

Cleanup.

Implements EBClient.

Definition at line 207 of file EBTimingClient.cc.

References cloneME_, dqmStore_, enableCleanup_, MonitorElement::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_ + "/EBTimingClient" );

  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;

  }

  if ( meTimeSummaryMapProjEta_ ) dqmStore_->removeElement( meTimeSummaryMapProjEta_->getName() );
  if ( meTimeSummaryMapProjPhi_ ) dqmStore_->removeElement( meTimeSummaryMapProjPhi_->getName() );

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

EndJob.

Implements EBClient.

Definition at line 123 of file EBTimingClient.cc.

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

                                {

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

  this->cleanup();

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

EndRun.

Implements EBClient.

Definition at line 131 of file EBTimingClient.cc.

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

                                {

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

  this->cleanup();

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

Get Functions.

Implements EBClient.

Definition at line 71 of file EBTimingClient.h.

References ievt_.

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

Returns the number of processed events in this Run.

Implements EBClient.

Definition at line 72 of file EBTimingClient.h.

References jevt_.

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

Setup.

Implements EBClient.

Definition at line 139 of file EBTimingClient.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), dqmStore_, i, ecalpyutils::ism(), mea01_, meg01_, mep01_, mer01_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, mergeVDriftHistosByStation::name, prefixME_, DQMStore::removeElement(), MonitorElement::Reset(), Numbers::sEB(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and superModules_.

Referenced by beginRun().

                               {

  std::string name;

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

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

    int ism = superModules_[i];

    if ( meg01_[ism-1] ) dqmStore_->removeElement( meg01_[ism-1]->getName() );
    name = "EBTMT timing quality " + Numbers::sEB(ism);
    meg01_[ism-1] = dqmStore_->book2D(name, name, 85, 0., 85., 20, 0., 20.);
    meg01_[ism-1]->setAxisTitle("ieta", 1);
    meg01_[ism-1]->setAxisTitle("iphi", 2);

    if ( mea01_[ism-1] ) dqmStore_->removeElement( mea01_[ism-1]->getName() );
    name = "EBTMT timing " + Numbers::sEB(ism);
    mea01_[ism-1] = dqmStore_->book1D(name, name, 1700, 0., 1700.);
    mea01_[ism-1]->setAxisTitle("channel", 1);
    mea01_[ism-1]->setAxisTitle("time (ns)", 2);

    if ( mep01_[ism-1] ) dqmStore_->removeElement( mep01_[ism-1]->getName() );
    name = "EBTMT timing mean " + Numbers::sEB(ism);
    mep01_[ism-1] = dqmStore_->book1D(name, name, 100, -25.0, 25.0);
    mep01_[ism-1]->setAxisTitle("mean (ns)", 1);

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

  }

  name = "EBTMT timing projection eta";
  meTimeSummaryMapProjEta_ = dqmStore_->bookProfile(name, name, 34, -85., 85., -20., 20., "");
  meTimeSummaryMapProjEta_->setAxisTitle("jeta", 1);
  meTimeSummaryMapProjEta_->setAxisTitle("time (ns)", 2);

  name = "EBTMT timing projection phi";
  meTimeSummaryMapProjPhi_ = dqmStore_->bookProfile(name, name, 72, 0., 360., -20., 20., "");
  meTimeSummaryMapProjPhi_->setAxisTitle("jphi", 1);
  meTimeSummaryMapProjPhi_->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 ie = 1; ie <= 85; ie++ ) {
      for ( int ip = 1; ip <= 20; ip++ ) {

        if ( meg01_[ism-1] ) meg01_[ism-1]->setBinContent( ie, ip, 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 EBSummaryClient [friend]

Definition at line 34 of file EBTimingClient.h.


Member Data Documentation

bool EBTimingClient::cloneME_ [private]

Definition at line 79 of file EBTimingClient.h.

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

bool EBTimingClient::debug_ [private]

Definition at line 82 of file EBTimingClient.h.

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

Definition at line 112 of file EBTimingClient.h.

Referenced by analyze(), and EBTimingClient().

Definition at line 90 of file EBTimingClient.h.

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

Definition at line 86 of file EBTimingClient.h.

Referenced by cleanup(), and EBTimingClient().

Definition at line 111 of file EBTimingClient.h.

Referenced by analyze(), and EBTimingClient().

TProfile2D* EBTimingClient::h01_[36] [private]

Definition at line 95 of file EBTimingClient.h.

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

TH2F* EBTimingClient::h02_[36] [private]

Definition at line 96 of file EBTimingClient.h.

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

int EBTimingClient::ievt_ [private]

Definition at line 76 of file EBTimingClient.h.

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

int EBTimingClient::jevt_ [private]

Definition at line 77 of file EBTimingClient.h.

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

Definition at line 100 of file EBTimingClient.h.

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

Definition at line 98 of file EBTimingClient.h.

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

Definition at line 92 of file EBTimingClient.h.

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

Definition at line 93 of file EBTimingClient.h.

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

Definition at line 102 of file EBTimingClient.h.

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

Definition at line 104 of file EBTimingClient.h.

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

Definition at line 106 of file EBTimingClient.h.

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

Definition at line 107 of file EBTimingClient.h.

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

Definition at line 115 of file EBTimingClient.h.

Referenced by analyze(), and EBTimingClient().

std::string EBTimingClient::prefixME_ [private]

Definition at line 84 of file EBTimingClient.h.

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

Definition at line 113 of file EBTimingClient.h.

Referenced by analyze(), and EBTimingClient().

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

Definition at line 88 of file EBTimingClient.h.

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

bool EBTimingClient::verbose_ [private]

Definition at line 81 of file EBTimingClient.h.

Referenced by EBTimingClient().