CMS 3D CMS Logo

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

#include <ttbarEventSelector.h>

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)
 

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
 
- 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 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 38 of file ttbarEventSelector.h.

Constructor & Destructor Documentation

◆ ttbarEventSelector()

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

Definition at line 15 of file ttbarEventSelector.cc.

16  : electronTag_(ps.getUntrackedParameter<edm::InputTag>("electronInputTag", edm::InputTag("gedGsfElectrons"))),
17  jetsTag_(ps.getUntrackedParameter<edm::InputTag>("jetsInputTag", edm::InputTag("ak4PFJetsCHS"))),
18  bjetsTag_(ps.getUntrackedParameter<edm::InputTag>("bjetsInputTag", edm::InputTag("pfDeepCSVJetTags", "probb"))),
20  muonTag_(ps.getUntrackedParameter<edm::InputTag>("muonInputTag", edm::InputTag("muons"))),
21  bsTag_(ps.getUntrackedParameter<edm::InputTag>("offlineBeamSpot", edm::InputTag("offlineBeamSpot"))),
22  electronToken_(consumes<reco::GsfElectronCollection>(electronTag_)),
23  jetsToken_(consumes<reco::PFJetCollection>(jetsTag_)),
24  bjetsToken_(consumes<reco::JetTagCollection>(bjetsTag_)),
25  pfmetToken_(consumes<reco::PFMETCollection>(pfmetTag_)),
26  muonToken_(consumes<reco::MuonCollection>(muonTag_)),
27  bsToken_(consumes<reco::BeamSpot>(bsTag_)),
28  maxEtaEle_(ps.getUntrackedParameter<double>("maxEta", 2.4)),
29  maxEtaMu_(ps.getUntrackedParameter<double>("maxEta", 2.4)),
30  minPt_(ps.getUntrackedParameter<double>("minPt", 5)),
31 
32  // for Electron only
33  maxDeltaPhiInEB_(ps.getUntrackedParameter<double>("maxDeltaPhiInEB", .15)),
34  maxDeltaEtaInEB_(ps.getUntrackedParameter<double>("maxDeltaEtaInEB", .007)),
35  maxHOEEB_(ps.getUntrackedParameter<double>("maxHOEEB", .12)),
36  maxSigmaiEiEEB_(ps.getUntrackedParameter<double>("maxSigmaiEiEEB", .01)),
37  maxDeltaPhiInEE_(ps.getUntrackedParameter<double>("maxDeltaPhiInEE", .1)),
38  maxDeltaEtaInEE_(ps.getUntrackedParameter<double>("maxDeltaEtaInEE", .009)),
39  maxHOEEE_(ps.getUntrackedParameter<double>("maxHOEEB_", .10)),
40  maxSigmaiEiEEE_(ps.getUntrackedParameter<double>("maxSigmaiEiEEE", .03)),
41 
42  // for Muon only
43  minChambers_(ps.getUntrackedParameter<uint32_t>("minChambers", 2)),
44  minMatches_(ps.getUntrackedParameter<uint32_t>("minMatches", 2)),
45  minMatchedStations_(ps.getUntrackedParameter<double>("minMatchedStations", 2)),
46 
47  // for Jets only
48  maxEtaHighest_Jets_(ps.getUntrackedParameter<double>("maxEtaHighest_Jets", 2.4)),
49  maxEta_Jets_(ps.getUntrackedParameter<double>("maxEta_Jets", 3.0)),
50 
51  // for b-tag only
52  btagFactor_(ps.getUntrackedParameter<double>("btagFactor", 0.6)),
53 
54  maxNormChi2_(ps.getUntrackedParameter<double>("maxNormChi2", 10)),
55  maxD0_(ps.getUntrackedParameter<double>("maxD0", 0.02)),
56  maxDz_(ps.getUntrackedParameter<double>("maxDz", 20.)),
57  minPixelHits_(ps.getUntrackedParameter<uint32_t>("minPixelHits", 1)),
58  minStripHits_(ps.getUntrackedParameter<uint32_t>("minStripHits", 8)),
59  maxIsoEle_(ps.getUntrackedParameter<double>("maxIso", 0.5)),
60  maxIsoMu_(ps.getUntrackedParameter<double>("maxIso", 0.3)),
61  minPtHighestMu_(ps.getUntrackedParameter<double>("minPtHighestMu", 24)),
62  minPtHighestEle_(ps.getUntrackedParameter<double>("minPtHighestEle", 32)),
63  minPtHighest_Jets_(ps.getUntrackedParameter<double>("minPtHighest_Jets", 30)),
64  minPt_Jets_(ps.getUntrackedParameter<double>("minPt_Jets", 20)),
65  minInvMass_(ps.getUntrackedParameter<double>("minInvMass", 140)),
66  maxInvMass_(ps.getUntrackedParameter<double>("maxInvMass", 200)),
67  minMet_(ps.getUntrackedParameter<double>("minMet", 50)),
68  maxMet_(ps.getUntrackedParameter<double>("maxMet", 80)),
69  minWmass_(ps.getUntrackedParameter<double>("minWmass", 50)),
70  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 minPt_Jets_
const double minPtHighestMu_
const edm::InputTag electronTag_
const edm::InputTag bjetsTag_
const edm::InputTag jetsTag_
const double maxEta_Jets_
const double minMatches_
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 minInvMass_
const double minPtHighest_Jets_
const double maxNormChi2_
const double minChambers_
const double btagFactor_
const double maxInvMass_
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 362 of file ttbarEventSelector.cc.

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

Referenced by filter().

362  {
363  int cat = 0;
364  if ((nEle >= 2 || nMu >= 2) && nJets > 1 && nbJets > 1) { // di-lepton
365  if (nEle >= 2 && nJets < 2)
366  cat = 11;
367  else if (nMu >= 2 && nJets < 2)
368  cat = 12;
369  else if (nEle >= 1 && nMu >= 1 && nJets < 2)
370  cat = 13;
371  } else if ((nEle >= 1 || nMu >= 1) && nJets > 3 && nbJets > 2) { //semi-lepton
372  if (nEle >= 1 && nJets > 1)
373  cat = 21;
374  else if (nMu >= 1 && nJets > 1)
375  cat = 22;
376  } else if ((nEle < 1 && nMu < 1) && nJets > 5 && nbJets > 1)
377  cat = 30;
378  else
379  cat = 50;
380  return cat;
381 }
def cat(path)
Definition: eostools.py:401

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 72 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.

72  {
73  // beamspot
75  iEvent.getByToken(bsToken_, beamSpot);
76 
77  int le = 0, lm = 0, lj = 0, lbj = 0;
78 
79  // Read Electron Collection
81  iEvent.getByToken(electronToken_, electronColl);
82  std::vector<TLorentzVector> list_ele;
83  std::vector<int> chrgeList_ele;
84 
85  if (electronColl.isValid()) {
86  for (auto const& ele : *electronColl) {
87  if (!ele.ecalDriven())
88  continue;
89  if (ele.pt() < minPt_)
90  continue;
91  // set a max Eta cut
92  if (!(ele.isEB() || ele.isEE()))
93  continue;
94 
95  double hOverE = ele.hadronicOverEm();
96  double sigmaee = ele.sigmaIetaIeta();
97  double deltaPhiIn = ele.deltaPhiSuperClusterTrackAtVtx();
98  double deltaEtaIn = ele.deltaEtaSuperClusterTrackAtVtx();
99 
100  // separate cut for barrel and endcap
101  if (ele.isEB()) {
102  if (fabs(deltaPhiIn) >= maxDeltaPhiInEB_ && fabs(deltaEtaIn) >= maxDeltaEtaInEB_ && hOverE >= maxHOEEB_ &&
103  sigmaee >= maxSigmaiEiEEB_)
104  continue;
105  } else if (ele.isEE()) {
106  if (fabs(deltaPhiIn) >= maxDeltaPhiInEE_ && fabs(deltaEtaIn) >= maxDeltaEtaInEE_ && hOverE >= maxHOEEE_ &&
107  sigmaee >= maxSigmaiEiEEE_)
108  continue;
109  }
110 
111  reco::GsfTrackRef trk = ele.gsfTrack();
112  if (!trk.isNonnull())
113  continue; // only electrons with tracks
114  double chi2 = trk->chi2();
115  double ndof = trk->ndof();
116  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
117  if (chbyndof >= maxNormChi2_)
118  continue;
119 
120  double trkd0 = trk->d0();
121  if (beamSpot.isValid()) {
122  trkd0 = -(trk->dxy(beamSpot->position()));
123  } else {
124  edm::LogError("ElectronSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
125  }
126  if (std::fabs(trkd0) >= maxD0_)
127  continue;
128 
129  const reco::HitPattern& hitp = trk->hitPattern();
130  int nPixelHits = hitp.numberOfValidPixelHits();
131  if (nPixelHits < minPixelHits_)
132  continue;
133 
134  int nStripHits = hitp.numberOfValidStripHits();
135  if (nStripHits < minStripHits_)
136  continue;
137 
138  // PF Isolation
139  reco::GsfElectron::PflowIsolationVariables pfIso = ele.pfIsolationVariables();
140  const float eiso =
141  pfIso.sumChargedHadronPt + std::max(0.0, pfIso.sumNeutralHadronEt + pfIso.sumPhotonEt - 0.5 * pfIso.sumPUPt);
142  if (eiso > maxIsoEle_ * ele.pt())
143  continue;
144 
145  TLorentzVector lv_ele;
146  lv_ele.SetPtEtaPhiE(ele.pt(), ele.eta(), ele.phi(), ele.energy());
147  list_ele.push_back(lv_ele);
148  chrgeList_ele.push_back(ele.charge());
149  }
150  le = list_ele.size();
151  } else {
152  edm::LogError("ElectronSelector") << "Error >> Failed to get ElectronCollection for label: " << electronTag_;
153  }
154 
155  // Read Muon Collection
157  iEvent.getByToken(muonToken_, muonColl);
158 
159  std::vector<TLorentzVector> list_mu;
160  std::vector<int> chrgeList_mu;
161  if (muonColl.isValid()) {
162  for (auto const& mu : *muonColl) {
163  if (!mu.isGlobalMuon())
164  continue;
165  if (!mu.isPFMuon())
166  continue;
167  if (std::fabs(mu.eta()) >= maxEtaMu_)
168  continue;
169  if (mu.pt() < minPt_)
170  continue;
171 
172  reco::TrackRef gtk = mu.globalTrack();
173  double chi2 = gtk->chi2();
174  double ndof = gtk->ndof();
175  double chbyndof = (ndof > 0) ? chi2 / ndof : 0;
176  if (chbyndof >= maxNormChi2_)
177  continue;
178 
179  reco::TrackRef tk = mu.innerTrack();
180  if (beamSpot.isValid()) {
181  double trkd0 = -(tk->dxy(beamSpot->position()));
182  if (std::fabs(trkd0) >= maxD0_)
183  continue;
184  double trkdz = tk->dz(beamSpot->position());
185  if (std::fabs(trkdz) >= maxDz_)
186  continue;
187  } else {
188  edm::LogError("MuonSelector") << "Error >> Failed to get BeamSpot for label: " << bsTag_;
189  }
190 
191  const reco::HitPattern& hitp = gtk->hitPattern();
193  continue;
195  continue;
196 
197  // Hits/section in the muon chamber
198  if (mu.numberOfChambers() < minChambers_)
199  continue;
200  if (mu.numberOfMatches() < minMatches_)
201  continue;
202  if (mu.numberOfMatchedStations() < minMatchedStations_)
203  continue;
205  continue;
206 
207  // PF Isolation
208  const reco::MuonPFIsolation& pfIso04 = mu.pfIsolationR04();
209  double absiso = pfIso04.sumChargedHadronPt +
210  std::max(0.0, pfIso04.sumNeutralHadronEt + pfIso04.sumPhotonEt - 0.5 * pfIso04.sumPUPt);
211  if (absiso > maxIsoMu_ * mu.pt())
212  continue;
213 
214  TLorentzVector lv_mu;
215  lv_mu.SetPtEtaPhiE(mu.pt(), mu.eta(), mu.phi(), mu.energy());
216  list_mu.push_back(lv_mu);
217  chrgeList_mu.push_back(mu.charge());
218  }
219  lm = list_mu.size();
220  } else {
221  edm::LogError("MuonSelector") << "Error >> Failed to get MuonCollection for label: " << muonTag_;
222  return false;
223  }
224 
225  // for Track jet collections
227  iEvent.getByToken(jetsToken_, jetColl);
228  std::vector<TLorentzVector> list_jets;
229 
230  if (jetColl.isValid()) {
231  for (const auto& jets : *jetColl) {
232  if (jets.pt() < minPt_Jets_)
233  continue;
234  if (std::fabs(jets.eta()) > maxEta_Jets_)
235  continue;
236  TLorentzVector lv_jets; // lv_bJets;
237  lv_jets.SetPtEtaPhiE(jets.pt(), jets.eta(), jets.phi(), jets.energy());
238  list_jets.push_back(lv_jets);
239  }
240  lj = list_jets.size();
241  }
242 
244  iEvent.getByToken(bjetsToken_, bTagHandle);
245  const reco::JetTagCollection& bTags = *(bTagHandle.product());
246  std::vector<TLorentzVector> list_bjets;
247 
248  if (!bTags.empty()) {
249  for (unsigned bj = 0; bj != bTags.size(); ++bj) {
250  TLorentzVector lv_bjets;
251  lv_bjets.SetPtEtaPhiE(
252  bTags[bj].first->pt(), bTags[bj].first->eta(), bTags[bj].first->phi(), bTags[bj].first->energy());
253  if ((bTags[bj].second > btagFactor_) && (lv_bjets.Pt() > minPt_Jets_))
254  list_bjets.push_back(lv_bjets);
255  }
256  lbj = list_bjets.size();
257  }
258 
259  // for MET collection
261  iEvent.getByToken(pfmetToken_, pfColl);
262  if (EventCategory(le, lm, lj, lbj) == 11) { // dilepton- ele ele
263  if (list_ele[0].Pt() < minPtHighestEle_)
264  return false;
265  if ((list_ele[0].Pt() < list_mu[0].Pt()) || (list_ele[1].Pt() < list_mu[0].Pt()))
266  return false;
267  if (chrgeList_ele[0] + chrgeList_ele[1] != 0)
268  return false;
269  if (pfColl.isValid()) {
270  double mt1 = getMt(list_ele[0], pfColl->front());
271  double mt2 = getMt(list_ele[1], pfColl->front());
272  double mt = mt1 + mt2;
273  if (mt < 2 * minMet_ || mt > 2 * maxMet_)
274  return false;
275  } else {
276  edm::LogError("ttbarEventSelector")
277  << "Error >> Failed to get PFMETCollection in dilepton ele-ele channel for label: " << pfmetTag_;
278  return false;
279  }
280  } else if (EventCategory(le, lm, lj, lbj) == 12) { // dilepton - mu mu
281  if (list_mu[0].Pt() < minPtHighestMu_)
282  return false;
283  if ((list_mu[0].Pt() < list_ele[0].Pt()) || (list_mu[1].Pt() < list_ele[0].Pt()))
284  return false;
285  if (chrgeList_mu[0] + chrgeList_mu[1] != 0)
286  return false;
287  if (pfColl.isValid()) {
288  double mt1 = getMt(list_mu[0], pfColl->front());
289  double mt2 = getMt(list_mu[1], pfColl->front());
290  double mt = mt1 + mt2;
291  if (mt < 2 * minMet_ || mt > 2 * maxMet_)
292  return false;
293  } else {
294  edm::LogError("ttbarEventSelector")
295  << "Error >> Failed to get PFMETCollection in dilepton mu-mu channel for label: " << pfmetTag_;
296  return false;
297  }
298  } else if (EventCategory(le, lm, lj, lbj) == 13) { // dilepton - ele mu
299  if ((list_mu[0].Pt() < list_ele[1].Pt()) || (list_ele[0].Pt() < list_mu[1].Pt()))
300  return false;
301  if ((list_mu[0].Pt() < minPtHighestMu_) || (list_ele[0].Pt() < minPtHighestEle_))
302  return false;
303  if (chrgeList_mu[0] + chrgeList_ele[0] != 0)
304  return false;
305  if (pfColl.isValid()) {
306  double mt1 = getMt(list_mu[0], pfColl->front());
307  double mt2 = getMt(list_ele[0], pfColl->front());
308  double mt = mt1 + mt2;
309  if (mt < 2 * minMet_ || mt > 2 * maxMet_)
310  return false;
311  } else {
312  edm::LogError("ttbarEventSelector")
313  << "Error >> Failed to get PFMETCollection in dilepton ele-mu channel for label: " << pfmetTag_;
314  return false;
315  }
316  }
317  if (EventCategory(le, lm, lj, lbj) == 21) { // semilepton - ele or mu
318  if (list_jets[0].Pt() < minPtHighest_Jets_)
319  return false;
320 
321  if (list_ele[0].Pt() < minPtHighestEle_)
322  return false;
323  // Both should not be present at the same time
324  if ((!list_ele.empty() && list_ele[0].Pt() > minPtHighestEle_) &&
325  (!list_mu.empty() && list_mu[0].Pt() > minPtHighestMu_))
326  return false;
327 
328  return true;
329  }
330  if (EventCategory(le, lm, lj, lbj) == 22) { // semilepton - ele or mu
331  if (list_jets[0].Pt() < minPtHighest_Jets_)
332  return false;
333 
334  if (list_mu[0].Pt() < minPtHighestMu_)
335  return false;
336  // Both should not be present at the same time
337  if ((!list_ele.empty() && list_ele[0].Pt() > minPtHighestEle_) &&
338  (!list_mu.empty() && list_mu[0].Pt() > minPtHighestMu_))
339  return false;
340 
341  return true;
342  } else if (EventCategory(le, lm, lj, lbj) == 30) {
343  if (list_jets[0].Pt() < minPtHighest_Jets_)
344  return false;
345  for (int i = 0; i < 4; i++) {
346  TLorentzVector vjet1;
347  for (int j = i + 1; j < 4; j++) {
348  TLorentzVector vjet2;
349  vjet1 = list_jets[i];
350  vjet2 = list_jets[j];
351  TLorentzVector vjet = vjet1 + vjet2;
352  if (vjet.M() < minWmass_ || vjet.M() > maxWmass_)
353  return false;
354  }
355  }
356  } else if (EventCategory(le, lm, lj, lbj) == 50)
357  return false;
358 
359  return false;
360 }
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 minPt_Jets_
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 maxEta_Jets_
const double minMatches_
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
const double maxNormChi2_
const double minChambers_
const double btagFactor_
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 383 of file ttbarEventSelector.cc.

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

Referenced by filter().

383  {
384  double met = obj.et();
385  double phi = obj.phi();
386 
387  TLorentzVector vmet;
388  double metx = met * std::cos(phi);
389  double mety = met * std::sin(phi);
390  vmet.SetPxPyPzE(metx, mety, 0.0, met);
391 
392  // transverse mass
393  TLorentzVector vw = vlep + vmet;
394 
395  return std::sqrt(2 * vlep.Et() * met * (1 - std::cos(deltaPhi(vlep.Phi(), phi))));
396 }
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 48 of file ttbarEventSelector.h.

◆ bjetsToken_

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

Definition at line 54 of file ttbarEventSelector.h.

Referenced by filter().

◆ bsTag_

const edm::InputTag ttbarEventSelector::bsTag_
private

Definition at line 51 of file ttbarEventSelector.h.

Referenced by filter().

◆ bsToken_

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

Definition at line 57 of file ttbarEventSelector.h.

Referenced by filter().

◆ btagFactor_

const double ttbarEventSelector::btagFactor_
private

Definition at line 78 of file ttbarEventSelector.h.

Referenced by filter().

◆ electronTag_

const edm::InputTag ttbarEventSelector::electronTag_
private

Definition at line 46 of file ttbarEventSelector.h.

Referenced by filter().

◆ electronToken_

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

Definition at line 52 of file ttbarEventSelector.h.

Referenced by filter().

◆ jetsTag_

const edm::InputTag ttbarEventSelector::jetsTag_
private

Definition at line 47 of file ttbarEventSelector.h.

◆ jetsToken_

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

Definition at line 53 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxD0_

const double ttbarEventSelector::maxD0_
private

Definition at line 81 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxDeltaEtaInEB_

const double ttbarEventSelector::maxDeltaEtaInEB_
private

Definition at line 63 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxDeltaEtaInEE_

const double ttbarEventSelector::maxDeltaEtaInEE_
private

Definition at line 67 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxDeltaPhiInEB_

const double ttbarEventSelector::maxDeltaPhiInEB_
private

Definition at line 62 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxDeltaPhiInEE_

const double ttbarEventSelector::maxDeltaPhiInEE_
private

Definition at line 66 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxDz_

const double ttbarEventSelector::maxDz_
private

Definition at line 82 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxEta_Jets_

const double ttbarEventSelector::maxEta_Jets_
private

Definition at line 76 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxEtaEle_

const double ttbarEventSelector::maxEtaEle_
private

Definition at line 59 of file ttbarEventSelector.h.

◆ maxEtaHighest_Jets_

const double ttbarEventSelector::maxEtaHighest_Jets_
private

Definition at line 75 of file ttbarEventSelector.h.

◆ maxEtaMu_

const double ttbarEventSelector::maxEtaMu_
private

Definition at line 60 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxHOEEB_

const double ttbarEventSelector::maxHOEEB_
private

Definition at line 64 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxHOEEE_

const double ttbarEventSelector::maxHOEEE_
private

Definition at line 68 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxInvMass_

const double ttbarEventSelector::maxInvMass_
private

Definition at line 92 of file ttbarEventSelector.h.

◆ maxIsoEle_

const double ttbarEventSelector::maxIsoEle_
private

Definition at line 85 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxIsoMu_

const double ttbarEventSelector::maxIsoMu_
private

Definition at line 86 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxMet_

const double ttbarEventSelector::maxMet_
private

Definition at line 94 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxNormChi2_

const double ttbarEventSelector::maxNormChi2_
private

Definition at line 80 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxSigmaiEiEEB_

const double ttbarEventSelector::maxSigmaiEiEEB_
private

Definition at line 65 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxSigmaiEiEEE_

const double ttbarEventSelector::maxSigmaiEiEEE_
private

Definition at line 69 of file ttbarEventSelector.h.

Referenced by filter().

◆ maxWmass_

const double ttbarEventSelector::maxWmass_
private

Definition at line 96 of file ttbarEventSelector.h.

Referenced by filter().

◆ minChambers_

const double ttbarEventSelector::minChambers_
private

Definition at line 71 of file ttbarEventSelector.h.

Referenced by filter().

◆ minInvMass_

const double ttbarEventSelector::minInvMass_
private

Definition at line 91 of file ttbarEventSelector.h.

◆ minMatchedStations_

const double ttbarEventSelector::minMatchedStations_
private

Definition at line 73 of file ttbarEventSelector.h.

Referenced by filter().

◆ minMatches_

const double ttbarEventSelector::minMatches_
private

Definition at line 72 of file ttbarEventSelector.h.

Referenced by filter().

◆ minMet_

const double ttbarEventSelector::minMet_
private

Definition at line 93 of file ttbarEventSelector.h.

◆ minPixelHits_

const int ttbarEventSelector::minPixelHits_
private

Definition at line 83 of file ttbarEventSelector.h.

Referenced by filter().

◆ minPt_

const double ttbarEventSelector::minPt_
private

Definition at line 61 of file ttbarEventSelector.h.

Referenced by filter().

◆ minPt_Jets_

const double ttbarEventSelector::minPt_Jets_
private

Definition at line 90 of file ttbarEventSelector.h.

Referenced by filter().

◆ minPtHighest_Jets_

const double ttbarEventSelector::minPtHighest_Jets_
private

Definition at line 89 of file ttbarEventSelector.h.

Referenced by filter().

◆ minPtHighestEle_

const double ttbarEventSelector::minPtHighestEle_
private

Definition at line 88 of file ttbarEventSelector.h.

Referenced by filter().

◆ minPtHighestMu_

const double ttbarEventSelector::minPtHighestMu_
private

Definition at line 87 of file ttbarEventSelector.h.

Referenced by filter().

◆ minStripHits_

const int ttbarEventSelector::minStripHits_
private

Definition at line 84 of file ttbarEventSelector.h.

Referenced by filter().

◆ minWmass_

const double ttbarEventSelector::minWmass_
private

Definition at line 95 of file ttbarEventSelector.h.

Referenced by filter().

◆ muonTag_

const edm::InputTag ttbarEventSelector::muonTag_
private

Definition at line 50 of file ttbarEventSelector.h.

Referenced by filter().

◆ muonToken_

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

Definition at line 56 of file ttbarEventSelector.h.

Referenced by filter().

◆ pfmetTag_

const edm::InputTag ttbarEventSelector::pfmetTag_
private

Definition at line 49 of file ttbarEventSelector.h.

Referenced by filter().

◆ pfmetToken_

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

Definition at line 55 of file ttbarEventSelector.h.

Referenced by filter().