CMS 3D CMS Logo

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 () override
 default destructor More...
 
- 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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
 everything that needs to be done during the event loop More...
 
void beginJob () override
 everything that needs to be done before the event loop More...
 
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
 
- 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 20 of file PatBasicAnalyzer.cc.

Constructor & Destructor Documentation

◆ PatBasicAnalyzer()

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

◆ ~PatBasicAnalyzer()

PatBasicAnalyzer::~PatBasicAnalyzer ( )
override

default destructor

Definition at line 60 of file PatBasicAnalyzer.cc.

60 {}

Member Function Documentation

◆ analyze()

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

62  {
63  // get electron collection
65  iEvent.getByToken(elecSrcToken_, electrons);
66 
67  // get muon collection
69  iEvent.getByToken(muonSrcToken_, muons);
70 
71  // get tau collection
73  iEvent.getByToken(tauSrcToken_, taus);
74 
75  // get jet collection
77  iEvent.getByToken(jetSrcToken_, jets);
78 
79  // get met collection
81  iEvent.getByToken(metSrcToken_, mets);
82 
83  // get photon collection
85  iEvent.getByToken(photonSrcToken_, photons);
86 
87  // loop over jets
88  size_t nJets = 0;
89  for (edm::View<pat::Jet>::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
90  if (jet->pt() > 50) {
91  ++nJets;
92  }
93  // uncomment the following line to fill the
94  // jetTowers_ histogram
95  // jetTowers_->Fill(jet->getCaloConstituents().size());
96  }
97  histContainer_["jets"]->Fill(nJets);
98 
99  // do something similar for the other candidates
100  histContainer_["photons"]->Fill(photons->size());
101  histContainer_["elecs"]->Fill(electrons->size());
102  histContainer_["muons"]->Fill(muons->size());
103  histContainer_["taus"]->Fill(taus->size());
104  histContainer_["met"]->Fill(mets->empty() ? 0 : (*mets)[0].et());
105 }

References elecSrcToken_, pwdgSkimBPark_cfi::electrons, histContainer_, iEvent, metsig::jet, singleTopDQM_cfi::jets, jetSrcToken_, singleTopDQM_cfi::mets, metSrcToken_, PDWG_BPHSkim_cff::muons, muonSrcToken_, BPHMonitor_cfi::photons, photonSrcToken_, Tau3MuMonitor_cff::taus, and tauSrcToken_.

◆ beginJob()

void PatBasicAnalyzer::beginJob ( void  )
overrideprivatevirtual

everything that needs to be done before the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 107 of file PatBasicAnalyzer.cc.

107  {
108  // register to the TFileService
110 
111  // book histograms:
112  // uncomment the following line to book the jetTowers_ histogram
113  //jetTowers_= fs->make<TH1F>("jetTowers", "towers per jet", 90, 0, 90);
114  histContainer_["photons"] = fs->make<TH1F>("photons", "photon multiplicity", 10, 0, 10);
115  histContainer_["elecs"] = fs->make<TH1F>("elecs", "electron multiplicity", 10, 0, 10);
116  histContainer_["muons"] = fs->make<TH1F>("muons", "muon multiplicity", 10, 0, 10);
117  histContainer_["taus"] = fs->make<TH1F>("taus", "tau multiplicity", 10, 0, 10);
118  histContainer_["jets"] = fs->make<TH1F>("jets", "jet multiplicity", 10, 0, 10);
119  histContainer_["met"] = fs->make<TH1F>("met", "missing E_{T}", 20, 0, 100);
120 }

References histContainer_, and TFileService::make().

◆ endJob()

void PatBasicAnalyzer::endJob ( void  )
overrideprivatevirtual

everything that needs to be done after the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file PatBasicAnalyzer.cc.

122 {}

Member Data Documentation

◆ elecSrcToken_

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

Definition at line 44 of file PatBasicAnalyzer.cc.

Referenced by analyze().

◆ histContainer_

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

Definition at line 38 of file PatBasicAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ jetSrcToken_

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

Definition at line 47 of file PatBasicAnalyzer.cc.

Referenced by analyze().

◆ jetTowers_

TH1F* PatBasicAnalyzer::jetTowers_
private

Definition at line 40 of file PatBasicAnalyzer.cc.

◆ metSrcToken_

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

Definition at line 48 of file PatBasicAnalyzer.cc.

Referenced by analyze().

◆ muonSrcToken_

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

Definition at line 45 of file PatBasicAnalyzer.cc.

Referenced by analyze().

◆ photonSrcToken_

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

Definition at line 43 of file PatBasicAnalyzer.cc.

Referenced by analyze().

◆ tauSrcToken_

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

Definition at line 46 of file PatBasicAnalyzer.cc.

Referenced by analyze().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
Tau3MuMonitor_cff.taus
taus
Definition: Tau3MuMonitor_cff.py:7
PatBasicAnalyzer::jetSrcToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetSrcToken_
Definition: PatBasicAnalyzer.cc:47
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
singleTopDQM_cfi.mets
mets
Definition: singleTopDQM_cfi.py:43
PatBasicAnalyzer::elecSrcToken_
edm::EDGetTokenT< edm::View< pat::Electron > > elecSrcToken_
Definition: PatBasicAnalyzer.cc:44
edm::Handle
Definition: AssociativeIterator.h:50
PatBasicAnalyzer::metSrcToken_
edm::EDGetTokenT< edm::View< pat::MET > > metSrcToken_
Definition: PatBasicAnalyzer.cc:48
PatBasicAnalyzer::histContainer_
std::map< std::string, TH1F * > histContainer_
Definition: PatBasicAnalyzer.cc:38
edm::View
Definition: CaloClusterFwd.h:14
PatBasicAnalyzer::muonSrcToken_
edm::EDGetTokenT< edm::View< pat::Muon > > muonSrcToken_
Definition: PatBasicAnalyzer.cc:45
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
BPHMonitor_cfi.photons
photons
Definition: BPHMonitor_cfi.py:91
TFileService::make
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
pwdgSkimBPark_cfi.electrons
electrons
Definition: pwdgSkimBPark_cfi.py:6
metsig::jet
Definition: SignAlgoResolutions.h:47
PatBasicAnalyzer::tauSrcToken_
edm::EDGetTokenT< edm::View< pat::Tau > > tauSrcToken_
Definition: PatBasicAnalyzer.cc:46
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
PatBasicAnalyzer::photonSrcToken_
edm::EDGetTokenT< edm::View< pat::Photon > > photonSrcToken_
Definition: PatBasicAnalyzer.cc:43
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:159
edm::InputTag
Definition: InputTag.h:15