CMS 3D CMS Logo

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

#include <TopElecAnalyzer.h>

Inheritance diagram for TopElecAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TopElecAnalyzer (const edm::ParameterSet &)
 
 ~TopElecAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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 Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

TH1F * en_
 
TH1F * eta_
 
edm::EDGetTokenT< std::vector< pat::Electron > > inputToken_
 
TH1F * mult_
 
TH1F * phi_
 
TH1F * pt_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 15 of file TopElecAnalyzer.h.

Constructor & Destructor Documentation

◆ TopElecAnalyzer()

TopElecAnalyzer::TopElecAnalyzer ( const edm::ParameterSet cfg)
explicit

Definition at line 3 of file TopElecAnalyzer.cc.

4  : inputToken_(consumes<std::vector<pat::Electron> >(cfg.getParameter<edm::InputTag>("input"))),
5  verbose_(cfg.getParameter<bool>("verbose")) {
7 
8  mult_ = fs->make<TH1F>("mult", "multiplicity (electrons)", 10, 0, 10);
9  en_ = fs->make<TH1F>("en", "energy (electrons)", 60, 0., 300.);
10  pt_ = fs->make<TH1F>("pt", "pt (electrons)", 60, 0., 300.);
11  eta_ = fs->make<TH1F>("eta", "eta (electrons)", 30, -3., 3.);
12  phi_ = fs->make<TH1F>("phi", "phi (electrons)", 40, -4., 4.);
13 }

References en_, eta_, TFileService::make(), mult_, phi_, and pt_.

◆ ~TopElecAnalyzer()

TopElecAnalyzer::~TopElecAnalyzer ( )
override

Definition at line 15 of file TopElecAnalyzer.cc.

15 {}

Member Function Documentation

◆ analyze()

void TopElecAnalyzer::analyze ( const edm::Event evt,
const edm::EventSetup setup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 17 of file TopElecAnalyzer.cc.

17  {
20 
21  // fill histograms
22 
23  mult_->Fill(elecs->size());
24  for (std::vector<pat::Electron>::const_iterator elec = elecs->begin(); elec != elecs->end(); ++elec) {
25  en_->Fill(elec->energy());
26  pt_->Fill(elec->pt());
27  eta_->Fill(elec->eta());
28  phi_->Fill(elec->phi());
29  }
30 
31  // produce printout if desired
32 
33  if (elecs->empty() || !verbose_)
34  return;
35 
36  unsigned i = 0;
37 
38  std::cout << "=======================================================" << std::endl;
39  std::cout << std::setw(5) << "ele :" << std::setw(13) << "et :" << std::setw(13) << "eta :" << std::setw(13)
40  << "phi :" << std::setw(11) << "relIso" << std::endl;
41  std::cout << "-------------------------------------------------------" << std::endl;
42  for (std::vector<pat::Electron>::const_iterator elec = elecs->begin(); elec != elecs->end(); ++elec) {
43  std::cout << std::setw(3) << i << " : " << std::setw(10) << elec->pt() << " : " << std::setw(10) << elec->eta()
44  << " : " << std::setw(10) << elec->phi() << " : " << std::setw(10)
45  << (elec->dr03TkSumPt() + elec->dr03EcalRecHitSumEt() + elec->dr03HcalTowerSumEt()) / elec->et()
46  << std::endl;
47  i++;
48  }
49  std::cout << "=======================================================" << std::endl;
50 }

References gather_cfg::cout, singleTopDQM_cfi::elecs, en_, eta_, edm::Event::getByToken(), mps_fire::i, inputToken_, mult_, phi_, pt_, and verbose_.

◆ beginJob()

void TopElecAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 52 of file TopElecAnalyzer.cc.

52 {}

◆ endJob()

void TopElecAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 54 of file TopElecAnalyzer.cc.

54 {}

Member Data Documentation

◆ en_

TH1F* TopElecAnalyzer::en_
private

Definition at line 29 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

◆ eta_

TH1F* TopElecAnalyzer::eta_
private

Definition at line 31 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

◆ inputToken_

edm::EDGetTokenT<std::vector<pat::Electron> > TopElecAnalyzer::inputToken_
private

Definition at line 25 of file TopElecAnalyzer.h.

Referenced by analyze().

◆ mult_

TH1F* TopElecAnalyzer::mult_
private

Definition at line 28 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

◆ phi_

TH1F* TopElecAnalyzer::phi_
private

Definition at line 32 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

◆ pt_

TH1F* TopElecAnalyzer::pt_
private

Definition at line 30 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

◆ verbose_

bool TopElecAnalyzer::verbose_
private

Definition at line 26 of file TopElecAnalyzer.h.

Referenced by analyze().

TopElecAnalyzer::verbose_
bool verbose_
Definition: TopElecAnalyzer.h:26
mps_fire.i
i
Definition: mps_fire.py:355
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TopElecAnalyzer::phi_
TH1F * phi_
Definition: TopElecAnalyzer.h:32
edm::Handle
Definition: AssociativeIterator.h:50
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
TopElecAnalyzer::mult_
TH1F * mult_
Definition: TopElecAnalyzer.h:28
edm::Service< TFileService >
TopElecAnalyzer::en_
TH1F * en_
Definition: TopElecAnalyzer.h:29
TopElecAnalyzer::inputToken_
edm::EDGetTokenT< std::vector< pat::Electron > > inputToken_
Definition: TopElecAnalyzer.h:25
TopElecAnalyzer::eta_
TH1F * eta_
Definition: TopElecAnalyzer.h:31
looper.cfg
cfg
Definition: looper.py:297
TopElecAnalyzer::pt_
TH1F * pt_
Definition: TopElecAnalyzer.h:30
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64