CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TopMuonAnalyzer Class Reference

#include <TopMuonAnalyzer.h>

Inheritance diagram for TopMuonAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

 TopMuonAnalyzer (const edm::ParameterSet &)
 ~TopMuonAnalyzer ()

Private Member Functions

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

Private Attributes

TH1F * en_
TH1F * eta_
edm::InputTag input_
TH1F * mult_
TH1F * phi_
TH1F * pt_
bool verbose_

Detailed Description

Definition at line 13 of file TopMuonAnalyzer.h.


Constructor & Destructor Documentation

TopMuonAnalyzer::TopMuonAnalyzer ( const edm::ParameterSet cfg) [explicit]

Definition at line 5 of file TopMuonAnalyzer.cc.

References en_, eta_, mult_, phi_, and pt_.

                                                          :
  input_  (cfg.getParameter<edm::InputTag>("input"  )),
  verbose_(cfg.getParameter<bool>         ("verbose"))
{
  edm::Service<TFileService> fs;
  
  mult_ = fs->make<TH1F>("mult", "multiplicity (muons)", 10,  0 ,   10);
  en_   = fs->make<TH1F>("en"  , "energy (muons)",       60,  0., 300.);
  pt_   = fs->make<TH1F>("pt"  , "pt (muons)",           60,  0., 300.);
  eta_  = fs->make<TH1F>("eta" , "eta (muons)",          30, -3.,   3.);
  phi_  = fs->make<TH1F>("phi" , "phi (muons)",          40, -4.,   4.);
  
}
TopMuonAnalyzer::~TopMuonAnalyzer ( )

Definition at line 19 of file TopMuonAnalyzer.cc.

{
}

Member Function Documentation

void TopMuonAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 24 of file TopMuonAnalyzer.cc.

References gather_cfg::cout, en_, eta_, edm::Event::getByLabel(), i, input_, mult_, metsig::muon, patZpeak::muons, phi_, pt_, and verbose_.

{
  edm::Handle<std::vector<pat::Muon> > muons;
  evt.getByLabel(input_, muons); 

  // fill histograms

  mult_->Fill( muons->size() ); 
  for(std::vector<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
    pt_ ->Fill( muon->pt()     );
    en_ ->Fill( muon->energy() );
    eta_->Fill( muon->eta()    );
    phi_->Fill( muon->phi()    );
  }

  // produce printout if desired

  if( muons->size()<1 || !verbose_ )
    return;

  unsigned i=0;

  std::cout << "==================================================================="
            << std::endl;
  std::cout << std::setw(5 ) << "mu  :"
            << std::setw(13) << "pt :"
            << std::setw(13) << "eta :"
            << std::setw(13) << "phi :"
            << std::setw(13) << "relIso :"
            << std::setw(6 ) << "GLB :"
            << std::setw(4 ) << "TRK" << std::endl;
  std::cout << "-------------------------------------------------------------------"
            << std::endl;
  for(std::vector<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
    std::cout << std::setw(3 ) << i << " : "
              << std::setw(10) << muon->pt() << " : "
              << std::setw(10) << muon->eta() << " : "
              << std::setw(10) << muon->phi() << " : "
              << std::setw(10) << (muon->trackIso()+muon->caloIso())/muon->pt() << " : "
              << std::setw( 3) << muon->isGlobalMuon() << " : "
              << std::setw( 3) << muon->isTrackerMuon() << std::endl;
    i++;
  }
  std::cout << "==================================================================="
            << std::endl;
}
void TopMuonAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file TopMuonAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file TopMuonAnalyzer.cc.

{
}

Member Data Documentation

TH1F* TopMuonAnalyzer::en_ [private]

Definition at line 30 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

TH1F* TopMuonAnalyzer::eta_ [private]

Definition at line 32 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

Definition at line 26 of file TopMuonAnalyzer.h.

Referenced by analyze().

TH1F* TopMuonAnalyzer::mult_ [private]

Definition at line 29 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

TH1F* TopMuonAnalyzer::phi_ [private]

Definition at line 33 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

TH1F* TopMuonAnalyzer::pt_ [private]

Definition at line 31 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

bool TopMuonAnalyzer::verbose_ [private]

Definition at line 27 of file TopMuonAnalyzer.h.

Referenced by analyze().