CMS 3D CMS Logo

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

#include <MuonVPlusJetsIDSelectionFunctor.h>

Inheritance diagram for MuonVPlusJetsIDSelectionFunctor:
Selector< pat::Muon >

Public Types

enum  Version_t {
  SUMMER08, FIRSTDATA, SPRING10, FALL10,
  N_VERSIONS, KITQCD
}
 
- Public Types inherited from Selector< pat::Muon >
typedef std::pair< index_type, size_t > cut_flow_item
 
typedef std::vector< cut_flow_itemcut_flow_map
 
typedef pat::Muon data_type
 
typedef std::map< index_type, double > double_map
 
typedef pat::strbitset::index_type index_type
 
typedef std::map< index_type, int > int_map
 

Public Member Functions

bool fall10Cuts (const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
 
bool firstDataCuts (const pat::Muon &muon, pat::strbitset &ret)
 
void initialize (Version_t version, double chi2=10.0, double d0=999.0, double ed0=999.0, double sd0=3.0, int nhits=11, int nValidMuonHits=0, double ecalveto=4.0, double hcalveto=6.0, double reliso=0.05, double maxLepZ=1.0, int minPixelHits=1, int minNMatches=1)
 
bool kitQCDCuts (const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
 
 MuonVPlusJetsIDSelectionFunctor ()
 
 MuonVPlusJetsIDSelectionFunctor (edm::ParameterSet const &parameters, edm::ConsumesCollector &iC)
 
 MuonVPlusJetsIDSelectionFunctor (edm::ParameterSet const &parameters)
 
 MuonVPlusJetsIDSelectionFunctor (Version_t version, double chi2=10.0, double d0=0.2, double ed0=999.0, double sd0=999.0, int nhits=11, int nValidMuonHits=0, double ecalveto=4.0, double hcalveto=6.0, double reliso=0.05, double maxLepZ=1.0, int minPixelHits=1, int minNMatches=1)
 
bool operator() (const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret) override
 This provides an alternative signature that includes extra information. More...
 
bool operator() (const pat::Muon &muon, pat::strbitset &ret) override
 This provides the interface for base classes to select objects. More...
 
bool spring10Cuts (const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
 
bool summer08Cuts (const pat::Muon &muon, pat::strbitset &ret)
 
- Public Member Functions inherited from Selector< pat::Muon >
void clear (std::string const &s)
 Turn off a given selection cut. More...
 
void clear (index_type const &i)
 
bool considerCut (std::string const &s) const
 consider the cut at index "s" More...
 
bool considerCut (index_type const &i) const
 
int cut (index_type const &i, int val) const
 Access the int cut values at index "s". More...
 
double cut (index_type const &i, double val) const
 Access the double cut values at index "s". More...
 
int cut (std::string s, int val) const
 Access the int cut values at index "s". More...
 
double cut (std::string s, double val) const
 Access the double cut values at index "s". More...
 
pat::strbitset getBitTemplate () const
 Get an empty bitset with the proper names. More...
 
double getPasses (std::string const &s) const
 Return the number of passing cases. More...
 
double getPasses (index_type const &i) const
 
bool ignoreCut (std::string const &s) const
 ignore the cut at index "s" More...
 
bool ignoreCut (index_type const &i) const
 
virtual bool operator() (pat::Muon const &t)
 This provides an alternative signature without the second ret. More...
 
virtual bool operator() (pat::Muon const &t, edm::EventBase const &e)
 This provides an alternative signature that includes extra information. More...
 
bool operator[] (std::string const &s) const
 
bool operator[] (index_type const &i) const
 
void passCut (pat::strbitset &ret, std::string const &s)
 Passing cuts. More...
 
void passCut (pat::strbitset &ret, index_type const &i)
 
void print (std::ostream &out) const
 Print the cut flow. More...
 
void printActiveCuts (std::ostream &out) const
 Print the cuts being considered. More...
 
virtual void push_back (std::string const &s)
 This is the registration of an individual cut string. More...
 
virtual void push_back (std::string const &s, int cut)
 This is the registration of an individual cut string, with an int cut value. More...
 
virtual void push_back (std::string const &s, double cut)
 This is the registration of an individual cut string, with a double cut value. More...
 
 Selector ()
 Constructor clears the bits. More...
 
void set (std::string const &s, bool val=true)
 Set a given selection cut, on or off. More...
 
void set (index_type const &i, bool val=true)
 
void set (std::string const &s, int cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
void set (index_type const &i, int cut, bool val=true)
 
void set (std::string const &s, double cut, bool val=true)
 Set a given selection cut, on or off, and reset int cut value. More...
 
void set (index_type const &i, double cut, bool val=true)
 
void setIgnored (pat::strbitset &ret)
 set ignored bits More...
 
void setIgnoredCuts (std::vector< std::string > const &bitsToIgnore)
 set the bits to ignore from a vector More...
 
virtual ~Selector ()
 

Public Attributes

bool verbose_
 

Private Attributes

edm::InputTag beamLineSrc_
 
edm::EDGetTokenT< reco::BeamSpotbeamLineSrcToken_
 
index_type indexChi2_
 
index_type indexD0_
 
index_type indexECalVeto_
 
index_type indexED0_
 
index_type indexHCalVeto_
 
index_type indexLepZ_
 
index_type indexNHits_
 
index_type indexNValMuHits_
 
index_type indexPixHits_
 
index_type indexRelIso_
 
index_type indexSD0_
 
index_type indexStations_
 
edm::InputTag pvSrc_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > pvSrcToken_
 
bool recalcDBFromBSp_
 
Version_t version_
 

Additional Inherited Members

- Protected Attributes inherited from Selector< pat::Muon >
pat::strbitset bits_
 the bitset indexed by strings More...
 
cut_flow_map cutFlow_
 map of cut flows in "human" order More...
 
double_map doubleCuts_
 the double-value cut map More...
 
int_map intCuts_
 the int-value cut map More...
 
pat::strbitset retInternal_
 internal ret if users don't care about return bits More...
 

Detailed Description

Definition at line 17 of file MuonVPlusJetsIDSelectionFunctor.h.

Member Enumeration Documentation

◆ Version_t

Constructor & Destructor Documentation

◆ MuonVPlusJetsIDSelectionFunctor() [1/4]

MuonVPlusJetsIDSelectionFunctor::MuonVPlusJetsIDSelectionFunctor ( )
inline

Definition at line 23 of file MuonVPlusJetsIDSelectionFunctor.h.

23 {}

◆ MuonVPlusJetsIDSelectionFunctor() [2/4]

MuonVPlusJetsIDSelectionFunctor::MuonVPlusJetsIDSelectionFunctor ( edm::ParameterSet const &  parameters,
edm::ConsumesCollector iC 
)
inline

◆ MuonVPlusJetsIDSelectionFunctor() [3/4]

MuonVPlusJetsIDSelectionFunctor::MuonVPlusJetsIDSelectionFunctor ( edm::ParameterSet const &  parameters)
inline

Definition at line 33 of file MuonVPlusJetsIDSelectionFunctor.h.

References gather_cfg::cout, Exception, FALL10, FIRSTDATA, Selector< pat::Muon >::getBitTemplate(), initialize(), KITQCD, N_VERSIONS, pvSrc_, recalcDBFromBSp_, Selector< pat::Muon >::retInternal_, Selector< pat::Muon >::setIgnoredCuts(), SPRING10, AlCaHLTBitMon_QueryRunRegistry::string, SUMMER08, verbose_, and BeamSplash_cfg::version.

33  {
34  verbose_ = false;
35 
36  std::string versionStr = parameters.getParameter<std::string>("version");
37 
39 
40  if (versionStr == "SUMMER08") {
41  version = SUMMER08;
42  } else if (versionStr == "FIRSTDATA") {
44  } else if (versionStr == "SPRING10") {
45  version = SPRING10;
46  } else if (versionStr == "FALL10") {
47  version = FALL10;
48  if (verbose_)
49  std::cout << "\nMUON SELECTION - you are using FALL10 Selection" << std::endl;
50  } else if (versionStr == "KITQCD") {
51  version = KITQCD;
52  if (verbose_)
53  std::cout << "\nMUON SELECTION - you are using KITQCD Selection" << std::endl;
54  } else {
55  throw cms::Exception("InvalidInput")
56  << "Expect version to be one of SUMMER08, FIRSTDATA, SPRING10, FALL10" << std::endl;
57  }
58 
60  parameters.getParameter<double>("Chi2"),
61  parameters.getParameter<double>("D0"),
62  parameters.getParameter<double>("ED0"),
63  parameters.getParameter<double>("SD0"),
64  parameters.getParameter<int>("NHits"),
65  parameters.getParameter<int>("NValMuHits"),
66  parameters.getParameter<double>("ECalVeto"),
67  parameters.getParameter<double>("HCalVeto"),
68  parameters.getParameter<double>("RelIso"),
69  parameters.getParameter<double>("LepZ"),
70  parameters.getParameter<int>("nPixelHits"),
71  parameters.getParameter<int>("nMatchedStations"));
72  if (parameters.exists("cutsToIgnore"))
73  setIgnoredCuts(parameters.getParameter<std::vector<std::string> >("cutsToIgnore"));
74 
76 
77  recalcDBFromBSp_ = parameters.getParameter<bool>("RecalcFromBeamSpot");
78  pvSrc_ = parameters.getParameter<edm::InputTag>("pvSrc");
79  }
void initialize(Version_t version, double chi2=10.0, double d0=999.0, double ed0=999.0, double sd0=3.0, int nhits=11, int nValidMuonHits=0, double ecalveto=4.0, double hcalveto=6.0, double reliso=0.05, double maxLepZ=1.0, int minPixelHits=1, int minNMatches=1)
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:242
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:168
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
Definition: Selector.h:131

◆ MuonVPlusJetsIDSelectionFunctor() [4/4]

MuonVPlusJetsIDSelectionFunctor::MuonVPlusJetsIDSelectionFunctor ( Version_t  version,
double  chi2 = 10.0,
double  d0 = 0.2,
double  ed0 = 999.0,
double  sd0 = 999.0,
int  nhits = 11,
int  nValidMuonHits = 0,
double  ecalveto = 4.0,
double  hcalveto = 6.0,
double  reliso = 0.05,
double  maxLepZ = 1.0,
int  minPixelHits = 1,
int  minNMatches = 1 
)
inline

Definition at line 81 of file MuonVPlusJetsIDSelectionFunctor.h.

References nano_mu_local_reco_cff::chi2, d0, Selector< pat::Muon >::getBitTemplate(), initialize(), beam_dqm_sourceclient-live_cfg::minPixelHits, TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::retInternal_, and BeamSplash_cfg::version.

94  : recalcDBFromBSp_(false) {
96  chi2,
97  d0,
98  ed0,
99  sd0,
100  nhits,
101  nValidMuonHits,
102  ecalveto,
103  hcalveto,
104  reliso,
105  maxLepZ,
106  minPixelHits,
107  minNMatches);
108 
110  }
void initialize(Version_t version, double chi2=10.0, double d0=999.0, double ed0=999.0, double sd0=3.0, int nhits=11, int nValidMuonHits=0, double ecalveto=4.0, double hcalveto=6.0, double reliso=0.05, double maxLepZ=1.0, int minPixelHits=1, int minNMatches=1)
pat::strbitset retInternal_
internal ret if users don&#39;t care about return bits
Definition: Selector.h:242
static constexpr float d0
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
Definition: Selector.h:168

Member Function Documentation

◆ fall10Cuts()

bool MuonVPlusJetsIDSelectionFunctor::fall10Cuts ( const pat::Muon muon,
edm::EventBase const &  event,
pat::strbitset ret 
)
inline

Definition at line 388 of file MuonVPlusJetsIDSelectionFunctor.h.

References beamLineSrc_, pwdgSkimBPark_cfi::beamSpot, Selector< pat::Muon >::cut(), run3scouting_cff::ecalIso, Exception, run3scouting_cff::hcalIso, Selector< pat::Muon >::ignoreCut(), indexChi2_, indexD0_, indexECalVeto_, indexED0_, indexHCalVeto_, indexLepZ_, indexNHits_, indexNValMuHits_, indexPixHits_, indexRelIso_, indexSD0_, indexStations_, susybsm::HSCParticleType::innerTrack, edm::HandleBase::isValid(), TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::passCut(), DiDispStaMuonMonitor_cfi::pt, pvSrc_, recalcDBFromBSp_, objects.autophobj::relIso, runTheMatrix::ret, Selector< pat::Muon >::setIgnored(), and mathSSE::sqrt().

Referenced by operator()().

388  {
389  ret.set(false);
390 
391  double norm_chi2 = muon.normChi2();
392  double corr_d0 = muon.dB();
393  double corr_ed0 = muon.edB();
394  double corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
395 
396  // Get the PV for the muon z requirement
398  event.getByLabel(pvSrc_, pvtxHandle_);
399 
400  double zvtx = -999;
401  if (!pvtxHandle_->empty()) {
402  zvtx = pvtxHandle_->at(0).z();
403  } else {
404  throw cms::Exception("InvalidInput")
405  << " There needs to be at least one primary vertex in the event." << std::endl;
406  }
407 
408  //If required, recalculate the impact parameter using the beam spot
409  if (recalcDBFromBSp_) {
410  //Get the beam spot
411  reco::TrackBase::Point beamPoint(0, 0, 0);
413  edm::Handle<reco::BeamSpot> beamSpotHandle;
414  event.getByLabel(beamLineSrc_, beamSpotHandle);
415 
416  if (beamSpotHandle.isValid()) {
417  beamSpot = *beamSpotHandle;
418  } else {
419  edm::LogError("DataNotAvailable")
420  << "No beam spot available from EventSetup, not adding high level selection \n";
421  }
422  beamPoint = reco::TrackBase::Point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
423 
424  //Use the beamspot to correct the impact parameter and uncertainty
425  reco::TrackRef innerTrack = muon.innerTrack();
426  if (innerTrack.isNonnull() && innerTrack.isAvailable()) {
427  corr_d0 = -1.0 * innerTrack->dxy(beamPoint);
428  corr_ed0 =
429  sqrt(innerTrack->d0Error() * innerTrack->d0Error() + 0.5 * beamSpot.BeamWidthX() * beamSpot.BeamWidthX() +
430  0.5 * beamSpot.BeamWidthY() * beamSpot.BeamWidthY());
431  corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
432 
433  } else {
434  corr_d0 = 999.;
435  corr_ed0 = 999.;
436  }
437  }
438 
439  int nhits = static_cast<int>(muon.numberOfValidHits());
440  int nValidMuonHits = static_cast<int>(muon.globalTrack()->hitPattern().numberOfValidMuonHits());
441 
442  double ecalVeto = muon.isolationR03().emVetoEt;
443  double hcalVeto = muon.isolationR03().hadVetoEt;
444 
445  double hcalIso = muon.hcalIso();
446  double ecalIso = muon.ecalIso();
447  double trkIso = muon.trackIso();
448  double pt = muon.pt();
449 
450  double relIso = (ecalIso + hcalIso + trkIso) / pt;
451 
452  double z_mu = muon.vertex().z();
453 
454  int nPixelHits = muon.innerTrack()->hitPattern().pixelLayersWithMeasurement();
455 
456  int nMatchedStations = muon.numberOfMatches();
457 
458  if (norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_))
460  if (fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_))
461  passCut(ret, indexD0_);
462  if (fabs(corr_ed0) < cut(indexED0_, double()) || ignoreCut(indexED0_))
464  if (fabs(corr_sd0) < cut(indexSD0_, double()) || ignoreCut(indexSD0_))
466  if (nhits >= cut(indexNHits_, int()) || ignoreCut(indexNHits_))
468  if (nValidMuonHits > cut(indexNValMuHits_, int()) || ignoreCut(indexNValMuHits_))
470  if (hcalVeto < cut(indexHCalVeto_, double()) || ignoreCut(indexHCalVeto_))
472  if (ecalVeto < cut(indexECalVeto_, double()) || ignoreCut(indexECalVeto_))
474  if (relIso < cut(indexRelIso_, double()) || ignoreCut(indexRelIso_))
476  if (fabs(z_mu - zvtx) < cut(indexLepZ_, double()) || ignoreCut(indexLepZ_))
478  if (nPixelHits > cut(indexPixHits_, int()) || ignoreCut(indexPixHits_))
480  if (nMatchedStations > cut(indexStations_, int()) || ignoreCut(indexStations_))
482 
483  setIgnored(ret);
484 
485  return (bool)ret;
486  }
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
ret
prodAgent to be discontinued
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Log< level::Error, false > LogError
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
T sqrt(T t)
Definition: SSEVec.h:23
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158
bool isValid() const
Definition: HandleBase.h:70

◆ firstDataCuts()

bool MuonVPlusJetsIDSelectionFunctor::firstDataCuts ( const pat::Muon muon,
pat::strbitset ret 
)
inline

Definition at line 269 of file MuonVPlusJetsIDSelectionFunctor.h.

References Selector< pat::Muon >::cut(), run3scouting_cff::ecalIso, run3scouting_cff::hcalIso, Selector< pat::Muon >::ignoreCut(), indexChi2_, indexD0_, indexECalVeto_, indexED0_, indexHCalVeto_, indexNHits_, indexRelIso_, indexSD0_, TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::passCut(), DiDispStaMuonMonitor_cfi::pt, objects.autophobj::relIso, runTheMatrix::ret, and Selector< pat::Muon >::setIgnored().

Referenced by operator()().

269  {
270  ret.set(false);
271 
272  double norm_chi2 = muon.normChi2();
273  double corr_d0 = muon.dB();
274  double corr_ed0 = muon.edB();
275  double corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
276  int nhits = static_cast<int>(muon.numberOfValidHits());
277 
278  double ecalVeto = muon.isolationR03().emVetoEt;
279  double hcalVeto = muon.isolationR03().hadVetoEt;
280 
281  double hcalIso = muon.hcalIso();
282  double ecalIso = muon.ecalIso();
283  double trkIso = muon.trackIso();
284  double pt = muon.pt();
285 
286  double relIso = (ecalIso + hcalIso + trkIso) / pt;
287 
288  if (norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_))
290  if (fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_))
291  passCut(ret, indexD0_);
292  if (fabs(corr_ed0) < cut(indexED0_, double()) || ignoreCut(indexED0_))
294  if (fabs(corr_sd0) < cut(indexSD0_, double()) || ignoreCut(indexSD0_))
296  if (nhits >= cut(indexNHits_, int()) || ignoreCut(indexNHits_))
298  if (hcalVeto < cut(indexHCalVeto_, double()) || ignoreCut(indexHCalVeto_))
300  if (ecalVeto < cut(indexECalVeto_, double()) || ignoreCut(indexECalVeto_))
302  if (relIso < cut(indexRelIso_, double()) || ignoreCut(indexRelIso_))
304 
305  setIgnored(ret);
306 
307  return (bool)ret;
308  }
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
ret
prodAgent to be discontinued
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158

◆ initialize()

void MuonVPlusJetsIDSelectionFunctor::initialize ( Version_t  version,
double  chi2 = 10.0,
double  d0 = 999.0,
double  ed0 = 999.0,
double  sd0 = 3.0,
int  nhits = 11,
int  nValidMuonHits = 0,
double  ecalveto = 4.0,
double  hcalveto = 6.0,
double  reliso = 0.05,
double  maxLepZ = 1.0,
int  minPixelHits = 1,
int  minNMatches = 1 
)
inline

Definition at line 112 of file MuonVPlusJetsIDSelectionFunctor.h.

References Selector< pat::Muon >::bits_, nano_mu_local_reco_cff::chi2, d0, FALL10, FIRSTDATA, indexChi2_, indexD0_, indexECalVeto_, indexED0_, indexHCalVeto_, indexLepZ_, indexNHits_, indexNValMuHits_, indexPixHits_, indexRelIso_, indexSD0_, indexStations_, beam_dqm_sourceclient-live_cfg::minPixelHits, TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::push_back(), SPRING10, SUMMER08, BeamSplash_cfg::version, and version_.

Referenced by MuonVPlusJetsIDSelectionFunctor().

124  {
125  version_ = version;
126 
127  push_back("Chi2", chi2);
128  push_back("D0", d0);
129  push_back("ED0", ed0);
130  push_back("SD0", sd0);
131  push_back("NHits", nhits);
132  push_back("NValMuHits", nValidMuonHits);
133  push_back("ECalVeto", ecalveto);
134  push_back("HCalVeto", hcalveto);
135  push_back("RelIso", reliso);
136  push_back("LepZ", maxLepZ);
137  push_back("nPixelHits", minPixelHits);
138  push_back("nMatchedStations", minNMatches);
139 
140  set("Chi2");
141  set("D0");
142  set("ED0");
143  set("SD0");
144  set("NHits");
145  set("NValMuHits");
146  set("ECalVeto");
147  set("HCalVeto");
148  set("RelIso");
149  set("LepZ");
150  set("nPixelHits");
151  set("nMatchedStations");
152 
153  indexChi2_ = index_type(&bits_, "Chi2");
154  indexD0_ = index_type(&bits_, "D0");
155  indexED0_ = index_type(&bits_, "ED0");
156  indexSD0_ = index_type(&bits_, "SD0");
157  indexNHits_ = index_type(&bits_, "NHits");
158  indexNValMuHits_ = index_type(&bits_, "NValMuHits");
159  indexECalVeto_ = index_type(&bits_, "ECalVeto");
160  indexHCalVeto_ = index_type(&bits_, "HCalVeto");
161  indexRelIso_ = index_type(&bits_, "RelIso");
162  indexLepZ_ = index_type(&bits_, "LepZ");
163  indexPixHits_ = index_type(&bits_, "nPixelHits");
164  indexStations_ = index_type(&bits_, "nMatchedStations");
165 
166  if (version == FALL10) {
167  set("ED0", false);
168  set("SD0", false);
169  set("ECalVeto", false);
170  set("HCalVeto", false);
171  } else if (version == SPRING10) {
172  set("ED0", false);
173  set("SD0", false);
174  set("ECalVeto", false);
175  set("HCalVeto", false);
176  set("LepZ", false);
177  set("nPixelHits", false);
178  set("nMatchedStations", false);
179  } else if (version_ == FIRSTDATA) {
180  set("D0", false);
181  set("ED0", false);
182  set("NValMuHits", false);
183  set("LepZ", false);
184  set("nPixelHits", false);
185  set("nMatchedStations", false);
186  } else if (version == SUMMER08) {
187  set("SD0", false);
188  set("NValMuHits", false);
189  set("LepZ", false);
190  set("nPixelHits", false);
191  set("nMatchedStations", false);
192  }
193  }
pat::strbitset::index_type index_type
Definition: Selector.h:25
pat::strbitset bits_
the bitset indexed by strings
Definition: Selector.h:241
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Definition: Selector.h:42
static constexpr float d0

◆ kitQCDCuts()

bool MuonVPlusJetsIDSelectionFunctor::kitQCDCuts ( const pat::Muon muon,
edm::EventBase const &  event,
pat::strbitset ret 
)
inline

Definition at line 492 of file MuonVPlusJetsIDSelectionFunctor.h.

References beamLineSrc_, pwdgSkimBPark_cfi::beamSpot, Selector< pat::Muon >::cut(), run3scouting_cff::ecalIso, Exception, run3scouting_cff::hcalIso, Selector< pat::Muon >::ignoreCut(), indexChi2_, indexD0_, indexECalVeto_, indexED0_, indexHCalVeto_, indexLepZ_, indexNHits_, indexNValMuHits_, indexPixHits_, indexRelIso_, indexSD0_, indexStations_, susybsm::HSCParticleType::innerTrack, edm::HandleBase::isValid(), TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::passCut(), DiDispStaMuonMonitor_cfi::pt, pvSrc_, recalcDBFromBSp_, objects.autophobj::relIso, runTheMatrix::ret, Selector< pat::Muon >::setIgnored(), and mathSSE::sqrt().

Referenced by operator()().

492  {
493  ret.set(false);
494 
495  double norm_chi2 = muon.normChi2();
496  double corr_d0 = muon.dB();
497  double corr_ed0 = muon.edB();
498  double corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
499 
500  // Get the PV for the muon z requirement
502  event.getByLabel(pvSrc_, pvtxHandle_);
503 
504  double zvtx = -999;
505  if (!pvtxHandle_->empty()) {
506  zvtx = pvtxHandle_->at(0).z();
507  } else {
508  throw cms::Exception("InvalidInput")
509  << " There needs to be at least one primary vertex in the event." << std::endl;
510  }
511 
512  //If required, recalculate the impact parameter using the beam spot
513  if (recalcDBFromBSp_) {
514  //Get the beam spot
515  reco::TrackBase::Point beamPoint(0, 0, 0);
517  edm::Handle<reco::BeamSpot> beamSpotHandle;
518  event.getByLabel(beamLineSrc_, beamSpotHandle);
519 
520  if (beamSpotHandle.isValid()) {
521  beamSpot = *beamSpotHandle;
522  } else {
523  edm::LogError("DataNotAvailable")
524  << "No beam spot available from EventSetup, not adding high level selection \n";
525  }
526  beamPoint = reco::TrackBase::Point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
527 
528  //Use the beamspot to correct the impact parameter and uncertainty
529  reco::TrackRef innerTrack = muon.innerTrack();
530  if (innerTrack.isNonnull() && innerTrack.isAvailable()) {
531  corr_d0 = -1.0 * innerTrack->dxy(beamPoint);
532  corr_ed0 =
533  sqrt(innerTrack->d0Error() * innerTrack->d0Error() + 0.5 * beamSpot.BeamWidthX() * beamSpot.BeamWidthX() +
534  0.5 * beamSpot.BeamWidthY() * beamSpot.BeamWidthY());
535  corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
536 
537  } else {
538  corr_d0 = 999.;
539  corr_ed0 = 999.;
540  }
541  }
542 
543  int nhits = static_cast<int>(muon.numberOfValidHits());
544  int nValidMuonHits = static_cast<int>(muon.globalTrack()->hitPattern().numberOfValidMuonHits());
545 
546  double ecalVeto = muon.isolationR03().emVetoEt;
547  double hcalVeto = muon.isolationR03().hadVetoEt;
548 
549  double hcalIso = muon.hcalIso();
550  double ecalIso = muon.ecalIso();
551  double trkIso = muon.trackIso();
552  double pt = muon.pt();
553 
554  double relIso = (ecalIso + hcalIso + trkIso) / pt;
555 
556  double z_mu = muon.vertex().z();
557 
558  int nPixelHits = muon.innerTrack()->hitPattern().pixelLayersWithMeasurement();
559 
560  int nMatchedStations = muon.numberOfMatches();
561 
562  if (norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_))
564  if (fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_))
565  passCut(ret, indexD0_);
566  if (fabs(corr_ed0) < cut(indexED0_, double()) || ignoreCut(indexED0_))
568  if (fabs(corr_sd0) < cut(indexSD0_, double()) || ignoreCut(indexSD0_))
570  if (nhits >= cut(indexNHits_, int()) || ignoreCut(indexNHits_))
572  if (nValidMuonHits > cut(indexNValMuHits_, int()) || ignoreCut(indexNValMuHits_))
574  if (hcalVeto < cut(indexHCalVeto_, double()) || ignoreCut(indexHCalVeto_))
576  if (ecalVeto < cut(indexECalVeto_, double()) || ignoreCut(indexECalVeto_))
578  if (fabs(z_mu - zvtx) < cut(indexLepZ_, double()) || ignoreCut(indexLepZ_))
580  if (nPixelHits > cut(indexPixHits_, int()) || ignoreCut(indexPixHits_))
582  if (nMatchedStations > cut(indexStations_, int()) || ignoreCut(indexStations_))
584 
586  //
587  // JMS Dec 13 2010
588  // HACK
589  // Need double-sided relIso cut to implement data-driven QCD
590  //
591  //
593  if (((relIso > 0.2) && (relIso < 0.75)) || ignoreCut(indexRelIso_))
595 
596  setIgnored(ret);
597 
598  return (bool)ret;
599  }
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
ret
prodAgent to be discontinued
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Log< level::Error, false > LogError
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
T sqrt(T t)
Definition: SSEVec.h:23
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158
bool isValid() const
Definition: HandleBase.h:70

◆ operator()() [1/2]

bool MuonVPlusJetsIDSelectionFunctor::operator() ( const pat::Muon t,
edm::EventBase const &  e,
pat::strbitset ret 
)
inlineoverridevirtual

This provides an alternative signature that includes extra information.

Reimplemented from Selector< pat::Muon >.

Definition at line 196 of file MuonVPlusJetsIDSelectionFunctor.h.

References gather_cfg::cout, FALL10, fall10Cuts(), FIRSTDATA, firstDataCuts(), KITQCD, kitQCDCuts(), runTheMatrix::ret, SPRING10, spring10Cuts(), SUMMER08, summer08Cuts(), verbose_, and version_.

196  {
197  if (version_ == FALL10)
198  return fall10Cuts(muon, event, ret);
199  else if (version_ == SPRING10)
200  return spring10Cuts(muon, event, ret);
201  else if (version_ == SUMMER08)
202  return summer08Cuts(muon, ret);
203  else if (version_ == FIRSTDATA)
204  return firstDataCuts(muon, ret);
205  else if (version_ == KITQCD) {
206  if (verbose_)
207  std::cout << "Calling KIT selection method" << std::endl;
208  return kitQCDCuts(muon, event, ret);
209  } else {
210  return false;
211  }
212  }
bool fall10Cuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
bool firstDataCuts(const pat::Muon &muon, pat::strbitset &ret)
ret
prodAgent to be discontinued
bool summer08Cuts(const pat::Muon &muon, pat::strbitset &ret)
bool spring10Cuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
bool kitQCDCuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
Definition: event.py:1

◆ operator()() [2/2]

bool MuonVPlusJetsIDSelectionFunctor::operator() ( const pat::Muon t,
pat::strbitset ret 
)
inlineoverridevirtual

This provides the interface for base classes to select objects.

Implements Selector< pat::Muon >.

Definition at line 215 of file MuonVPlusJetsIDSelectionFunctor.h.

References Exception, FALL10, FIRSTDATA, firstDataCuts(), runTheMatrix::ret, SPRING10, SUMMER08, summer08Cuts(), and version_.

215  {
216  if (version_ == SPRING10 || version_ == FALL10)
217  throw cms::Exception("LogicError") << "MuonVPlusJetsSelectionFunctor SPRING10 and FALL10 versions needs the "
218  "event! Call operator()(muon,event,ret)"
219  << std::endl;
220 
221  else if (version_ == SUMMER08)
222  return summer08Cuts(muon, ret);
223  else if (version_ == FIRSTDATA)
224  return firstDataCuts(muon, ret);
225  else {
226  return false;
227  }
228  }
bool firstDataCuts(const pat::Muon &muon, pat::strbitset &ret)
ret
prodAgent to be discontinued
bool summer08Cuts(const pat::Muon &muon, pat::strbitset &ret)

◆ spring10Cuts()

bool MuonVPlusJetsIDSelectionFunctor::spring10Cuts ( const pat::Muon muon,
edm::EventBase const &  event,
pat::strbitset ret 
)
inline

Definition at line 311 of file MuonVPlusJetsIDSelectionFunctor.h.

References beamLineSrc_, pwdgSkimBPark_cfi::beamSpot, Selector< pat::Muon >::cut(), run3scouting_cff::ecalIso, run3scouting_cff::hcalIso, Selector< pat::Muon >::ignoreCut(), indexChi2_, indexD0_, indexECalVeto_, indexED0_, indexHCalVeto_, indexNHits_, indexNValMuHits_, indexRelIso_, indexSD0_, susybsm::HSCParticleType::innerTrack, edm::HandleBase::isValid(), TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::passCut(), DiDispStaMuonMonitor_cfi::pt, recalcDBFromBSp_, objects.autophobj::relIso, runTheMatrix::ret, Selector< pat::Muon >::setIgnored(), and mathSSE::sqrt().

Referenced by operator()().

311  {
312  ret.set(false);
313 
314  double norm_chi2 = muon.normChi2();
315  double corr_d0 = muon.dB();
316  double corr_ed0 = muon.edB();
317  double corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
318 
319  //If required, recalculate the impact parameter using the beam spot
320  if (recalcDBFromBSp_) {
321  //Get the beam spot
322  reco::TrackBase::Point beamPoint(0, 0, 0);
324  edm::Handle<reco::BeamSpot> beamSpotHandle;
325  event.getByLabel(beamLineSrc_, beamSpotHandle);
326 
327  if (beamSpotHandle.isValid()) {
328  beamSpot = *beamSpotHandle;
329  } else {
330  edm::LogError("DataNotAvailable")
331  << "No beam spot available from EventSetup, not adding high level selection \n";
332  }
333  beamPoint = reco::TrackBase::Point(beamSpot.x0(), beamSpot.y0(), beamSpot.z0());
334 
335  //Use the beamspot to correct the impact parameter and uncertainty
336  reco::TrackRef innerTrack = muon.innerTrack();
337  if (innerTrack.isNonnull() && innerTrack.isAvailable()) {
338  corr_d0 = -1.0 * innerTrack->dxy(beamPoint);
339  corr_ed0 =
340  sqrt(innerTrack->d0Error() * innerTrack->d0Error() + 0.5 * beamSpot.BeamWidthX() * beamSpot.BeamWidthX() +
341  0.5 * beamSpot.BeamWidthY() * beamSpot.BeamWidthY());
342  corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
343 
344  } else {
345  corr_d0 = 999.;
346  corr_ed0 = 999.;
347  }
348  }
349 
350  int nhits = static_cast<int>(muon.numberOfValidHits());
351  int nValidMuonHits = static_cast<int>(muon.globalTrack()->hitPattern().numberOfValidMuonHits());
352 
353  double ecalVeto = muon.isolationR03().emVetoEt;
354  double hcalVeto = muon.isolationR03().hadVetoEt;
355 
356  double hcalIso = muon.hcalIso();
357  double ecalIso = muon.ecalIso();
358  double trkIso = muon.trackIso();
359  double pt = muon.pt();
360 
361  double relIso = (ecalIso + hcalIso + trkIso) / pt;
362 
363  if (norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_))
365  if (fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_))
366  passCut(ret, indexD0_);
367  if (fabs(corr_ed0) < cut(indexED0_, double()) || ignoreCut(indexED0_))
369  if (fabs(corr_sd0) < cut(indexSD0_, double()) || ignoreCut(indexSD0_))
371  if (nhits >= cut(indexNHits_, int()) || ignoreCut(indexNHits_))
373  if (nValidMuonHits > cut(indexNValMuHits_, int()) || ignoreCut(indexNValMuHits_))
375  if (hcalVeto < cut(indexHCalVeto_, double()) || ignoreCut(indexHCalVeto_))
377  if (ecalVeto < cut(indexECalVeto_, double()) || ignoreCut(indexECalVeto_))
379  if (relIso < cut(indexRelIso_, double()) || ignoreCut(indexRelIso_))
381 
382  setIgnored(ret);
383 
384  return (bool)ret;
385  }
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
ret
prodAgent to be discontinued
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
Log< level::Error, false > LogError
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
T sqrt(T t)
Definition: SSEVec.h:23
math::XYZPoint Point
point in the space
Definition: TrackBase.h:80
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158
bool isValid() const
Definition: HandleBase.h:70

◆ summer08Cuts()

bool MuonVPlusJetsIDSelectionFunctor::summer08Cuts ( const pat::Muon muon,
pat::strbitset ret 
)
inline

Definition at line 233 of file MuonVPlusJetsIDSelectionFunctor.h.

References Selector< pat::Muon >::cut(), run3scouting_cff::ecalIso, run3scouting_cff::hcalIso, Selector< pat::Muon >::ignoreCut(), indexChi2_, indexD0_, indexECalVeto_, indexHCalVeto_, indexNHits_, indexRelIso_, TrackingDataMCValidation_Standalone_cff::nhits, Selector< pat::Muon >::passCut(), DiDispStaMuonMonitor_cfi::pt, objects.autophobj::relIso, runTheMatrix::ret, and Selector< pat::Muon >::setIgnored().

Referenced by operator()().

233  {
234  ret.set(false);
235 
236  double norm_chi2 = muon.normChi2();
237  double corr_d0 = muon.dB();
238  int nhits = static_cast<int>(muon.numberOfValidHits());
239 
240  double ecalVeto = muon.isolationR03().emVetoEt;
241  double hcalVeto = muon.isolationR03().hadVetoEt;
242 
243  double hcalIso = muon.hcalIso();
244  double ecalIso = muon.ecalIso();
245  double trkIso = muon.trackIso();
246  double pt = muon.pt();
247 
248  double relIso = (ecalIso + hcalIso + trkIso) / pt;
249 
250  if (norm_chi2 < cut(indexChi2_, double()) || ignoreCut(indexChi2_))
252  if (fabs(corr_d0) < cut(indexD0_, double()) || ignoreCut(indexD0_))
253  passCut(ret, indexD0_);
254  if (nhits >= cut(indexNHits_, int()) || ignoreCut(indexNHits_))
256  if (hcalVeto < cut(indexHCalVeto_, double()) || ignoreCut(indexHCalVeto_))
258  if (ecalVeto < cut(indexECalVeto_, double()) || ignoreCut(indexECalVeto_))
260  if (relIso < cut(indexRelIso_, double()) || ignoreCut(indexRelIso_))
262 
263  setIgnored(ret);
264 
265  return (bool)ret;
266  }
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
Definition: Selector.h:127
ret
prodAgent to be discontinued
void setIgnored(pat::strbitset &ret)
set ignored bits
Definition: Selector.h:181
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
Definition: Selector.h:142
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
Definition: Selector.h:158

Member Data Documentation

◆ beamLineSrc_

edm::InputTag MuonVPlusJetsIDSelectionFunctor::beamLineSrc_
private

◆ beamLineSrcToken_

edm::EDGetTokenT<reco::BeamSpot> MuonVPlusJetsIDSelectionFunctor::beamLineSrcToken_
private

Definition at line 606 of file MuonVPlusJetsIDSelectionFunctor.h.

Referenced by MuonVPlusJetsIDSelectionFunctor().

◆ indexChi2_

index_type MuonVPlusJetsIDSelectionFunctor::indexChi2_
private

◆ indexD0_

index_type MuonVPlusJetsIDSelectionFunctor::indexD0_
private

◆ indexECalVeto_

index_type MuonVPlusJetsIDSelectionFunctor::indexECalVeto_
private

◆ indexED0_

index_type MuonVPlusJetsIDSelectionFunctor::indexED0_
private

◆ indexHCalVeto_

index_type MuonVPlusJetsIDSelectionFunctor::indexHCalVeto_
private

◆ indexLepZ_

index_type MuonVPlusJetsIDSelectionFunctor::indexLepZ_
private

Definition at line 622 of file MuonVPlusJetsIDSelectionFunctor.h.

Referenced by fall10Cuts(), initialize(), and kitQCDCuts().

◆ indexNHits_

index_type MuonVPlusJetsIDSelectionFunctor::indexNHits_
private

◆ indexNValMuHits_

index_type MuonVPlusJetsIDSelectionFunctor::indexNValMuHits_
private

◆ indexPixHits_

index_type MuonVPlusJetsIDSelectionFunctor::indexPixHits_
private

Definition at line 623 of file MuonVPlusJetsIDSelectionFunctor.h.

Referenced by fall10Cuts(), initialize(), and kitQCDCuts().

◆ indexRelIso_

index_type MuonVPlusJetsIDSelectionFunctor::indexRelIso_
private

◆ indexSD0_

index_type MuonVPlusJetsIDSelectionFunctor::indexSD0_
private

◆ indexStations_

index_type MuonVPlusJetsIDSelectionFunctor::indexStations_
private

Definition at line 624 of file MuonVPlusJetsIDSelectionFunctor.h.

Referenced by fall10Cuts(), initialize(), and kitQCDCuts().

◆ pvSrc_

edm::InputTag MuonVPlusJetsIDSelectionFunctor::pvSrc_
private

◆ pvSrcToken_

edm::EDGetTokenT<std::vector<reco::Vertex> > MuonVPlusJetsIDSelectionFunctor::pvSrcToken_
private

Definition at line 610 of file MuonVPlusJetsIDSelectionFunctor.h.

Referenced by MuonVPlusJetsIDSelectionFunctor().

◆ recalcDBFromBSp_

bool MuonVPlusJetsIDSelectionFunctor::recalcDBFromBSp_
private

◆ verbose_

bool MuonVPlusJetsIDSelectionFunctor::verbose_

◆ version_

Version_t MuonVPlusJetsIDSelectionFunctor::version_
private

Definition at line 602 of file MuonVPlusJetsIDSelectionFunctor.h.

Referenced by initialize(), and operator()().