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 Member Functions | Private Attributes
TopMuonAnalyzer Class Reference

#include <TopMuonAnalyzer.h>

Inheritance diagram for TopMuonAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 TopMuonAnalyzer (const edm::ParameterSet &)
 
 ~TopMuonAnalyzer ()
 
- 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
 
 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 (const std::string &iProcessName, std::vector< const char * > &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 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::Muon > > 
inputToken_
 
TH1F * mult_
 
TH1F * phi_
 
TH1F * pt_
 
bool verbose_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 TopMuonAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 5 of file TopMuonAnalyzer.cc.

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

5  :
6  inputToken_ (consumes<std::vector<pat::Muon> >(cfg.getParameter<edm::InputTag>("input" ))),
7  verbose_(cfg.getParameter<bool> ("verbose"))
8 {
10 
11  mult_ = fs->make<TH1F>("mult", "multiplicity (muons)", 10, 0 , 10);
12  en_ = fs->make<TH1F>("en" , "energy (muons)", 60, 0., 300.);
13  pt_ = fs->make<TH1F>("pt" , "pt (muons)", 60, 0., 300.);
14  eta_ = fs->make<TH1F>("eta" , "eta (muons)", 30, -3., 3.);
15  phi_ = fs->make<TH1F>("phi" , "phi (muons)", 40, -4., 4.);
16 
17 }
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::Muon > > inputToken_
TopMuonAnalyzer::~TopMuonAnalyzer ( )

Definition at line 19 of file TopMuonAnalyzer.cc.

20 {
21 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 24 of file TopMuonAnalyzer.cc.

References gather_cfg::cout, en_, eta_, edm::Event::getByToken(), i, inputToken_, mult_, digitizers_cfi::muon, patZpeak::muons, phi_, pt_, and verbose_.

25 {
27  evt.getByToken(inputToken_, muons);
28 
29  // fill histograms
30 
31  mult_->Fill( muons->size() );
32  for(std::vector<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
33  pt_ ->Fill( muon->pt() );
34  en_ ->Fill( muon->energy() );
35  eta_->Fill( muon->eta() );
36  phi_->Fill( muon->phi() );
37  }
38 
39  // produce printout if desired
40 
41  if( muons->size()<1 || !verbose_ )
42  return;
43 
44  unsigned i=0;
45 
46  std::cout << "==================================================================="
47  << std::endl;
48  std::cout << std::setw(5 ) << "mu :"
49  << std::setw(13) << "pt :"
50  << std::setw(13) << "eta :"
51  << std::setw(13) << "phi :"
52  << std::setw(13) << "relIso :"
53  << std::setw(6 ) << "GLB :"
54  << std::setw(4 ) << "TRK" << std::endl;
55  std::cout << "-------------------------------------------------------------------"
56  << std::endl;
57  for(std::vector<pat::Muon>::const_iterator muon=muons->begin(); muon!=muons->end(); ++muon){
58  std::cout << std::setw(3 ) << i << " : "
59  << std::setw(10) << muon->pt() << " : "
60  << std::setw(10) << muon->eta() << " : "
61  << std::setw(10) << muon->phi() << " : "
62  << std::setw(10) << (muon->trackIso()+muon->caloIso())/muon->pt() << " : "
63  << std::setw( 3) << muon->isGlobalMuon() << " : "
64  << std::setw( 3) << muon->isTrackerMuon() << std::endl;
65  i++;
66  }
67  std::cout << "==================================================================="
68  << std::endl;
69 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< std::vector< pat::Muon > > inputToken_
tuple muons
Definition: patZpeak.py:38
tuple cout
Definition: gather_cfg.py:121
void TopMuonAnalyzer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 71 of file TopMuonAnalyzer.cc.

72 {
73 }
void TopMuonAnalyzer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 75 of file TopMuonAnalyzer.cc.

76 {
77 }

Member Data Documentation

TH1F* TopMuonAnalyzer::en_
private

Definition at line 32 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

TH1F* TopMuonAnalyzer::eta_
private

Definition at line 34 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

edm::EDGetTokenT<std::vector<pat::Muon> > TopMuonAnalyzer::inputToken_
private

Definition at line 28 of file TopMuonAnalyzer.h.

Referenced by analyze().

TH1F* TopMuonAnalyzer::mult_
private

Definition at line 31 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

TH1F* TopMuonAnalyzer::phi_
private

Definition at line 35 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

TH1F* TopMuonAnalyzer::pt_
private

Definition at line 33 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

bool TopMuonAnalyzer::verbose_
private

Definition at line 29 of file TopMuonAnalyzer.h.

Referenced by analyze().