CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< TtGenEventinputGenEventToken_
 
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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 15 of file TopGenEventAnalyzer.h.

Constructor & Destructor Documentation

◆ TopGenEventAnalyzer()

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

Definition at line 3 of file TopGenEventAnalyzer.cc.

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

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

◆ ~TopGenEventAnalyzer()

TopGenEventAnalyzer::~TopGenEventAnalyzer ( )
override

Definition at line 22 of file TopGenEventAnalyzer.cc.

22 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 24 of file TopGenEventAnalyzer.cc.

24  {
27 
28  if (!genEvent->isTtBar())
29  return;
30 
31  if (genEvent->fromGluonFusion())
32  prodChan_->Fill("gg", 1);
33  else if (genEvent->fromQuarkAnnihilation())
34  prodChan_->Fill("qqbar", 1);
35  else
36  prodChan_->Fill("other", 1);
37 
38  // fill BR's
39  nLep_->Fill(genEvent->numberOfLeptons());
40 
41  //fill top kinematic
42  topPt_->Fill(genEvent->top()->pt());
43  topEta_->Fill(genEvent->top()->eta());
44  topPhi_->Fill(genEvent->top()->phi());
45  topBarPt_->Fill(genEvent->topBar()->pt());
46  topBarEta_->Fill(genEvent->topBar()->eta());
47  topBarPhi_->Fill(genEvent->topBar()->phi());
48 
49  //fill ttbar kinematics
50  ttbarPt_->Fill(genEvent->topPair()->pt());
51  ttbarEta_->Fill(genEvent->topPair()->eta());
52  ttbarPhi_->Fill(genEvent->topPair()->phi());
53 }

References genWeightsTable_cfi::genEvent, edm::Event::getByToken(), inputGenEventToken_, nLep_, prodChan_, topBarEta_, topBarPhi_, topBarPt_, topEta_, topPhi_, topPt_, ttbarEta_, ttbarPhi_, and ttbarPt_.

◆ beginJob()

void TopGenEventAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file TopGenEventAnalyzer.cc.

55 {}

◆ endJob()

void TopGenEventAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file TopGenEventAnalyzer.cc.

57 {}

Member Data Documentation

◆ inputGenEventToken_

edm::EDGetTokenT<TtGenEvent> TopGenEventAnalyzer::inputGenEventToken_
private

Definition at line 25 of file TopGenEventAnalyzer.h.

Referenced by analyze().

◆ nLep_

TH1F* TopGenEventAnalyzer::nLep_
private

Definition at line 27 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ prodChan_

TH1F* TopGenEventAnalyzer::prodChan_
private

Definition at line 37 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ topBarEta_

TH1F* TopGenEventAnalyzer::topBarEta_
private

Definition at line 32 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ topBarPhi_

TH1F* TopGenEventAnalyzer::topBarPhi_
private

Definition at line 33 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ topBarPt_

TH1F* TopGenEventAnalyzer::topBarPt_
private

Definition at line 31 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ topEta_

TH1F* TopGenEventAnalyzer::topEta_
private

Definition at line 29 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ topPhi_

TH1F* TopGenEventAnalyzer::topPhi_
private

Definition at line 30 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ topPt_

TH1F* TopGenEventAnalyzer::topPt_
private

Definition at line 28 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ ttbarEta_

TH1F* TopGenEventAnalyzer::ttbarEta_
private

Definition at line 35 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ ttbarPhi_

TH1F* TopGenEventAnalyzer::ttbarPhi_
private

Definition at line 36 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

◆ ttbarPt_

TH1F* TopGenEventAnalyzer::ttbarPt_
private

Definition at line 34 of file TopGenEventAnalyzer.h.

Referenced by analyze(), and TopGenEventAnalyzer().

TopGenEventAnalyzer::topPt_
TH1F * topPt_
Definition: TopGenEventAnalyzer.h:28
TopGenEventAnalyzer::topEta_
TH1F * topEta_
Definition: TopGenEventAnalyzer.h:29
TopGenEventAnalyzer::inputGenEventToken_
edm::EDGetTokenT< TtGenEvent > inputGenEventToken_
Definition: TopGenEventAnalyzer.h:25
TopGenEventAnalyzer::topBarPhi_
TH1F * topBarPhi_
Definition: TopGenEventAnalyzer.h:33
edm::Handle
Definition: AssociativeIterator.h:50
TopGenEventAnalyzer::topPhi_
TH1F * topPhi_
Definition: TopGenEventAnalyzer.h:30
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
TopGenEventAnalyzer::topBarPt_
TH1F * topBarPt_
Definition: TopGenEventAnalyzer.h:31
TopGenEventAnalyzer::topBarEta_
TH1F * topBarEta_
Definition: TopGenEventAnalyzer.h:32
edm::Service< TFileService >
TopGenEventAnalyzer::ttbarEta_
TH1F * ttbarEta_
Definition: TopGenEventAnalyzer.h:35
TopGenEventAnalyzer::ttbarPt_
TH1F * ttbarPt_
Definition: TopGenEventAnalyzer.h:34
looper.cfg
cfg
Definition: looper.py:297
TopGenEventAnalyzer::ttbarPhi_
TH1F * ttbarPhi_
Definition: TopGenEventAnalyzer.h:36
genWeightsTable_cfi.genEvent
genEvent
Definition: genWeightsTable_cfi.py:4
TopGenEventAnalyzer::prodChan_
TH1F * prodChan_
Definition: TopGenEventAnalyzer.h:37
TopGenEventAnalyzer::nLep_
TH1F * nLep_
Definition: TopGenEventAnalyzer.h:27
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64