#include <NoiseRates.h>
Public Member Functions | |
NoiseRates (const edm::ParameterSet &) | |
~NoiseRates () | |
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 NoiseRates.h.
NoiseRates::NoiseRates | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 18 of file NoiseRates.cc.
References dbe_, edm::ParameterSet::getUntrackedParameter(), timingPdfMaker::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("NoiseRatesV/NoiseRatesTask"); } // 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); }
NoiseRates::~NoiseRates | ( | ) |
Definition at line 67 of file NoiseRates.cc.
{ }
void NoiseRates::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | evSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 78 of file NoiseRates.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 NoiseRates::beginJob | ( | void | ) | [private, virtual] |
void NoiseRates::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 123 of file NoiseRates.cc.
{ /* if (useAllHistos_) hLumiBlockCount_->Fill(0.0, lumiCountMap_.size()); if ( outputFile_.size() != 0 && dbe_ ) dbe_->save(outputFile_); */ }
DQMStore* NoiseRates::dbe_ [private] |
Definition at line 50 of file NoiseRates.h.
Referenced by NoiseRates().
MonitorElement* NoiseRates::hLumiBlockCount_ [private] |
Definition at line 59 of file NoiseRates.h.
Referenced by NoiseRates().
MonitorElement* NoiseRates::hRBXEnergy_ [private] |
Definition at line 60 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
MonitorElement* NoiseRates::hRBXEnergyType1_ [private] |
Definition at line 61 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
MonitorElement* NoiseRates::hRBXEnergyType2_ [private] |
Definition at line 62 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
MonitorElement* NoiseRates::hRBXEnergyType3_ [private] |
Definition at line 63 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
MonitorElement* NoiseRates::hRBXNHits_ [private] |
Definition at line 64 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
std::map<int, int> NoiseRates::lumiCountMap_ [private] |
Definition at line 67 of file NoiseRates.h.
Referenced by analyze().
double NoiseRates::minHitEnergy_ [private] |
Definition at line 56 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
double NoiseRates::minRBXEnergy_ [private] |
Definition at line 55 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
std::string NoiseRates::outputFile_ [private] |
Definition at line 51 of file NoiseRates.h.
Referenced by NoiseRates().
edm::InputTag NoiseRates::rbxCollName_ [private] |
Definition at line 54 of file NoiseRates.h.
Referenced by analyze(), and NoiseRates().
bool NoiseRates::useAllHistos_ [private] |
Definition at line 57 of file NoiseRates.h.
Referenced by NoiseRates().