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
TopGenEventAnalyzer Class Reference

#include <TopGenEventAnalyzer.h>

Inheritance diagram for TopGenEventAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TopGenEventAnalyzer (const edm::ParameterSet &)
 
 ~TopGenEventAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::InputTag inputGenEvent_
 
TH1F * nLep_
 
TH1F * prodChan_
 
TH1F * topBarEta_
 
TH1F * topBarPhi_
 
TH1F * topBarPt_
 
TH1F * topEta_
 
TH1F * topPhi_
 
TH1F * topPt_
 
TH1F * ttbarEta_
 
TH1F * ttbarPhi_
 
TH1F * ttbarPt_
 

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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 14 of file TopGenEventAnalyzer.h.

Constructor & Destructor Documentation

TopGenEventAnalyzer::TopGenEventAnalyzer ( const edm::ParameterSet cfg)
explicit

Definition at line 4 of file TopGenEventAnalyzer.cc.

References TFileDirectory::make(), nLep_, prodChan_, topBarEta_, topBarPhi_, topBarPt_, topEta_, topPhi_, topPt_, ttbarEta_, ttbarPhi_, and ttbarPt_.

4  :
6 {
8  nLep_ = fs->make<TH1F>("nLep", "N(Lepton)", 5, 0., 5.);
9  topPt_ = fs->make<TH1F>("topPt", "pt (top)", 100, 0., 500.);
10  topEta_ = fs->make<TH1F>("topEta", "eta(top)", 40, -5., 5.);
11  topPhi_ = fs->make<TH1F>("topPhi", "phi(top)", 60, -3.5, 3.5);
12  topBarPt_ = fs->make<TH1F>("topBarPt", "pt (topBar)", 100, 0., 500.);
13  topBarEta_ = fs->make<TH1F>("topBarEta", "eta(topBar)", 40, -5., 5.);
14  topBarPhi_ = fs->make<TH1F>("topBarPhi", "phi(topBar)", 60, -3.5, 3.5);
15  ttbarPt_ = fs->make<TH1F>("ttbarPt", "pt (ttbar)", 100, 0., 500.);
16  ttbarEta_ = fs->make<TH1F>("ttbarEta", "eta(ttbar)", 40, -5., 5.);
17  ttbarPhi_ = fs->make<TH1F>("ttbarPhi", "phi(ttbar)", 60, -3.5, 3.5);
18  prodChan_ = fs->make<TH1F>("prodChan", "production mode", 3, 0, 3);
19  prodChan_->GetXaxis()->SetBinLabel(1, "gg" );
20  prodChan_->GetXaxis()->SetBinLabel(2, "qqbar");
21  prodChan_->GetXaxis()->SetBinLabel(3, "other");
22 }
T getParameter(std::string const &) const
edm::InputTag inputGenEvent_
T * make() const
make new ROOT object
TopGenEventAnalyzer::~TopGenEventAnalyzer ( )

Definition at line 24 of file TopGenEventAnalyzer.cc.

25 {
26 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 29 of file TopGenEventAnalyzer.cc.

References MCTruth::genEvent, edm::Event::getByLabel(), inputGenEvent_, nLep_, prodChan_, topBarEta_, topBarPhi_, topBarPt_, topEta_, topPhi_, topPt_, ttbarEta_, ttbarPhi_, and ttbarPt_.

30 {
32  evt.getByLabel(inputGenEvent_, genEvent);
33 
34  if(!genEvent->isTtBar())
35  return;
36 
37  if(genEvent->fromGluonFusion())
38  prodChan_->Fill("gg", 1);
39  else if(genEvent->fromQuarkAnnihilation())
40  prodChan_->Fill("qqbar", 1);
41  else
42  prodChan_->Fill("other", 1);
43 
44  // fill BR's
45  nLep_ ->Fill(genEvent->numberOfLeptons());
46 
47  //fill top kinematic
48  topPt_ ->Fill(genEvent->top ()->pt ());
49  topEta_ ->Fill(genEvent->top ()->eta());
50  topPhi_ ->Fill(genEvent->top ()->phi());
51  topBarPt_ ->Fill(genEvent->topBar()->pt ());
52  topBarEta_->Fill(genEvent->topBar()->eta());
53  topBarPhi_->Fill(genEvent->topBar()->phi());
54 
55  //fill ttbar kinematics
56  ttbarPt_ ->Fill(genEvent->topPair()->pt() );
57  ttbarEta_->Fill(genEvent->topPair()->eta());
58  ttbarPhi_->Fill(genEvent->topPair()->phi());
59 }
edm::InputTag inputGenEvent_
tuple genEvent
Definition: MCTruth.py:33
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
void TopGenEventAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file TopGenEventAnalyzer.cc.

62 {
63 }
void TopGenEventAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file TopGenEventAnalyzer.cc.

66 {
67 }

Member Data Documentation

edm::InputTag TopGenEventAnalyzer::inputGenEvent_
private

Definition at line 27 of file TopGenEventAnalyzer.h.

Referenced by analyze().

TH1F* TopGenEventAnalyzer::nLep_
private

Definition at line 29 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::prodChan_
private

Definition at line 39 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::topBarEta_
private

Definition at line 34 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::topBarPhi_
private

Definition at line 35 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::topBarPt_
private

Definition at line 33 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::topEta_
private

Definition at line 31 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::topPhi_
private

Definition at line 32 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::topPt_
private

Definition at line 30 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::ttbarEta_
private

Definition at line 37 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::ttbarPhi_
private

Definition at line 38 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TH1F* TopGenEventAnalyzer::ttbarPt_
private

Definition at line 36 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().