Go to the documentation of this file.00001 #include "AnalysisDataFormats/TopObjects/interface/TtGenEvent.h"
00002 #include "TopQuarkAnalysis/Examples/plugins/TopGenEventAnalyzer.h"
00003
00004 TopGenEventAnalyzer::TopGenEventAnalyzer(const edm::ParameterSet& cfg):
00005 inputGenEvent_(cfg.getParameter<edm::InputTag>("genEvent"))
00006 {
00007 edm::Service<TFileService> fs;
00008 nLep_ = fs->make<TH1F>("nLep", "N(Lepton)", 5, 0., 5.);
00009 topPt_ = fs->make<TH1F>("topPt", "pt (top)", 100, 0., 500.);
00010 topEta_ = fs->make<TH1F>("topEta", "eta(top)", 40, -5., 5.);
00011 topPhi_ = fs->make<TH1F>("topPhi", "phi(top)", 60, -3.5, 3.5);
00012 topBarPt_ = fs->make<TH1F>("topBarPt", "pt (topBar)", 100, 0., 500.);
00013 topBarEta_ = fs->make<TH1F>("topBarEta", "eta(topBar)", 40, -5., 5.);
00014 topBarPhi_ = fs->make<TH1F>("topBarPhi", "phi(topBar)", 60, -3.5, 3.5);
00015 ttbarPt_ = fs->make<TH1F>("ttbarPt", "pt (ttbar)", 100, 0., 500.);
00016 ttbarEta_ = fs->make<TH1F>("ttbarEta", "eta(ttbar)", 40, -5., 5.);
00017 ttbarPhi_ = fs->make<TH1F>("ttbarPhi", "phi(ttbar)", 60, -3.5, 3.5);
00018 }
00019
00020 TopGenEventAnalyzer::~TopGenEventAnalyzer()
00021 {
00022 }
00023
00024 void
00025 TopGenEventAnalyzer::analyze(const edm::Event& evt, const edm::EventSetup& setup)
00026 {
00027 edm::Handle<TtGenEvent> genEvent;
00028 evt.getByLabel(inputGenEvent_, genEvent);
00029
00030
00031 nLep_ ->Fill(genEvent->numberOfLeptons());
00032
00033
00034 topPt_ ->Fill(genEvent->top ()->pt ());
00035 topEta_ ->Fill(genEvent->top ()->eta());
00036 topPhi_ ->Fill(genEvent->top ()->phi());
00037 topBarPt_ ->Fill(genEvent->topBar()->pt ());
00038 topBarEta_->Fill(genEvent->topBar()->eta());
00039 topBarPhi_->Fill(genEvent->topBar()->phi());
00040
00041
00042 reco::Particle::LorentzVector p4 = genEvent->top()->p4()+genEvent->topBar()->p4();
00043 ttbarPt_ ->Fill(p4.pt() );
00044 ttbarEta_->Fill(p4.eta());
00045 ttbarPhi_->Fill(p4.phi());
00046 }
00047
00048 void TopGenEventAnalyzer::beginJob()
00049 {
00050 }
00051
00052 void TopGenEventAnalyzer::endJob()
00053 {
00054 }