CMS 3D CMS Logo

TopGenEventAnalyzer.cc
Go to the documentation of this file.
2 
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 }
21 
23 
26  evt.getByToken(inputGenEventToken_, genEvent);
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 }
54 
56 
double eta() const final
momentum pseudorapidity
TopGenEventAnalyzer(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool fromQuarkAnnihilation() const
check if the tops were produced from qqbar
Definition: TtGenEvent.cc:25
double pt() const final
transverse momentum
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
const reco::GenParticle * top() const
return top if available; 0 else
Definition: TopGenEvent.h:101
Class derived from the TopGenEvent for ttbar events.
Definition: TtGenEvent.h:18
bool fromGluonFusion() const
check if the tops were produced from a pair of gluons
Definition: TtGenEvent.cc:17
void analyze(const edm::Event &, const edm::EventSetup &) override
void beginJob() override
edm::EDGetTokenT< TtGenEvent > inputGenEventToken_
HLT enums.
const math::XYZTLorentzVector * topPair() const
return combined 4-vector of top and topBar
Definition: TtGenEvent.h:93
double phi() const final
momentum azimuthal angle
const reco::GenParticle * topBar() const
return anti-top if available; 0 else
Definition: TopGenEvent.h:103
bool isTtBar() const
check if the event can be classified as ttbar
Definition: TtGenEvent.h:28
int numberOfLeptons(bool fromWBoson=true) const
return number of leptons in the decay chain
Definition: TopGenEvent.cc:41