CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TopElecAnalyzer Class Reference

#include <TopElecAnalyzer.h>

Inheritance diagram for TopElecAnalyzer:
edm::EDAnalyzer

Public Member Functions

 TopElecAnalyzer (const edm::ParameterSet &)
 
 ~TopElecAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

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_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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_, TFileDirectory::make(), mult_, phi_, and pt_.

4  :
5  input_ (cfg.getParameter<edm::InputTag>("input" )),
6  verbose_(cfg.getParameter<bool> ("verbose"))
7 {
9 
10  mult_ = fs->make<TH1F>("mult", "multiplicity (electrons)", 10, 0 , 10);
11  en_ = fs->make<TH1F>("en" , "energy (electrons)" , 60, 0., 300.);
12  pt_ = fs->make<TH1F>("pt" , "pt (electrons)" , 60, 0., 300.);
13  eta_ = fs->make<TH1F>("eta" , "eta (electrons)" , 30, -3., 3.);
14  phi_ = fs->make<TH1F>("phi" , "phi (electrons)" , 40, -4., 4.);
15 }
T getParameter(std::string const &) const
edm::InputTag input_
T * make() const
make new ROOT object
TopElecAnalyzer::~TopElecAnalyzer ( )

Definition at line 17 of file TopElecAnalyzer.cc.

18 {
19 }

Member Function Documentation

void TopElecAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
privatevirtual

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_.

23 {
25  evt.getByLabel(input_, elecs);
26 
27  // fill histograms
28 
29  mult_->Fill( elecs->size() );
30  for(std::vector<pat::Electron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
31  en_ ->Fill( elec->energy() );
32  pt_ ->Fill( elec->pt() );
33  eta_->Fill( elec->eta() );
34  phi_->Fill( elec->phi() );
35  }
36 
37  // produce printout if desired
38 
39  if( elecs->size()<1 || !verbose_ )
40  return;
41 
42  unsigned i=0;
43 
44  std::cout << "======================================================="
45  << std::endl;
46  std::cout << std::setw(5 ) << "ele :"
47  << std::setw(13) << "et :"
48  << std::setw(13) << "eta :"
49  << std::setw(13) << "phi :"
50  << std::setw(11) << "relIso" << std::endl;
51  std::cout << "-------------------------------------------------------"
52  << std::endl;
53  for(std::vector<pat::Electron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
54  std::cout << std::setw(3 ) << i << " : "
55  << std::setw(10) << elec->pt() << " : "
56  << std::setw(10) << elec->eta() << " : "
57  << std::setw(10) << elec->phi() << " : "
58  << std::setw(10) << (elec->dr03TkSumPt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt())/elec->et() << std::endl;
59  i++;
60  }
61  std::cout << "======================================================="
62  << std::endl;
63 }
int i
Definition: DBlmapReader.cc:9
edm::InputTag input_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple cout
Definition: gather_cfg.py:121
void TopElecAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file TopElecAnalyzer.cc.

66 {
67 }
void TopElecAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file TopElecAnalyzer.cc.

70 {
71 }

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

edm::InputTag TopElecAnalyzer::input_
private

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