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
PatTopSelectionAnalyzer Class Reference
Inheritance diagram for PatTopSelectionAnalyzer:
edm::EDAnalyzer

Public Member Functions

 PatTopSelectionAnalyzer (const edm::ParameterSet &)
 default constructor More...
 
 ~PatTopSelectionAnalyzer ()
 default destructor More...
 
- 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 &)
 everything that needs to be done during the event loop More...
 
virtual void beginJob ()
 everything that needs to be done before the event loop More...
 
bool booked (const std::string histName) const
 check if histogram was booked More...
 
virtual void endJob ()
 everything that needs to be done after the event loop More...
 
void fill (const std::string histName, double value) const
 fill histogram if it had been booked before More...
 

Private Attributes

edm::InputTag elecs_
 
std::map< std::string, TH1F * > hists_
 
edm::InputTag jets_
 
edm::InputTag met_
 
edm::InputTag muons_
 

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)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 13 of file PatTopSelectionAnalyzer.cc.

Constructor & Destructor Documentation

PatTopSelectionAnalyzer::PatTopSelectionAnalyzer ( const edm::ParameterSet iConfig)
explicit

default constructor

Definition at line 51 of file PatTopSelectionAnalyzer.cc.

51  :
52  hists_(),
53  elecs_(iConfig.getUntrackedParameter<edm::InputTag>("elecs")),
54  muons_(iConfig.getUntrackedParameter<edm::InputTag>("muons")),
55  jets_ (iConfig.getUntrackedParameter<edm::InputTag>("jets" )),
56  met_ (iConfig.getUntrackedParameter<edm::InputTag>("met" ))
57 {
58 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< std::string, TH1F * > hists_
PatTopSelectionAnalyzer::~PatTopSelectionAnalyzer ( )

default destructor

Definition at line 60 of file PatTopSelectionAnalyzer.cc.

61 {
62 }

Member Function Documentation

void PatTopSelectionAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

everything that needs to be done during the event loop

Implements edm::EDAnalyzer.

Definition at line 65 of file PatTopSelectionAnalyzer.cc.

References elecs_, fill(), edm::Event::getByLabel(), analyzePatCleaning_cfg::jets, jets_, CaloMET_cfi::met, met_, patZpeak::muons, and muons_.

66 {
67  // get electron collection
69  iEvent.getByLabel(elecs_,elecs);
70 
71  // get muon collection
73  iEvent.getByLabel(muons_,muons);
74 
75  // get jet collection
77  iEvent.getByLabel(jets_,jets);
78 
79  // get met collection
81  iEvent.getByLabel(met_,met);
82 
83  // fill yield
84  fill("yield", 0.5);
85 
86  // fill quantities for leading elec and elec multiplicity
87  fill("elecMult", elecs->size());
88  if(elecs->begin()!=elecs->end()){
89  fill("elecIso", (elecs->begin()->trackIso()+elecs->begin()->caloIso())/elecs->begin()->pt());
90  fill("elecPt", elecs->begin()->pt());
91  }
92 
93  // fill quantities for leading muon and muon multiplicity
94  fill("muonMult", muons->size());
95  if(muons->begin()!=muons->end()){
96  fill("muonIso", (muons->begin()->trackIso()+muons->begin()->caloIso())/muons->begin()->pt());
97  fill("muonPt", muons->begin()->pt());
98  }
99 
100  // fill quantities for leading jets and jet multiplicity
101  // jet pt is corrected up to L3Absolute
102  fill("jetMult", jets->size());
103  if( jets->size()>0 ) fill("jet0Pt", (*jets)[0].pt());
104  if( jets->size()>1 ) fill("jet1Pt", (*jets)[1].pt());
105  if( jets->size()>2 ) fill("jet2Pt", (*jets)[2].pt());
106  if( jets->size()>3 ) fill("jet3Pt", (*jets)[3].pt());
107 
108  // fill MET
109  fill("met", met->empty()?0:(*met)[0].et());
110 }
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple muons
Definition: patZpeak.py:38
void PatTopSelectionAnalyzer::beginJob ( void  )
privatevirtual

everything that needs to be done before the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 113 of file PatTopSelectionAnalyzer.cc.

References hists_, and TFileDirectory::make().

114 {
115  // register to the TFileService
117 
118  // book histograms:
119  hists_["yield" ]=fs->make<TH1F>("yield" , "electron multiplicity", 1, 0., 1.);
120  hists_["elecMult"]=fs->make<TH1F>("elecMult", "electron multiplicity", 10, 0., 10.);
121  hists_["elecIso" ]=fs->make<TH1F>("elecIso" , "electron isolation" , 20, 0., 1.);
122  hists_["elecPt" ]=fs->make<TH1F>("elecPt" , "electron pt" , 30, 0., 150.);
123  hists_["muonMult"]=fs->make<TH1F>("muonMult", "muon multiplicity" , 10, 0., 10.);
124  hists_["muonIso" ]=fs->make<TH1F>("muonIso" , "muon isolation" , 20, 0., 1.);
125  hists_["muonPt" ]=fs->make<TH1F>("muonPt" , "muon pt" , 30, 0., 150.);
126  hists_["jetMult" ]=fs->make<TH1F>("jetMult" , "jet multiplicity" , 15, 0., 15.);
127  hists_["jet0Pt" ]=fs->make<TH1F>("jet0Pt" , "1. leading jet pt" , 50, 0., 250.);
128  hists_["jet1Pt" ]=fs->make<TH1F>("jet1Pt" , "1. leading jet pt" , 50, 0., 250.);
129  hists_["jet2Pt" ]=fs->make<TH1F>("jet2Pt" , "1. leading jet pt" , 50, 0., 200.);
130  hists_["jet3Pt" ]=fs->make<TH1F>("jet3Pt" , "1. leading jet pt" , 50, 0., 200.);
131  hists_["met" ]=fs->make<TH1F>("met" , "missing E_{T}" , 25, 0., 200.);
132 }
std::map< std::string, TH1F * > hists_
T * make() const
make new ROOT object
bool PatTopSelectionAnalyzer::booked ( const std::string  histName) const
inlineprivate

check if histogram was booked

Definition at line 30 of file PatTopSelectionAnalyzer.cc.

References hists_.

30 { return hists_.find(histName.c_str())!=hists_.end(); };
std::map< std::string, TH1F * > hists_
void PatTopSelectionAnalyzer::endJob ( void  )
privatevirtual

everything that needs to be done after the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 135 of file PatTopSelectionAnalyzer.cc.

136 {
137 }
void PatTopSelectionAnalyzer::fill ( const std::string  histName,
double  value 
) const
inlineprivate

fill histogram if it had been booked before

Definition at line 32 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

32 { if(booked(histName.c_str())) hists_.find(histName.c_str())->second->Fill(value); };
U second(std::pair< T, U > const &p)
std::map< std::string, TH1F * > hists_
bool booked(const std::string histName) const
check if histogram was booked

Member Data Documentation

edm::InputTag PatTopSelectionAnalyzer::elecs_
private

Definition at line 40 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

std::map<std::string, TH1F*> PatTopSelectionAnalyzer::hists_
private

Definition at line 32 of file PatTopSelectionAnalyzer.cc.

Referenced by beginJob(), and booked().

edm::InputTag PatTopSelectionAnalyzer::jets_
private

Definition at line 42 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

edm::InputTag PatTopSelectionAnalyzer::met_
private

Definition at line 43 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

edm::InputTag PatTopSelectionAnalyzer::muons_
private

Definition at line 41 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().