CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ttbarEventSelector Class Reference
Inheritance diagram for ttbarEventSelector:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, edm::EventSetup const &) override
 
 ttbarEventSelector (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
 
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)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

int EventCategory (int &nEle, int &nMu, int &nJets, int &nbJets)
 
double getMt (const TLorentzVector &vlep, const reco::PFMET &obj)
 

Private Attributes

const edm::InputTag bjetsTag_
 
const edm::EDGetTokenT< reco::JetTagCollectionbjetsToken_
 
const edm::InputTag bsTag_
 
const edm::EDGetTokenT< reco::BeamSpotbsToken_
 
const double btagFactor_
 
const edm::InputTag electronTag_
 
const edm::EDGetTokenT< reco::GsfElectronCollectionelectronToken_
 
const edm::InputTag jetsTag_
 
const edm::EDGetTokenT< reco::PFJetCollectionjetsToken_
 
const double maxD0_
 
const double maxDeltaEtaInEB_
 
const double maxDeltaEtaInEE_
 
const double maxDeltaPhiInEB_
 
const double maxDeltaPhiInEE_
 
const double maxDz_
 
const double maxEta_Jets_
 
const double maxEtaEle_
 
const double maxEtaHighest_Jets_
 
const double maxEtaMu_
 
const double maxHOEEB_
 
const double maxHOEEE_
 
const double maxInvMass_
 
const double maxIsoEle_
 
const double maxIsoMu_
 
const double maxMet_
 
const double maxNormChi2_
 
const double maxSigmaiEiEEB_
 
const double maxSigmaiEiEEE_
 
const double maxWmass_
 
const double minChambers_
 
const double minInvMass_
 
const double minMatchedStations_
 
const double minMatches_
 
const double minMet_
 
const int minPixelHits_
 
const double minPt_
 
const double minPt_Jets_
 
const double minPtHighest_Jets_
 
const double minPtHighestEle_
 
const double minPtHighestMu_
 
const int minStripHits_
 
const double minWmass_
 
const edm::InputTag muonTag_
 
const edm::EDGetTokenT< reco::MuonCollectionmuonToken_
 
const edm::InputTag pfmetTag_
 
const edm::EDGetTokenT< reco::PFMETCollectionpfmetToken_
 

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
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
 
- 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 31 of file ttbarEventSelector.cc.

Constructor & Destructor Documentation

◆ ttbarEventSelector()

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

Definition at line 143 of file ttbarEventSelector.cc.

144  : electronTag_(ps.getUntrackedParameter<edm::InputTag>("electronInputTag", edm::InputTag("gedGsfElectrons"))),
145  jetsTag_(ps.getUntrackedParameter<edm::InputTag>("jetsInputTag", edm::InputTag("ak4PFJetsCHS"))),
146  bjetsTag_(ps.getUntrackedParameter<edm::InputTag>("bjetsInputTag", edm::InputTag("pfDeepCSVJetTags", "probb"))),
147  pfmetTag_(ps.getUntrackedParameter<edm::InputTag>("pfmetTag", edm::InputTag("pfMet"))),
148  muonTag_(ps.getUntrackedParameter<edm::InputTag>("muonInputTag", edm::InputTag("muons"))),
149  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
150  electronToken_(consumes<reco::GsfElectronCollection>(electronTag_)),
151  jetsToken_(consumes<reco::PFJetCollection>(jetsTag_)),
152  bjetsToken_(consumes<reco::JetTagCollection>(bjetsTag_)),
153  pfmetToken_(consumes<reco::PFMETCollection>(pfmetTag_)),
154  muonToken_(consumes<reco::MuonCollection>(muonTag_)),
155  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
156  maxEtaEle_(ps.getUntrackedParameter<double>("maxEtaEle", 2.4)),
157  maxEtaMu_(ps.getUntrackedParameter<double>("maxEtaMu", 2.4)),
158  minPt_(ps.getUntrackedParameter<double>("minPt", 5)),
159 
160  // for Electron only
161  maxDeltaPhiInEB_(ps.getUntrackedParameter<double>("maxDeltaPhiInEB", .15)),
162  maxDeltaEtaInEB_(ps.getUntrackedParameter<double>("maxDeltaEtaInEB", .007)),
163  maxHOEEB_(ps.getUntrackedParameter<double>("maxHOEEB", .12)),
164  maxSigmaiEiEEB_(ps.getUntrackedParameter<double>("maxSigmaiEiEEB", .01)),
165  maxDeltaPhiInEE_(ps.getUntrackedParameter<double>("maxDeltaPhiInEE", .1)),
166  maxDeltaEtaInEE_(ps.getUntrackedParameter<double>("maxDeltaEtaInEE", .009)),
167  maxHOEEE_(ps.getUntrackedParameter<double>("maxHOEEB_", .10)),
168  maxSigmaiEiEEE_(ps.getUntrackedParameter<double>("maxSigmaiEiEEE", .03)),
169 
170  // for Muon only
171  minChambers_(ps.getUntrackedParameter<uint32_t>("minChambers", 2)),
172  minMatches_(ps.getUntrackedParameter<uint32_t>("minMatches", 2)),
173  minMatchedStations_(ps.getUntrackedParameter<double>("minMatchedStations", 2)),
174 
175  // for Jets only
176  maxEtaHighest_Jets_(ps.getUntrackedParameter<double>("maxEtaHighest_Jets", 2.4)),
177  maxEta_Jets_(ps.getUntrackedParameter<double>("maxEta_Jets", 3.0)),
178 
179  // for b-tag only
180  btagFactor_(ps.getUntrackedParameter<double>("btagFactor", 0.6)),
181 
182  maxNormChi2_(ps.getUntrackedParameter<double>("maxNormChi2", 10)),
183  maxD0_(ps.getUntrackedParameter<double>("maxD0", 0.02)),
184  maxDz_(ps.getUntrackedParameter<double>("maxDz", 20.)),
185  minPixelHits_(ps.getUntrackedParameter<uint32_t>("minPixelHits", 1)),
186  minStripHits_(ps.getUntrackedParameter<uint32_t>("minStripHits", 8)),
187  maxIsoEle_(ps.getUntrackedParameter<double>("maxIsoEle", 0.5)),
188  maxIsoMu_(ps.getUntrackedParameter<double>("maxIsoMu", 0.3)),
189  minPtHighestMu_(ps.getUntrackedParameter<double>("minPtHighestMu", 24)),
190  minPtHighestEle_(ps.getUntrackedParameter<double>("minPtHighestEle", 32)),
191  minPtHighest_Jets_(ps.getUntrackedParameter<double>("minPtHighest_Jets", 30)),
192  minPt_Jets_(ps.getUntrackedParameter<double>("minPt_Jets", 20)),
193  minInvMass_(ps.getUntrackedParameter<double>("minInvMass", 140)),
194  maxInvMass_(ps.getUntrackedParameter<double>("maxInvMass", 200)),
195  minMet_(ps.getUntrackedParameter<double>("minMet", 50)),
196  maxMet_(ps.getUntrackedParameter<double>("maxMet", 80)),
197  minWmass_(ps.getUntrackedParameter<double>("minWmass", 50)),
198  maxWmass_(ps.getUntrackedParameter<double>("maxWmass", 130)) {}
const edm::InputTag pfmetTag_
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::EDGetTokenT< reco::JetTagCollection > bjetsToken_
const edm::EDGetTokenT< reco::PFJetCollection > jetsToken_
const edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
const double minPtHighestMu_
const edm::InputTag electronTag_
const edm::InputTag bjetsTag_
const edm::InputTag jetsTag_
const double maxSigmaiEiEEE_
const double maxDeltaPhiInEB_
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag bsTag_
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const double minMatchedStations_
const edm::InputTag muonTag_
const double maxDeltaEtaInEB_
const double maxSigmaiEiEEB_
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
const double maxEtaHighest_Jets_
const double minPtHighest_Jets_
const double minPtHighestEle_
const double maxDeltaPhiInEE_
const double maxDeltaEtaInEE_

Member Function Documentation

◆ EventCategory()

int ttbarEventSelector::EventCategory ( int &  nEle,
int &  nMu,
int &  nJets,
int &  nbJets 
)
private

Definition at line 490 of file ttbarEventSelector.cc.

References eostools::cat(), nJets, and l1ctLayer1_cff::nMu.

Referenced by filter().

490  {
491  int cat = 0;
492  if ((nEle >= 2 || nMu >= 2) && nJets > 1 && nbJets > 1) { // di-lepton
493  if (nEle >= 2 && nJets < 2)
494  cat = 11;
495  else if (nMu >= 2 && nJets < 2)
496  cat = 12;
497  else if (nEle >= 1 && nMu >= 1 && nJets < 2)
498  cat = 13;
499  } else if ((nEle >= 1 || nMu >= 1) && nJets > 3 && nbJets > 2) { //semi-lepton
500  if (nEle >= 1 && nJets > 1)
501  cat = 21;
502  else if (nMu >= 1 && nJets > 1)
503  cat = 22;
504  } else if ((nEle < 1 && nMu < 1) && nJets > 5 && nbJets > 1)
505  cat = 30;
506  else
507  cat = 50;
508  return cat;
509 }
static constexpr int nJets
def cat(path)
Definition: eostools.py:401

◆ fillDescriptions()

void ttbarEventSelector::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 98 of file ttbarEventSelector.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

98  {
100  desc.addUntracked<edm::InputTag>("electronInputTag", edm::InputTag("gedGsfElectrons"));
101  desc.addUntracked<edm::InputTag>("jetsInputTag", edm::InputTag("ak4PFJetsCHS"));
102  desc.addUntracked<edm::InputTag>("bjetsInputTag", edm::InputTag("pfDeepCSVJetTags", "probb"));
103  desc.addUntracked<edm::InputTag>("pfmetTag", edm::InputTag("pfMet"));
104  desc.addUntracked<edm::InputTag>("muonInputTag", edm::InputTag("muons"));
105  desc.addUntracked<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"));
106  desc.addUntracked<double>("maxEtaEle", 2.4);
107  desc.addUntracked<double>("maxEtaMu", 2.4);
108  desc.addUntracked<double>("minPt", 5);
109  desc.addUntracked<double>("maxDeltaPhiInEB", .15);
110  desc.addUntracked<double>("maxDeltaEtaInEB", .007);
111  desc.addUntracked<double>("maxHOEEB", .12);
112  desc.addUntracked<double>("maxSigmaiEiEEB", .01);
113  desc.addUntracked<double>("maxDeltaPhiInEE", .1);
114  desc.addUntracked<double>("maxDeltaEtaInEE", .009);
115  desc.addUntracked<double>("maxHOEEB_", .10);
116  desc.addUntracked<double>("maxSigmaiEiEEE", .03);
117  desc.addUntracked<uint32_t>("minChambers", 2);
118  desc.addUntracked<uint32_t>("minMatches", 2);
119  desc.addUntracked<double>("minMatchedStations", 2);
120  desc.addUntracked<double>("maxEtaHighest_Jets", 2.4);
121  desc.addUntracked<double>("maxEta_Jets", 3.0);
122  desc.addUntracked<double>("btagFactor", 0.6);
123  desc.addUntracked<double>("maxNormChi2", 10);
124  desc.addUntracked<double>("maxD0", 0.02);
125  desc.addUntracked<double>("maxDz", 20.);
126  desc.addUntracked<uint32_t>("minPixelHits", 1);
127  desc.addUntracked<uint32_t>("minStripHits", 8);
128  desc.addUntracked<double>("maxIsoEle", 0.5);
129  desc.addUntracked<double>("maxIsoMu", 0.3);
130  desc.addUntracked<double>("minPtHighestMu", 24);
131  desc.addUntracked<double>("minPtHighestEle", 32);
132  desc.addUntracked<double>("minPtHighest_Jets", 30);
133  desc.addUntracked<double>("minPt_Jets", 20);
134  desc.addUntracked<double>("minInvMass", 140);
135  desc.addUntracked<double>("maxInvMass", 200);
136  desc.addUntracked<double>("minMet", 50);
137  desc.addUntracked<double>("maxMet", 80);
138  desc.addUntracked<double>("minWmass", 50);
139  desc.addUntracked<double>("maxWmass", 130);
140  descriptions.addWithDefaultLabel(desc);
141 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 200 of file ttbarEventSelector.cc.

References pwdgSkimBPark_cfi::beamSpot, bjetsToken_, bsTag_, bsToken_, btagFactor_, TtFullHadKinFitProducer_cfi::bTags, nano_mu_local_reco_cff::chi2, electronIdCutBasedExt_cfi::deltaEtaIn, electronIdCutBasedExt_cfi::deltaPhiIn, electronTag_, electronToken_, EventCategory(), dqmdumpme::first, getMt(), muon::GlobalMuonPromptTight, EgHLTOffHistBins_cfi::hOverE, mps_fire::i, iEvent, muon::isGoodMuon(), edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), dqmiolumiharvest::j, PDWG_EXODelayedJetMET_cff::jets, jetsToken_, SiStripPI::max, maxD0_, maxDeltaEtaInEB_, maxDeltaEtaInEE_, maxDeltaPhiInEB_, maxDeltaPhiInEE_, maxDz_, maxEta_Jets_, maxEtaMu_, maxHOEEB_, maxHOEEE_, maxIsoEle_, maxIsoMu_, maxMet_, maxNormChi2_, maxSigmaiEiEEB_, maxSigmaiEiEEE_, maxWmass_, minChambers_, minMatchedStations_, minMatches_, minPixelHits_, minPt_, minPt_Jets_, minPtHighest_Jets_, minPtHighestEle_, minPtHighestMu_, minStripHits_, minWmass_, TtSemiLepEvtBuilder_cfi::mt, MT2Analyzer::mt2, amptDefaultParameters_cff::mu, muonTag_, muonToken_, ndof, reco::HitPattern::numberOfValidPixelHits(), reco::HitPattern::numberOfValidStripHits(), nano_mu_reco_cff::pfIso04, pfmetTag_, pfmetToken_, edm::Handle< T >::product(), edm::second(), reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::PflowIsolationVariables::sumPUPt.

200  {
201  // beamspot
203  iEvent.getByToken(bsToken_, beamSpot);
204 
205  int le = 0, lm = 0, lj = 0, lbj = 0;
206 
207  // Read Electron Collection
209  iEvent.getByToken(electronToken_, electronColl);
210  std::vector<TLorentzVector> list_ele;
211  std::vector<int> chrgeList_ele;
212 
213  if (electronColl.isValid()) {
214  for (auto const& ele : *electronColl) {
215  if (!ele.ecalDriven())
216  continue;
217  if (ele.pt() < minPt_)
218  continue;
219  // set a max Eta cut
220  if (!(ele.isEB() || ele.isEE()))
221  continue;
222 
223  double hOverE = ele.hadronicOverEm();
224  double sigmaee = ele.sigmaIetaIeta();
225  double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
226  double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
227 
228  // separate cut for barrel and endcap
229  if (ele.isEB()) {
230  if (fabs(deltaPhiIn) >= maxDeltaPhiInEB_ && fabs(deltaEtaIn) >= maxDeltaEtaInEB_ && hOverE >= maxHOEEB_ &&
231  sigmaee >= maxSigmaiEiEEB_)
232  continue;
233  } else if (ele.isEE()) {
234  if (fabs(deltaPhiIn) >= maxDeltaPhiInEE_ && fabs(deltaEtaIn) >= maxDeltaEtaInEE_ && hOverE >= maxHOEEE_ &&
235  sigmaee >= maxSigmaiEiEEE_)
236  continue;
237  }
238 
239  reco::GsfTrackRef trk = ele.gsfTrack();
240  if (!trk.isNonnull())
241  continue; // only electrons with tracks
242  double chi2 = trk->chi2();
243  double ndof = trk->ndof();
244  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
245  if (chbyndof >= maxNormChi2_)
246  continue;
247 
248  double trkd0 = trk->d0();
249  if (beamSpot.isValid()) {
250  trkd0 = -(trk->dxy(beamSpot->position()));
251  } else {
252  edm::LogError("ElectronSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
253  }
254  if (std::fabs(trkd0) >= maxD0_)
255  continue;
256 
257  const reco::HitPattern& hitp = trk->hitPattern();
258  int nPixelHits = hitp.numberOfValidPixelHits();
259  if (nPixelHits < minPixelHits_)
260  continue;
261 
262  int nStripHits = hitp.numberOfValidStripHits();
263  if (nStripHits < minStripHits_)
264  continue;
265 
266  // PF Isolation
267  reco::GsfElectron::PflowIsolationVariables pfIso = ele.pfIsolationVariables();
268  const float eiso =
269  pfIso.sumChargedHadronPt + std::max(0.0, pfIso.sumNeutralHadronEt + pfIso.sumPhotonEt - 0.5 * pfIso.sumPUPt);
270  if (eiso > maxIsoEle_ * ele.pt())
271  continue;
272 
273  TLorentzVector lv_ele;
274  lv_ele.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
275  list_ele.push_back(lv_ele);
276  chrgeList_ele.push_back(ele.charge());
277  }
278  le = list_ele.size();
279  } else {
280  edm::LogError("ElectronSelector") << "Error >> Failed to get ElectronCollection for label: " << electronTag_;
281  }
282 
283  // Read Muon Collection
285  iEvent.getByToken(muonToken_, muonColl);
286 
287  std::vector<TLorentzVector> list_mu;
288  std::vector<int> chrgeList_mu;
289  if (muonColl.isValid()) {
290  for (auto const& mu : *muonColl) {
291  if (!mu.isGlobalMuon())
292  continue;
293  if (!mu.isPFMuon())
294  continue;
295  if (std::fabs(mu.eta()) >= maxEtaMu_)
296  continue;
297  if (mu.pt() < minPt_)
298  continue;
299 
300  reco::TrackRef gtk = mu.globalTrack();
301  double chi2 = gtk->chi2();
302  double ndof = gtk->ndof();
303  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
304  if (chbyndof >= maxNormChi2_)
305  continue;
306 
307  reco::TrackRef tk = mu.innerTrack();
308  if (beamSpot.isValid()) {
309  double trkd0 = -(tk->dxy(beamSpot->position()));
310  if (std::fabs(trkd0) >= maxD0_)
311  continue;
312  double trkdz = tk->dz(beamSpot->position());
313  if (std::fabs(trkdz) >= maxDz_)
314  continue;
315  } else {
316  edm::LogError("MuonSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
317  }
318 
319  const reco::HitPattern& hitp = gtk->hitPattern();
321  continue;
323  continue;
324 
325  // Hits/section in the muon chamber
326  if (mu.numberOfChambers() < minChambers_)
327  continue;
328  if (mu.numberOfMatches() < minMatches_)
329  continue;
330  if (mu.numberOfMatchedStations() < minMatchedStations_)
331  continue;
333  continue;
334 
335  // PF Isolation
336  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
337  double absiso = pfIso04.sumChargedHadronPt +
338  std::max(0.0, pfIso04.sumNeutralHadronEt + pfIso04.sumPhotonEt - 0.5 * pfIso04.sumPUPt);
339  if (absiso > maxIsoMu_ * mu.pt())
340  continue;
341 
342  TLorentzVector lv_mu;
343  lv_mu.SetPtEtaPhiE(mu.pt(), mu.eta(), mu.phi(), mu.energy());
344  list_mu.push_back(lv_mu);
345  chrgeList_mu.push_back(mu.charge());
346  }
347  lm = list_mu.size();
348  } else {
349  edm::LogError("MuonSelector") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
350  return false;
351  }
352 
353  // for Track jet collections
355  iEvent.getByToken(jetsToken_, jetColl);
356  std::vector<TLorentzVector> list_jets;
357 
358  if (jetColl.isValid()) {
359  for (const auto& jets : *jetColl) {
360  if (jets.pt() < minPt_Jets_)
361  continue;
362  if (std::fabs(jets.eta()) > maxEta_Jets_)
363  continue;
364  TLorentzVector lv_jets; // lv_bJets;
365  lv_jets.SetPtEtaPhiE(jets.pt(), jets.eta(), jets.phi(), jets.energy());
366  list_jets.push_back(lv_jets);
367  }
368  lj = list_jets.size();
369  }
370 
372  iEvent.getByToken(bjetsToken_, bTagHandle);
373  const reco::JetTagCollection& bTags = *(bTagHandle.product());
374  std::vector<TLorentzVector> list_bjets;
375 
376  if (!bTags.empty()) {
377  for (unsigned bj = 0; bj != bTags.size(); ++bj) {
378  TLorentzVector lv_bjets;
379  lv_bjets.SetPtEtaPhiE(
380  bTags[bj].first->pt(), bTags[bj].first->eta(), bTags[bj].first->phi(), bTags[bj].first->energy());
381  if ((bTags[bj].second > btagFactor_) && (lv_bjets.Pt() > minPt_Jets_))
382  list_bjets.push_back(lv_bjets);
383  }
384  lbj = list_bjets.size();
385  }
386 
387  // for MET collection
389  iEvent.getByToken(pfmetToken_, pfColl);
390  if (EventCategory(le, lm, lj, lbj) == 11) { // dilepton- ele ele
391  if (list_ele[0].Pt() < minPtHighestEle_)
392  return false;
393  if ((list_ele[0].Pt() < list_mu[0].Pt()) || (list_ele[1].Pt() < list_mu[0].Pt()))
394  return false;
395  if (chrgeList_ele[0] + chrgeList_ele[1] != 0)
396  return false;
397  if (pfColl.isValid()) {
398  double mt1 = getMt(list_ele[0], pfColl->front());
399  double mt2 = getMt(list_ele[1], pfColl->front());
400  double mt = mt1 + mt2;
401  if (mt < 2 * minMet_ || mt > 2 * maxMet_)
402  return false;
403  } else {
404  edm::LogError("ttbarEventSelector")
405  << "Error >> Failed to get PFMETCollection in dilepton ele-ele channel for label: " << pfmetTag_;
406  return false;
407  }
408  } else if (EventCategory(le, lm, lj, lbj) == 12) { // dilepton - mu mu
409  if (list_mu[0].Pt() < minPtHighestMu_)
410  return false;
411  if ((list_mu[0].Pt() < list_ele[0].Pt()) || (list_mu[1].Pt() < list_ele[0].Pt()))
412  return false;
413  if (chrgeList_mu[0] + chrgeList_mu[1] != 0)
414  return false;
415  if (pfColl.isValid()) {
416  double mt1 = getMt(list_mu[0], pfColl->front());
417  double mt2 = getMt(list_mu[1], pfColl->front());
418  double mt = mt1 + mt2;
419  if (mt < 2 * minMet_ || mt > 2 * maxMet_)
420  return false;
421  } else {
422  edm::LogError("ttbarEventSelector")
423  << "Error >> Failed to get PFMETCollection in dilepton mu-mu channel for label: " << pfmetTag_;
424  return false;
425  }
426  } else if (EventCategory(le, lm, lj, lbj) == 13) { // dilepton - ele mu
427  if ((list_mu[0].Pt() < list_ele[1].Pt()) || (list_ele[0].Pt() < list_mu[1].Pt()))
428  return false;
429  if ((list_mu[0].Pt() < minPtHighestMu_) || (list_ele[0].Pt() < minPtHighestEle_))
430  return false;
431  if (chrgeList_mu[0] + chrgeList_ele[0] != 0)
432  return false;
433  if (pfColl.isValid()) {
434  double mt1 = getMt(list_mu[0], pfColl->front());
435  double mt2 = getMt(list_ele[0], pfColl->front());
436  double mt = mt1 + mt2;
437  if (mt < 2 * minMet_ || mt > 2 * maxMet_)
438  return false;
439  } else {
440  edm::LogError("ttbarEventSelector")
441  << "Error >> Failed to get PFMETCollection in dilepton ele-mu channel for label: " << pfmetTag_;
442  return false;
443  }
444  }
445  if (EventCategory(le, lm, lj, lbj) == 21) { // semilepton - ele or mu
446  if (list_jets[0].Pt() < minPtHighest_Jets_)
447  return false;
448 
449  if (list_ele[0].Pt() < minPtHighestEle_)
450  return false;
451  // Both should not be present at the same time
452  if ((!list_ele.empty() && list_ele[0].Pt() > minPtHighestEle_) &&
453  (!list_mu.empty() && list_mu[0].Pt() > minPtHighestMu_))
454  return false;
455 
456  return true;
457  }
458  if (EventCategory(le, lm, lj, lbj) == 22) { // semilepton - ele or mu
459  if (list_jets[0].Pt() < minPtHighest_Jets_)
460  return false;
461 
462  if (list_mu[0].Pt() < minPtHighestMu_)
463  return false;
464  // Both should not be present at the same time
465  if ((!list_ele.empty() && list_ele[0].Pt() > minPtHighestEle_) &&
466  (!list_mu.empty() && list_mu[0].Pt() > minPtHighestMu_))
467  return false;
468 
469  return true;
470  } else if (EventCategory(le, lm, lj, lbj) == 30) {
471  if (list_jets[0].Pt() < minPtHighest_Jets_)
472  return false;
473  for (int i = 0; i < 4; i++) {
474  TLorentzVector vjet1;
475  for (int j = i + 1; j < 4; j++) {
476  TLorentzVector vjet2;
477  vjet1 = list_jets[i];
478  vjet2 = list_jets[j];
479  TLorentzVector vjet = vjet1 + vjet2;
480  if (vjet.M() < minWmass_ || vjet.M() > maxWmass_)
481  return false;
482  }
483  }
484  } else if (EventCategory(le, lm, lj, lbj) == 50)
485  return false;
486 
487  return false;
488 }
const edm::InputTag pfmetTag_
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
const edm::EDGetTokenT< reco::MuonCollection > muonToken_
const edm::EDGetTokenT< reco::JetTagCollection > bjetsToken_
const edm::EDGetTokenT< reco::PFJetCollection > jetsToken_
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< reco::PFMETCollection > pfmetToken_
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:670
const double minPtHighestMu_
const edm::InputTag electronTag_
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
Log< level::Error, false > LogError
int EventCategory(int &nEle, int &nMu, int &nJets, int &nbJets)
const double maxSigmaiEiEEE_
int numberOfValidStripHits() const
Definition: HitPattern.h:843
const double maxDeltaPhiInEB_
const edm::InputTag bsTag_
U second(std::pair< T, U > const &p)
const edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
const double minMatchedStations_
int iEvent
Definition: GenABIO.cc:224
const edm::InputTag muonTag_
const double maxDeltaEtaInEB_
const double maxSigmaiEiEEB_
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
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
const edm::EDGetTokenT< reco::BeamSpot > bsToken_
double getMt(const TLorentzVector &vlep, const reco::PFMET &obj)
const double minPtHighest_Jets_
bool isValid() const
Definition: HandleBase.h:70
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663
const double minPtHighestEle_
const double maxDeltaPhiInEE_
const double maxDeltaEtaInEE_

◆ getMt()

double ttbarEventSelector::getMt ( const TLorentzVector &  vlep,
const reco::PFMET obj 
)
private

Definition at line 511 of file ttbarEventSelector.cc.

References funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, BTaggingMonitor_cfi::met, getGTfromDQMFile::obj, phi, funct::sin(), and mathSSE::sqrt().

Referenced by filter().

511  {
512  double met = obj.et();
513  double phi = obj.phi();
514 
515  TLorentzVector vmet;
516  double metx = met * std::cos(phi);
517  double mety = met * std::sin(phi);
518  vmet.SetPxPyPzE(metx, mety, 0.0, met);
519 
520  // transverse mass
521  TLorentzVector vw = vlep + vmet;
522 
523  return std::sqrt(2 * vlep.Et() * met * (1 - std::cos(deltaPhi(vlep.Phi(), phi))));
524 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22

Member Data Documentation

◆ bjetsTag_

const edm::InputTag ttbarEventSelector::bjetsTag_
private

Definition at line 42 of file ttbarEventSelector.cc.

◆ bjetsToken_

const edm::EDGetTokenT<reco::JetTagCollection> ttbarEventSelector::bjetsToken_
private

Definition at line 48 of file ttbarEventSelector.cc.

Referenced by filter().

◆ bsTag_

const edm::InputTag ttbarEventSelector::bsTag_
private

Definition at line 45 of file ttbarEventSelector.cc.

Referenced by filter().

◆ bsToken_

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

Definition at line 51 of file ttbarEventSelector.cc.

Referenced by filter().

◆ btagFactor_

const double ttbarEventSelector::btagFactor_
private

Definition at line 72 of file ttbarEventSelector.cc.

Referenced by filter().

◆ electronTag_

const edm::InputTag ttbarEventSelector::electronTag_
private

Definition at line 40 of file ttbarEventSelector.cc.

Referenced by filter().

◆ electronToken_

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

Definition at line 46 of file ttbarEventSelector.cc.

Referenced by filter().

◆ jetsTag_

const edm::InputTag ttbarEventSelector::jetsTag_
private

Definition at line 41 of file ttbarEventSelector.cc.

◆ jetsToken_

const edm::EDGetTokenT<reco::PFJetCollection> ttbarEventSelector::jetsToken_
private

Definition at line 47 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxD0_

const double ttbarEventSelector::maxD0_
private

Definition at line 75 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxDeltaEtaInEB_

const double ttbarEventSelector::maxDeltaEtaInEB_
private

Definition at line 57 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxDeltaEtaInEE_

const double ttbarEventSelector::maxDeltaEtaInEE_
private

Definition at line 61 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxDeltaPhiInEB_

const double ttbarEventSelector::maxDeltaPhiInEB_
private

Definition at line 56 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxDeltaPhiInEE_

const double ttbarEventSelector::maxDeltaPhiInEE_
private

Definition at line 60 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxDz_

const double ttbarEventSelector::maxDz_
private

Definition at line 76 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxEta_Jets_

const double ttbarEventSelector::maxEta_Jets_
private

Definition at line 70 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxEtaEle_

const double ttbarEventSelector::maxEtaEle_
private

Definition at line 53 of file ttbarEventSelector.cc.

◆ maxEtaHighest_Jets_

const double ttbarEventSelector::maxEtaHighest_Jets_
private

Definition at line 69 of file ttbarEventSelector.cc.

◆ maxEtaMu_

const double ttbarEventSelector::maxEtaMu_
private

Definition at line 54 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxHOEEB_

const double ttbarEventSelector::maxHOEEB_
private

Definition at line 58 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxHOEEE_

const double ttbarEventSelector::maxHOEEE_
private

Definition at line 62 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxInvMass_

const double ttbarEventSelector::maxInvMass_
private

Definition at line 86 of file ttbarEventSelector.cc.

◆ maxIsoEle_

const double ttbarEventSelector::maxIsoEle_
private

Definition at line 79 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxIsoMu_

const double ttbarEventSelector::maxIsoMu_
private

Definition at line 80 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxMet_

const double ttbarEventSelector::maxMet_
private

Definition at line 88 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxNormChi2_

const double ttbarEventSelector::maxNormChi2_
private

Definition at line 74 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxSigmaiEiEEB_

const double ttbarEventSelector::maxSigmaiEiEEB_
private

Definition at line 59 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxSigmaiEiEEE_

const double ttbarEventSelector::maxSigmaiEiEEE_
private

Definition at line 63 of file ttbarEventSelector.cc.

Referenced by filter().

◆ maxWmass_

const double ttbarEventSelector::maxWmass_
private

Definition at line 90 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minChambers_

const double ttbarEventSelector::minChambers_
private

Definition at line 65 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minInvMass_

const double ttbarEventSelector::minInvMass_
private

Definition at line 85 of file ttbarEventSelector.cc.

◆ minMatchedStations_

const double ttbarEventSelector::minMatchedStations_
private

Definition at line 67 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minMatches_

const double ttbarEventSelector::minMatches_
private

Definition at line 66 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minMet_

const double ttbarEventSelector::minMet_
private

Definition at line 87 of file ttbarEventSelector.cc.

◆ minPixelHits_

const int ttbarEventSelector::minPixelHits_
private

Definition at line 77 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minPt_

const double ttbarEventSelector::minPt_
private

Definition at line 55 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minPt_Jets_

const double ttbarEventSelector::minPt_Jets_
private

Definition at line 84 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minPtHighest_Jets_

const double ttbarEventSelector::minPtHighest_Jets_
private

Definition at line 83 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minPtHighestEle_

const double ttbarEventSelector::minPtHighestEle_
private

Definition at line 82 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minPtHighestMu_

const double ttbarEventSelector::minPtHighestMu_
private

Definition at line 81 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minStripHits_

const int ttbarEventSelector::minStripHits_
private

Definition at line 78 of file ttbarEventSelector.cc.

Referenced by filter().

◆ minWmass_

const double ttbarEventSelector::minWmass_
private

Definition at line 89 of file ttbarEventSelector.cc.

Referenced by filter().

◆ muonTag_

const edm::InputTag ttbarEventSelector::muonTag_
private

Definition at line 44 of file ttbarEventSelector.cc.

Referenced by filter().

◆ muonToken_

const edm::EDGetTokenT<reco::MuonCollection> ttbarEventSelector::muonToken_
private

Definition at line 50 of file ttbarEventSelector.cc.

Referenced by filter().

◆ pfmetTag_

const edm::InputTag ttbarEventSelector::pfmetTag_
private

Definition at line 43 of file ttbarEventSelector.cc.

Referenced by filter().

◆ pfmetToken_

const edm::EDGetTokenT<reco::PFMETCollection> ttbarEventSelector::pfmetToken_
private

Definition at line 49 of file ttbarEventSelector.cc.

Referenced by filter().