#include <EBTimingTask.h>
Definition at line 20 of file EBTimingTask.h.
EBTimingTask::EBTimingTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 33 of file EBTimingTask.cc.
References dqmStore_, EcalRawDataCollection_, EcalRecHitCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, mergeRuns_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, 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); EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection"); EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection"); for (int i = 0; i < 36; i++) { meTime_[i] = 0; meTimeMap_[i] = 0; meTimeAmpli_[i] = 0; } meTimeAmpliSummary_ = 0; meTimeSummary1D_ = 0; meTimeSummaryMap_ = 0; meTimeSummaryMapProjEta_ = 0; meTimeSummaryMapProjPhi_ = 0; }
EBTimingTask::~EBTimingTask | ( | ) | [virtual] |
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().
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] |
Cleanup.
Definition at line 163 of file EBTimingTask.cc.
References dqmStore_, edm::getName(), MonitorElement::getName(), i, init_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().
Referenced by endJob().
{ if ( ! init_ ) return; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EBTimingTask"); for ( int i = 0; i < 36; i++ ) { if ( meTime_[i] ) dqmStore_->removeElement( meTime_[i]->getName() ); meTime_[i] = 0; if ( meTimeMap_[i] ) dqmStore_->removeElement( meTimeMap_[i]->getName() ); meTimeMap_[i] = 0; if ( meTimeAmpli_[i] ) dqmStore_->removeElement( meTimeAmpli_[i]->getName() ); meTimeAmpli_[i] = 0; } if ( meTimeAmpliSummary_ ) dqmStore_->removeElement( meTimeAmpliSummary_->getName() ); meTimeAmpliSummary_ = 0; if ( meTimeSummary1D_ ) dqmStore_->removeElement( meTimeSummary1D_->getName() ); meTimeSummary1D_ = 0; if ( meTimeSummaryMap_ ) dqmStore_->removeElement( meTimeSummaryMap_->getName() ); meTimeSummaryMap_ = 0; if ( meTimeSummaryMapProjEta_ ) dqmStore_->removeElement( meTimeSummaryMapProjEta_->getName() ); meTimeSummaryMapProjEta_ = 0; if ( meTimeSummaryMapProjPhi_ ) dqmStore_->removeElement( meTimeSummaryMapProjPhi_->getName() ); meTimeSummaryMapProjPhi_ = 0; } init_ = false; }
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] |
void EBTimingTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 89 of file EBTimingTask.cc.
References i, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, meTimeSummaryMapProjEta_, meTimeSummaryMapProjPhi_, and MonitorElement::Reset().
Referenced by beginRun().
{ for (int i = 0; i < 36; i++) { if ( meTime_[i] ) meTime_[i]->Reset(); if ( meTimeMap_[i] ) meTimeMap_[i]->Reset(); if ( meTimeAmpli_[i] ) meTimeAmpli_[i]->Reset(); } if ( meTimeAmpliSummary_ ) meTimeAmpliSummary_->Reset(); if ( meTimeSummary1D_ ) meTimeSummary1D_->Reset(); if ( meTimeSummaryMap_ ) meTimeSummaryMap_->Reset(); if ( meTimeSummaryMapProjEta_ ) meTimeSummaryMapProjEta_->Reset(); if ( meTimeSummaryMapProjPhi_ ) meTimeSummaryMapProjPhi_->Reset(); }
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); } }
DQMStore* EBTimingTask::dqmStore_ [private] |
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().
bool EBTimingTask::enableCleanup_ [private] |
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().
MonitorElement* EBTimingTask::meTime_[36] [private] |
Definition at line 73 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeAmpli_[36] [private] |
Definition at line 75 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeAmpliSummary_ [private] |
Definition at line 77 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeMap_[36] [private] |
Definition at line 74 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeSummary1D_ [private] |
Definition at line 78 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeSummaryMap_ [private] |
Definition at line 79 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement * EBTimingTask::meTimeSummaryMapProjEta_ [private] |
Definition at line 79 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement * EBTimingTask::meTimeSummaryMapProjPhi_ [private] |
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.