CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

const edm::InputTag bsTag_
 
const edm::EDGetTokenT
< reco::BeamSpot
bsToken_
 
const edm::InputTag electronTag_
 
const edm::EDGetTokenT
< reco::GsfElectronCollection
electronToken_
 
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<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Definition at line 12 of file ZtoEEEventSelector.h.

Constructor & Destructor Documentation

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

Definition at line 23 of file ZtoEEEventSelector.cc.

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

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

Implements edm::stream::EDFilterBase.

Definition at line 50 of file ZtoEEEventSelector.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, bsTag_, bsToken_, electronTag_, electronToken_, edm::Event::getByToken(), edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), list(), bookConverter::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::tau::disc::Pt(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::PflowIsolationVariables::sumPUPt.

Referenced by Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::filter(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::setDataAccessor(), and Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::switchCenterView().

50  {
51  // Read Electron Collection
53  iEvent.getByToken(electronToken_, electronColl);
54 
56  iEvent.getByToken(bsToken_, beamSpot);
57 
58  std::vector<TLorentzVector> list;
59  std::vector<int> chrgeList;
60 
61  if (electronColl.isValid()) {
62  for (auto const& ele: *electronColl) {
63  if (!ele.ecalDriven()) continue;
64  if (ele.pt() < minPt_) continue;
65  // set a max Eta cut
66  if (!(ele.isEB() || ele.isEE())) 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_
76  && fabs(deltaEtaIn) >= maxDeltaEtaInEB_
77  && hOverE >= maxHOEEB_
78  && sigmaee >= maxSigmaiEiEEB_) continue;
79  }
80  else if (ele.isEE()) {
81  if (fabs(deltaPhiIn) >= maxDeltaPhiInEE_
82  && fabs(deltaEtaIn) >= maxDeltaEtaInEE_
83  && hOverE >= maxHOEEE_
84  && sigmaee >= maxSigmaiEiEEE_) continue;
85  }
86 
87  reco::GsfTrackRef trk = ele.gsfTrack();
88  if (!trk.isNonnull() ) continue; // only electrons with tracks
89  double chi2 = trk->chi2();
90  double ndof = trk->ndof();
91  double chbyndof = (ndof > 0) ? chi2/ndof : 0;
92  if (chbyndof >= maxNormChi2_) continue;
93 
94  double trkd0 = trk->d0();
95  if (beamSpot.isValid()) {
96  trkd0 = -(trk->dxy(beamSpot->position()));
97  }
98  else {
99  edm::LogError("ZtoEEEventSelector") << "Error >> Failed to get BeamSpot for label: "
100  << bsTag_;
101  }
102  if (std::fabs(trkd0) >= maxD0_) continue;
103 
104  const reco::HitPattern& hitp = trk->hitPattern();
105  int nPixelHits = hitp.numberOfValidPixelHits();
106  if (nPixelHits < minPixelHits_) continue;
107 
108  int nStripHits = hitp.numberOfValidStripHits();
109  if (nStripHits < minStripHits_) continue;
110 
111  // PF Isolation
112  reco::GsfElectron::PflowIsolationVariables pfIso = ele.pfIsolationVariables();
113  float absiso = pfIso.sumChargedHadronPt + std::max(0.0, pfIso.sumNeutralHadronEt + pfIso.sumPhotonEt - 0.5 * pfIso.sumPUPt);
114  float eiso = absiso/(ele.pt());
115  if (eiso > maxIso_) continue;
116 
117  TLorentzVector lv;
118  lv.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
119  list.push_back(lv);
120  chrgeList.push_back(ele.charge());
121  }
122  }
123  else {
124  edm::LogError("ZtoEEEventSelector") << "Error >> Failed to get ElectronCollection for label: "
125  << electronTag_;
126  }
127  if (list.size() < 2) return false;
128  if (chrgeList[0] + chrgeList[1] != 0) return false;
129 
130  if (list[0].Pt() < minPtHighest_) return false;
131  TLorentzVector zv = list[0] + list[1];
132  if (zv.M() < minInvMass_ || zv.M() > maxInvMass_) return false;
133 
134  return true;
135 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
const edm::InputTag electronTag_
const double maxSigmaiEiEEE_
const double maxDeltaPhiInEB_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const double minPtHighest_
const double maxDeltaPhiInEE_
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:580
int numberOfValidStripHits() const
Definition: HitPattern.h:831
const double minInvMass_
const double maxDeltaEtaInEE_
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:575
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:574
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const double maxDeltaEtaInEB_
bool isValid() const
Definition: HandleBase.h:75
const double maxInvMass_
const edm::InputTag bsTag_
int numberOfValidPixelHits() const
Definition: HitPattern.h:816
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:573
const double maxSigmaiEiEEB_
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
const double maxNormChi2_

Member Data Documentation

const edm::InputTag ZtoEEEventSelector::bsTag_
private

Definition at line 21 of file ZtoEEEventSelector.h.

Referenced by filter().

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

Definition at line 23 of file ZtoEEEventSelector.h.

Referenced by filter().

const edm::InputTag ZtoEEEventSelector::electronTag_
private

Definition at line 20 of file ZtoEEEventSelector.h.

Referenced by filter().

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

Definition at line 22 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxD0_
private

Definition at line 36 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxDeltaEtaInEB_
private

Definition at line 28 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxDeltaEtaInEE_
private

Definition at line 32 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxDeltaPhiInEB_
private

Definition at line 27 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxDeltaPhiInEE_
private

Definition at line 31 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxDz_
private

Definition at line 37 of file ZtoEEEventSelector.h.

const double ZtoEEEventSelector::maxEta_
private

Definition at line 25 of file ZtoEEEventSelector.h.

const double ZtoEEEventSelector::maxHOEEB_
private

Definition at line 29 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxHOEEE_
private

Definition at line 33 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxInvMass_
private

Definition at line 43 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxIso_
private

Definition at line 40 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxNormChi2_
private

Definition at line 35 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxSigmaiEiEEB_
private

Definition at line 30 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::maxSigmaiEiEEE_
private

Definition at line 34 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::minInvMass_
private

Definition at line 42 of file ZtoEEEventSelector.h.

Referenced by filter().

const int ZtoEEEventSelector::minPixelHits_
private

Definition at line 38 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::minPt_
private

Definition at line 26 of file ZtoEEEventSelector.h.

Referenced by filter().

const double ZtoEEEventSelector::minPtHighest_
private

Definition at line 41 of file ZtoEEEventSelector.h.

Referenced by filter().

const int ZtoEEEventSelector::minStripHits_
private

Definition at line 39 of file ZtoEEEventSelector.h.

Referenced by filter().