CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ZtoEEElectronTrackProducer Class Reference

#include <ZtoEEElectronTrackProducer.h>

Inheritance diagram for ZtoEEElectronTrackProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::StreamID streamID, edm::Event &iEvent, edm::EventSetup const &iSetup) const override
 
 ZtoEEElectronTrackProducer (const edm::ParameterSet &)
 
 ~ZtoEEElectronTrackProducer () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 Attributes

const edm::InputTag bsTag_
 
const edm::EDGetTokenT< reco::BeamSpotbsToken_
 
const edm::InputTag electronTag_
 
const edm::EDGetTokenT< reco::GsfElectronCollectionelectronToken_
 
const double maxD0_
 
const double maxDeltaEtaInEB_
 
const double maxDeltaEtaInEE_
 
const double maxDeltaPhiInEB_
 
const double maxDeltaPhiInEE_
 
const double maxDz_
 
const double maxEta_
 
const double maxHOEEB_
 
const double maxHOEEE_
 
const double maxInvMass_
 
const double maxIso_
 
const double maxNormChi2_
 
const double maxSigmaiEiEEB_
 
const double maxSigmaiEiEEE_
 
const double minInvMass_
 
const int minPixelHits_
 
const double minPt_
 
const double minPtHighest_
 
const int minStripHits_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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 17 of file ZtoEEElectronTrackProducer.h.

Constructor & Destructor Documentation

◆ ZtoEEElectronTrackProducer()

ZtoEEElectronTrackProducer::ZtoEEElectronTrackProducer ( const edm::ParameterSet ps)
explicit

Definition at line 20 of file ZtoEEElectronTrackProducer.cc.

21  : electronTag_(ps.getUntrackedParameter<edm::InputTag>("electronInputTag", edm::InputTag("gedGsfElectrons"))),
22  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
23  electronToken_(consumes<reco::GsfElectronCollection>(electronTag_)),
24  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
25  maxEta_(ps.getUntrackedParameter<double>("maxEta", 2.4)),
26  minPt_(ps.getUntrackedParameter<double>("minPt", 5)),
27  maxDeltaPhiInEB_(ps.getUntrackedParameter<double>("maxDeltaPhiInEB", 0.15)),
28  maxDeltaEtaInEB_(ps.getUntrackedParameter<double>("maxDeltaEtaInEB", 0.007)),
29  maxHOEEB_(ps.getUntrackedParameter<double>("maxHOEEB", 0.12)),
30  maxSigmaiEiEEB_(ps.getUntrackedParameter<double>("maxSigmaiEiEEB", 0.01)),
31  maxDeltaPhiInEE_(ps.getUntrackedParameter<double>("maxDeltaPhiInEE", 0.1)),
32  maxDeltaEtaInEE_(ps.getUntrackedParameter<double>("maxDeltaEtaInEE", 0.009)),
33  maxHOEEE_(ps.getUntrackedParameter<double>("maxHOEEB_", .10)),
34  maxSigmaiEiEEE_(ps.getUntrackedParameter<double>("maxSigmaiEiEEE", 0.03)),
35  maxNormChi2_(ps.getUntrackedParameter<double>("maxNormChi2", 10)),
36  maxD0_(ps.getUntrackedParameter<double>("maxD0", 0.02)),
37  maxDz_(ps.getUntrackedParameter<double>("maxDz", 20.)),
38  minPixelHits_(ps.getUntrackedParameter<uint32_t>("minPixelHits", 1)),
39  minStripHits_(ps.getUntrackedParameter<uint32_t>("minStripHits", 8)),
40  maxIso_(ps.getUntrackedParameter<double>("maxIso", 0.3)),
41  minPtHighest_(ps.getUntrackedParameter<double>("minPtHighest", 24)),
42  minInvMass_(ps.getUntrackedParameter<double>("minInvMass", 60)),
43  maxInvMass_(ps.getUntrackedParameter<double>("maxInvMass", 120)) {
44  produces<reco::TrackCollection>("");
45 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_

◆ ~ZtoEEElectronTrackProducer()

ZtoEEElectronTrackProducer::~ZtoEEElectronTrackProducer ( )
override

Definition at line 47 of file ZtoEEElectronTrackProducer.cc.

47 {}

Member Function Documentation

◆ produce()

void ZtoEEElectronTrackProducer::produce ( edm::StreamID  streamID,
edm::Event iEvent,
edm::EventSetup const &  iSetup 
) const
overridevirtual

Implements edm::global::EDProducerBase.

Definition at line 49 of file ZtoEEElectronTrackProducer.cc.

References pwdgSkimBPark_cfi::beamSpot, bsTag_, bsToken_, nano_mu_local_reco_cff::chi2, electronIdCutBasedExt_cfi::deltaEtaIn, electronIdCutBasedExt_cfi::deltaPhiIn, electronTag_, electronToken_, EgHLTOffHistBins_cfi::hOverE, iEvent, edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), SiStripPI::max, maxD0_, maxDeltaEtaInEB_, maxDeltaEtaInEE_, maxDeltaPhiInEB_, maxDeltaPhiInEE_, maxHOEEB_, maxHOEEE_, maxIso_, maxNormChi2_, maxSigmaiEiEEB_, maxSigmaiEiEEE_, minPixelHits_, minPt_, minStripHits_, eostools::move(), ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::PflowIsolationVariables::sumPUPt.

51  {
52  std::unique_ptr<reco::TrackCollection> outputTColl(new reco::TrackCollection());
53 
54  // Read Electron Collection
56  iEvent.getByToken(electronToken_, electronColl);
57 
59  iEvent.getByToken(bsToken_, beamSpot);
60 
61  if (electronColl.isValid()) {
62  for (auto const& ele : *electronColl) {
63  if (!ele.ecalDriven())
64  continue;
65  if (ele.pt() < minPt_)
66  continue;
67  // set a max Eta cut
68  if (!(ele.isEB() || ele.isEE()))
69  continue;
70 
71  double hOverE = ele.hadronicOverEm();
72  double sigmaee = ele.sigmaIetaIeta();
73  double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
74  double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
75 
76  // separate cut for barrel and endcap
77  if (ele.isEB()) {
78  if (fabs(deltaPhiIn) >= maxDeltaPhiInEB_ && fabs(deltaEtaIn) >= maxDeltaEtaInEB_ && hOverE >= maxHOEEB_ &&
79  sigmaee >= maxSigmaiEiEEB_)
80  continue;
81  } else if (ele.isEE()) {
82  if (fabs(deltaPhiIn) >= maxDeltaPhiInEE_ && fabs(deltaEtaIn) >= maxDeltaEtaInEE_ && hOverE >= maxHOEEE_ &&
83  sigmaee >= maxSigmaiEiEEE_)
84  continue;
85  }
86 
87  reco::GsfTrackRef trk = ele.gsfTrack();
88  reco::TrackRef tk = ele.closestCtfTrackRef();
89  if (!trk.isNonnull())
90  continue; // only electrons with tracks
91  if (!tk.isNonnull())
92  continue;
93  double chi2 = trk->chi2();
94  double ndof = trk->ndof();
95  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
96  if (chbyndof >= maxNormChi2_)
97  continue;
98 
99  double trkd0 = trk->d0();
100  if (beamSpot.isValid()) {
101  trkd0 = -(trk->dxy(beamSpot->position()));
102  } else {
103  edm::LogError("ZtoEEElectronTrackProducer") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
104  }
105  if (std::fabs(trkd0) >= maxD0_)
106  continue;
107 
108  const reco::HitPattern& hitp = trk->hitPattern();
109  int nPixelHits = hitp.numberOfValidPixelHits();
110  if (nPixelHits < minPixelHits_)
111  continue;
112 
113  int nStripHits = hitp.numberOfValidStripHits();
114  if (nStripHits < minStripHits_)
115  continue;
116 
117  // DB corrected PF Isolation
118  reco::GsfElectron::PflowIsolationVariables pfIso = ele.pfIsolationVariables();
119  const float eiso =
120  pfIso.sumChargedHadronPt + std::max(0.0, pfIso.sumNeutralHadronEt + pfIso.sumPhotonEt - 0.5 * pfIso.sumPUPt);
121  if (eiso > maxIso_ * ele.pt())
122  continue;
123 
124  outputTColl->push_back(*tk);
125  }
126  } else {
127  edm::LogError("ZtoEEElectronTrackProducer")
128  << "Error >> Failed to get ElectronCollection for label: " << electronTag_;
129  }
130 
131  iEvent.put(std::move(outputTColl));
132 }
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:670
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
Log< level::Error, false > LogError
int numberOfValidStripHits() const
Definition: HitPattern.h:843
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
int iEvent
Definition: GenABIO.cc:224
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:665
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:664
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
bool isValid() const
Definition: HandleBase.h:70
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ bsTag_

const edm::InputTag ZtoEEElectronTrackProducer::bsTag_
private

Definition at line 27 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ bsToken_

const edm::EDGetTokenT<reco::BeamSpot> ZtoEEElectronTrackProducer::bsToken_
private

Definition at line 29 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ electronTag_

const edm::InputTag ZtoEEElectronTrackProducer::electronTag_
private

Definition at line 26 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ electronToken_

const edm::EDGetTokenT<reco::GsfElectronCollection> ZtoEEElectronTrackProducer::electronToken_
private

Definition at line 28 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxD0_

const double ZtoEEElectronTrackProducer::maxD0_
private

Definition at line 42 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxDeltaEtaInEB_

const double ZtoEEElectronTrackProducer::maxDeltaEtaInEB_
private

Definition at line 34 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxDeltaEtaInEE_

const double ZtoEEElectronTrackProducer::maxDeltaEtaInEE_
private

Definition at line 38 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxDeltaPhiInEB_

const double ZtoEEElectronTrackProducer::maxDeltaPhiInEB_
private

Definition at line 33 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxDeltaPhiInEE_

const double ZtoEEElectronTrackProducer::maxDeltaPhiInEE_
private

Definition at line 37 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxDz_

const double ZtoEEElectronTrackProducer::maxDz_
private

Definition at line 43 of file ZtoEEElectronTrackProducer.h.

◆ maxEta_

const double ZtoEEElectronTrackProducer::maxEta_
private

Definition at line 31 of file ZtoEEElectronTrackProducer.h.

◆ maxHOEEB_

const double ZtoEEElectronTrackProducer::maxHOEEB_
private

Definition at line 35 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxHOEEE_

const double ZtoEEElectronTrackProducer::maxHOEEE_
private

Definition at line 39 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxInvMass_

const double ZtoEEElectronTrackProducer::maxInvMass_
private

Definition at line 49 of file ZtoEEElectronTrackProducer.h.

◆ maxIso_

const double ZtoEEElectronTrackProducer::maxIso_
private

Definition at line 46 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxNormChi2_

const double ZtoEEElectronTrackProducer::maxNormChi2_
private

Definition at line 41 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxSigmaiEiEEB_

const double ZtoEEElectronTrackProducer::maxSigmaiEiEEB_
private

Definition at line 36 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ maxSigmaiEiEEE_

const double ZtoEEElectronTrackProducer::maxSigmaiEiEEE_
private

Definition at line 40 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ minInvMass_

const double ZtoEEElectronTrackProducer::minInvMass_
private

Definition at line 48 of file ZtoEEElectronTrackProducer.h.

◆ minPixelHits_

const int ZtoEEElectronTrackProducer::minPixelHits_
private

Definition at line 44 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ minPt_

const double ZtoEEElectronTrackProducer::minPt_
private

Definition at line 32 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().

◆ minPtHighest_

const double ZtoEEElectronTrackProducer::minPtHighest_
private

Definition at line 47 of file ZtoEEElectronTrackProducer.h.

◆ minStripHits_

const int ZtoEEElectronTrackProducer::minStripHits_
private

Definition at line 45 of file ZtoEEElectronTrackProducer.h.

Referenced by produce().