CMS 3D CMS Logo

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

EETimingTask Class Reference

#include <EETimingTask.h>

Inheritance diagram for EETimingTask:
edm::EDAnalyzer

List of all members.

Public Member Functions

 EETimingTask (const edm::ParameterSet &ps)
 Constructor.
virtual ~EETimingTask ()
 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 initCaloGeometry_
bool mergeRuns_
MonitorElementmeTime_ [18]
MonitorElementmeTimeAmpli_ [18]
MonitorElementmeTimeAmpliSummary_ [2]
MonitorElementmeTimeDelta2D_
MonitorElementmeTimeDelta_
MonitorElementmeTimeMap_ [18]
MonitorElementmeTimeSummary1D_ [2]
MonitorElementmeTimeSummaryMap_ [2]
MonitorElementmeTimeSummaryMapProjEta_ [2]
MonitorElementmeTimeSummaryMapProjPhi_ [2]
edm::ESHandle< CaloGeometrypGeometry_
std::string prefixME_

Detailed Description

Definition at line 26 of file EETimingTask.h.


Constructor & Destructor Documentation

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

Destructor.

Definition at line 69 of file EETimingTask.cc.

                           {

}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 270 of file EETimingTask.cc.

References abs, EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, EcalEndcap, EcalRawDataCollection_, EcalRecHitCollection_, eta(), PV3DBase< T, PVType, FrameType >::eta(), MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByLabel(), i, ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), EEDetId::ix(), EcalRecHit::kGood, EcalRecHit::kOutOfTime, EcalSeverityLevelAlgo::kWeird, LogDebug, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeDelta2D_, meTimeDelta_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, EcalDCCHeaderBlock::MTCC, pGeometry_, PV3DBase< T, PVType, FrameType >::phi(), phi, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, pos, setup(), shiftProf2D, funct::sin(), Numbers::subDet(), theta(), and PV3DBase< T, PVType, FrameType >::theta().

                                                                   {

  bool isData = true;
  bool enable = false;
  int runType[18];
  for (int i=0; i<18; 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 ) != EcalEndcap ) continue;

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

      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("EETimingTask") << EcalRawDataCollection_ << " not available";

  }

  if ( ! enable ) return;

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

  ievt_++;

  float sumTime_hithr[2] = {0.,0.};
  int n_hithr[2] = {0,0};

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

  edm::Handle<EcalRecHitCollection> hits;

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

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

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

      EEDetId id = hitItr->id();

      int ix = id.ix();
      int iy = id.iy();
      int iz = ( id.positiveZ() ) ? 1 : 0;

      int ism = Numbers::iSM( id );

      if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;

      float xix = ix - 0.5;
      float xiy = iy - 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 );

      const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();

      float theta = pos.theta();
      float eta = pos.eta();
      float phi = pos.phi();

      float et = hitItr->energy() * std::abs(sin(theta));

      if ( (flag == EcalRecHit::kGood || flag == EcalRecHit::kOutOfTime) && sev != EcalSeverityLevelAlgo::kWeird ) {
        if ( meTimeAmpli ) meTimeAmpli->Fill(xval, yval);
        if ( meTimeAmpliSummary_[iz] ) meTimeAmpliSummary_[iz]->Fill(xval, yval);
        if ( et > 0.600 ) {
          if ( meTimeMap ) meTimeMap->Fill(xix, xiy, yval+shiftProf2D);
          if ( meTime ) meTime->Fill(yval);
          if ( meTimeSummary1D_[iz] ) meTimeSummary1D_[iz]->Fill(yval);

          if ( meTimeSummaryMap_[iz] ) meTimeSummaryMap_[iz]->Fill(id.ix()-0.5, xiy, yval+shiftProf2D);
          if ( meTimeSummaryMapProjEta_[iz] ) meTimeSummaryMapProjEta_[iz]->Fill(eta, yval);
          if ( meTimeSummaryMapProjPhi_[iz] ) meTimeSummaryMapProjPhi_[iz]->Fill(phi, yval);

          sumTime_hithr[iz] += yval;
          n_hithr[iz]++;
        }
      } // good rh for timing
    } // loop over rh

    if (n_hithr[0] > 0 && n_hithr[1] > 0 ) {
      if ( meTimeDelta_ ) meTimeDelta_->Fill( sumTime_hithr[1]/n_hithr[1] - sumTime_hithr[0]/n_hithr[0] );
      if ( meTimeDelta2D_ ) meTimeDelta2D_->Fill( sumTime_hithr[1]/n_hithr[1], sumTime_hithr[0]/n_hithr[0] );
    }

  } else {

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

  }

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file EETimingTask.cc.

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

                               {

  ievt_ = 0;

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file EETimingTask.cc.

References edm::EventSetup::get(), initCaloGeometry_, Numbers::initGeometry(), mergeRuns_, pGeometry_, and reset().

                                                                   {

  Numbers::initGeometry(c, true);

  if( !initCaloGeometry_ ) {
    c.get<CaloGeometryRecord>().get(pGeometry_);
    initCaloGeometry_ = true;
  }

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

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

Cleanup.

Definition at line 215 of file EETimingTask.cc.

References dqmStore_, edm::getName(), MonitorElement::getName(), i, init_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeDelta2D_, meTimeDelta_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().

Referenced by endJob().

void EETimingTask::endJob ( void  ) [protected, virtual]

EndJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 262 of file EETimingTask.cc.

References cleanup(), enableCleanup_, and ievt_.

                             {

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

  if ( enableCleanup_ ) this->cleanup();

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

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 97 of file EETimingTask.cc.

                                                                 {

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

Setup.

Definition at line 122 of file EETimingTask.cc.

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

Referenced by analyze().

                            {

  init_ = true;

  char histo[200];

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

    for (int i = 0; i < 18; i++) {
      sprintf(histo, "EETMT timing 1D %s", Numbers::sEE(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, "EETMT timing %s", Numbers::sEE(i+1).c_str());
      meTimeMap_[i] = dqmStore_->bookProfile2D(histo, histo, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., -25.+shiftProf2D, 25.+shiftProf2D, "s");
      meTimeMap_[i]->setAxisTitle("ix", 1);
      if ( i+1 >= 1 && i+1 <= 9 ) meTimeMap_[i]->setAxisTitle("101-ix", 1);
      meTimeMap_[i]->setAxisTitle("iy", 2);
      meTimeMap_[i]->setAxisTitle("time (ns)", 3);
      dqmStore_->tag(meTimeMap_[i], i+1);

      sprintf(histo, "EETMT timing vs amplitude %s", Numbers::sEE(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, "EETMT timing vs amplitude summary EE -");
    meTimeAmpliSummary_[0] = dqmStore_->book2D(histo, histo, 100, 0., 10., 50, -50., 50.);
    meTimeAmpliSummary_[0]->setAxisTitle("energy (GeV)", 1);
    meTimeAmpliSummary_[0]->setAxisTitle("time (ns)", 2);

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

    sprintf(histo, "EETMT timing 1D summary EE -");
    meTimeSummary1D_[0] = dqmStore_->book1D(histo, histo, 50, -50., 50.);
    meTimeSummary1D_[0]->setAxisTitle("time (ns)", 1);

    sprintf(histo, "EETMT timing 1D summary EE +");
    meTimeSummary1D_[1] = dqmStore_->book1D(histo, histo, 50, -50., 50.);
    meTimeSummary1D_[1]->setAxisTitle("time (ns)", 1);

    sprintf(histo, "EETMT timing map EE -");
    meTimeSummaryMap_[0] = dqmStore_->bookProfile2D(histo, histo, 20, 0., 100., 20, 0., 100., 50, -25.+shiftProf2D, 25.+shiftProf2D, "s");
    meTimeSummaryMap_[0]->setAxisTitle("ix'", 1);
    meTimeSummaryMap_[0]->setAxisTitle("101-iy'", 2);
    meTimeSummaryMap_[0]->setAxisTitle("time (ns)", 3);

    sprintf(histo, "EETMT timing map EE +");
    meTimeSummaryMap_[1] = dqmStore_->bookProfile2D(histo, histo, 20, 0., 100., 20, 0., 100., 50, -25.+shiftProf2D, 25.+shiftProf2D, "s");
    meTimeSummaryMap_[1]->setAxisTitle("ix'", 1);
    meTimeSummaryMap_[1]->setAxisTitle("iy'", 2);
    meTimeSummaryMap_[1]->setAxisTitle("time (ns)", 3);

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

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

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

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

    sprintf(histo, "EETMT timing EE+ - EE-");
    meTimeDelta_ = dqmStore_->book1D(histo, histo, 100, -3., 3.);
    meTimeDelta_->setAxisTitle("time (ns)", 1);

    sprintf(histo, "EETMT timing EE+ vs EE-");
    meTimeDelta2D_ = dqmStore_->book2D(histo, histo, 50, -50., 50., 50, -50., 50.);
    meTimeDelta2D_->setAxisTitle("EE+ average time (ns)", 1);
    meTimeDelta2D_->setAxisTitle("EE- average time (ns)", 2);

  }

}

Member Data Documentation

Definition at line 68 of file EETimingTask.h.

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

Definition at line 76 of file EETimingTask.h.

Referenced by analyze(), and EETimingTask().

Definition at line 77 of file EETimingTask.h.

Referenced by analyze(), and EETimingTask().

Definition at line 72 of file EETimingTask.h.

Referenced by EETimingTask(), and endJob().

int EETimingTask::ievt_ [private]

Definition at line 66 of file EETimingTask.h.

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

bool EETimingTask::init_ [private]

Definition at line 90 of file EETimingTask.h.

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

Definition at line 91 of file EETimingTask.h.

Referenced by beginRun(), and EETimingTask().

bool EETimingTask::mergeRuns_ [private]

Definition at line 74 of file EETimingTask.h.

Referenced by beginRun(), and EETimingTask().

Definition at line 79 of file EETimingTask.h.

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

Definition at line 81 of file EETimingTask.h.

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

Definition at line 83 of file EETimingTask.h.

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

Definition at line 86 of file EETimingTask.h.

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

Definition at line 86 of file EETimingTask.h.

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

Definition at line 80 of file EETimingTask.h.

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

Definition at line 84 of file EETimingTask.h.

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

Definition at line 85 of file EETimingTask.h.

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

Definition at line 85 of file EETimingTask.h.

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

Definition at line 85 of file EETimingTask.h.

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

Definition at line 88 of file EETimingTask.h.

Referenced by analyze(), and beginRun().

std::string EETimingTask::prefixME_ [private]

Definition at line 70 of file EETimingTask.h.

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

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

Definition at line 36 of file EETimingTask.h.

Referenced by analyze(), and setup().