CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PatTopSelectionAnalyzer Class Reference
Inheritance diagram for PatTopSelectionAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 PatTopSelectionAnalyzer (const edm::ParameterSet &)
 default constructor More...
 
 ~PatTopSelectionAnalyzer () 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::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
 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...
 
bool booked (const std::string histName) const
 check if histogram was booked More...
 
void endJob () override
 everything that needs to be done after the event loop More...
 
void fill (const std::string histName, double value) const
 fill histogram if it had been booked before More...
 

Private Attributes

edm::EDGetTokenT< edm::View< pat::Electron > > elecsToken_
 
std::map< std::string, TH1F * > hists_
 
edm::EDGetTokenT< edm::View< pat::Jet > > jetsToken_
 
edm::EDGetTokenT< edm::View< pat::MET > > metToken_
 
edm::EDGetTokenT< edm::View< pat::Muon > > muonsToken_
 

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 18 of file PatTopSelectionAnalyzer.cc.

Constructor & Destructor Documentation

◆ PatTopSelectionAnalyzer()

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

◆ ~PatTopSelectionAnalyzer()

PatTopSelectionAnalyzer::~PatTopSelectionAnalyzer ( )
override

default destructor

Definition at line 60 of file PatTopSelectionAnalyzer.cc.

60 {}

Member Function Documentation

◆ analyze()

void PatTopSelectionAnalyzer::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 PatTopSelectionAnalyzer.cc.

62  {
63  // get electron collection
65  iEvent.getByToken(elecsToken_, elecs);
66 
67  // get muon collection
69  iEvent.getByToken(muonsToken_, muons);
70 
71  // get jet collection
73  iEvent.getByToken(jetsToken_, jets);
74 
75  // get met collection
77  iEvent.getByToken(metToken_, met);
78 
79  // fill yield
80  fill("yield", 0.5);
81 
82  // fill quantities for leading elec and elec multiplicity
83  fill("elecMult", elecs->size());
84  if (elecs->begin() != elecs->end()) {
85  fill("elecIso", (elecs->begin()->trackIso() + elecs->begin()->caloIso()) / elecs->begin()->pt());
86  fill("elecPt", elecs->begin()->pt());
87  }
88 
89  // fill quantities for leading muon and muon multiplicity
90  fill("muonMult", muons->size());
91  if (muons->begin() != muons->end()) {
92  fill("muonIso", (muons->begin()->trackIso() + muons->begin()->caloIso()) / muons->begin()->pt());
93  fill("muonPt", muons->begin()->pt());
94  }
95 
96  // fill quantities for leading jets and jet multiplicity
97  // jet pt is corrected up to L3Absolute
98  fill("jetMult", jets->size());
99  if (!jets->empty())
100  fill("jet0Pt", (*jets)[0].pt());
101  if (jets->size() > 1)
102  fill("jet1Pt", (*jets)[1].pt());
103  if (jets->size() > 2)
104  fill("jet2Pt", (*jets)[2].pt());
105  if (jets->size() > 3)
106  fill("jet3Pt", (*jets)[3].pt());
107 
108  // fill MET
109  fill("met", met->empty() ? 0 : (*met)[0].et());
110 }

References singleTopDQM_cfi::elecs, elecsToken_, fill(), iEvent, singleTopDQM_cfi::jets, jetsToken_, BTaggingMonitor_cfi::met, metToken_, PDWG_BPHSkim_cff::muons, and muonsToken_.

◆ beginJob()

void PatTopSelectionAnalyzer::beginJob ( void  )
overrideprivatevirtual

everything that needs to be done before the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 112 of file PatTopSelectionAnalyzer.cc.

112  {
113  // register to the TFileService
115 
116  // book histograms:
117  hists_["yield"] = fs->make<TH1F>("yield", "electron multiplicity", 1, 0., 1.);
118  hists_["elecMult"] = fs->make<TH1F>("elecMult", "electron multiplicity", 10, 0., 10.);
119  hists_["elecIso"] = fs->make<TH1F>("elecIso", "electron isolation", 20, 0., 1.);
120  hists_["elecPt"] = fs->make<TH1F>("elecPt", "electron pt", 30, 0., 150.);
121  hists_["muonMult"] = fs->make<TH1F>("muonMult", "muon multiplicity", 10, 0., 10.);
122  hists_["muonIso"] = fs->make<TH1F>("muonIso", "muon isolation", 20, 0., 1.);
123  hists_["muonPt"] = fs->make<TH1F>("muonPt", "muon pt", 30, 0., 150.);
124  hists_["jetMult"] = fs->make<TH1F>("jetMult", "jet multiplicity", 15, 0., 15.);
125  hists_["jet0Pt"] = fs->make<TH1F>("jet0Pt", "1. leading jet pt", 50, 0., 250.);
126  hists_["jet1Pt"] = fs->make<TH1F>("jet1Pt", "1. leading jet pt", 50, 0., 250.);
127  hists_["jet2Pt"] = fs->make<TH1F>("jet2Pt", "1. leading jet pt", 50, 0., 200.);
128  hists_["jet3Pt"] = fs->make<TH1F>("jet3Pt", "1. leading jet pt", 50, 0., 200.);
129  hists_["met"] = fs->make<TH1F>("met", "missing E_{T}", 25, 0., 200.);
130 }

References hists_, and TFileService::make().

◆ booked()

bool PatTopSelectionAnalyzer::booked ( const std::string  histName) const
inlineprivate

check if histogram was booked

Definition at line 34 of file PatTopSelectionAnalyzer.cc.

34 { return hists_.find(histName) != hists_.end(); };

References hists_.

Referenced by fill().

◆ endJob()

void PatTopSelectionAnalyzer::endJob ( void  )
overrideprivatevirtual

everything that needs to be done after the event loop

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file PatTopSelectionAnalyzer.cc.

132 {}

◆ fill()

void PatTopSelectionAnalyzer::fill ( const std::string  histName,
double  value 
) const
inlineprivate

fill histogram if it had been booked before

Definition at line 36 of file PatTopSelectionAnalyzer.cc.

36  {
37  if (booked(histName))
38  hists_.find(histName)->second->Fill(value);
39  };

References booked(), and hists_.

Referenced by analyze().

Member Data Documentation

◆ elecsToken_

edm::EDGetTokenT<edm::View<pat::Electron> > PatTopSelectionAnalyzer::elecsToken_
private

Definition at line 47 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

◆ hists_

std::map<std::string, TH1F*> PatTopSelectionAnalyzer::hists_
private

Definition at line 39 of file PatTopSelectionAnalyzer.cc.

Referenced by beginJob(), booked(), and fill().

◆ jetsToken_

edm::EDGetTokenT<edm::View<pat::Jet> > PatTopSelectionAnalyzer::jetsToken_
private

Definition at line 49 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

◆ metToken_

edm::EDGetTokenT<edm::View<pat::MET> > PatTopSelectionAnalyzer::metToken_
private

Definition at line 50 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

◆ muonsToken_

edm::EDGetTokenT<edm::View<pat::Muon> > PatTopSelectionAnalyzer::muonsToken_
private

Definition at line 48 of file PatTopSelectionAnalyzer.cc.

Referenced by analyze().

PDWG_BPHSkim_cff.muons
muons
Definition: PDWG_BPHSkim_cff.py:47
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::Handle
Definition: AssociativeIterator.h:50
BTaggingMonitor_cfi.met
met
Definition: BTaggingMonitor_cfi.py:84
PatTopSelectionAnalyzer::metToken_
edm::EDGetTokenT< edm::View< pat::MET > > metToken_
Definition: PatTopSelectionAnalyzer.cc:50
PatTopSelectionAnalyzer::elecsToken_
edm::EDGetTokenT< edm::View< pat::Electron > > elecsToken_
Definition: PatTopSelectionAnalyzer.cc:47
singleTopDQM_cfi.elecs
elecs
Definition: singleTopDQM_cfi.py:41
PatTopSelectionAnalyzer::jetsToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetsToken_
Definition: PatTopSelectionAnalyzer.cc:49
PatTopSelectionAnalyzer::muonsToken_
edm::EDGetTokenT< edm::View< pat::Muon > > muonsToken_
Definition: PatTopSelectionAnalyzer.cc:48
edm::View
Definition: CaloClusterFwd.h:14
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
value
Definition: value.py:1
PatTopSelectionAnalyzer::booked
bool booked(const std::string histName) const
check if histogram was booked
Definition: PatTopSelectionAnalyzer.cc:34
PatTopSelectionAnalyzer::hists_
std::map< std::string, TH1F * > hists_
Definition: PatTopSelectionAnalyzer.cc:39
PatTopSelectionAnalyzer::fill
void fill(const std::string histName, double value) const
fill histogram if it had been booked before
Definition: PatTopSelectionAnalyzer.cc:36
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:153
edm::InputTag
Definition: InputTag.h:15
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64