CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
TTbar_GenLepAnalyzer Class Reference

#include <TTbar_GenLepAnalyzer.h>

Inheritance diagram for TTbar_GenLepAnalyzer:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void bookHistograms (DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
 
 TTbar_GenLepAnalyzer (const edm::ParameterSet &)
 
 ~TTbar_GenLepAnalyzer ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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 edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 53 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_.

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

Definition at line 16 of file TTbar_GenLepAnalyzer.cc.

17 {
18 
19  // do anything here that needs to be done at desctruction time
20  // (e.g. close files, deallocate resources etc.)
21 
22 }

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 31 of file TTbar_GenLepAnalyzer.cc.

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

32 {
33 
34  // Handle to the Leptons collections
36  iEvent.getByToken(lepsToken_, leps);
37  if(!leps.isValid()) return;
38 
39  // loop Jet collection and fill histograms
40  int nleps = 0;
41  for(edm::View<reco::Candidate>::const_iterator lep_it=leps->begin(); lep_it!=leps->end(); ++lep_it){
42 
43  ++nleps;
44 
45  if (nleps > 0) { hists_["lepPtAll" ]->Fill( lep_it->p4().pt() );
46  hists_["lepEtaAll"]->Fill( lep_it->p4().eta() );
47  }
48  if (nleps == 1) { hists_["lepPt1" ]->Fill( lep_it->p4().pt() );
49  hists_["lepEta1"]->Fill( lep_it->p4().eta() );
50  }
51  if (nleps == 2) { hists_["lepPt2" ]->Fill( lep_it->p4().pt() );
52  hists_["lepEta2"]->Fill( lep_it->p4().eta() );
53  }
54  if (nleps == 3) { hists_["lepPt3" ]->Fill( lep_it->p4().pt() );
55  hists_["lepEta3"]->Fill( lep_it->p4().eta() );
56  }
57  if (nleps == 4) { hists_["lepPt4" ]->Fill( lep_it->p4().pt() );
58  hists_["lepEta4"]->Fill( lep_it->p4().eta() );
59  }
60  }
61 
62  hists_["lepN" ]->Fill( nleps ) ;
63 
64 
65 }
edm::EDGetTokenT< edm::View< reco::Candidate > > lepsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
bool isValid() const
Definition: HandleBase.h:75
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
std::map< std::string, MonitorElement * > hists_
void TTbar_GenLepAnalyzer::bookHistograms ( DQMStore::IBooker i,
edm::Run const &  r,
edm::EventSetup const &  e 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 68 of file TTbar_GenLepAnalyzer.cc.

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

68  {
69  DQMHelper dqm(&i); i.setCurrentFolder("Generator/TTbar");
70  hists_["lepN" ] = dqm.book1dHisto("TTbar_lepN"+leps_.label() , "N" , 10, -.5, 9.5 ,"Number of "+leps_.label(),"Number of Events");
71 
72  hists_["lepPtAll" ] = dqm.book1dHisto("TTbar_lepPtAll_"+leps_.label() , "pt" , 1000, 0., 1000.,"P_{t}^{All-"+leps_.label()+"} (GeV)","Number of Events");
73  hists_["lepPt1" ] = dqm.book1dHisto("TTbar_lepPt1_"+leps_.label() , "pt" , 1000, 0., 1000.,"P_{t}^{1st-"+leps_.label()+"} (GeV)","Number of Events");
74  hists_["lepPt2" ] = dqm.book1dHisto("TTbar_lepPt2_"+leps_.label() , "pt" , 1000, 0., 1000.,"P_{t}^{2nd-"+leps_.label()+"} (GeV)","Number of Events");
75  hists_["lepPt3" ] = dqm.book1dHisto("TTbar_lepPt3_"+leps_.label() , "pt" , 1000, 0., 1000.,"P_{t}^{3rd-"+leps_.label()+"} (GeV)","Number of Events");
76  hists_["lepPt4" ] = dqm.book1dHisto("TTbar_lepPt4_"+leps_.label() , "pt" , 1000, 0., 1000.,"P_{t}^{4th-"+leps_.label()+"} (GeV)","Number of Events");
77 
78  hists_["lepEtaAll"] = dqm.book1dHisto("TTbar_lepEtaAll"+leps_.label(), "eta", 100, -5., 5.,"#eta^{All-"+leps_.label()+"}","Number of Events");
79  hists_["lepEta1" ] = dqm.book1dHisto("TTbar_lepEta1"+leps_.label() , "eta", 100, -5., 5.,"#eta^{1st-"+leps_.label()+"}","Number of Events");
80  hists_["lepEta2" ] = dqm.book1dHisto("TTbar_lepEta2"+leps_.label() , "eta", 100, -5., 5.,"#eta^{2nd-"+leps_.label()+"}","Number of Events");
81  hists_["lepEta3" ] = dqm.book1dHisto("TTbar_lepEta3"+leps_.label() , "eta", 100, -5., 5.,"#eta^{3rd-"+leps_.label()+"}","Number of Events");
82  hists_["lepEta4" ] = dqm.book1dHisto("TTbar_lepEta4"+leps_.label() , "eta", 100, -5., 5.,"#eta^{4th-"+leps_.label()+"}","Number of Events");
83 }
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
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 67 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_mu_
private

Definition at line 67 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_e_
private

Definition at line 67 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_mu_
private

Definition at line 67 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_tau_
private

Definition at line 67 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_tau_
private

Definition at line 67 of file TTbar_GenLepAnalyzer.h.

double TTbar_GenLepAnalyzer::eta_cut_
private

Definition at line 68 of file TTbar_GenLepAnalyzer.h.

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

Definition at line 65 of file TTbar_GenLepAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag TTbar_GenLepAnalyzer::leps_
private

Definition at line 64 of file TTbar_GenLepAnalyzer.h.

Referenced by bookHistograms(), and TTbar_GenLepAnalyzer().

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

Definition at line 71 of file TTbar_GenLepAnalyzer.h.

Referenced by analyze(), and TTbar_GenLepAnalyzer().

int TTbar_GenLepAnalyzer::pdgid
private

Definition at line 69 of file TTbar_GenLepAnalyzer.h.

double TTbar_GenLepAnalyzer::pt_cut_
private

Definition at line 68 of file TTbar_GenLepAnalyzer.h.