CMS 3D CMS Logo

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

#include <ZtoEEEventSelector.h>

Inheritance diagram for ZtoEEEventSelector:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, edm::EventSetup const &) override
 
 ZtoEEEventSelector (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=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
 
const EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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 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::stream::EDFilter<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::stream::EDFilterBase
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 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<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 13 of file ZtoEEEventSelector.h.

Constructor & Destructor Documentation

◆ ZtoEEEventSelector()

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

Definition at line 22 of file ZtoEEEventSelector.cc.

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

Member Function Documentation

◆ filter()

bool ZtoEEEventSelector::filter ( edm::Event iEvent,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements edm::stream::EDFilterBase.

Definition at line 47 of file ZtoEEEventSelector.cc.

References pwdgSkimBPark_cfi::beamSpot, bsTag_, bsToken_, hltPixelTracks_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_, maxInvMass_, maxIso_, maxNormChi2_, maxSigmaiEiEEB_, maxSigmaiEiEEE_, minInvMass_, minPixelHits_, minPt_, minPtHighest_, minStripHits_, ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, reco::GsfElectron::PflowIsolationVariables::sumPUPt, and gpuVertexFinder::zv.

47  {
48  // Read Electron Collection
50  iEvent.getByToken(electronToken_, electronColl);
51 
53  iEvent.getByToken(bsToken_, beamSpot);
54 
55  std::vector<TLorentzVector> list;
56  std::vector<int> chrgeList;
57 
58  if (electronColl.isValid()) {
59  for (auto const& ele : *electronColl) {
60  if (!ele.ecalDriven())
61  continue;
62  if (ele.pt() < minPt_)
63  continue;
64  // set a max Eta cut
65  if (!(ele.isEB() || ele.isEE()))
66  continue;
67 
68  double hOverE = ele.hadronicOverEm();
69  double sigmaee = ele.sigmaIetaIeta();
70  double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
71  double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
72 
73  // separate cut for barrel and endcap
74  if (ele.isEB()) {
75  if (fabs(deltaPhiIn) >= maxDeltaPhiInEB_ && fabs(deltaEtaIn) >= maxDeltaEtaInEB_ && hOverE >= maxHOEEB_ &&
76  sigmaee >= maxSigmaiEiEEB_)
77  continue;
78  } else if (ele.isEE()) {
79  if (fabs(deltaPhiIn) >= maxDeltaPhiInEE_ && fabs(deltaEtaIn) >= maxDeltaEtaInEE_ && hOverE >= maxHOEEE_ &&
80  sigmaee >= maxSigmaiEiEEE_)
81  continue;
82  }
83 
84  reco::GsfTrackRef trk = ele.gsfTrack();
85  if (!trk.isNonnull())
86  continue; // only electrons with tracks
87  double chi2 = trk->chi2();
88  double ndof = trk->ndof();
89  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
90  if (chbyndof >= maxNormChi2_)
91  continue;
92 
93  double trkd0 = trk->d0();
94  if (beamSpot.isValid()) {
95  trkd0 = -(trk->dxy(beamSpot->position()));
96  } else {
97  edm::LogError("ZtoEEEventSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
98  }
99  if (std::fabs(trkd0) >= maxD0_)
100  continue;
101 
102  const reco::HitPattern& hitp = trk->hitPattern();
103  int nPixelHits = hitp.numberOfValidPixelHits();
104  if (nPixelHits < minPixelHits_)
105  continue;
106 
107  int nStripHits = hitp.numberOfValidStripHits();
108  if (nStripHits < minStripHits_)
109  continue;
110 
111  // PF Isolation
112  reco::GsfElectron::PflowIsolationVariables pfIso = ele.pfIsolationVariables();
113  float absiso =
114  pfIso.sumChargedHadronPt + std::max(0.0, pfIso.sumNeutralHadronEt + pfIso.sumPhotonEt - 0.5 * pfIso.sumPUPt);
115  float eiso = absiso / (ele.pt());
116  if (eiso > maxIso_)
117  continue;
118 
119  TLorentzVector lv;
120  lv.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
121  list.push_back(lv);
122  chrgeList.push_back(ele.charge());
123  }
124  } else {
125  edm::LogError("ZtoEEEventSelector") << "Error >> Failed to get ElectronCollection for label: " << electronTag_;
126  }
127  if (list.size() < 2)
128  return false;
129  if (chrgeList[0] + chrgeList[1] != 0)
130  return false;
131 
132  if (list[0].Pt() < minPtHighest_)
133  return false;
134  TLorentzVector zv = list[0] + list[1];
135  if (zv.M() < minInvMass_ || zv.M() > maxInvMass_)
136  return false;
137 
138  return true;
139 }
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
const edm::InputTag electronTag_
const double maxSigmaiEiEEE_
const double maxDeltaPhiInEB_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const double minPtHighest_
const double maxDeltaPhiInEE_
float *__restrict__ zv
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
const double minInvMass_
const double maxDeltaEtaInEE_
Log< level::Error, false > LogError
int numberOfValidStripHits() const
Definition: HitPattern.h:843
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::BeamSpot > bsToken_
const double maxDeltaEtaInEB_
const double maxInvMass_
const edm::InputTag bsTag_
bool isValid() const
Definition: HandleBase.h:70
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663
const double maxSigmaiEiEEB_
const double maxNormChi2_

Member Data Documentation

◆ bsTag_

const edm::InputTag ZtoEEEventSelector::bsTag_
private

Definition at line 22 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ bsToken_

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

Definition at line 24 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ electronTag_

const edm::InputTag ZtoEEEventSelector::electronTag_
private

Definition at line 21 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ electronToken_

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

Definition at line 23 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxD0_

const double ZtoEEEventSelector::maxD0_
private

Definition at line 37 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxDeltaEtaInEB_

const double ZtoEEEventSelector::maxDeltaEtaInEB_
private

Definition at line 29 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxDeltaEtaInEE_

const double ZtoEEEventSelector::maxDeltaEtaInEE_
private

Definition at line 33 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxDeltaPhiInEB_

const double ZtoEEEventSelector::maxDeltaPhiInEB_
private

Definition at line 28 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxDeltaPhiInEE_

const double ZtoEEEventSelector::maxDeltaPhiInEE_
private

Definition at line 32 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxDz_

const double ZtoEEEventSelector::maxDz_
private

Definition at line 38 of file ZtoEEEventSelector.h.

◆ maxEta_

const double ZtoEEEventSelector::maxEta_
private

Definition at line 26 of file ZtoEEEventSelector.h.

◆ maxHOEEB_

const double ZtoEEEventSelector::maxHOEEB_
private

Definition at line 30 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxHOEEE_

const double ZtoEEEventSelector::maxHOEEE_
private

Definition at line 34 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxInvMass_

const double ZtoEEEventSelector::maxInvMass_
private

Definition at line 44 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxIso_

const double ZtoEEEventSelector::maxIso_
private

Definition at line 41 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxNormChi2_

const double ZtoEEEventSelector::maxNormChi2_
private

Definition at line 36 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxSigmaiEiEEB_

const double ZtoEEEventSelector::maxSigmaiEiEEB_
private

Definition at line 31 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ maxSigmaiEiEEE_

const double ZtoEEEventSelector::maxSigmaiEiEEE_
private

Definition at line 35 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ minInvMass_

const double ZtoEEEventSelector::minInvMass_
private

Definition at line 43 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ minPixelHits_

const int ZtoEEEventSelector::minPixelHits_
private

Definition at line 39 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ minPt_

const double ZtoEEEventSelector::minPt_
private

Definition at line 27 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ minPtHighest_

const double ZtoEEEventSelector::minPtHighest_
private

Definition at line 42 of file ZtoEEEventSelector.h.

Referenced by filter().

◆ minStripHits_

const int ZtoEEEventSelector::minStripHits_
private

Definition at line 40 of file ZtoEEEventSelector.h.

Referenced by filter().