CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PatBasicAnalyzer Class Reference

Inheritance diagram for PatBasicAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 PatBasicAnalyzer (const edm::ParameterSet &)
 default constructor
 ~PatBasicAnalyzer ()
 default destructor

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 everything that needs to be done during the event loop
virtual void beginJob ()
 everything that needs to be done before the event loop
virtual void endJob ()
 everything that needs to be done after the event loop

Private Attributes

edm::InputTag elecSrc_
std::map< std::string, TH1F * > histContainer_
edm::InputTag jetSrc_
TH1F * jetTowers_
edm::InputTag metSrc_
edm::InputTag muonSrc_
edm::InputTag photonSrc_
edm::InputTag tauSrc_

Detailed Description

Definition at line 13 of file PatBasicAnalyzer.cc.


Constructor & Destructor Documentation

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

default constructor

Definition at line 52 of file PatBasicAnalyzer.cc.

PatBasicAnalyzer::~PatBasicAnalyzer ( )

default destructor

Definition at line 63 of file PatBasicAnalyzer.cc.

{
}

Member Function Documentation

void PatBasicAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

everything that needs to be done during the event loop

Implements edm::EDAnalyzer.

Definition at line 68 of file PatBasicAnalyzer.cc.

References elecSrc_, HI_PhotonSkim_cff::electrons, edm::Event::getByLabel(), histContainer_, metsig::jet, fwrapper::jets, jetSrc_, metSrc_, patZpeak::muons, muonSrc_, interactiveExample::photons, photonSrc_, and tauSrc_.

{
  // get electron collection
  edm::Handle<edm::View<pat::Electron> > electrons;
  iEvent.getByLabel(elecSrc_,electrons);

  // get muon collection
  edm::Handle<edm::View<pat::Muon> > muons;
  iEvent.getByLabel(muonSrc_,muons);

  // get tau collection  
  edm::Handle<edm::View<pat::Tau> > taus;
  iEvent.getByLabel(tauSrc_,taus);

  // get jet collection
  edm::Handle<edm::View<pat::Jet> > jets;
  iEvent.getByLabel(jetSrc_,jets);

  // get met collection  
  edm::Handle<edm::View<pat::MET> > mets;
  iEvent.getByLabel(metSrc_,mets);
  
  // get photon collection  
  edm::Handle<edm::View<pat::Photon> > photons;
  iEvent.getByLabel(photonSrc_,photons);
    
  // loop over jets
  size_t nJets=0;
  for(edm::View<pat::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
    if(jet->pt()>50){
      ++nJets;
    }
    // uncomment the following line to fill the 
    // jetTowers_ histogram
    // jetTowers_->Fill(jet->getCaloConstituents().size());
  }
  histContainer_["jets"]->Fill(nJets);

  // do something similar for the other candidates
  histContainer_["photons"]->Fill(photons->size() );
  histContainer_["elecs" ]->Fill(electrons->size());
  histContainer_["muons"]->Fill(muons->size() );
  histContainer_["taus" ]->Fill(taus->size()  );
  histContainer_["met"  ]->Fill(mets->empty() ? 0 : (*mets)[0].et());
}
void PatBasicAnalyzer::beginJob ( void  ) [private, virtual]

everything that needs to be done before the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file PatBasicAnalyzer.cc.

References histContainer_.

{
  // register to the TFileService
  edm::Service<TFileService> fs;
  
  // book histograms:
  // uncomment the following line to book the jetTowers_ histogram
  //jetTowers_= fs->make<TH1F>("jetTowers", "towers per jet",   90, 0,  90); 
  histContainer_["photons"]=fs->make<TH1F>("photons", "photon multiplicity",   10, 0,  10);
  histContainer_["elecs"  ]=fs->make<TH1F>("elecs",   "electron multiplicity", 10, 0,  10);
  histContainer_["muons"  ]=fs->make<TH1F>("muons",   "muon multiplicity",     10, 0,  10);
  histContainer_["taus"   ]=fs->make<TH1F>("taus",    "tau multiplicity",      10, 0,  10);
  histContainer_["jets"   ]=fs->make<TH1F>("jets",    "jet multiplicity",      10, 0,  10);
  histContainer_["met"    ]=fs->make<TH1F>("met",     "missing E_{T}",         20, 0, 100);
}
void PatBasicAnalyzer::endJob ( void  ) [private, virtual]

everything that needs to be done after the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file PatBasicAnalyzer.cc.

{
}

Member Data Documentation

Definition at line 38 of file PatBasicAnalyzer.cc.

Referenced by analyze().

std::map<std::string,TH1F*> PatBasicAnalyzer::histContainer_ [private]

Definition at line 32 of file PatBasicAnalyzer.cc.

Referenced by analyze(), and beginJob().

Definition at line 41 of file PatBasicAnalyzer.cc.

Referenced by analyze().

Definition at line 34 of file PatBasicAnalyzer.cc.

Definition at line 42 of file PatBasicAnalyzer.cc.

Referenced by analyze().

Definition at line 39 of file PatBasicAnalyzer.cc.

Referenced by analyze().

Definition at line 37 of file PatBasicAnalyzer.cc.

Referenced by analyze().

Definition at line 40 of file PatBasicAnalyzer.cc.

Referenced by analyze().