1 #ifndef PhysicsTools_PatUtils_interface_MuonVPlusJetsIDSelectionFunctor_h 2 #define PhysicsTools_PatUtils_interface_MuonVPlusJetsIDSelectionFunctor_h 44 if ( versionStr ==
"SUMMER08" ) {
47 else if ( versionStr ==
"FIRSTDATA" ) {
50 else if ( versionStr ==
"SPRING10" ) {
53 else if ( versionStr ==
"FALL10" ) {
55 if (verbose_)
std::cout <<
"\nMUON SELECTION - you are using FALL10 Selection" << std::endl;
57 else if (versionStr ==
"KITQCD") {
59 if (verbose_)
std::cout <<
"\nMUON SELECTION - you are using KITQCD Selection" << std::endl;
62 throw cms::Exception(
"InvalidInput") <<
"Expect version to be one of SUMMER08, FIRSTDATA, SPRING10, FALL10" << std::endl;
79 if ( parameters.
exists(
"cutsToIgnore") )
95 int nValidMuonHits = 0,
96 double ecalveto = 4.0,
97 double hcalveto = 6.0,
103 initialize( version,
chi2,
d0, ed0, sd0,
nhits, nValidMuonHits, ecalveto, hcalveto, reliso,
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 )
133 push_back(
"NValMuHits", nValidMuonHits );
139 push_back(
"nMatchedStations", minNMatches);
152 set(
"nMatchedStations");
170 set(
"ECalVeto",
false);
171 set(
"HCalVeto",
false);
175 set(
"ECalVeto",
false);
176 set(
"HCalVeto",
false);
178 set(
"nPixelHits",
false);
179 set(
"nMatchedStations",
false);
183 set(
"NValMuHits",
false);
185 set(
"nPixelHits",
false);
186 set(
"nMatchedStations",
false);
189 set(
"NValMuHits",
false);
191 set(
"nPixelHits",
false);
192 set(
"nMatchedStations",
false);
207 if (verbose_)
std::cout <<
"Calling KIT selection method" << std::endl;
220 <<
"MuonVPlusJetsSelectionFunctor SPRING10 and FALL10 versions needs the event! Call operator()(muon,event,ret)" 240 double corr_d0 = muon.
dB();
246 double hcalIso = muon.
hcalIso();
247 double ecalIso = muon.
ecalIso();
249 double pt = muon.
pt() ;
251 double relIso = (ecalIso + hcalIso + trkIso) / pt;
274 double corr_d0 = muon.
dB();
275 double corr_ed0 = muon.
edB();
276 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
282 double hcalIso = muon.
hcalIso();
283 double ecalIso = muon.
ecalIso();
285 double pt = muon.
pt() ;
287 double relIso = (ecalIso + hcalIso + trkIso) / pt;
310 double corr_d0 = muon.
dB();
311 double corr_ed0 = muon.
edB();
312 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
323 if( beamSpotHandle.
isValid() ){
324 beamSpot = *beamSpotHandle;
327 <<
"No beam spot available from EventSetup, not adding high level selection \n";
333 if ( innerTrack.isNonnull() && innerTrack.isAvailable() ) {
334 corr_d0 = -1.0 * innerTrack->dxy( beamPoint );
335 corr_ed0 =
sqrt( innerTrack->d0Error() * innerTrack->d0Error()
338 corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
347 int nValidMuonHits =
static_cast<int> (muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
352 double hcalIso = muon.
hcalIso();
353 double ecalIso = muon.
ecalIso();
355 double pt = muon.
pt() ;
357 double relIso = (ecalIso + hcalIso + trkIso) / pt;
384 double corr_d0 = muon.
dB();
385 double corr_ed0 = muon.
edB();
386 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
390 event.getByLabel(
pvSrc_, pvtxHandle_ );
393 if ( !pvtxHandle_->empty() ) {
394 zvtx = pvtxHandle_->at(0).z();
396 throw cms::Exception(
"InvalidInput") <<
" There needs to be at least one primary vertex in the event." << std::endl;
408 if( beamSpotHandle.
isValid() ){
409 beamSpot = *beamSpotHandle;
412 <<
"No beam spot available from EventSetup, not adding high level selection \n";
418 if ( innerTrack.isNonnull() && innerTrack.isAvailable() ) {
419 corr_d0 = -1.0 * innerTrack->dxy( beamPoint );
420 corr_ed0 =
sqrt( innerTrack->d0Error() * innerTrack->d0Error()
423 corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
432 int nValidMuonHits =
static_cast<int> (muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
437 double hcalIso = muon.
hcalIso();
438 double ecalIso = muon.
ecalIso();
440 double pt = muon.
pt() ;
442 double relIso = (ecalIso + hcalIso + trkIso) / pt;
445 double z_mu = muon.
vertex().z();
447 int nPixelHits = muon.
innerTrack()->hitPattern().pixelLayersWithMeasurement();
480 double corr_d0 = muon.
dB();
481 double corr_ed0 = muon.
edB();
482 double corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
486 event.getByLabel(
pvSrc_, pvtxHandle_ );
489 if ( !pvtxHandle_->empty() ) {
490 zvtx = pvtxHandle_->at(0).z();
492 throw cms::Exception(
"InvalidInput") <<
" There needs to be at least one primary vertex in the event." << std::endl;
504 if( beamSpotHandle.
isValid() ){
505 beamSpot = *beamSpotHandle;
508 <<
"No beam spot available from EventSetup, not adding high level selection \n";
514 if ( innerTrack.isNonnull() && innerTrack.isAvailable() ) {
515 corr_d0 = -1.0 * innerTrack->dxy( beamPoint );
516 corr_ed0 =
sqrt( innerTrack->d0Error() * innerTrack->d0Error()
519 corr_sd0 = ( corr_ed0 > 0.000000001 ) ? corr_d0 / corr_ed0 : 999.0;
528 int nValidMuonHits =
static_cast<int> (muon.
globalTrack()->hitPattern().numberOfValidMuonHits());
533 double hcalIso = muon.
hcalIso();
534 double ecalIso = muon.
ecalIso();
536 double pt = muon.
pt() ;
538 double relIso = (ecalIso + hcalIso + trkIso) / pt;
541 double z_mu = muon.
vertex().z();
543 int nPixelHits = muon.
innerTrack()->hitPattern().pixelLayersWithMeasurement();
568 if ( ((relIso > 0.2) && (relIso < 0.75))
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
double z0() const
z coordinate
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)
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
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
double pt() const final
transverse momentum
pat::strbitset::index_type index_type
void setIgnored(pat::strbitset &ret)
set ignored bits
pat::strbitset retInternal_
internal ret if users don't care about return bits
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.
reco::TrackRef innerTrack() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
index_type indexStations_
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
const Point & vertex() const override
vertex position (overwritten by PF...)
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)
bool operator()(const pat::Muon &muon, pat::strbitset &ret) override
float emVetoEt
ecal sum-et in the veto region in r-phi
reco::TrackRef globalTrack() const override
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
strbitset & set(bool val=true)
set method of all bits
double BeamWidthY() const
beam width Y
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
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