CMS 3D CMS Logo

TTbar_GenLepAnalyzer.cc
Go to the documentation of this file.
6 
8  : leps_(iConfig.getParameter<edm::InputTag>("leptons")) {
9  lepsToken_ = consumes<edm::View<reco::Candidate> >(leps_);
10 }
11 
13  // do anything here that needs to be done at desctruction time
14  // (e.g. close files, deallocate resources etc.)
15 }
16 
17 //
18 // member functions
19 //
20 
21 // ------------ method called for each event ------------
23  // Handle to the Leptons collections
25  iEvent.getByToken(lepsToken_, leps);
26  if (!leps.isValid())
27  return;
28 
29  // loop Jet collection and fill histograms
30  int nleps = 0;
31  for (edm::View<reco::Candidate>::const_iterator lep_it = leps->begin(); lep_it != leps->end(); ++lep_it) {
32  ++nleps;
33 
34  if (nleps > 0) {
35  hists_["lepPtAll"]->Fill(lep_it->p4().pt());
36  hists_["lepEtaAll"]->Fill(lep_it->p4().eta());
37  }
38  if (nleps == 1) {
39  hists_["lepPt1"]->Fill(lep_it->p4().pt());
40  hists_["lepEta1"]->Fill(lep_it->p4().eta());
41  }
42  if (nleps == 2) {
43  hists_["lepPt2"]->Fill(lep_it->p4().pt());
44  hists_["lepEta2"]->Fill(lep_it->p4().eta());
45  }
46  if (nleps == 3) {
47  hists_["lepPt3"]->Fill(lep_it->p4().pt());
48  hists_["lepEta3"]->Fill(lep_it->p4().eta());
49  }
50  if (nleps == 4) {
51  hists_["lepPt4"]->Fill(lep_it->p4().pt());
52  hists_["lepEta4"]->Fill(lep_it->p4().eta());
53  }
54  }
55 
56  hists_["lepN"]->Fill(nleps);
57 }
58 
60  DQMHelper dqm(&i);
61  i.setCurrentFolder("Generator/TTbar");
62  hists_["lepN"] = dqm.book1dHisto(
63  "TTbar_lepN" + leps_.label(), "N", 10, -.5, 9.5, "Number of " + leps_.label(), "Number of Events");
64 
65  hists_["lepPtAll"] = dqm.book1dHisto("TTbar_lepPtAll_" + leps_.label(),
66  "pt",
67  1000,
68  0.,
69  1000.,
70  "P_{t}^{All-" + leps_.label() + "} (GeV)",
71  "Number of Events");
72  hists_["lepPt1"] = dqm.book1dHisto("TTbar_lepPt1_" + leps_.label(),
73  "pt",
74  1000,
75  0.,
76  1000.,
77  "P_{t}^{1st-" + leps_.label() + "} (GeV)",
78  "Number of Events");
79  hists_["lepPt2"] = dqm.book1dHisto("TTbar_lepPt2_" + leps_.label(),
80  "pt",
81  1000,
82  0.,
83  1000.,
84  "P_{t}^{2nd-" + leps_.label() + "} (GeV)",
85  "Number of Events");
86  hists_["lepPt3"] = dqm.book1dHisto("TTbar_lepPt3_" + leps_.label(),
87  "pt",
88  1000,
89  0.,
90  1000.,
91  "P_{t}^{3rd-" + leps_.label() + "} (GeV)",
92  "Number of Events");
93  hists_["lepPt4"] = dqm.book1dHisto("TTbar_lepPt4_" + leps_.label(),
94  "pt",
95  1000,
96  0.,
97  1000.,
98  "P_{t}^{4th-" + leps_.label() + "} (GeV)",
99  "Number of Events");
100 
101  hists_["lepEtaAll"] = dqm.book1dHisto(
102  "TTbar_lepEtaAll" + leps_.label(), "eta", 100, -5., 5., "#eta^{All-" + leps_.label() + "}", "Number of Events");
103  hists_["lepEta1"] = dqm.book1dHisto(
104  "TTbar_lepEta1" + leps_.label(), "eta", 100, -5., 5., "#eta^{1st-" + leps_.label() + "}", "Number of Events");
105  hists_["lepEta2"] = dqm.book1dHisto(
106  "TTbar_lepEta2" + leps_.label(), "eta", 100, -5., 5., "#eta^{2nd-" + leps_.label() + "}", "Number of Events");
107  hists_["lepEta3"] = dqm.book1dHisto(
108  "TTbar_lepEta3" + leps_.label(), "eta", 100, -5., 5., "#eta^{3rd-" + leps_.label() + "}", "Number of Events");
109  hists_["lepEta4"] = dqm.book1dHisto(
110  "TTbar_lepEta4" + leps_.label(), "eta", 100, -5., 5., "#eta^{4th-" + leps_.label() + "}", "Number of Events");
111 }
PdtPdgMini.h
TTbar_GenLepAnalyzer::bookHistograms
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Definition: TTbar_GenLepAnalyzer.cc:59
mps_fire.i
i
Definition: mps_fire.py:428
edm::Run
Definition: Run.h:45
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89353
TTbar_GenLepAnalyzer::lepsToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > lepsToken_
Definition: TTbar_GenLepAnalyzer.h:69
DQMStore.h
edm::Handle
Definition: AssociativeIterator.h:50
GenParticle.h
TtSemiLepHitFitProducer_Electrons_cfi.leps
leps
Definition: TtSemiLepHitFitProducer_Electrons_cfi.py:5
TTbar_GenLepAnalyzer::~TTbar_GenLepAnalyzer
~TTbar_GenLepAnalyzer() override
Definition: TTbar_GenLepAnalyzer.cc:12
DQMHelper.h
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
TTbar_GenLepAnalyzer::hists_
std::map< std::string, MonitorElement * > hists_
Definition: TTbar_GenLepAnalyzer.h:63
TTbar_GenLepAnalyzer::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: TTbar_GenLepAnalyzer.cc:22
edm::ParameterSet
Definition: ParameterSet.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup
Definition: EventSetup.h:57
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DQMHelper
Definition: DQMHelper.h:15
TTbar_GenLepAnalyzer::leps_
edm::InputTag leps_
Definition: TTbar_GenLepAnalyzer.h:62
dqm::implementation::IBooker
Definition: DQMStore.h:43
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
dqm
Definition: DQMStore.h:18
TTbar_GenLepAnalyzer::TTbar_GenLepAnalyzer
TTbar_GenLepAnalyzer(const edm::ParameterSet &)
Definition: TTbar_GenLepAnalyzer.cc:7
edm::Event
Definition: Event.h:73
TTbar_GenLepAnalyzer.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37