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
PatBasicAnalyzer Class Reference
Inheritance diagram for PatBasicAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PatBasicAnalyzer (const edm::ParameterSet &)
 default constructor More...
 
 ~PatBasicAnalyzer ()
 default destructor More...
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 &) override
 everything that needs to be done during the event loop More...
 
virtual void beginJob () override
 everything that needs to be done before the event loop More...
 
virtual void endJob () override
 everything that needs to be done after the event loop More...
 

Private Attributes

edm::EDGetTokenT< edm::View
< pat::Electron > > 
elecSrcToken_
 
std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View
< pat::Jet > > 
jetSrcToken_
 
TH1F * jetTowers_
 
edm::EDGetTokenT< edm::View
< pat::MET > > 
metSrcToken_
 
edm::EDGetTokenT< edm::View
< pat::Muon > > 
muonSrcToken_
 
edm::EDGetTokenT< edm::View
< pat::Photon > > 
photonSrcToken_
 
edm::EDGetTokenT< edm::View
< pat::Tau > > 
tauSrcToken_
 

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 20 of file PatBasicAnalyzer.cc.

Constructor & Destructor Documentation

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

default constructor

Definition at line 52 of file PatBasicAnalyzer.cc.

52  :
60 {
61 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< pat::Tau > > tauSrcToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetSrcToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
edm::EDGetTokenT< edm::View< pat::MET > > metSrcToken_
std::map< std::string, TH1F * > histContainer_
edm::EDGetTokenT< edm::View< pat::Electron > > elecSrcToken_
edm::EDGetTokenT< edm::View< pat::Photon > > photonSrcToken_
PatBasicAnalyzer::~PatBasicAnalyzer ( )

default destructor

Definition at line 63 of file PatBasicAnalyzer.cc.

64 {
65 }

Member Function Documentation

void PatBasicAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

everything that needs to be done during the event loop

Implements edm::EDAnalyzer.

Definition at line 68 of file PatBasicAnalyzer.cc.

References elecSrcToken_, HI_PhotonSkim_cff::electrons, edm::Event::getByToken(), histContainer_, metsig::jet, fwrapper::jets, jetSrcToken_, metSrcToken_, patZpeak::muons, muonSrcToken_, interactiveExample::photons, photonSrcToken_, and tauSrcToken_.

69 {
70  // get electron collection
72  iEvent.getByToken(elecSrcToken_,electrons);
73 
74  // get muon collection
76  iEvent.getByToken(muonSrcToken_,muons);
77 
78  // get tau collection
80  iEvent.getByToken(tauSrcToken_,taus);
81 
82  // get jet collection
84  iEvent.getByToken(jetSrcToken_,jets);
85 
86  // get met collection
88  iEvent.getByToken(metSrcToken_,mets);
89 
90  // get photon collection
92  iEvent.getByToken(photonSrcToken_,photons);
93 
94  // loop over jets
95  size_t nJets=0;
96  for(edm::View<pat::Jet>::const_iterator jet=jets->begin(); jet!=jets->end(); ++jet){
97  if(jet->pt()>50){
98  ++nJets;
99  }
100  // uncomment the following line to fill the
101  // jetTowers_ histogram
102  // jetTowers_->Fill(jet->getCaloConstituents().size());
103  }
104  histContainer_["jets"]->Fill(nJets);
105 
106  // do something similar for the other candidates
107  histContainer_["photons"]->Fill(photons->size() );
108  histContainer_["elecs" ]->Fill(electrons->size());
109  histContainer_["muons"]->Fill(muons->size() );
110  histContainer_["taus" ]->Fill(taus->size() );
111  histContainer_["met" ]->Fill(mets->empty() ? 0 : (*mets)[0].et());
112 }
edm::EDGetTokenT< edm::View< pat::Tau > > tauSrcToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetSrcToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
edm::EDGetTokenT< edm::View< pat::MET > > metSrcToken_
vector< PseudoJet > jets
std::map< std::string, TH1F * > histContainer_
edm::EDGetTokenT< edm::View< pat::Electron > > elecSrcToken_
tuple muons
Definition: patZpeak.py:38
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< edm::View< pat::Photon > > photonSrcToken_
void PatBasicAnalyzer::beginJob ( void  )
overrideprivatevirtual

everything that needs to be done before the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 115 of file PatBasicAnalyzer.cc.

References histContainer_, and TFileService::make().

116 {
117  // register to the TFileService
119 
120  // book histograms:
121  // uncomment the following line to book the jetTowers_ histogram
122  //jetTowers_= fs->make<TH1F>("jetTowers", "towers per jet", 90, 0, 90);
123  histContainer_["photons"]=fs->make<TH1F>("photons", "photon multiplicity", 10, 0, 10);
124  histContainer_["elecs" ]=fs->make<TH1F>("elecs", "electron multiplicity", 10, 0, 10);
125  histContainer_["muons" ]=fs->make<TH1F>("muons", "muon multiplicity", 10, 0, 10);
126  histContainer_["taus" ]=fs->make<TH1F>("taus", "tau multiplicity", 10, 0, 10);
127  histContainer_["jets" ]=fs->make<TH1F>("jets", "jet multiplicity", 10, 0, 10);
128  histContainer_["met" ]=fs->make<TH1F>("met", "missing E_{T}", 20, 0, 100);
129 }
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::map< std::string, TH1F * > histContainer_
void PatBasicAnalyzer::endJob ( void  )
overrideprivatevirtual

everything that needs to be done after the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file PatBasicAnalyzer.cc.

133 {
134 }

Member Data Documentation

edm::EDGetTokenT<edm::View<pat::Electron> > PatBasicAnalyzer::elecSrcToken_
private

Definition at line 45 of file PatBasicAnalyzer.cc.

Referenced by analyze().

std::map<std::string,TH1F*> PatBasicAnalyzer::histContainer_
private

Definition at line 39 of file PatBasicAnalyzer.cc.

Referenced by analyze(), and beginJob().

edm::EDGetTokenT<edm::View<pat::Jet> > PatBasicAnalyzer::jetSrcToken_
private

Definition at line 48 of file PatBasicAnalyzer.cc.

Referenced by analyze().

TH1F* PatBasicAnalyzer::jetTowers_
private

Definition at line 41 of file PatBasicAnalyzer.cc.

edm::EDGetTokenT<edm::View<pat::MET> > PatBasicAnalyzer::metSrcToken_
private

Definition at line 49 of file PatBasicAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<edm::View<pat::Muon> > PatBasicAnalyzer::muonSrcToken_
private

Definition at line 46 of file PatBasicAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<edm::View<pat::Photon> > PatBasicAnalyzer::photonSrcToken_
private

Definition at line 44 of file PatBasicAnalyzer.cc.

Referenced by analyze().

edm::EDGetTokenT<edm::View<pat::Tau> > PatBasicAnalyzer::tauSrcToken_
private

Definition at line 47 of file PatBasicAnalyzer.cc.

Referenced by analyze().