CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TopElecAnalyzer Class Reference

#include <TopElecAnalyzer.h>

Inheritance diagram for TopElecAnalyzer:
edm::EDAnalyzer

List of all members.

Public Member Functions

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

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


Constructor & Destructor Documentation

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

Definition at line 4 of file TopElecAnalyzer.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 (electrons)", 10,  0 ,   10);
  en_   = fs->make<TH1F>("en"  , "energy (electrons)"      , 60,  0., 300.);
  pt_   = fs->make<TH1F>("pt"  , "pt (electrons)"          , 60,  0., 300.);
  eta_  = fs->make<TH1F>("eta" , "eta (electrons)"         , 30, -3.,   3.);
  phi_  = fs->make<TH1F>("phi" , "phi (electrons)"         , 40, -4.,   4.);
}
TopElecAnalyzer::~TopElecAnalyzer ( )

Definition at line 17 of file TopElecAnalyzer.cc.

{
}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 22 of file TopElecAnalyzer.cc.

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

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

  // fill histograms

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

  // produce printout if desired

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

  unsigned i=0;

  std::cout << "======================================================="
            << std::endl;
  std::cout << std::setw(5 ) << "ele :"
            << std::setw(13) << "et :"
            << std::setw(13) << "eta :"
            << std::setw(13) << "phi :"
            << std::setw(11) << "relIso" << std::endl;
  std::cout << "-------------------------------------------------------"
            << std::endl;
  for(std::vector<pat::Electron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
    std::cout << std::setw(3 ) << i << " : "
              << std::setw(10) << elec->pt() << " : "
              << std::setw(10) << elec->eta() << " : "
              << std::setw(10) << elec->phi() << " : "
              << std::setw(10) << (elec->dr03TkSumPt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt())/elec->et() << std::endl;
    i++;
  }
  std::cout << "======================================================="
            << std::endl;
}
void TopElecAnalyzer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file TopElecAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file TopElecAnalyzer.cc.

{
}

Member Data Documentation

TH1F* TopElecAnalyzer::en_ [private]

Definition at line 30 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

TH1F* TopElecAnalyzer::eta_ [private]

Definition at line 32 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

Definition at line 26 of file TopElecAnalyzer.h.

Referenced by analyze().

TH1F* TopElecAnalyzer::mult_ [private]

Definition at line 29 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

TH1F* TopElecAnalyzer::phi_ [private]

Definition at line 33 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

TH1F* TopElecAnalyzer::pt_ [private]

Definition at line 31 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

bool TopElecAnalyzer::verbose_ [private]

Definition at line 27 of file TopElecAnalyzer.h.

Referenced by analyze().