CMS 3D CMS Logo

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

Public Member Functions

 PatZjetsElectronAnalyzer (const edm::ParameterSet &)
 
 ~PatZjetsElectronAnalyzer () override
 
- 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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
void beginJob () override
 
void endJob () override
 

Private Attributes

std::map< std::string, TH1F * > histContainer_
 
edm::EDGetTokenT< edm::View< pat::Electron > > srcToken_
 

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 15 of file PatZjetsElectronAnalyzer.cc.

Constructor & Destructor Documentation

◆ PatZjetsElectronAnalyzer()

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

Definition at line 34 of file PatZjetsElectronAnalyzer.cc.

References TFileService::kSharedResource.

35  : histContainer_(),
37  usesResource(TFileService::kSharedResource);
38 }
static const std::string kSharedResource
Definition: TFileService.h:76
std::map< std::string, TH1F * > histContainer_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< edm::View< pat::Electron > > srcToken_

◆ ~PatZjetsElectronAnalyzer()

PatZjetsElectronAnalyzer::~PatZjetsElectronAnalyzer ( )
override

Definition at line 40 of file PatZjetsElectronAnalyzer.cc.

40 {}

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 42 of file PatZjetsElectronAnalyzer.cc.

References newFWLiteAna::bin, singleTopDQM_cfi::elecs, histContainer_, iEvent, singleTopDQM_cfi::lowerEdge, srcToken_, and singleTopDQM_cfi::upperEdge.

42  {
43  // get electron collection
45  iEvent.getByToken(srcToken_, elecs);
46 
47  // loop electrons
48  for (edm::View<pat::Electron>::const_iterator elec = elecs->begin(); elec != elecs->end(); ++elec) {
49  // fill simple histograms
50  histContainer_["pt"]->Fill(elec->pt());
51  histContainer_["eta"]->Fill(elec->eta());
52  histContainer_["phi"]->Fill(elec->phi());
53  histContainer_["iso"]->Fill((elec->trackIso() + elec->caloIso()) / elec->pt());
54  histContainer_["eop"]->Fill(elec->eSeedClusterOverP());
55  histContainer_["clus"]->Fill(elec->e1x5() / elec->e5x5());
56  // fill enegry flow histogram for isolation
57  for (int bin = 1; bin <= histContainer_["dr"]->GetNbinsX(); ++bin) {
58  double lowerEdge = histContainer_["dr"]->GetBinLowEdge(bin);
59  double upperEdge = histContainer_["dr"]->GetBinLowEdge(bin) + histContainer_["dr"]->GetBinWidth(bin);
60  histContainer_["dr"]->Fill(
61  histContainer_["dr"]->GetBinCenter(bin),
62  elec->trackIsoDeposit()->depositWithin(upperEdge) - elec->trackIsoDeposit()->depositWithin(lowerEdge));
63  }
64  // fill electron id histograms
65  if (elec->electronID("eidRobustLoose") > 0.5)
66  histContainer_["eIDs"]->Fill(0);
67  if (elec->electronID("eidRobustTight") > 0.5)
68  histContainer_["eIDs"]->Fill(1);
69  if (elec->electronID("eidLoose") > 0.5)
70  histContainer_["eIDs"]->Fill(2);
71  if (elec->electronID("eidTight") > 0.5)
72  histContainer_["eIDs"]->Fill(3);
73  if (elec->electronID("eidRobustHighEnergy") > 0.5)
74  histContainer_["eIDs"]->Fill(4);
75  }
76 }
std::map< std::string, TH1F * > histContainer_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< edm::View< pat::Electron > > srcToken_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88

◆ beginJob()

void PatZjetsElectronAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 78 of file PatZjetsElectronAnalyzer.cc.

References compareTotals::fs, and histContainer_.

78  {
79  // register to the TFileService
81 
82  // book histograms:
83  histContainer_["pt"] = fs->make<TH1F>("pt", "pt", 150, 0., 150.);
84  histContainer_["eta"] = fs->make<TH1F>("eta", "eta", 50, 0., 5.);
85  histContainer_["phi"] = fs->make<TH1F>("phi", "phi", 60, 3.14, 3.14);
86  histContainer_["iso"] = fs->make<TH1F>("iso", "iso", 30, 0., 10.);
87  histContainer_["dr"] = fs->make<TH1F>("dr", "dr", 40, 0., 1.);
88  histContainer_["eop"] = fs->make<TH1F>("eop", "eop", 40, 0., 1.);
89  histContainer_["clus"] = fs->make<TH1F>("clus", "clus", 40, 0., 1.);
90  histContainer_["eIDs"] = fs->make<TH1F>("eIDs", "eIDS", 5, 0., 5.);
91 }
std::map< std::string, TH1F * > histContainer_

◆ endJob()

void PatZjetsElectronAnalyzer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 93 of file PatZjetsElectronAnalyzer.cc.

93 {}

Member Data Documentation

◆ histContainer_

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

Definition at line 28 of file PatZjetsElectronAnalyzer.cc.

Referenced by analyze(), and beginJob().

◆ srcToken_

edm::EDGetTokenT<edm::View<pat::Electron> > PatZjetsElectronAnalyzer::srcToken_
private

Definition at line 31 of file PatZjetsElectronAnalyzer.cc.

Referenced by analyze().