CMS 3D CMS Logo

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

#include <TTbar_GenLepAnalyzer.h>

Inheritance diagram for TTbar_GenLepAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TTbar_GenLepAnalyzer (const edm::ParameterSet &)
 
 ~TTbar_GenLepAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

DQMStoredbe
 ME's "container". More...
 
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::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 54 of file TTbar_GenLepAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file TTbar_GenLepAnalyzer.cc.

References dbe, leps_, lepsToken_, and cppFunctionSkipper::operator.

6  :
7  leps_(iConfig.getParameter<edm::InputTag>("leptons"))
8 {
9  //now do what ever initialization is needed
10  dbe = 0;
12 
13  lepsToken_=consumes< edm::View<reco::Candidate> >(leps_);
14 
15 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::View< reco::Candidate > > lepsToken_
DQMStore * dbe
ME&#39;s &quot;container&quot;.
TTbar_GenLepAnalyzer::~TTbar_GenLepAnalyzer ( )

Definition at line 18 of file TTbar_GenLepAnalyzer.cc.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 33 of file TTbar_GenLepAnalyzer.cc.

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

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

Reimplemented from edm::EDAnalyzer.

Definition at line 72 of file TTbar_GenLepAnalyzer.cc.

References DQMStore::book1D(), dbe, hists_, edm::InputTag::label(), leps_, and DQMStore::setCurrentFolder().

73 {
74  if(!dbe) return;
75  dbe->setCurrentFolder("Generator/TTbar");
76  hists_["lepN" ] = dbe->book1D("TTbar_lepN" , "N" , 10, -.5, 9.5 );
77 
78  hists_["lepPtAll" ] = dbe->book1D("TTbar_lepPtAll_"+leps_.label() , "pt" , 1000, 0., 1000.);
79  hists_["lepPt1" ] = dbe->book1D("TTbar_lepPt1_"+leps_.label() , "pt" , 1000, 0., 1000.);
80  hists_["lepPt2" ] = dbe->book1D("TTbar_lepPt2_"+leps_.label() , "pt" , 1000, 0., 1000.);
81  hists_["lepPt3" ] = dbe->book1D("TTbar_lepPt3_"+leps_.label() , "pt" , 1000, 0., 1000.);
82  hists_["lepPt4" ] = dbe->book1D("TTbar_lepPt4_"+leps_.label() , "pt" , 1000, 0., 1000.);
83 
84  hists_["lepEtaAll"] = dbe->book1D("TTbar_lepEtaAll"+leps_.label(), "eta", 100, -5., 5.);
85  hists_["lepEta1" ] = dbe->book1D("TTbar_lepEta1"+leps_.label() , "eta", 100, -5., 5.);
86  hists_["lepEta2" ] = dbe->book1D("TTbar_lepEta2"+leps_.label() , "eta", 100, -5., 5.);
87  hists_["lepEta3" ] = dbe->book1D("TTbar_lepEta3"+leps_.label() , "eta", 100, -5., 5.);
88  hists_["lepEta4" ] = dbe->book1D("TTbar_lepEta4"+leps_.label() , "eta", 100, -5., 5.);
89 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
std::string const & label() const
Definition: InputTag.h:42
DQMStore * dbe
ME&#39;s &quot;container&quot;.
std::map< std::string, MonitorElement * > hists_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void TTbar_GenLepAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 111 of file TTbar_GenLepAnalyzer.cc.

112 {
113 }
void TTbar_GenLepAnalyzer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 99 of file TTbar_GenLepAnalyzer.cc.

100 {
101 }
void TTbar_GenLepAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 93 of file TTbar_GenLepAnalyzer.cc.

94 {
95 }
void TTbar_GenLepAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 117 of file TTbar_GenLepAnalyzer.cc.

118 {
119 }
void TTbar_GenLepAnalyzer::endRun ( edm::Run const &  ,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 105 of file TTbar_GenLepAnalyzer.cc.

106 {
107 }
void TTbar_GenLepAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 123 of file TTbar_GenLepAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

123  {
124  //The following says we do not know what parameters are allowed so do no validation
125  // Please change this to state exactly what you do use, even if it is no parameters
127  desc.setUnknown();
128  descriptions.addDefault(desc);
129 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

DQMStore* TTbar_GenLepAnalyzer::dbe
private

ME's "container".

Definition at line 74 of file TTbar_GenLepAnalyzer.h.

Referenced by beginJob(), and TTbar_GenLepAnalyzer().

bool TTbar_GenLepAnalyzer::do_e_
private

Definition at line 79 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_mu_
private

Definition at line 79 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_e_
private

Definition at line 79 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_mu_
private

Definition at line 79 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_nu_tau_
private

Definition at line 79 of file TTbar_GenLepAnalyzer.h.

bool TTbar_GenLepAnalyzer::do_tau_
private

Definition at line 79 of file TTbar_GenLepAnalyzer.h.

double TTbar_GenLepAnalyzer::eta_cut_
private

Definition at line 80 of file TTbar_GenLepAnalyzer.h.

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

Definition at line 77 of file TTbar_GenLepAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag TTbar_GenLepAnalyzer::leps_
private

Definition at line 76 of file TTbar_GenLepAnalyzer.h.

Referenced by beginJob(), and TTbar_GenLepAnalyzer().

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

Definition at line 83 of file TTbar_GenLepAnalyzer.h.

Referenced by analyze(), and TTbar_GenLepAnalyzer().

int TTbar_GenLepAnalyzer::pdgid
private

Definition at line 81 of file TTbar_GenLepAnalyzer.h.

double TTbar_GenLepAnalyzer::pt_cut_
private

Definition at line 80 of file TTbar_GenLepAnalyzer.h.