Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-03-26 02:43:36

0001 #include "DataFormats/MuonReco/interface/Muon.h"
0002 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0003 #include "DataFormats/TrackReco/interface/Track.h"
0004 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0005 #include "DataFormats/GeometrySurface/interface/Cylinder.h"
0006 #include "DataFormats/GeometrySurface/interface/Plane.h"
0007 #include "DataFormats/MuonReco/interface/MuonEnergy.h"
0008 #include "DataFormats/MuonReco/interface/MuonTime.h"
0009 #include "CondFormats/AlignmentRecord/interface/TrackerSurfaceDeformationRcd.h"
0010 #include <DataFormats/PatCandidates/interface/Muon.h>
0011 
0012 //vertex
0013 // EDM formats
0014 #include "DataFormats/VertexReco/interface/Vertex.h"
0015 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0016 //local  data formats
0017 #include "L1Trigger/L1TNtuples/interface/L1AnalysisRecoVertexDataFormat.h"
0018 
0019 inline bool isLooseMuonCustom(const reco::Muon& recoMu) {
0020   bool flag = false;
0021   if (recoMu.isPFMuon() && (recoMu.isGlobalMuon() || recoMu.isTrackerMuon()))
0022     flag = true;
0023 
0024   return flag;
0025 }
0026 
0027 inline bool isMediumMuonCustom(const reco::Muon& recoMu) {
0028   bool goodGlob = recoMu.isGlobalMuon() && recoMu.globalTrack()->normalizedChi2() < 3 &&
0029                   recoMu.combinedQuality().chi2LocalPosition < 12 && recoMu.combinedQuality().trkKink < 20;
0030   bool isMedium = isLooseMuonCustom(recoMu) && recoMu.innerTrack()->validFraction() > 0.49 &&
0031                   muon::segmentCompatibility(recoMu) > (goodGlob ? 0.303 : 0.451);
0032 
0033   return isMedium;
0034 }
0035 
0036 inline bool isTightMuonCustom(const reco::Muon& recoMu, const reco::Vertex recoVtx) {
0037   //bp
0038   bool isTight = recoMu.isGlobalMuon() && recoMu.isPFMuon() && recoMu.globalTrack()->normalizedChi2() < 10. &&
0039                  recoMu.globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
0040                  recoMu.numberOfMatchedStations() > 1 &&
0041                  std::abs(recoMu.muonBestTrack()->dxy(recoVtx.position())) < 0.2 &&
0042                  std::abs(recoMu.muonBestTrack()->dz(recoVtx.position())) < 0.5 &&
0043                  recoMu.innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
0044                  recoMu.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
0045                  recoMu.globalTrack()->normalizedChi2() < 1;
0046 
0047   return isTight;
0048 }