#include <EECosmicTask.h>
Public Member Functions | |
EECosmicTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~EECosmicTask () |
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 | |
DQMStore * | dqmStore_ |
edm::InputTag | EcalRawDataCollection_ |
edm::InputTag | EcalRecHitCollection_ |
edm::InputTag | EcalUncalibratedRecHitCollection_ |
bool | enableCleanup_ |
int | ievt_ |
bool | init_ |
double | maxJitter_ |
bool | mergeRuns_ |
MonitorElement * | meSelMap_ [18] |
MonitorElement * | meSpectrum_ [2][18] |
double | minJitter_ |
std::string | prefixME_ |
double | threshold_ |
Definition at line 20 of file EECosmicTask.h.
EECosmicTask::EECosmicTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 29 of file EECosmicTask.cc.
References dqmStore_, EcalRawDataCollection_, EcalRecHitCollection_, EcalUncalibratedRecHitCollection_, enableCleanup_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, init_, maxJitter_, mergeRuns_, meSelMap_, meSpectrum_, minJitter_, cppFunctionSkipper::operator, prefixME_, AlCaHLTBitMon_QueryRunRegistry::string, and threshold_.
{ 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"); EcalUncalibratedRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalUncalibratedRecHitCollection"); EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection"); threshold_ = 0.12500; // typical muon energy deposit is 250 MeV minJitter_ = -2.0; maxJitter_ = 1.5; for (int i = 0; i < 18; i++) { meSelMap_[i] = 0; meSpectrum_[0][i] = 0; meSpectrum_[1][i] = 0; } }
EECosmicTask::~EECosmicTask | ( | ) | [virtual] |
void EECosmicTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 164 of file EECosmicTask.cc.
References EcalDCCHeaderBlock::COSMIC, EcalDCCHeaderBlock::COSMICS_GLOBAL, EcalDCCHeaderBlock::COSMICS_LOCAL, EcalEndcap, EcalRawDataCollection_, EcalRecHitCollection_, EcalUncalibratedRecHitCollection_, MonitorElement::Fill(), edm::Event::getByLabel(), i, ievt_, init_, Numbers::iSM(), ecalpyutils::ism(), edm::HandleBase::isValid(), EEDetId::ix(), LogDebug, maxJitter_, meSelMap_, meSpectrum_, minJitter_, EcalDCCHeaderBlock::MTCC, EcalDCCHeaderBlock::PHYSICS_GLOBAL, EcalDCCHeaderBlock::PHYSICS_LOCAL, environment_file_cff::runType, setup(), Numbers::subDet(), threshold_, EEDetId::validDetId(), and EEDetId::XYMODE.
{ 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("EECosmicTask") << EcalRawDataCollection_ << " not available"; } if ( ! enable ) return; if ( ! init_ ) this->setup(); ievt_++; edm::Handle<EcalRecHitCollection> hits; if ( e.getByLabel(EcalRecHitCollection_, hits) ) { int neeh = hits->size(); LogDebug("EECosmicTask") << "event " << ievt_ << " hits collection size " << neeh; edm::Handle<EcalUncalibratedRecHitCollection> uhits; if ( ! e.getByLabel(EcalUncalibratedRecHitCollection_, uhits) ) { edm::LogWarning("EECosmicTask") << EcalUncalibratedRecHitCollection_ << " not available"; } for ( EcalRecHitCollection::const_iterator hitItr = hits->begin(); hitItr != hits->end(); ++hitItr ) { EEDetId id = hitItr->id(); int ix = id.ix(); int iy = id.iy(); int ism = Numbers::iSM( id ); if ( ism >= 1 && ism <= 9 ) ix = 101 - ix; float xix = ix - 0.5; float xiy = iy - 0.5; int iz = 0; if ( ism >= 1 && ism <= 9 ) iz = -1; if ( ism >= 10 && ism <= 18 ) iz = +1; 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; } float xval = hitItr->energy(); if ( xval <= 0. ) xval = 0.0; // look for the seeds float e3x3 = 0.; bool isSeed = true; // evaluate 3x3 matrix around a seed for(int icry=0; icry<9; ++icry) { unsigned int row = icry/3; unsigned int column = icry%3; int icryX = id.ix()+column-1; int icryY = id.iy()+row-1; if ( EEDetId::validDetId(icryX, icryY, iz) ) { EEDetId id3x3 = EEDetId(icryX, icryY, iz, EEDetId::XYMODE); if ( hits->find(id3x3) != hits->end() ) { float neighbourEnergy = hits->find(id3x3)->energy(); e3x3 += neighbourEnergy; if ( neighbourEnergy > xval ) isSeed = false; } } } // find the jitter of the seed float jitter = -999.; if ( isSeed ) { if ( uhits.isValid() ) { if ( uhits->find(id) != uhits->end() ) { jitter = uhits->find(id)->jitter(); } } } if ( isSeed && e3x3 >= threshold_ && jitter > minJitter_ && jitter < maxJitter_ ) { if ( meSelMap_[ism-1] ) meSelMap_[ism-1]->Fill(xix, xiy, e3x3); } if ( meSpectrum_[0][ism-1] ) meSpectrum_[0][ism-1]->Fill(xval); if ( isSeed && xval >= threshold_ && jitter > minJitter_ && jitter < maxJitter_ ) { if ( meSpectrum_[1][ism-1] ) meSpectrum_[1][ism-1]->Fill(e3x3); } } } else { edm::LogWarning("EECosmicTask") << EcalRecHitCollection_ << " not available"; } }
void EECosmicTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 62 of file EECosmicTask.cc.
References dqmStore_, ievt_, prefixME_, DQMStore::rmdir(), and DQMStore::setCurrentFolder().
void EECosmicTask::beginRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 73 of file EECosmicTask.cc.
References Numbers::initGeometry(), mergeRuns_, and reset().
{ Numbers::initGeometry(c, false); if ( ! mergeRuns_ ) this->reset(); }
void EECosmicTask::cleanup | ( | void | ) | [protected] |
Cleanup.
Definition at line 129 of file EECosmicTask.cc.
References dqmStore_, i, init_, meSelMap_, meSpectrum_, prefixME_, DQMStore::removeElement(), and DQMStore::setCurrentFolder().
Referenced by endJob().
{ if ( ! init_ ) return; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EECosmicTask"); dqmStore_->setCurrentFolder(prefixME_ + "/EECosmicTask/Sel"); for (int i = 0; i < 18; i++) { if ( meSelMap_[i] ) dqmStore_->removeElement( meSelMap_[i]->getName() ); meSelMap_[i] = 0; } dqmStore_->setCurrentFolder(prefixME_ + "/EECosmicTask/Spectrum"); for (int i = 0; i < 18; i++) { if ( meSpectrum_[0][i] ) dqmStore_->removeElement( meSpectrum_[0][i]->getName() ); meSpectrum_[0][i] = 0; if ( meSpectrum_[1][i] ) dqmStore_->removeElement( meSpectrum_[1][i]->getName() ); meSpectrum_[1][i] = 0; } } init_ = false; }
void EECosmicTask::endJob | ( | void | ) | [protected, virtual] |
EndJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 156 of file EECosmicTask.cc.
References cleanup(), enableCleanup_, and ievt_.
{ edm::LogInfo("EECosmicTask") << "analyzed " << ievt_ << " events"; if ( enableCleanup_ ) this->cleanup(); }
void EECosmicTask::endRun | ( | const edm::Run & | r, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
void EECosmicTask::reset | ( | void | ) | [protected] |
Reset.
Definition at line 85 of file EECosmicTask.cc.
References i, meSelMap_, meSpectrum_, and MonitorElement::Reset().
Referenced by beginRun().
{ for (int i = 0; i < 18; i++) { if ( meSelMap_[i] ) meSelMap_[i]->Reset(); if ( meSpectrum_[0][i] ) meSpectrum_[0][i]->Reset(); if ( meSpectrum_[1][i] ) meSpectrum_[1][i]->Reset(); } }
void EECosmicTask::setup | ( | void | ) | [protected] |
Setup.
Definition at line 95 of file EECosmicTask.cc.
References DQMStore::book1D(), DQMStore::bookProfile2D(), dqmStore_, i, init_, Numbers::ix0EE(), Numbers::iy0EE(), meSelMap_, meSpectrum_, mergeVDriftHistosByStation::name, prefixME_, Numbers::sEE(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by analyze().
{ init_ = true; std::string name; if ( dqmStore_ ) { dqmStore_->setCurrentFolder(prefixME_ + "/EECosmicTask"); dqmStore_->setCurrentFolder(prefixME_ + "/EECosmicTask/Sel"); for (int i = 0; i < 18; i++) { name = "EECT energy sel " + Numbers::sEE(i+1); meSelMap_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096., "s"); meSelMap_[i]->setAxisTitle("ix", 1); if ( i+1 >= 1 && i+1 <= 9 ) meSelMap_[i]->setAxisTitle("101-ix", 1); meSelMap_[i]->setAxisTitle("iy", 2); meSelMap_[i]->setAxisTitle("energy (GeV)", 3); } dqmStore_->setCurrentFolder(prefixME_ + "/EECosmicTask/Spectrum"); for (int i = 0; i < 18; i++) { name = "EECT 1x1 energy spectrum " + Numbers::sEE(i+1); meSpectrum_[0][i] = dqmStore_->book1D(name, name, 100, 0., 1.5); meSpectrum_[0][i]->setAxisTitle("energy (GeV)", 1); name = "EECT 3x3 energy spectrum " + Numbers::sEE(i+1); meSpectrum_[1][i] = dqmStore_->book1D(name, name, 100, 0., 1.5); meSpectrum_[1][i]->setAxisTitle("energy (GeV)", 1); } } }
DQMStore* EECosmicTask::dqmStore_ [private] |
Definition at line 60 of file EECosmicTask.h.
Referenced by beginJob(), cleanup(), EECosmicTask(), and setup().
Definition at line 68 of file EECosmicTask.h.
Referenced by analyze(), and EECosmicTask().
Definition at line 70 of file EECosmicTask.h.
Referenced by analyze(), and EECosmicTask().
Definition at line 69 of file EECosmicTask.h.
Referenced by analyze(), and EECosmicTask().
bool EECosmicTask::enableCleanup_ [private] |
Definition at line 64 of file EECosmicTask.h.
Referenced by EECosmicTask(), and endJob().
int EECosmicTask::ievt_ [private] |
Definition at line 58 of file EECosmicTask.h.
Referenced by analyze(), beginJob(), and endJob().
bool EECosmicTask::init_ [private] |
Definition at line 80 of file EECosmicTask.h.
Referenced by analyze(), cleanup(), EECosmicTask(), and setup().
double EECosmicTask::maxJitter_ [private] |
Definition at line 78 of file EECosmicTask.h.
Referenced by analyze(), and EECosmicTask().
bool EECosmicTask::mergeRuns_ [private] |
Definition at line 66 of file EECosmicTask.h.
Referenced by beginRun(), and EECosmicTask().
MonitorElement* EECosmicTask::meSelMap_[18] [private] |
Definition at line 72 of file EECosmicTask.h.
Referenced by analyze(), cleanup(), EECosmicTask(), reset(), and setup().
MonitorElement* EECosmicTask::meSpectrum_[2][18] [private] |
Definition at line 74 of file EECosmicTask.h.
Referenced by analyze(), cleanup(), EECosmicTask(), reset(), and setup().
double EECosmicTask::minJitter_ [private] |
Definition at line 77 of file EECosmicTask.h.
Referenced by analyze(), and EECosmicTask().
std::string EECosmicTask::prefixME_ [private] |
Definition at line 62 of file EECosmicTask.h.
Referenced by beginJob(), cleanup(), EECosmicTask(), and setup().
double EECosmicTask::threshold_ [private] |
Definition at line 76 of file EECosmicTask.h.
Referenced by analyze(), and EECosmicTask().