CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TopElecAnalyzer.cc
Go to the documentation of this file.
3 
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 }
16 
18 {
19 }
20 
21 void
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 }
64 
66 {
67 }
68 
70 {
71 }
72 
int i
Definition: DBlmapReader.cc:9
edm::InputTag input_
virtual void beginJob()
virtual void analyze(const edm::Event &, const edm::EventSetup &)
TopElecAnalyzer(const edm::ParameterSet &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
T * make() const
make new ROOT object
tuple cout
Definition: gather_cfg.py:121
virtual void endJob()
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")