CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

NoiseRates Class Reference

#include <NoiseRates.h>

Inheritance diagram for NoiseRates:
edm::EDAnalyzer

List of all members.

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

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 NoiseRates.h.


Constructor & Destructor Documentation

NoiseRates::NoiseRates ( const edm::ParameterSet iConfig) [explicit]

Definition at line 18 of file NoiseRates.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("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.

{
}

Member Function Documentation

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]

Reimplemented from edm::EDAnalyzer.

Definition at line 119 of file NoiseRates.cc.

{}
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_);
*/
}

Member Data Documentation

Definition at line 50 of file NoiseRates.h.

Referenced by NoiseRates().

Definition at line 59 of file NoiseRates.h.

Referenced by NoiseRates().

Definition at line 60 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

Definition at line 61 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

Definition at line 62 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

Definition at line 63 of file NoiseRates.h.

Referenced by analyze(), and NoiseRates().

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

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