CMS 3D CMS Logo

Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes

EBTimingTask Class Reference

#include <EBTimingTask.h>

Inheritance diagram for EBTimingTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

Static Public Attributes

static const float shiftProf2D = 50.

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 EcalRawDataCollection_
edm::InputTag EcalRecHitCollection_
bool enableCleanup_
int ievt_
bool init_
bool mergeRuns_
MonitorElementmeTime_ [36]
MonitorElementmeTimeAmpli_ [36]
MonitorElementmeTimeAmpliSummary_
MonitorElementmeTimeMap_ [36]
MonitorElementmeTimeSummary1D_
MonitorElementmeTimeSummaryMap_
MonitorElementmeTimeSummaryMapProjEta_
MonitorElementmeTimeSummaryMapProjPhi_
std::string prefixME_

Detailed Description

Definition at line 20 of file EBTimingTask.h.


Constructor & Destructor Documentation

EBTimingTask::EBTimingTask ( const edm::ParameterSet ps)
EBTimingTask::~EBTimingTask ( ) [virtual]

Destructor.

Definition at line 62 of file EBTimingTask.cc.

                           {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 210 of file EBTimingTask.cc.

References EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, EcalBarrel, EcalRawDataCollection_, EcalRecHitCollection_, MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByLabel(), i, EBDetId::ic(), ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), EcalRecHit::kGood, EcalRecHit::kOutOfTime, EcalSeverityLevelAlgo::kWeird, LogDebug, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, EcalDCCHeaderBlock::MTCC, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, setup(), shiftProf2D, and Numbers::subDet().

                                                                   {

  bool isData = true;
  bool enable = false;
  int runType[36];
  for (int i=0; i<36; i++) runType[i] = -1;

  edm::Handle<EcalRawDataCollection> dcchs;

  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {

    for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {

      if ( Numbers::subDet( *dcchItr ) != EcalBarrel ) continue;

      int ism = Numbers::iSM( *dcchItr, EcalBarrel );

      runType[ism-1] = dcchItr->getRunType();

      if ( dcchItr->getRunType() == EcalDCCHeaderBlock::COSMIC ||
           dcchItr->getRunType() == EcalDCCHeaderBlock::MTCC ||
           dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
           dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
           dcchItr->getRunType() == EcalDCCHeaderBlock::COSMICS_LOCAL ||
           dcchItr->getRunType() == EcalDCCHeaderBlock::PHYSICS_LOCAL ) enable = true;

    }

  } else {

    isData = false; enable = true;
    edm::LogWarning("EBTimingTask") << EcalRawDataCollection_ << " not available";

  }

  if ( ! enable ) return;

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

  ievt_++;

  edm::ESHandle<EcalSeverityLevelAlgo> sevlv;
  c.get<EcalSeverityLevelAlgoRcd>().get(sevlv);

  edm::Handle<EcalRecHitCollection> hits;

  if ( e.getByLabel(EcalRecHitCollection_, hits) ) {

    int neh = hits->size();
    LogDebug("EBTimingTask") << "event " << ievt_ << " hits collection size " << neh;

    for ( EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) {

      EBDetId id = hitItr->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;

      if ( isData ) {

        if ( ! ( runType[ism-1] == EcalDCCHeaderBlock::COSMIC ||
                 runType[ism-1] == EcalDCCHeaderBlock::MTCC ||
                 runType[ism-1] == EcalDCCHeaderBlock::COSMICS_GLOBAL ||
                 runType[ism-1] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
                 runType[ism-1] == EcalDCCHeaderBlock::COSMICS_LOCAL ||
                 runType[ism-1] == EcalDCCHeaderBlock::PHYSICS_LOCAL ) ) continue;

      }

      MonitorElement* meTime = 0;
      MonitorElement* meTimeMap = 0;
      MonitorElement* meTimeAmpli = 0;

      meTime = meTime_[ism-1];
      meTimeMap = meTimeMap_[ism-1];
      meTimeAmpli = meTimeAmpli_[ism-1];

      float xval = hitItr->energy();
      float yval = hitItr->time();

      uint32_t flag = hitItr->recoFlag();

      uint32_t sev = sevlv->severityLevel(id, *hits);

      if ( (flag == EcalRecHit::kGood || flag == EcalRecHit::kOutOfTime) && sev != EcalSeverityLevelAlgo::kWeird ) {
        if ( meTimeAmpli ) meTimeAmpli->Fill(xval, yval);
        if ( meTimeAmpliSummary_ ) meTimeAmpliSummary_->Fill(xval, yval);

        if ( xval > 0.480 ) {
          if ( meTime ) meTime->Fill(yval);
          if ( meTimeMap ) meTimeMap->Fill(xie, xip, yval+shiftProf2D);
          if ( meTimeSummary1D_ ) meTimeSummary1D_->Fill(yval);

          float xebeta = id.ieta() - 0.5 * id.zside();
          float xebphi = id.iphi() - 0.5;
          if ( meTimeSummaryMap_ ) meTimeSummaryMap_->Fill(xebphi, xebeta, yval+shiftProf2D);
          if ( meTimeSummaryMapProjEta_ ) meTimeSummaryMapProjEta_->Fill(xebeta, yval);
          if ( meTimeSummaryMapProjPhi_ ) meTimeSummaryMapProjPhi_->Fill(xebphi, yval);
        }

      }
    }

  } else {

    edm::LogWarning("EBTimingTask") << EcalRecHitCollection_ << " not available";

  }

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 66 of file EBTimingTask.cc.

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

                               {

  ievt_ = 0;

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file EBTimingTask.cc.

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

                                                                   {

  Numbers::initGeometry(c, false);

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

}
void EBTimingTask::cleanup ( void  ) [protected]
void EBTimingTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 202 of file EBTimingTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                             {

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

  if ( enableCleanup_ ) this->cleanup();

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 85 of file EBTimingTask.cc.

                                                                 {

}
void EBTimingTask::reset ( void  ) [protected]
void EBTimingTask::setup ( void  ) [protected]

Setup.

Definition at line 105 of file EBTimingTask.cc.

References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile(), DQMStore::bookProfile2D(), dqmStore_, trackerHits::histo, i, init_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), shiftProf2D, and DQMStore::tag().

Referenced by analyze().

                            {

  init_ = true;

  char histo[200];

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

    for (int i = 0; i < 36; i++) {
      sprintf(histo, "EBTMT timing 1D %s", Numbers::sEB(i+1).c_str());
      meTime_[i] = dqmStore_->book1D(histo, histo, 50, -50., 50.);
      meTime_[i]->setAxisTitle("time (ns)", 1);
      dqmStore_->tag(meTime_[i], i+1);

      sprintf(histo, "EBTMT timing %s", Numbers::sEB(i+1).c_str());
      meTimeMap_[i] = dqmStore_->bookProfile2D(histo, histo, 85, 0., 85., 20, 0., 20., 50, -25.+shiftProf2D, 25.+shiftProf2D, "s");
      meTimeMap_[i]->setAxisTitle("ieta", 1);
      meTimeMap_[i]->setAxisTitle("iphi", 2);
      meTimeMap_[i]->setAxisTitle("time (ns)", 3);
      dqmStore_->tag(meTimeMap_[i], i+1);

      sprintf(histo, "EBTMT timing vs amplitude %s", Numbers::sEB(i+1).c_str());
      meTimeAmpli_[i] = dqmStore_->book2D(histo, histo, 100, 0., 10., 50, -50., 50.);
      meTimeAmpli_[i]->setAxisTitle("energy (GeV)", 1);
      meTimeAmpli_[i]->setAxisTitle("time (ns)", 2);
      dqmStore_->tag(meTimeAmpli_[i], i+1);
    }

    sprintf(histo, "EBTMT timing vs amplitude summary");
    meTimeAmpliSummary_ = dqmStore_->book2D(histo, histo, 100, 0., 10., 50, -50., 50.);
    meTimeAmpliSummary_->setAxisTitle("energy (GeV)", 1);
    meTimeAmpliSummary_->setAxisTitle("time (ns)", 2);

    sprintf(histo, "EBTMT timing 1D summary");
    meTimeSummary1D_ = dqmStore_->book1D(histo, histo, 50, -50., 50.);
    meTimeSummary1D_->setAxisTitle("time (ns)", 1);

    sprintf(histo, "EBTMT timing map");
    meTimeSummaryMap_ = dqmStore_->bookProfile2D(histo, histo, 72, 0., 360., 34, -85, 85, 50, -25.+shiftProf2D, 25.+shiftProf2D, "s");
    meTimeSummaryMap_->setAxisTitle("jphi", 1);
    meTimeSummaryMap_->setAxisTitle("jeta", 2);
    meTimeSummaryMap_->setAxisTitle("time (ns)", 3);

    sprintf(histo, "EBTMT timing projection eta");
    meTimeSummaryMapProjEta_ = dqmStore_->bookProfile(histo, histo, 34, -85., 85., 50, -25., 25., "s");
    meTimeSummaryMapProjEta_->setAxisTitle("jeta", 1);
    meTimeSummaryMapProjEta_->setAxisTitle("time (ns)", 2);

    sprintf(histo, "EBTMT timing projection phi");
    meTimeSummaryMapProjPhi_ = dqmStore_->bookProfile(histo, histo, 72, 0., 360., 50, -25., 25., "s");
    meTimeSummaryMapProjPhi_->setAxisTitle("jphi", 1);
    meTimeSummaryMapProjPhi_->setAxisTitle("time (ns)", 2);

  }

}

Member Data Documentation

Definition at line 62 of file EBTimingTask.h.

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

Definition at line 70 of file EBTimingTask.h.

Referenced by analyze(), and EBTimingTask().

Definition at line 71 of file EBTimingTask.h.

Referenced by analyze(), and EBTimingTask().

Definition at line 66 of file EBTimingTask.h.

Referenced by EBTimingTask(), and endJob().

int EBTimingTask::ievt_ [private]

Definition at line 60 of file EBTimingTask.h.

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

bool EBTimingTask::init_ [private]

Definition at line 81 of file EBTimingTask.h.

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

bool EBTimingTask::mergeRuns_ [private]

Definition at line 68 of file EBTimingTask.h.

Referenced by beginRun(), and EBTimingTask().

Definition at line 73 of file EBTimingTask.h.

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

Definition at line 75 of file EBTimingTask.h.

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

Definition at line 77 of file EBTimingTask.h.

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

Definition at line 74 of file EBTimingTask.h.

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

Definition at line 78 of file EBTimingTask.h.

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

Definition at line 79 of file EBTimingTask.h.

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

Definition at line 79 of file EBTimingTask.h.

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

Definition at line 79 of file EBTimingTask.h.

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

std::string EBTimingTask::prefixME_ [private]

Definition at line 64 of file EBTimingTask.h.

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

const float EBTimingTask::shiftProf2D = 50. [static]

Definition at line 30 of file EBTimingTask.h.

Referenced by analyze(), and setup().