CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CaloTowersExample Class Reference

#include <CaloTowersExample.h>

Inheritance diagram for CaloTowersExample:
edm::EDAnalyzer

List of all members.

Public Member Functions

 CaloTowersExample (const edm::ParameterSet &)

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &)
void beginJob ()
void endJob ()

Private Attributes

std::string CaloTowersAlgorithm
TH1F h_et
TFile * m_file

Detailed Description

Definition at line 15 of file CaloTowersExample.h.


Constructor & Destructor Documentation

CaloTowersExample::CaloTowersExample ( const edm::ParameterSet cfg)

Definition at line 20 of file CaloTowersExample.cc.

                                                               :
  CaloTowersAlgorithm( cfg.getParameter<string>( "CaloTowersAlgorithm" ) )
  {
}

Member Function Documentation

void CaloTowersExample::analyze ( const edm::Event evt,
const edm::EventSetup es 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 32 of file CaloTowersExample.cc.

References ExpressReco_HICollisions_FallBack::caloTowers, CaloTowersAlgorithm, edm::Event::getByLabel(), and h_et.

                                                                        {

  //Get the CaloTower collection
  Handle<CaloTowerCollection> caloTowers;
  evt.getByLabel( CaloTowersAlgorithm, caloTowers );

  //Loop over the two leading CaloJets and fill some histograms
  for( CaloTowerCollection::const_iterator cal = caloTowers->begin(); cal != caloTowers->end(); ++ cal ) {
    h_et.Fill( cal->et() );   
  }

}
void CaloTowersExample::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 25 of file CaloTowersExample.cc.

References h_et, and m_file.

                                  {

  // Open the histogram file and book some associated histograms
  m_file=new TFile("histo.root","RECREATE"); 
  h_et =  TH1F( "et",  "E_{T} of leading CaloTowers", 50, 0, 25 );
}
void CaloTowersExample::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file CaloTowersExample.cc.

References m_file.

                               {

  //Write out the histogram file.
  m_file->Write(); 

}

Member Data Documentation

Definition at line 23 of file CaloTowersExample.h.

Referenced by analyze().

TH1F CaloTowersExample::h_et [private]

Definition at line 24 of file CaloTowersExample.h.

Referenced by analyze(), and beginJob().

TFile* CaloTowersExample::m_file [private]

Definition at line 25 of file CaloTowersExample.h.

Referenced by beginJob(), and endJob().