CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DataFormats/MuonReco/interface/MuonSelectors.h

Go to the documentation of this file.
00001 #ifndef MuonReco_MuonSelectors_h
00002 #define MuonReco_MuonSelectors_h
00003 //
00004 // Package:    MuonReco
00005 // 
00006 //
00007 // Original Author:  Jake Ribnik, Dmytro Kovalskyi
00008 // $Id: MuonSelectors.h,v 1.17 2012/08/21 21:28:00 mskim Exp $
00009 
00010 #include "DataFormats/MuonReco/interface/Muon.h"
00011 #include "TMath.h"
00012 #include <string>
00013 
00014 namespace reco{class Vertex;}
00015 
00016 namespace muon {
00018    enum SelectionType {
00019       All = 0,                      // dummy options - always true
00020       AllGlobalMuons = 1,           // checks isGlobalMuon flag
00021       AllStandAloneMuons = 2,       // checks isStandAloneMuon flag
00022       AllTrackerMuons = 3,          // checks isTrackerMuon flag
00023       TrackerMuonArbitrated = 4,    // resolve ambiguity of sharing segments
00024       AllArbitrated = 5,            // all muons with the tracker muon arbitrated
00025       GlobalMuonPromptTight = 6,    // global muons with tighter fit requirements
00026       TMLastStationLoose = 7,       // penetration depth loose selector
00027       TMLastStationTight = 8,       // penetration depth tight selector
00028       TM2DCompatibilityLoose = 9,   // likelihood based loose selector
00029       TM2DCompatibilityTight = 10,  // likelihood based tight selector
00030       TMOneStationLoose = 11,       // require one well matched segment
00031       TMOneStationTight = 12,       // require one well matched segment
00032       TMLastStationOptimizedLowPtLoose = 13, // combination of TMLastStation and TMOneStation
00033       TMLastStationOptimizedLowPtTight = 14, // combination of TMLastStation and TMOneStation
00034       GMTkChiCompatibility = 15,    // require tk stub have good chi2 relative to glb track
00035       GMStaChiCompatibility = 16,   // require sta stub have good chi2 compatibility relative to glb track
00036       GMTkKinkTight = 17,           // require a small kink value in the tracker stub
00037       TMLastStationAngLoose = 18,   // TMLastStationLoose with additional angular cuts
00038       TMLastStationAngTight = 19,   // TMLastStationTight with additional angular cuts
00039       TMOneStationAngLoose = 20,    // TMOneStationLoose with additional angular cuts
00040       TMOneStationAngTight = 21,    // TMOneStationTight with additional angular cuts
00041       // The two algorithms that follow are identical to what were known as
00042       // TMLastStationOptimizedLowPt* (sans the Barrel) as late as revision
00043       // 1.7 of this file. The names were changed because indeed the low pt
00044       // optimization applies only to the barrel region, whereas the sel-
00045       // ectors above are more efficient at low pt in the endcaps, which is
00046       // what we feel is more suggestive of the algorithm name. This will be
00047       // less confusing for future generations of CMS members, I hope...
00048       TMLastStationOptimizedBarrelLowPtLoose = 22, // combination of TMLastStation and TMOneStation but with low pT optimization in barrel only
00049       TMLastStationOptimizedBarrelLowPtTight = 23, // combination of TMLastStation and TMOneStation but with low pT optimization in barrel only
00050       RPCMuLoose = 24                              // checks isRPCMuon flag (require two well matched hits in different RPC layers)
00051    };
00052 
00054    struct SelectionTypeStringToEnum { const char *label; SelectionType value; };
00055    SelectionType selectionTypeFromString( const std::string &label );
00056      
00058    bool isGoodMuon( const reco::Muon& muon, SelectionType type, 
00059                     reco::Muon::ArbitrationType arbitrationType = reco::Muon::SegmentAndTrackArbitration);
00060 
00061    // ===========================================================================
00062    //                               Support functions
00063    // 
00064    enum AlgorithmType { TMLastStation, TM2DCompatibility, TMOneStation, RPCMu };
00065    
00066    // specialized GoodMuon functions called from main wrapper
00067    bool isGoodMuon( const reco::Muon& muon, 
00068                     AlgorithmType type,
00069                     double minCompatibility,
00070                     reco::Muon::ArbitrationType arbitrationType );
00071    
00072    bool isGoodMuon( const reco::Muon& muon, 
00073                     AlgorithmType type,
00074                     int minNumberOfMatches,
00075                     double maxAbsDx,
00076                     double maxAbsPullX,
00077                     double maxAbsDy,
00078                     double maxAbsPullY,
00079                     double maxChamberDist,
00080                     double maxChamberDistPull,
00081                     reco::Muon::ArbitrationType arbitrationType,
00082                     bool   syncMinNMatchesNRequiredStationsInBarrelOnly = true,//this is what we had originally
00083                     bool   applyAlsoAngularCuts = false);
00084 
00085    bool isTightMuon(const reco::Muon&, const reco::Vertex&);
00086    bool isLooseMuon(const reco::Muon&);
00087    bool isSoftMuon(const reco::Muon&, const reco::Vertex&);
00088    bool isHighPtMuon(const reco::Muon&, const reco::Vertex&);
00089    
00090    // determine if station was crossed well withing active volume
00091    unsigned int RequiredStationMask( const reco::Muon& muon,
00092                                      double maxChamberDist,
00093                                      double maxChamberDistPull,
00094                                      reco::Muon::ArbitrationType arbitrationType );
00095 
00096    // ------------ method to return the calo compatibility for a track with matched muon info  ------------
00097    float caloCompatibility(const reco::Muon& muon);
00098 
00099    // ------------ method to calculate the segment compatibility for a track with matched muon info  ------------
00100    float segmentCompatibility(const reco::Muon& muon,reco::Muon::ArbitrationType arbitrationType = reco::Muon::SegmentAndTrackArbitration);
00101    
00102    // Check if two muon trajectory overlap
00103    // The overlap is performed by comparing distance between two muon
00104    // trajectories if they cross the same muon chamber. Trajectories 
00105    // overlap if distance/uncertainty is smaller than allowed pullX 
00106    // and pullY
00107    bool overlap( const reco::Muon& muon1, const reco::Muon& muon2, 
00108                  double pullX = 1.0, double pullY = 1.0, bool checkAdjacentChambers = false);
00109 
00112    int sharedSegments( const reco::Muon& muon1, const reco::Muon& muon2, 
00113                        unsigned int segmentArbitrationMask = reco::MuonSegmentMatch::BestInChamberByDR ) ;
00114 
00115 }
00116 #endif