#include <EBTimingTask.h>
Definition at line 20 of file EBTimingTask.h.
EBTimingTask::EBTimingTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 36 of file EBTimingTask.cc.
References dqmStore_, EcalRawDataCollection_, EcalRecHitCollection_, enableCleanup_, energyThreshold_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, L1GtEvmReadoutRecord_, mergeRuns_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, cppFunctionSkipper::operator, prefixME_, stableBeamsDeclared_, AlCaHLTBitMon_QueryRunRegistry::string, and useBeamStatus_.
{ 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); energyThreshold_ = ps.getUntrackedParameter<double>("energyTreshold",1.0); EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection"); EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection"); L1GtEvmReadoutRecord_ = ps.getParameter<edm::InputTag>("L1GtEvmReadoutRecord"); useBeamStatus_ = ps.getUntrackedParameter<bool>("useBeamStatus", false); for (int i = 0; i < 36; i++) { meTime_[i] = 0; meTimeMap_[i] = 0; meTimeAmpli_[i] = 0; } meTimeAmpliSummary_ = 0; meTimeSummary1D_ = 0; meTimeSummaryMap_ = 0; stableBeamsDeclared_ = false; }
EBTimingTask::~EBTimingTask | ( | ) | [virtual] |
void EBTimingTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 218 of file EBTimingTask.cc.
References EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, EcalBarrel, EcalRawDataCollection_, EcalRecHitCollection_, energyThreshold_, MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByLabel(), i, EBDetId::ic(), ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), EcalRecHit::kGood, EcalRecHit::kOutOfTime, EcalSeverityLevel::kWeird, L1GtEvmReadoutRecord_, LogDebug, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, EcalDCCHeaderBlock::MTCC, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, reset(), environment_file_cff::runType, setup(), shiftProf2D_, stableBeamsDeclared_, Numbers::subDet(), and useBeamStatus_.
{ const unsigned STABLE_BEAMS = 11; 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_++; // resetting plots when stable beam is declared if( useBeamStatus_ && !stableBeamsDeclared_ ) { edm::Handle<L1GlobalTriggerEvmReadoutRecord> gtRecord; if( e.getByLabel(L1GtEvmReadoutRecord_, gtRecord) ) { unsigned lhcBeamMode = gtRecord->gtfeWord().beamMode(); if( lhcBeamMode == STABLE_BEAMS ){ reset(); stableBeamsDeclared_ = true; } } } 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 != EcalSeverityLevel::kWeird ) { if ( meTimeAmpli ) meTimeAmpli->Fill(xval, yval); if ( meTimeAmpliSummary_ ) meTimeAmpliSummary_->Fill(xval, yval); if ( xval > energyThreshold_ ) { 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_); } } } } else { edm::LogWarning("EBTimingTask") << EcalRecHitCollection_ << " not available"; } }
void EBTimingTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 75 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 86 of file EBTimingTask.cc.
References Numbers::initGeometry(), mergeRuns_, reset(), and stableBeamsDeclared_.
{ Numbers::initGeometry(c, false); if ( ! mergeRuns_ ) this->reset(); stableBeamsDeclared_ = false; }
void EBTimingTask::cleanup | ( | void | ) | [protected] |
Cleanup.
Definition at line 177 of file EBTimingTask.cc.
References dqmStore_, MonitorElement::getName(), i, init_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, 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; } init_ = false; }
void EBTimingTask::endJob | ( | void | ) | [protected, virtual] |
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 210 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 100 of file EBTimingTask.cc.
References i, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, and MonitorElement::Reset().
Referenced by analyze(), and 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(); }
void EBTimingTask::setup | ( | void | ) | [protected] |
Setup.
Definition at line 114 of file EBTimingTask.cc.
References DQMStore::book1D(), DQMStore::book2D(), DQMStore::bookProfile2D(), dqmStore_, i, init_, meTime_, meTimeAmpli_, meTimeAmpliSummary_, meTimeMap_, meTimeSummary1D_, meTimeSummaryMap_, mergeVDriftHistosByStation::name, funct::pow(), prefixME_, Numbers::sEB(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), shiftProf2D_, AlCaHLTBitMon_QueryRunRegistry::string, and DQMStore::tag().
Referenced by analyze().
{ init_ = true; std::string name; // for timing vs amplitude plots const int nbinsE = 25; const float minlogE = -0.5; const float maxlogE = 2.; float binEdgesE[nbinsE + 1]; for(int i = 0; i <= nbinsE; i++) binEdgesE[i] = std::pow((float)10., minlogE + (maxlogE - minlogE) / nbinsE * i); const int nbinsT = 200; const float minT = -50.; const float maxT = 50.; float binEdgesT[nbinsT + 1]; for(int i = 0; i <= nbinsT; i++) binEdgesT[i] = minT + (maxT - minT) / nbinsT * i; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EBTimingTask"); for (int i = 0; i < 36; i++) { name = "EBTMT timing 1D " + Numbers::sEB(i+1); meTime_[i] = dqmStore_->book1D(name, name, 50, -25., 25.); meTime_[i]->setAxisTitle("time (ns)", 1); dqmStore_->tag(meTime_[i], i+1); name = "EBTMT timing " + Numbers::sEB(i+1); meTimeMap_[i] = dqmStore_->bookProfile2D(name, name, 85, 0., 85., 20, 0., 20., -20.+shiftProf2D_, 20.+shiftProf2D_, "s"); meTimeMap_[i]->setAxisTitle("ieta", 1); meTimeMap_[i]->setAxisTitle("iphi", 2); meTimeMap_[i]->setAxisTitle("time (ns)", 3); dqmStore_->tag(meTimeMap_[i], i+1); name = "EBTMT timing vs amplitude " + Numbers::sEB(i+1); meTimeAmpli_[i] = dqmStore_->book2D(name, name, nbinsE, binEdgesE, nbinsT, binEdgesT); meTimeAmpli_[i]->setAxisTitle("energy (GeV)", 1); meTimeAmpli_[i]->setAxisTitle("time (ns)", 2); dqmStore_->tag(meTimeAmpli_[i], i+1); } name = "EBTMT timing vs amplitude summary"; meTimeAmpliSummary_ = dqmStore_->book2D(name, name, nbinsE, binEdgesE, nbinsT, binEdgesT); meTimeAmpliSummary_->setAxisTitle("energy (GeV)", 1); meTimeAmpliSummary_->setAxisTitle("time (ns)", 2); name = "EBTMT timing 1D summary"; meTimeSummary1D_ = dqmStore_->book1D(name, name, 50, -25., 25.); meTimeSummary1D_->setAxisTitle("time (ns)", 1); name = "EBTMT timing map"; meTimeSummaryMap_ = dqmStore_->bookProfile2D(name, name, 72, 0., 360., 34, -85, 85, -20.+shiftProf2D_, 20.+shiftProf2D_, "s"); meTimeSummaryMap_->setAxisTitle("jphi", 1); meTimeSummaryMap_->setAxisTitle("jeta", 2); meTimeSummaryMap_->setAxisTitle("time (ns)", 3); } }
DQMStore* EBTimingTask::dqmStore_ [private] |
Definition at line 62 of file EBTimingTask.h.
Referenced by beginJob(), cleanup(), EBTimingTask(), and setup().
Definition at line 72 of file EBTimingTask.h.
Referenced by analyze(), and EBTimingTask().
Definition at line 73 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().
float EBTimingTask::energyThreshold_ [private] |
Definition at line 70 of file EBTimingTask.h.
Referenced by analyze(), and EBTimingTask().
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 84 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), and setup().
Definition at line 74 of file EBTimingTask.h.
Referenced by analyze(), and EBTimingTask().
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 76 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeAmpli_[36] [private] |
Definition at line 78 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeAmpliSummary_ [private] |
Definition at line 80 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeMap_[36] [private] |
Definition at line 77 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeSummary1D_ [private] |
Definition at line 81 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement* EBTimingTask::meTimeSummaryMap_ [private] |
Definition at line 82 of file EBTimingTask.h.
Referenced by analyze(), cleanup(), EBTimingTask(), reset(), and setup().
MonitorElement * EBTimingTask::meTimeSummaryMapProjEta_ [private] |
Definition at line 82 of file EBTimingTask.h.
MonitorElement * EBTimingTask::meTimeSummaryMapProjPhi_ [private] |
Definition at line 82 of file EBTimingTask.h.
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.
bool EBTimingTask::stableBeamsDeclared_ [private] |
Definition at line 87 of file EBTimingTask.h.
Referenced by analyze(), beginRun(), and EBTimingTask().
bool EBTimingTask::useBeamStatus_ [private] |
Definition at line 86 of file EBTimingTask.h.
Referenced by analyze(), and EBTimingTask().