CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalNoiseRates Class Reference

#include <HcalNoiseRates.h>

Inheritance diagram for HcalNoiseRates:
edm::EDAnalyzer

List of all members.

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

DQMStoredbe_
MonitorElementhLumiBlockCount_
MonitorElementhRBXEnergy_
MonitorElementhRBXEnergyType1_
MonitorElementhRBXEnergyType2_
MonitorElementhRBXEnergyType3_
MonitorElementhRBXNHits_
std::map< int, int > lumiCountMap_
double minHitEnergy_
double minRBXEnergy_
std::string outputFile_
edm::InputTag rbxCollName_
bool useAllHistos_

Detailed Description

Definition at line 39 of file HcalNoiseRates.h.


Constructor & Destructor Documentation

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.

{
}

Member Function Documentation

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]

Reimplemented from edm::EDAnalyzer.

Definition at line 119 of file HcalNoiseRates.cc.

{}
void HcalNoiseRates::endJob ( void  ) [private, virtual]

Member Data Documentation

Definition at line 50 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().

Definition at line 59 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().

Definition at line 60 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

Definition at line 61 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

Definition at line 62 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

Definition at line 63 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

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.

Referenced by analyze(), and endJob().

Definition at line 56 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

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().

Definition at line 54 of file HcalNoiseRates.h.

Referenced by analyze(), and HcalNoiseRates().

Definition at line 57 of file HcalNoiseRates.h.

Referenced by endJob(), and HcalNoiseRates().