#include <HcalNoiseRates.h>
Public Member Functions | |
HcalNoiseRates (const edm::ParameterSet &) | |
~HcalNoiseRates () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
virtual void | endJob () |
Private Attributes | |
DQMStore * | dbe_ |
MonitorElement * | hLumiBlockCount_ |
MonitorElement * | hRBXEnergy_ |
MonitorElement * | hRBXEnergyType1_ |
MonitorElement * | hRBXEnergyType2_ |
MonitorElement * | hRBXEnergyType3_ |
MonitorElement * | hRBXNHits_ |
std::map< int, int > | lumiCountMap_ |
double | minHitEnergy_ |
double | minRBXEnergy_ |
std::string | outputFile_ |
edm::InputTag | rbxCollName_ |
bool | useAllHistos_ |
Definition at line 39 of file HcalNoiseRates.h.
HcalNoiseRates::HcalNoiseRates | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 18 of file HcalNoiseRates.cc.
References dbe_, edm::ParameterSet::getUntrackedParameter(), interpolateCardsSimple::histo, hLumiBlockCount_, hRBXEnergy_, hRBXEnergyType1_, hRBXEnergyType2_, hRBXEnergyType3_, hRBXNHits_, minHitEnergy_, minRBXEnergy_, cppFunctionSkipper::operator, outputFile_, rbxCollName_, and useAllHistos_.
{ // DQM ROOT output outputFile_ = iConfig.getUntrackedParameter<std::string>("outputFile","myfile.root"); dbe_ = 0; // get hold of back-end interface dbe_ = edm::Service<DQMStore>().operator->(); Char_t histo[100]; if ( dbe_ ) { dbe_->setCurrentFolder("HcalNoiseRatesD/HcalNoiseRatesTask"); } // set parameters rbxCollName_ = iConfig.getUntrackedParameter<edm::InputTag>("rbxCollName"); minRBXEnergy_ = iConfig.getUntrackedParameter<double>("minRBXEnergy"); minHitEnergy_ = iConfig.getUntrackedParameter<double>("minHitEnergy"); useAllHistos_ = iConfig.getUntrackedParameter<bool>("useAllHistos", false); // book histograms //Lumi block is not drawn; the rest are if (useAllHistos_){ sprintf (histo, "hLumiBlockCount" ); hLumiBlockCount_ = dbe_->book1D(histo, histo, 1, -0.5, 0.5); } sprintf (histo, "hRBXEnergy" ); hRBXEnergy_ = dbe_->book1D(histo, histo, 300, 0, 3000); sprintf (histo, "hRBXEnergyType1" ); hRBXEnergyType1_ = dbe_->book1D(histo, histo, 300, 0, 3000); sprintf (histo, "hRBXEnergyType2" ); hRBXEnergyType2_ = dbe_->book1D(histo, histo, 300, 0, 3000); sprintf (histo, "hRBXEnergyType3" ); hRBXEnergyType3_ = dbe_->book1D(histo, histo, 300, 0, 3000); sprintf (histo, "hRBXNHits" ); hRBXNHits_ = dbe_->book1D(histo, histo, 73,-0.5,72.5); }
HcalNoiseRates::~HcalNoiseRates | ( | ) |
Definition at line 67 of file HcalNoiseRates.cc.
{ }
void HcalNoiseRates::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | evSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 78 of file HcalNoiseRates.cc.
References relval_parameters_module::energy, Exception, MonitorElement::Fill(), edm::Event::getByLabel(), patZpeak::handle, hRBXEnergy_, hRBXEnergyType1_, hRBXEnergyType2_, hRBXEnergyType3_, hRBXNHits_, edm::HandleBase::isValid(), lumiCountMap_, edm::EventBase::luminosityBlock(), minHitEnergy_, minRBXEnergy_, reco::HcalNoiseRBX::numRecHits(), edm::errors::ProductNotFound, rbxCollName_, and reco::HcalNoiseRBX::recHitEnergy().
{ // get the lumi section int lumiSection = iEvent.luminosityBlock(); lumiCountMap_[lumiSection]++; // get the RBX Noise collection edm::Handle<reco::HcalNoiseRBXCollection> handle; iEvent.getByLabel(rbxCollName_,handle); if(!handle.isValid()) { throw edm::Exception(edm::errors::ProductNotFound) << " could not find HcalNoiseRBXCollection named " << rbxCollName_ << ".\n"; return; } // loop over the RBXs and fill the histograms for(reco::HcalNoiseRBXCollection::const_iterator it=handle->begin(); it!=handle->end(); ++it) { const reco::HcalNoiseRBX &rbx=(*it); double energy = rbx.recHitEnergy(minHitEnergy_); int nhits = rbx.numRecHits(minHitEnergy_); if(energy < minRBXEnergy_) continue; hRBXEnergy_->Fill(energy); if (nhits <= 9) hRBXEnergyType1_->Fill(energy); else if (nhits <= 18) hRBXEnergyType2_->Fill(energy); else hRBXEnergyType3_->Fill(energy); hRBXNHits_->Fill(nhits); } // done looping over RBXs }
void HcalNoiseRates::beginJob | ( | void | ) | [private, virtual] |
void HcalNoiseRates::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 123 of file HcalNoiseRates.cc.
References dbe_, MonitorElement::Fill(), hLumiBlockCount_, lumiCountMap_, outputFile_, DQMStore::save(), and useAllHistos_.
{ if (useAllHistos_) hLumiBlockCount_->Fill(0.0, lumiCountMap_.size()); if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_); }
DQMStore* HcalNoiseRates::dbe_ [private] |
Definition at line 50 of file HcalNoiseRates.h.
Referenced by endJob(), and HcalNoiseRates().
MonitorElement* HcalNoiseRates::hLumiBlockCount_ [private] |
Definition at line 59 of file HcalNoiseRates.h.
Referenced by endJob(), and HcalNoiseRates().
MonitorElement* HcalNoiseRates::hRBXEnergy_ [private] |
Definition at line 60 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
MonitorElement* HcalNoiseRates::hRBXEnergyType1_ [private] |
Definition at line 61 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
MonitorElement* HcalNoiseRates::hRBXEnergyType2_ [private] |
Definition at line 62 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
MonitorElement* HcalNoiseRates::hRBXEnergyType3_ [private] |
Definition at line 63 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
MonitorElement* HcalNoiseRates::hRBXNHits_ [private] |
Definition at line 64 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
std::map<int, int> HcalNoiseRates::lumiCountMap_ [private] |
Definition at line 67 of file HcalNoiseRates.h.
double HcalNoiseRates::minHitEnergy_ [private] |
Definition at line 56 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
double HcalNoiseRates::minRBXEnergy_ [private] |
Definition at line 55 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
std::string HcalNoiseRates::outputFile_ [private] |
Definition at line 51 of file HcalNoiseRates.h.
Referenced by endJob(), and HcalNoiseRates().
edm::InputTag HcalNoiseRates::rbxCollName_ [private] |
Definition at line 54 of file HcalNoiseRates.h.
Referenced by analyze(), and HcalNoiseRates().
bool HcalNoiseRates::useAllHistos_ [private] |
Definition at line 57 of file HcalNoiseRates.h.
Referenced by endJob(), and HcalNoiseRates().