CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TTbar_GenLepAnalyzer Class Reference

#include <TTbar_GenLepAnalyzer.h>

Inheritance diagram for TTbar_GenLepAnalyzer:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 TTbar_GenLepAnalyzer (const edm::ParameterSet &)
 
 ~TTbar_GenLepAnalyzer () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 Attributes

bool do_e_
 
bool do_mu_
 
bool do_nu_e_
 
bool do_nu_mu_
 
bool do_nu_tau_
 
bool do_tau_
 
double eta_cut_
 
std::map< std::string, MonitorElement * > hists_
 
edm::InputTag leps_
 
edm::EDGetTokenT< edm::View< reco::Candidate > > lepsToken_
 
int pdgid
 
double pt_cut_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 51 of file TTbar_GenLepAnalyzer.h.

Constructor & Destructor Documentation

TTbar_GenLepAnalyzer::TTbar_GenLepAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 7 of file TTbar_GenLepAnalyzer.cc.

References leps_, and lepsToken_.

8  : leps_(iConfig.getParameter<edm::InputTag>("leptons")) {
9  lepsToken_ = consumes<edm::View<reco::Candidate> >(leps_);
10 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > lepsToken_
TTbar_GenLepAnalyzer::~TTbar_GenLepAnalyzer ( )
override

Definition at line 12 of file TTbar_GenLepAnalyzer.cc.

12  {
13  // do anything here that needs to be done at desctruction time
14  // (e.g. close files, deallocate resources etc.)
15 }

Member Function Documentation

void TTbar_GenLepAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 22 of file TTbar_GenLepAnalyzer.cc.

References edm::Event::getByToken(), hists_, edm::HandleBase::isValid(), TtSemiLepHitFitProducer_Electrons_cfi::leps, and lepsToken_.

22  {
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 }
edm::EDGetTokenT< edm::View< reco::Candidate > > lepsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
bool isValid() const
Definition: HandleBase.h:70
std::map< std::string, MonitorElement * > hists_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
void TTbar_GenLepAnalyzer::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  r,
edm::EventSetup const &  e 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 59 of file TTbar_GenLepAnalyzer.cc.

References DQMHelper::book1dHisto(), hists_, edm::InputTag::label(), leps_, and dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder().

59  {
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 }
std::string const & label() const
Definition: InputTag.h:36
std::map< std::string, MonitorElement * > hists_

Member Data Documentation

bool TTbar_GenLepAnalyzer::do_e_
private

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_mu_
private

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_e_
private

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_mu_
private

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_tau_
private

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_tau_
private

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

double TTbar_GenLepAnalyzer::eta_cut_
private

Definition at line 66 of file TTbar_GenLepAnalyzer.h.

std::map<std::string, MonitorElement *> TTbar_GenLepAnalyzer::hists_
private

Definition at line 63 of file TTbar_GenLepAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag TTbar_GenLepAnalyzer::leps_
private

Definition at line 62 of file TTbar_GenLepAnalyzer.h.

Referenced by bookHistograms(), and TTbar_GenLepAnalyzer().

edm::EDGetTokenT<edm::View<reco::Candidate> > TTbar_GenLepAnalyzer::lepsToken_
private

Definition at line 69 of file TTbar_GenLepAnalyzer.h.

Referenced by analyze(), and TTbar_GenLepAnalyzer().

int TTbar_GenLepAnalyzer::pdgid
private

Definition at line 67 of file TTbar_GenLepAnalyzer.h.

double TTbar_GenLepAnalyzer::pt_cut_
private

Definition at line 66 of file TTbar_GenLepAnalyzer.h.