CMS 3D CMS Logo

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 () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::Muon > > 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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
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 = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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 TopMuonAnalyzer.h.

Constructor & Destructor Documentation

◆ TopMuonAnalyzer()

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

Definition at line 4 of file TopMuonAnalyzer.cc.

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

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

◆ ~TopMuonAnalyzer()

TopMuonAnalyzer::~TopMuonAnalyzer ( )
override

Definition at line 16 of file TopMuonAnalyzer.cc.

16 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 18 of file TopMuonAnalyzer.cc.

18  {
21 
22  // fill histograms
23 
24  mult_->Fill(muons->size());
25  for (std::vector<pat::Muon>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
26  pt_->Fill(muon->pt());
27  en_->Fill(muon->energy());
28  eta_->Fill(muon->eta());
29  phi_->Fill(muon->phi());
30  }
31 
32  // produce printout if desired
33 
34  if (muons->empty() || !verbose_)
35  return;
36 
37  unsigned i = 0;
38 
39  std::cout << "===================================================================" << std::endl;
40  std::cout << std::setw(5) << "mu :" << std::setw(13) << "pt :" << std::setw(13) << "eta :" << std::setw(13)
41  << "phi :" << std::setw(13) << "relIso :" << std::setw(6) << "GLB :" << std::setw(4) << "TRK" << std::endl;
42  std::cout << "-------------------------------------------------------------------" << std::endl;
43  for (std::vector<pat::Muon>::const_iterator muon = muons->begin(); muon != muons->end(); ++muon) {
44  std::cout << std::setw(3) << i << " : " << std::setw(10) << muon->pt() << " : " << std::setw(10) << muon->eta()
45  << " : " << std::setw(10) << muon->phi() << " : " << std::setw(10)
46  << (muon->trackIso() + muon->caloIso()) / muon->pt() << " : " << std::setw(3) << muon->isGlobalMuon()
47  << " : " << std::setw(3) << muon->isTrackerMuon() << std::endl;
48  i++;
49  }
50  std::cout << "===================================================================" << std::endl;
51 }

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

◆ beginJob()

void TopMuonAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file TopMuonAnalyzer.cc.

53 {}

◆ endJob()

void TopMuonAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file TopMuonAnalyzer.cc.

55 {}

Member Data Documentation

◆ en_

TH1F* TopMuonAnalyzer::en_
private

Definition at line 29 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

◆ eta_

TH1F* TopMuonAnalyzer::eta_
private

Definition at line 31 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

◆ inputToken_

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

Definition at line 25 of file TopMuonAnalyzer.h.

Referenced by analyze().

◆ mult_

TH1F* TopMuonAnalyzer::mult_
private

Definition at line 28 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

◆ phi_

TH1F* TopMuonAnalyzer::phi_
private

Definition at line 32 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

◆ pt_

TH1F* TopMuonAnalyzer::pt_
private

Definition at line 30 of file TopMuonAnalyzer.h.

Referenced by analyze(), and TopMuonAnalyzer().

◆ verbose_

bool TopMuonAnalyzer::verbose_
private

Definition at line 26 of file TopMuonAnalyzer.h.

Referenced by analyze().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
mps_fire.i
i
Definition: mps_fire.py:428
muon
Definition: MuonCocktails.h:17
gather_cfg.cout
cout
Definition: gather_cfg.py:144
TopMuonAnalyzer::eta_
TH1F * eta_
Definition: TopMuonAnalyzer.h:31
edm::Handle
Definition: AssociativeIterator.h:50
HLT_FULL_cff.muon
muon
Definition: HLT_FULL_cff.py:11710
TopMuonAnalyzer::mult_
TH1F * mult_
Definition: TopMuonAnalyzer.h:28
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:531
TopMuonAnalyzer::en_
TH1F * en_
Definition: TopMuonAnalyzer.h:29
edm::Service< TFileService >
looper.cfg
cfg
Definition: looper.py:297
TopMuonAnalyzer::phi_
TH1F * phi_
Definition: TopMuonAnalyzer.h:32
TopMuonAnalyzer::pt_
TH1F * pt_
Definition: TopMuonAnalyzer.h:30
TopMuonAnalyzer::inputToken_
edm::EDGetTokenT< std::vector< pat::Muon > > inputToken_
Definition: TopMuonAnalyzer.h:25
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
TopMuonAnalyzer::verbose_
bool verbose_
Definition: TopMuonAnalyzer.h:26
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64