CMS 3D CMS Logo

Public Member Functions | Private Attributes | Friends

EBTriggerTowerClient Class Reference

#include <EBTriggerTowerClient.h>

Inheritance diagram for EBTriggerTowerClient:
EBClient

List of all members.

Public Member Functions

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

Private Attributes

bool cloneME_
bool debug_
DQMStoredqmStore_
bool enableCleanup_
int ievt_
int jevt_
TH2F * l01_ [36]
TH2F * l02_ [36]
MonitorElementme_o01_ [36]
MonitorElementme_o02_ [36]
MonitorElementmel01_ [36]
MonitorElementmel02_ [36]
MonitorElementmeo01_ [36]
TH3F * o01_ [36]
std::string prefixME_
std::vector< int > superModules_
bool verbose_

Friends

class EBSummaryClient

Detailed Description

Definition at line 35 of file EBTriggerTowerClient.h.


Constructor & Destructor Documentation

EBTriggerTowerClient::EBTriggerTowerClient ( const edm::ParameterSet ps)

Constructor.

Definition at line 26 of file EBTriggerTowerClient.cc.

References cloneME_, debug_, enableCleanup_, edm::ParameterSet::getUntrackedParameter(), i, ecalpyutils::ism(), l01_, me_o01_, me_o02_, mel01_, meo01_, o01_, prefixME_, 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];

    l01_[ism-1] = 0;
    o01_[ism-1] = 0;

    mel01_[ism-1] = 0;
    meo01_[ism-1] = 0;

  }

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

    int ism = superModules_[i];

    me_o01_[ism-1] = 0;
    me_o02_[ism-1] = 0;

  }

}
EBTriggerTowerClient::~EBTriggerTowerClient ( ) [virtual]

Destructor.

Definition at line 71 of file EBTriggerTowerClient.cc.

                                            {

}

Member Function Documentation

void EBTriggerTowerClient::analyze ( void  ) [virtual]

Analyze.

Implements EBClient.

Definition at line 206 of file EBTriggerTowerClient.cc.

References cloneME_, gather_cfg::cout, debug_, dqmStore_, DQMStore::get(), i, ievt_, getHLTprescales::index, j, jevt_, l01_, l02_, max(), me_o01_, me_o02_, mel01_, mel02_, meo01_, o01_, prefixME_, MonitorElement::Reset(), Numbers::sEB(), MonitorElement::setBinContent(), superModules_, and pileupDistInMC::total.

                                       {

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

  MonitorElement* me;

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

    int ism = superModules_[i];

    me = dqmStore_->get( prefixME_ + "/EBTriggerTowerTask/EBTTT EmulError " + Numbers::sEB(ism) );
    l01_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, l01_[ism-1] );
    mel01_[ism-1] = me;

    me = dqmStore_->get( prefixME_ + "/EBTriggerTowerTask/EBTTT EmulFineGrainVetoError " + Numbers::sEB(ism) );
    l02_[ism-1] = UtilsClient::getHisto<TH2F*>( me, cloneME_, l02_[ism-1] );
    mel02_[ism-1] = me;

    me = dqmStore_->get( prefixME_ + "/EBTriggerTowerTask/EBTTT EmulMatch " + Numbers::sEB(ism) );
    o01_[ism-1] = UtilsClient::getHisto<TH3F*>( me, cloneME_, o01_[ism-1] );
    meo01_[ism-1] = me;

    if ( me_o01_[ism-1] ) me_o01_[ism-1]->Reset();
    if ( me_o02_[ism-1] ) me_o02_[ism-1]->Reset();

    for (int ie = 1; ie <= 17; ie++) {
      for (int ip = 1; ip <= 4; ip++) {

        if ( o01_[ism-1] ) {
          // find the most frequent TP timing that matches the emulator
          float index=-1;
          double max=0;
          double total=0;
          for (int j=0; j<6; j++) {
            double sampleEntries = o01_[ism-1]->GetBinContent(ie, ip, j+1);
            if(sampleEntries > max) {
              index=j;
              max = sampleEntries;
            }
            total += sampleEntries;
          }
          if ( max > 0 ) {
            if ( index == 0 ) {
              me_o01_[ism-1]->setBinContent(ie, ip, -1);
            } else {
              me_o01_[ism-1]->setBinContent(ie, ip, index );
            }
          }
          double fraction = (total > 0) ? 1.0 - max/total : 0.;
          if ( me_o02_[ism-1] ) me_o02_[ism-1]->setBinContent(ie, ip, fraction);
        }

      }
    }

  }

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

BeginJob.

Implements EBClient.

Definition at line 75 of file EBTriggerTowerClient.cc.

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

                                        {

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

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

  ievt_ = 0;
  jevt_ = 0;

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

BeginRun.

Implements EBClient.

Definition at line 86 of file EBTriggerTowerClient.cc.

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

                                        {

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

  jevt_ = 0;

  this->setup();

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

Cleanup.

Implements EBClient.

Definition at line 148 of file EBTriggerTowerClient.cc.

References cloneME_, dqmStore_, enableCleanup_, edm::getName(), i, ecalpyutils::ism(), l01_, me_o01_, me_o02_, mel01_, meo01_, o01_, 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 ( l01_[ism-1] ) delete l01_[ism-1];
      if ( o01_[ism-1] ) delete o01_[ism-1];
    }

    l01_[ism-1] = 0;
    o01_[ism-1] = 0;

    mel01_[ism-1] = 0;
    meo01_[ism-1] = 0;

  }

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

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

    int ism = superModules_[i];

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

  }

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

EndJob.

Implements EBClient.

Definition at line 96 of file EBTriggerTowerClient.cc.

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

                                      {

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

  this->cleanup();

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

EndRun.

Implements EBClient.

Definition at line 104 of file EBTriggerTowerClient.cc.

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

                                      {

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

  this->cleanup();

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

Get Functions.

Implements EBClient.

Definition at line 74 of file EBTriggerTowerClient.h.

References ievt_.

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

Returns the number of processed events in this Run.

Implements EBClient.

Definition at line 75 of file EBTriggerTowerClient.h.

References jevt_.

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

Setup.

Implements EBClient.

Definition at line 112 of file EBTriggerTowerClient.cc.

References DQMStore::book2D(), dqmStore_, edm::getName(), i, ecalpyutils::ism(), me_o01_, me_o02_, mergeVDriftHistosByStation::name, prefixME_, DQMStore::removeElement(), MonitorElement::Reset(), Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and superModules_.

Referenced by beginRun().

                                     {

  std::string name;

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

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

    int ism = superModules_[i];

    if ( me_o01_[ism-1] ) dqmStore_->removeElement( me_o01_[ism-1]->getName() );
    name = "EBTTT Trigger Primitives Timing " + Numbers::sEB(ism);
    me_o01_[ism-1] = dqmStore_->book2D(name, name, 17, 0., 17., 4, 0., 4.);
    me_o01_[ism-1]->setAxisTitle("ieta'", 1);
    me_o01_[ism-1]->setAxisTitle("iphi'", 2);

    if ( me_o02_[ism-1] ) dqmStore_->removeElement( me_o02_[ism-1]->getName() );
    name = "EBTTT Non Single Timing " + Numbers::sEB(ism);
    me_o02_[ism-1] = dqmStore_->book2D(name, name, 17, 0., 17., 4, 0., 4.);
    me_o02_[ism-1]->setAxisTitle("ieta'", 1);
    me_o02_[ism-1]->setAxisTitle("iphi'", 2);
    me_o02_[ism-1]->setAxisTitle("fraction", 3);

  }

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

    int ism = superModules_[i];

    if ( me_o01_[ism-1] ) me_o01_[ism-1]->Reset();
    if ( me_o02_[ism-1] ) me_o02_[ism-1]->Reset();

  }

}

Friends And Related Function Documentation

friend class EBSummaryClient [friend]

Definition at line 37 of file EBTriggerTowerClient.h.


Member Data Documentation

Definition at line 82 of file EBTriggerTowerClient.h.

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

Definition at line 85 of file EBTriggerTowerClient.h.

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

Definition at line 93 of file EBTriggerTowerClient.h.

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

Definition at line 89 of file EBTriggerTowerClient.h.

Referenced by cleanup(), and EBTriggerTowerClient().

Definition at line 79 of file EBTriggerTowerClient.h.

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

Definition at line 80 of file EBTriggerTowerClient.h.

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

TH2F* EBTriggerTowerClient::l01_[36] [private]
TH2F* EBTriggerTowerClient::l02_[36] [private]

Definition at line 99 of file EBTriggerTowerClient.h.

Referenced by analyze(), and EBSummaryClient::analyze().

Definition at line 95 of file EBTriggerTowerClient.h.

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

Definition at line 96 of file EBTriggerTowerClient.h.

Referenced by analyze().

Definition at line 97 of file EBTriggerTowerClient.h.

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

TH3F* EBTriggerTowerClient::o01_[36] [private]

Definition at line 100 of file EBTriggerTowerClient.h.

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

std::string EBTriggerTowerClient::prefixME_ [private]

Definition at line 87 of file EBTriggerTowerClient.h.

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

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

Definition at line 91 of file EBTriggerTowerClient.h.

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

Definition at line 84 of file EBTriggerTowerClient.h.

Referenced by EBTriggerTowerClient().