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 ()
 
- 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
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
 
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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

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 &)
 
- 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

Definition at line 15 of file TopElecAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 3 of file TopElecAnalyzer.cc.

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

3  :
4  inputToken_ (consumes<std::vector<pat::Electron> >(cfg.getParameter<edm::InputTag>("input" ))),
5  verbose_(cfg.getParameter<bool> ("verbose"))
6 {
8 
9  mult_ = fs->make<TH1F>("mult", "multiplicity (electrons)", 10, 0 , 10);
10  en_ = fs->make<TH1F>("en" , "energy (electrons)" , 60, 0., 300.);
11  pt_ = fs->make<TH1F>("pt" , "pt (electrons)" , 60, 0., 300.);
12  eta_ = fs->make<TH1F>("eta" , "eta (electrons)" , 30, -3., 3.);
13  phi_ = fs->make<TH1F>("phi" , "phi (electrons)" , 40, -4., 4.);
14 }
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< std::vector< pat::Electron > > inputToken_
TopElecAnalyzer::~TopElecAnalyzer ( )

Definition at line 16 of file TopElecAnalyzer.cc.

17 {
18 }

Member Function Documentation

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

Definition at line 21 of file TopElecAnalyzer.cc.

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

22 {
24  evt.getByToken(inputToken_, elecs);
25 
26  // fill histograms
27 
28  mult_->Fill( elecs->size() );
29  for(std::vector<pat::Electron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
30  en_ ->Fill( elec->energy() );
31  pt_ ->Fill( elec->pt() );
32  eta_->Fill( elec->eta() );
33  phi_->Fill( elec->phi() );
34  }
35 
36  // produce printout if desired
37 
38  if( elecs->size()<1 || !verbose_ )
39  return;
40 
41  unsigned i=0;
42 
43  std::cout << "======================================================="
44  << std::endl;
45  std::cout << std::setw(5 ) << "ele :"
46  << std::setw(13) << "et :"
47  << std::setw(13) << "eta :"
48  << std::setw(13) << "phi :"
49  << std::setw(11) << "relIso" << std::endl;
50  std::cout << "-------------------------------------------------------"
51  << std::endl;
52  for(std::vector<pat::Electron>::const_iterator elec=elecs->begin(); elec!=elecs->end(); ++elec){
53  std::cout << std::setw(3 ) << i << " : "
54  << std::setw(10) << elec->pt() << " : "
55  << std::setw(10) << elec->eta() << " : "
56  << std::setw(10) << elec->phi() << " : "
57  << std::setw(10) << (elec->dr03TkSumPt()+elec->dr03EcalRecHitSumEt()+elec->dr03HcalTowerSumEt())/elec->et() << std::endl;
58  i++;
59  }
60  std::cout << "======================================================="
61  << std::endl;
62 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
edm::EDGetTokenT< std::vector< pat::Electron > > inputToken_
void TopElecAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file TopElecAnalyzer.cc.

65 {
66 }
void TopElecAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 68 of file TopElecAnalyzer.cc.

69 {
70 }

Member Data Documentation

TH1F* TopElecAnalyzer::en_
private

Definition at line 32 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

TH1F* TopElecAnalyzer::eta_
private

Definition at line 34 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

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

Definition at line 28 of file TopElecAnalyzer.h.

Referenced by analyze().

TH1F* TopElecAnalyzer::mult_
private

Definition at line 31 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

TH1F* TopElecAnalyzer::phi_
private

Definition at line 35 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

TH1F* TopElecAnalyzer::pt_
private

Definition at line 33 of file TopElecAnalyzer.h.

Referenced by analyze(), and TopElecAnalyzer().

bool TopElecAnalyzer::verbose_
private

Definition at line 29 of file TopElecAnalyzer.h.

Referenced by analyze().