CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

EBPedestalOnlineTask Class Reference

#include <EBPedestalOnlineTask.h>

Inheritance diagram for EBPedestalOnlineTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EBPedestalOnlineTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EBPedestalOnlineTask ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze.
void beginJob (void)
 BeginJob.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun.
void cleanup (void)
 Cleanup.
void endJob (void)
 EndJob.
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun.
void reset (void)
 Reset.
void setup (void)
 Setup.

Private Attributes

DQMStoredqmStore_
edm::InputTag EBDigiCollection_
bool enableCleanup_
int ievt_
bool init_
MonitorElementmePedMapG12_ [36]
bool mergeRuns_
std::string prefixME_

Detailed Description

Definition at line 20 of file EBPedestalOnlineTask.h.


Constructor & Destructor Documentation

EBPedestalOnlineTask::EBPedestalOnlineTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 28 of file EBPedestalOnlineTask.cc.

References dqmStore_, EBDigiCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mePedMapG12_, mergeRuns_, cmsCodeRules::cppFunctionSkipper::operator, and prefixME_.

                                                                   {

  init_ = false;

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

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

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

  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);

  EBDigiCollection_ = ps.getParameter<edm::InputTag>("EBDigiCollection");

  for (int i = 0; i < 36; i++) {
    mePedMapG12_[i] = 0;
  }

}
EBPedestalOnlineTask::~EBPedestalOnlineTask ( ) [virtual]

Destructor.

Definition at line 48 of file EBPedestalOnlineTask.cc.

                                           {

}

Member Function Documentation

void EBPedestalOnlineTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 132 of file EBPedestalOnlineTask.cc.

References ecalMGPA::adc(), EcalMGPASample::adc(), EBDigiCollection_, MonitorElement::Fill(), EcalMGPASample::gainId(), edm::Event::getByLabel(), i, EBDetId::ic(), ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), LogDebug, mePedMapG12_, EcalDataFrame::sample(), and setup().

                                                                           {

  if ( ! init_ ) this->setup();

  ievt_++;

  edm::Handle<EBDigiCollection> digis;

  if ( e.getByLabel(EBDigiCollection_, digis) ) {

    int nebd = digis->size();
    LogDebug("EBPedestalOnlineTask") << "event " << ievt_ << " digi collection size " << nebd;

    for ( EBDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {

      EBDetId id = digiItr->id();

      int ic = id.ic();
      int ie = (ic-1)/20 + 1;
      int ip = (ic-1)%20 + 1;

      int ism = Numbers::iSM( id );

      float xie = ie - 0.5;
      float xip = ip - 0.5;

      EBDataFrame dataframe = (*digiItr);

      for (int i = 0; i < 3; i++) {

        int adc = dataframe.sample(i).adc();

        MonitorElement* mePedMap = 0;

        if ( dataframe.sample(i).gainId() == 1 ) mePedMap = mePedMapG12_[ism-1];
        if ( dataframe.sample(i).gainId() == 2 ) mePedMap = 0;
        if ( dataframe.sample(i).gainId() == 3 ) mePedMap = 0;

        float xval = float(adc);

        if ( mePedMap ) mePedMap->Fill(xie, xip, xval);

      }

    }

  } else {

    edm::LogWarning("EBPedestalOnlineTask") << EBDigiCollection_ << " not available";

  }

}
void EBPedestalOnlineTask::beginJob ( void  ) [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file EBPedestalOnlineTask.cc.

References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().

                                       {

  ievt_ = 0;

  if ( dqmStore_ ) {
    dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask");
    dqmStore_->rmdir(prefixME_ + "/EBPedestalOnlineTask");
  }

}
void EBPedestalOnlineTask::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 63 of file EBPedestalOnlineTask.cc.

References Numbers::initGeometry(), mergeRuns_, and reset().

                                                                           {

  Numbers::initGeometry(c, false);

  if ( ! mergeRuns_ ) this->reset();

}
void EBPedestalOnlineTask::cleanup ( void  ) [protected]

Cleanup.

Definition at line 105 of file EBPedestalOnlineTask.cc.

References dqmStore_, edm::getName(), i, init_, mePedMapG12_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().

Referenced by endJob().

                                      {

  if ( ! init_ ) return;

  if ( dqmStore_ ) {
    dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask");

    dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask/Gain12");
    for ( int i = 0; i < 36; i++ ) {
      if ( mePedMapG12_[i] ) dqmStore_->removeElement( mePedMapG12_[i]->getName() );
      mePedMapG12_[i] = 0;
    }

  }

  init_ = false;

}
void EBPedestalOnlineTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 124 of file EBPedestalOnlineTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                                     {

  edm::LogInfo("EBPedestalOnlineTask") << "analyzed " << ievt_ << " events";

  if ( enableCleanup_ ) this->cleanup();

}
void EBPedestalOnlineTask::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file EBPedestalOnlineTask.cc.

                                                                         {

}
void EBPedestalOnlineTask::reset ( void  ) [protected]

Reset.

Definition at line 75 of file EBPedestalOnlineTask.cc.

References i, mePedMapG12_, and MonitorElement::Reset().

Referenced by beginRun().

                                     {

  for (int i = 0; i < 36; i++) {
    if ( mePedMapG12_[i] ) mePedMapG12_[i]->Reset();
  }

}
void EBPedestalOnlineTask::setup ( void  ) [protected]

Setup.

Definition at line 83 of file EBPedestalOnlineTask.cc.

References DQMStore::bookProfile2D(), dqmStore_, i, init_, mePedMapG12_, mergeVDriftHistosByStation::name, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and DQMStore::tag().

Referenced by analyze().

                                    {

  init_ = true;

  std::string name;

  if ( dqmStore_ ) {
    dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask");

    dqmStore_->setCurrentFolder(prefixME_ + "/EBPedestalOnlineTask/Gain12");
    for (int i = 0; i < 36; i++) {
      name = "EBPOT pedestal " + Numbers::sEB(i+1) + " G12";
      mePedMapG12_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., 4096, 0., 4096., "s");
      mePedMapG12_[i]->setAxisTitle("ieta", 1);
      mePedMapG12_[i]->setAxisTitle("iphi", 2);
      dqmStore_->tag(mePedMapG12_[i], i+1);
    }

  }

}

Member Data Documentation

Definition at line 60 of file EBPedestalOnlineTask.h.

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

Definition at line 68 of file EBPedestalOnlineTask.h.

Referenced by analyze(), and EBPedestalOnlineTask().

Definition at line 64 of file EBPedestalOnlineTask.h.

Referenced by EBPedestalOnlineTask(), and endJob().

Definition at line 58 of file EBPedestalOnlineTask.h.

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

Definition at line 72 of file EBPedestalOnlineTask.h.

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

Definition at line 70 of file EBPedestalOnlineTask.h.

Referenced by analyze(), cleanup(), EBPedestalOnlineTask(), reset(), and setup().

Definition at line 66 of file EBPedestalOnlineTask.h.

Referenced by beginRun(), and EBPedestalOnlineTask().

std::string EBPedestalOnlineTask::prefixME_ [private]

Definition at line 62 of file EBPedestalOnlineTask.h.

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