1 #ifndef PhysicsTools_PatUtils_interface_MuonVPlusJetsIDSelectionFunctor_h
2 #define PhysicsTools_PatUtils_interface_MuonVPlusJetsIDSelectionFunctor_h
40 if (versionStr ==
"SUMMER08") {
42 }
else if (versionStr ==
"FIRSTDATA") {
44 }
else if (versionStr ==
"SPRING10") {
46 }
else if (versionStr ==
"FALL10") {
49 std::cout <<
"\nMUON SELECTION - you are using FALL10 Selection" << std::endl;
50 }
else if (versionStr ==
"KITQCD") {
53 std::cout <<
"\nMUON SELECTION - you are using KITQCD Selection" << std::endl;
56 <<
"Expect version to be one of SUMMER08, FIRSTDATA, SPRING10, FALL10" << std::endl;
72 if (parameters.
exists(
"cutsToIgnore"))
87 int nValidMuonHits = 0,
88 double ecalveto = 4.0,
89 double hcalveto = 6.0,
118 int nValidMuonHits = 0,
119 double ecalveto = 4.0,
120 double hcalveto = 6.0,
121 double reliso = 0.05,
122 double maxLepZ = 1.0,
124 int minNMatches = 1) {
138 push_back(
"nMatchedStations", minNMatches);
151 set(
"nMatchedStations");
169 set(
"ECalVeto",
false);
170 set(
"HCalVeto",
false);
174 set(
"ECalVeto",
false);
175 set(
"HCalVeto",
false);
177 set(
"nPixelHits",
false);
178 set(
"nMatchedStations",
false);
182 set(
"NValMuHits",
false);
184 set(
"nPixelHits",
false);
185 set(
"nMatchedStations",
false);
188 set(
"NValMuHits",
false);
190 set(
"nPixelHits",
false);
191 set(
"nMatchedStations",
false);
207 std::cout <<
"Calling KIT selection method" << std::endl;
217 throw cms::Exception(
"LogicError") <<
"MuonVPlusJetsSelectionFunctor SPRING10 and FALL10 versions needs the "
218 "event! Call operator()(muon,event,ret)"
237 double corr_d0 = muon.
dB();
243 double hcalIso = muon.
hcalIso();
244 double ecalIso = muon.
ecalIso();
246 double pt = muon.
pt();
248 double relIso = (ecalIso + hcalIso + trkIso) / pt;
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;
281 double hcalIso = muon.
hcalIso();
282 double ecalIso = muon.
ecalIso();
284 double pt = muon.
pt();
286 double relIso = (ecalIso + hcalIso + trkIso) / pt;
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;
327 if (beamSpotHandle.
isValid()) {
328 beamSpot = *beamSpotHandle;
331 <<
"No beam spot available from EventSetup, not adding high level selection \n";
337 if (innerTrack.isNonnull() && innerTrack.isAvailable()) {
338 corr_d0 = -1.0 * innerTrack->dxy(beamPoint);
342 corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
351 int nValidMuonHits =
static_cast<int>(muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
356 double hcalIso = muon.
hcalIso();
357 double ecalIso = muon.
ecalIso();
359 double pt = muon.
pt();
361 double relIso = (ecalIso + hcalIso + trkIso) / pt;
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;
398 event.getByLabel(
pvSrc_, pvtxHandle_);
401 if (!pvtxHandle_->empty()) {
402 zvtx = pvtxHandle_->at(0).z();
405 <<
" There needs to be at least one primary vertex in the event." << std::endl;
416 if (beamSpotHandle.
isValid()) {
417 beamSpot = *beamSpotHandle;
420 <<
"No beam spot available from EventSetup, not adding high level selection \n";
426 if (innerTrack.isNonnull() && innerTrack.isAvailable()) {
427 corr_d0 = -1.0 * innerTrack->dxy(beamPoint);
431 corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
440 int nValidMuonHits =
static_cast<int>(muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
445 double hcalIso = muon.
hcalIso();
446 double ecalIso = muon.
ecalIso();
448 double pt = muon.
pt();
450 double relIso = (ecalIso + hcalIso + trkIso) / pt;
452 double z_mu = muon.
vertex().z();
454 int nPixelHits = muon.
innerTrack()->hitPattern().pixelLayersWithMeasurement();
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;
502 event.getByLabel(
pvSrc_, pvtxHandle_);
505 if (!pvtxHandle_->empty()) {
506 zvtx = pvtxHandle_->at(0).z();
509 <<
" There needs to be at least one primary vertex in the event." << std::endl;
520 if (beamSpotHandle.
isValid()) {
521 beamSpot = *beamSpotHandle;
524 <<
"No beam spot available from EventSetup, not adding high level selection \n";
530 if (innerTrack.isNonnull() && innerTrack.isAvailable()) {
531 corr_d0 = -1.0 * innerTrack->dxy(beamPoint);
535 corr_sd0 = (corr_ed0 > 0.000000001) ? corr_d0 / corr_ed0 : 999.0;
544 int nValidMuonHits =
static_cast<int>(muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
549 double hcalIso = muon.
hcalIso();
550 double ecalIso = muon.
ecalIso();
552 double pt = muon.
pt();
554 double relIso = (ecalIso + hcalIso + trkIso) / pt;
556 double z_mu = muon.
vertex().z();
558 int nPixelHits = muon.
innerTrack()->hitPattern().pixelLayersWithMeasurement();
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
void set(std::string const &s, bool val=true)
Set a given selection cut, on or off.
double z0() const
z coordinate
tuple ret
prodAgent to be discontinued
bool fall10Cuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
edm::EDGetTokenT< std::vector< reco::Vertex > > pvSrcToken_
bool firstDataCuts(const pat::Muon &muon, pat::strbitset &ret)
double pt() const final
transverse momentum
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 operator()(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret) override
This provides an alternative signature that includes extra information.
MuonVPlusJetsIDSelectionFunctor(edm::ParameterSet const ¶meters, edm::ConsumesCollector &iC)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
float hadVetoEt
hcal sum-et in the veto region in r-phi
double dB(IPTYPE type) const
pat::strbitset::index_type index_type
void setIgnored(pat::strbitset &ret)
set ignored bits
const Point & vertex() const override
vertex position (overwritten by PF...)
pat::strbitset retInternal_
internal ret if users don't care about return bits
Log< level::Error, false > LogError
bool summer08Cuts(const pat::Muon &muon, pat::strbitset &ret)
MuonVPlusJetsIDSelectionFunctor()
pat::strbitset bits_
the bitset indexed by strings
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
index_type indexStations_
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
double BeamWidthX() const
beam width X
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
index_type indexECalVeto_
math::XYZPoint Point
point in the space
Functor that operates on <T>
double edB(IPTYPE type) const
index_type indexNValMuHits_
edm::EDGetTokenT< reco::BeamSpot > beamLineSrcToken_
index_type indexHCalVeto_
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 spring10Cuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
static constexpr float d0
bool operator()(const pat::Muon &muon, pat::strbitset &ret) override
This provides the interface for base classes to select objects.
float emVetoEt
ecal sum-et in the veto region in r-phi
strbitset & set(bool val=true)
set method of all bits
T getParameter(std::string const &) const
double BeamWidthY() const
beam width Y
reco::TrackRef globalTrack() const override
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
reco::TrackRef innerTrack() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
MuonVPlusJetsIDSelectionFunctor(edm::ParameterSet const ¶meters)
double y0() const
y coordinate
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
unsigned int numberOfValidHits() const
numberOfValidHits returns the number of valid hits on the global track.
bool kitQCDCuts(const pat::Muon &muon, edm::EventBase const &event, pat::strbitset &ret)
double normChi2() const
Norm chi2 gives the normalized chi2 of the global track.
Analysis-level muon class.
edm::InputTag beamLineSrc_
const MuonIsolation & isolationR03() const
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
double x0() const
x coordinate