CMS 3D CMS Logo

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

Public Member Functions

 PatTopSelectionAnalyzer (const edm::ParameterSet &)
 default constructor More...
 
 ~PatTopSelectionAnalyzer () override
 default destructor More...
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, 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::ESRecordsToProductResolverIndices 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::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 18 of file PatTopSelectionAnalyzer.cc.

Constructor & Destructor Documentation

◆ PatTopSelectionAnalyzer()

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

default constructor

Definition at line 53 of file PatTopSelectionAnalyzer.cc.

References TFileService::kSharedResource.

54  : hists_(),
59  usesResource(TFileService::kSharedResource);
60 }
static const std::string kSharedResource
Definition: TFileService.h:76
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< pat::MET > > metToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetsToken_
edm::EDGetTokenT< edm::View< pat::Electron > > elecsToken_
edm::EDGetTokenT< edm::View< pat::Muon > > muonsToken_
std::map< std::string, TH1F * > hists_

◆ ~PatTopSelectionAnalyzer()

PatTopSelectionAnalyzer::~PatTopSelectionAnalyzer ( )
override

default destructor

Definition at line 62 of file PatTopSelectionAnalyzer.cc.

62 {}

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::one::EDAnalyzerBase.

Definition at line 64 of file PatTopSelectionAnalyzer.cc.

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

64  {
65  // get electron collection
67  iEvent.getByToken(elecsToken_, elecs);
68 
69  // get muon collection
71  iEvent.getByToken(muonsToken_, muons);
72 
73  // get jet collection
75  iEvent.getByToken(jetsToken_, jets);
76 
77  // get met collection
79  iEvent.getByToken(metToken_, met);
80 
81  // fill yield
82  fill("yield", 0.5);
83 
84  // fill quantities for leading elec and elec multiplicity
85  fill("elecMult", elecs->size());
86  if (elecs->begin() != elecs->end()) {
87  fill("elecIso", (elecs->begin()->trackIso() + elecs->begin()->caloIso()) / elecs->begin()->pt());
88  fill("elecPt", elecs->begin()->pt());
89  }
90 
91  // fill quantities for leading muon and muon multiplicity
92  fill("muonMult", muons->size());
93  if (muons->begin() != muons->end()) {
94  fill("muonIso", (muons->begin()->trackIso() + muons->begin()->caloIso()) / muons->begin()->pt());
95  fill("muonPt", muons->begin()->pt());
96  }
97 
98  // fill quantities for leading jets and jet multiplicity
99  // jet pt is corrected up to L3Absolute
100  fill("jetMult", jets->size());
101  if (!jets->empty())
102  fill("jet0Pt", (*jets)[0].pt());
103  if (jets->size() > 1)
104  fill("jet1Pt", (*jets)[1].pt());
105  if (jets->size() > 2)
106  fill("jet2Pt", (*jets)[2].pt());
107  if (jets->size() > 3)
108  fill("jet3Pt", (*jets)[3].pt());
109 
110  // fill MET
111  fill("met", met->empty() ? 0 : (*met)[0].et());
112 }
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
Definition: DiMuonV_cfg.py:214
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< pat::MET > > metToken_
edm::EDGetTokenT< edm::View< pat::Jet > > jetsToken_
edm::EDGetTokenT< edm::View< pat::Electron > > elecsToken_
edm::EDGetTokenT< edm::View< pat::Muon > > muonsToken_
void fill(const std::string histName, double value) const
fill histogram if it had been booked before

◆ beginJob()

void PatTopSelectionAnalyzer::beginJob ( void  )
overrideprivatevirtual

everything that needs to be done before the event loop

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 114 of file PatTopSelectionAnalyzer.cc.

References compareTotals::fs, and hists_.

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

◆ booked()

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

check if histogram was booked

Definition at line 34 of file PatTopSelectionAnalyzer.cc.

References hists_.

Referenced by fill().

34 { return hists_.find(histName) != hists_.end(); };
std::map< std::string, TH1F * > hists_

◆ endJob()

void PatTopSelectionAnalyzer::endJob ( void  )
overrideprivatevirtual

everything that needs to be done after the event loop

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 134 of file PatTopSelectionAnalyzer.cc.

134 {}

◆ 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.

References booked(), and hists_.

Referenced by analyze().

36  {
37  if (booked(histName))
38  hists_.find(histName)->second->Fill(value);
39  };
Definition: value.py:1
bool booked(const std::string histName) const
check if histogram was booked
std::map< std::string, TH1F * > hists_

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().