CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Enumerations | Functions
muon Namespace Reference

Classes

struct  SelectionTypeStringToEnum
 a lightweight "map" for selection type string label and enum value More...
 

Enumerations

enum  AlgorithmType { TMLastStation, TM2DCompatibility, TMOneStation }
 
enum  SelectionType {
  All = 0, AllGlobalMuons = 1, AllStandAloneMuons = 2, AllTrackerMuons = 3,
  TrackerMuonArbitrated = 4, AllArbitrated = 5, GlobalMuonPromptTight = 6, TMLastStationLoose = 7,
  TMLastStationTight = 8, TM2DCompatibilityLoose = 9, TM2DCompatibilityTight = 10, TMOneStationLoose = 11,
  TMOneStationTight = 12, TMLastStationOptimizedLowPtLoose = 13, TMLastStationOptimizedLowPtTight = 14, GMTkChiCompatibility = 15,
  GMStaChiCompatibility = 16, GMTkKinkTight = 17, TMLastStationAngLoose = 18, TMLastStationAngTight = 19,
  TMOneStationAngLoose = 20, TMOneStationAngTight = 21, TMLastStationOptimizedBarrelLowPtLoose = 22, TMLastStationOptimizedBarrelLowPtTight = 23
}
 Selector type. More...
 

Functions

float caloCompatibility (const reco::Muon &muon)
 
bool cocktailInputIsOK (const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack)
 
bool cocktailInputIsOK (const reco::Muon &muon)
 
reco::TrackRef getTevRefitTrack (const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
 
bool isGoodMuon (const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
 main GoodMuon wrapper call More...
 
bool isGoodMuon (const reco::Muon &muon, AlgorithmType type, double minCompatibility, reco::Muon::ArbitrationType arbitrationType)
 
bool isGoodMuon (const reco::Muon &muon, AlgorithmType type, int minNumberOfMatches, double maxAbsDx, double maxAbsPullX, double maxAbsDy, double maxAbsPullY, double maxChamberDist, double maxChamberDistPull, reco::Muon::ArbitrationType arbitrationType, bool syncMinNMatchesNRequiredStationsInBarrelOnly=true, bool applyAlsoAngularCuts=false)
 
bool isHighPtMuon (const reco::Muon &, const reco::Vertex &, reco::TunePType)
 
bool isLooseMuon (const reco::Muon &)
 
bool isSoftMuon (const reco::Muon &, const reco::Vertex &)
 
bool isTightMuon (const reco::Muon &, const reco::Vertex &)
 
reco::Muon::MuonTrackTypePair muonBestTrack (const reco::Muon &muon, reco::TunePType tunePType)
 
bool overlap (const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
 
unsigned int RequiredStationMask (const reco::Muon &muon, double maxChamberDist, double maxChamberDistPull, reco::Muon::ArbitrationType arbitrationType)
 
float segmentCompatibility (const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
 
SelectionType selectionTypeFromString (const std::string &label)
 
int sharedSegments (const reco::Muon &muon1, const reco::Muon &muon2, unsigned int segmentArbitrationMask=reco::MuonSegmentMatch::BestInChamberByDR)
 
reco::Muon::MuonTrackTypePair sigmaSwitch (const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const double nSigma=2., const double ptThreshold=200.)
 
reco::Muon::MuonTrackTypePair sigmaSwitch (const reco::Muon &muon, const double nSigma=2., const double ptThreshold=200.)
 
reco::Muon::MuonTrackTypePair tevOptimized (const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
 
reco::Muon::MuonTrackTypePair tevOptimized (const reco::Muon &muon, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
 
reco::Muon::MuonTrackTypePair tevOptimized (const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackToTrackMap &tevMap1, const reco::TrackToTrackMap &tevMap2, const reco::TrackToTrackMap &tevMap3, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
 
reco::Muon::MuonTrackTypePair tevOptimized (const reco::Muon &muon, const reco::TrackToTrackMap &tevMap1, const reco::TrackToTrackMap &tevMap2, const reco::TrackToTrackMap &tevMap3)
 
reco::Muon::MuonTrackTypePair TMR (const reco::TrackRef &trackerTrack, const reco::TrackRef &fmsTrack, const double tune=4.)
 
double trackProbability (const reco::TrackRef track)
 

Enumeration Type Documentation

Enumerator
TMLastStation 
TM2DCompatibility 
TMOneStation 

Definition at line 64 of file MuonSelectors.h.

Selector type.

Enumerator
All 
AllGlobalMuons 
AllStandAloneMuons 
AllTrackerMuons 
TrackerMuonArbitrated 
AllArbitrated 
GlobalMuonPromptTight 
TMLastStationLoose 
TMLastStationTight 
TM2DCompatibilityLoose 
TM2DCompatibilityTight 
TMOneStationLoose 
TMOneStationTight 
TMLastStationOptimizedLowPtLoose 
TMLastStationOptimizedLowPtTight 
GMTkChiCompatibility 
GMStaChiCompatibility 
GMTkKinkTight 
TMLastStationAngLoose 
TMLastStationAngTight 
TMOneStationAngLoose 
TMOneStationAngTight 
TMLastStationOptimizedBarrelLowPtLoose 
TMLastStationOptimizedBarrelLowPtTight 

Definition at line 19 of file MuonSelectors.h.

19  {
20  All = 0, // dummy options - always true
21  AllGlobalMuons = 1, // checks isGlobalMuon flag
22  AllStandAloneMuons = 2, // checks isStandAloneMuon flag
23  AllTrackerMuons = 3, // checks isTrackerMuon flag
24  TrackerMuonArbitrated = 4, // resolve ambiguity of sharing segments
25  AllArbitrated = 5, // all muons with the tracker muon arbitrated
26  GlobalMuonPromptTight = 6, // global muons with tighter fit requirements
27  TMLastStationLoose = 7, // penetration depth loose selector
28  TMLastStationTight = 8, // penetration depth tight selector
29  TM2DCompatibilityLoose = 9, // likelihood based loose selector
30  TM2DCompatibilityTight = 10, // likelihood based tight selector
31  TMOneStationLoose = 11, // require one well matched segment
32  TMOneStationTight = 12, // require one well matched segment
33  TMLastStationOptimizedLowPtLoose = 13, // combination of TMLastStation and TMOneStation
34  TMLastStationOptimizedLowPtTight = 14, // combination of TMLastStation and TMOneStation
35  GMTkChiCompatibility = 15, // require tk stub have good chi2 relative to glb track
36  GMStaChiCompatibility = 16, // require sta stub have good chi2 compatibility relative to glb track
37  GMTkKinkTight = 17, // require a small kink value in the tracker stub
38  TMLastStationAngLoose = 18, // TMLastStationLoose with additional angular cuts
39  TMLastStationAngTight = 19, // TMLastStationTight with additional angular cuts
40  TMOneStationAngLoose = 20, // TMOneStationLoose with additional angular cuts
41  TMOneStationAngTight = 21, // TMOneStationTight with additional angular cuts
42  // The two algorithms that follow are identical to what were known as
43  // TMLastStationOptimizedLowPt* (sans the Barrel) as late as revision
44  // 1.7 of this file. The names were changed because indeed the low pt
45  // optimization applies only to the barrel region, whereas the sel-
46  // ectors above are more efficient at low pt in the endcaps, which is
47  // what we feel is more suggestive of the algorithm name. This will be
48  // less confusing for future generations of CMS members, I hope...
49  TMLastStationOptimizedBarrelLowPtLoose = 22, // combination of TMLastStation and TMOneStation but with low pT optimization in barrel only
50  TMLastStationOptimizedBarrelLowPtTight = 23 // combination of TMLastStation and TMOneStation but with low pT optimization in barrel only
51  };

Function Documentation

float muon::caloCompatibility ( const reco::Muon muon)

Definition at line 69 of file MuonSelectors.cc.

References reco::Muon::caloCompatibility().

Referenced by CSCEfficiency::filter(), isGoodMuon(), and pat::MuonSelector::muIdSelection_().

69  {
70  return muon.caloCompatibility();
71 }
float caloCompatibility() const
Definition: Muon.h:151
bool muon::cocktailInputIsOK ( const reco::TrackRef combinedTrack,
const reco::TrackRef trackerTrack,
const reco::TrackRef tpfmsTrack,
const reco::TrackRef pickyTrack 
)
inline

Definition at line 111 of file MuonCocktails.h.

References edm::Ref< C, T, F >::isNonnull().

Referenced by cocktailInputIsOK(), and muonBestTrack().

114  {
115 
116  return combinedTrack.isNonnull() && trackerTrack.isNonnull() && tpfmsTrack.isNonnull() && pickyTrack.isNonnull();
117  }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
bool muon::cocktailInputIsOK ( const reco::Muon muon)
inline

Definition at line 119 of file MuonCocktails.h.

References cocktailInputIsOK(), reco::Muon::globalTrack(), reco::Muon::innerTrack(), reco::Muon::pickyTrack(), and reco::Muon::tpfmsTrack().

119  {
120  return cocktailInputIsOK(muon.globalTrack(),
121  muon.innerTrack(),
122  muon.tpfmsTrack(),
123  muon.pickyTrack());
124  }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool cocktailInputIsOK(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack)
virtual TrackRef tpfmsTrack() const
Definition: Muon.h:58
virtual TrackRef pickyTrack() const
Definition: Muon.h:59
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55
reco::TrackRef muon::getTevRefitTrack ( const reco::TrackRef combinedTrack,
const reco::TrackToTrackMap map 
)

Definition at line 109 of file MuonCocktails.cc.

References edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), and edm::helpers::KeyVal< K, V >::val.

Referenced by MuonIdProducer::makeMuon(), and tevOptimized().

110  {
111  reco::TrackToTrackMap::const_iterator it = map.find(combinedTrack);
112  return it == map.end() ? reco::TrackRef() : it->val;
113 }
const_iterator end() const
last iterator over the map (read only)
const_iterator find(const key_type &k) const
find element with specified reference key
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:14
bool muon::isGoodMuon ( const reco::Muon muon,
SelectionType  type,
reco::Muon::ArbitrationType  arbitrationType = reco::Muon::SegmentAndTrackArbitration 
)

main GoodMuon wrapper call

Definition at line 534 of file MuonSelectors.cc.

References All, AllArbitrated, AllGlobalMuons, AllStandAloneMuons, AllTrackerMuons, reco::Muon::combinedQuality(), reco::LeafCandidate::eta(), GlobalMuonPromptTight, reco::Muon::globalTrack(), GMStaChiCompatibility, GMTkChiCompatibility, GMTkKinkTight, reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), reco::Muon::isQualityValid(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), reco::Muon::numberOfMatches(), reco::Muon::outerTrack(), reco::LeafCandidate::pt(), reco::MuonQuality::staRelChi2, TM2DCompatibility, TM2DCompatibilityLoose, TM2DCompatibilityTight, TMLastStation, TMLastStationAngLoose, TMLastStationAngTight, TMLastStationLoose, TMLastStationOptimizedBarrelLowPtLoose, TMLastStationOptimizedBarrelLowPtTight, TMLastStationOptimizedLowPtLoose, TMLastStationOptimizedLowPtTight, TMLastStationTight, TMOneStation, TMOneStationAngLoose, TMOneStationAngTight, TMOneStationLoose, TMOneStationTight, TrackerMuonArbitrated, reco::MuonQuality::trkKink, and reco::MuonQuality::trkRelChi2.

Referenced by BPhysicsOniaDQM::analyze(), TrackEfficiencyMonitor::analyze(), HiggsDQM::analyze(), MuonIdVal::analyze(), MuonCosmicCompatibilityFiller::checkMuonID(), PFRecoTauDiscriminationAgainstMuon::discriminate(), WMuNuValidator::filter(), WMuNuSelector::filter(), HLTDiMuonGlbTrkFilter::hltFilter(), PFMuonAlgo::isGlobalLooseMuon(), PFMuonAlgo::isGlobalTightMuon(), SoftPFMuonTagInfoProducer::isSoftMuon(), isSoftMuon(), isTightMuon(), PFMuonAlgo::isTightMuonPOG(), PFMuonAlgo::isTrackerLooseMuon(), PFMuonAlgo::isTrackerTightMuon(), JetPlusTrackCorrector::matchMuons(), pat::MuonSelector::muIdSelection_(), pat::Muon::muonID(), PFMuonAlgo::printMuonProperties(), MuonTrackProducer::produce(), MuonSelectionTypeValueMapProducer::produce(), MuonRefProducer::produce(), SoftLepton::produce(), and FourVectorHLTOffline::selectMuons().

536 {
537  switch (type)
538  {
539  case muon::All:
540  return true;
541  break;
543  return muon.isGlobalMuon();
544  break;
546  return muon.isTrackerMuon();
547  break;
549  return muon.isStandAloneMuon();
550  break;
552  return muon.isTrackerMuon() && muon.numberOfMatches(arbitrationType)>0;
553  break;
554  case muon::AllArbitrated:
555  return ! muon.isTrackerMuon() || muon.numberOfMatches(arbitrationType)>0;
556  break;
558  return muon.isGlobalMuon() && muon.globalTrack()->normalizedChi2()<10. && muon.globalTrack()->hitPattern().numberOfValidMuonHits() >0;
559  break;
560  // For "Loose" algorithms we choose maximum y quantity cuts of 1E9 instead of
561  // 9999 as before. We do this because the muon methods return 999999 (note
562  // there are six 9's) when the requested information is not available. For
563  // example, if a muon fails to traverse the z measuring superlayer in a station
564  // in the DT, then all methods involving segmentY in this station return
565  // 999999 to demonstrate that the information is missing. In order to not
566  // penalize muons for missing y information in Loose algorithms where we do
567  // not care at all about y information, we raise these limits. In the
568  // TMLastStation and TMOneStation algorithms we actually use this huge number
569  // to determine whether to consider y information at all.
571  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,true,false);
572  break;
574  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,true,false);
575  break;
577  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,false);
578  break;
580  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,false);
581  break;
583  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
584  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,false);
585  else
586  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,false,false);
587  break;
589  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
590  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,false);
591  else
592  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,false,false);
593  break;
594  //compatibility loose
596  return muon.isTrackerMuon() && isGoodMuon(muon,TM2DCompatibility,0.7,arbitrationType);
597  break;
598  //compatibility tight
600  return muon.isTrackerMuon() && isGoodMuon(muon,TM2DCompatibility,1.0,arbitrationType);
601  break;
603  return muon.isGlobalMuon() && muon.isQualityValid() && fabs(muon.combinedQuality().trkRelChi2 - muon.innerTrack()->normalizedChi2()) < 2.0;
604  break;
606  return muon.isGlobalMuon() && muon.isQualityValid() && fabs(muon.combinedQuality().staRelChi2 - muon.outerTrack()->normalizedChi2()) < 2.0;
607  break;
608  case muon::GMTkKinkTight:
609  return muon.isGlobalMuon() && muon.isQualityValid() && muon.combinedQuality().trkKink < 100.0;
610  break;
612  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,false,true);
613  break;
615  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,false,true);
616  break;
618  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,true);
619  break;
621  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,true);
622  break;
624  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
625  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,false);
626  else
627  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,true,false);
628  break;
630  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
631  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,false);
632  else
633  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,true,false);
634  break;
635  default:
636  return false;
637  }
638 }
type
Definition: HCALResponse.h:22
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isTrackerMuon() const
Definition: Muon.h:212
bool isGlobalMuon() const
Definition: Muon.h:211
float trkKink
value of the kink algorithm applied to the inner track stub
Definition: MuonQuality.h:11
bool isStandAloneMuon() const
Definition: Muon.h:213
float trkRelChi2
chi2 value for the inner track stub with respect to the global track
Definition: MuonQuality.h:15
virtual double eta() const
momentum pseudorapidity
MuonQuality combinedQuality() const
get energy deposition information
Definition: Muon.h:122
bool isQualityValid() const
Definition: Muon.h:120
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:52
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:56
float staRelChi2
chi2 value for the outer track stub with respect to the global track
Definition: MuonQuality.h:17
virtual double pt() const
transverse momentum
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55
bool muon::isGoodMuon ( const reco::Muon muon,
AlgorithmType  type,
double  minCompatibility,
reco::Muon::ArbitrationType  arbitrationType 
)

Definition at line 287 of file MuonSelectors.cc.

References caloCompatibility(), reco::Muon::isMatchesValid(), segmentCompatibility(), and TM2DCompatibility.

290  {
291  if (!muon.isMatchesValid()) return false;
292  bool goodMuon = false;
293 
294  switch( type ) {
295  case TM2DCompatibility:
296  // Simplistic first cut in the 2D segment- vs calo-compatibility plane. Will have to be refined!
297  if( ( (0.8*caloCompatibility( muon ))+(1.2*segmentCompatibility( muon, arbitrationType )) ) > minCompatibility ) goodMuon = true;
298  else goodMuon = false;
299  return goodMuon;
300  break;
301  default :
302  // LogTrace("MuonIdentification")<<" // Invalid Algorithm Type called!";
303  goodMuon = false;
304  return goodMuon;
305  break;
306  }
307 }
type
Definition: HCALResponse.h:22
bool isMatchesValid() const
Definition: Muon.h:139
float caloCompatibility(const reco::Muon &muon)
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
bool muon::isGoodMuon ( const reco::Muon muon,
AlgorithmType  type,
int  minNumberOfMatches,
double  maxAbsDx,
double  maxAbsPullX,
double  maxAbsDy,
double  maxAbsPullY,
double  maxChamberDist,
double  maxChamberDistPull,
reco::Muon::ArbitrationType  arbitrationType,
bool  syncMinNMatchesNRequiredStationsInBarrelOnly = true,
bool  applyAlsoAngularCuts = false 
)

Definition at line 309 of file MuonSelectors.cc.

References reco::Muon::dX(), reco::Muon::dY(), reco::LeafCandidate::eta(), reco::Muon::isMatchesValid(), reco::Muon::pullDxDz(), reco::Muon::pullDyDz(), reco::Muon::pullX(), reco::Muon::pullY(), RequiredStationMask(), relativeConstraints::station, reco::Muon::stationMask(), TMLastStation, and TMOneStation.

321 {
322  if (!muon.isMatchesValid()) return false;
323  bool goodMuon = false;
324 
325  if (type == TMLastStation) {
326  // To satisfy my own paranoia, if the user specifies that the
327  // minimum number of matches is zero, then return true.
328  if(minNumberOfMatches == 0) return true;
329 
330  unsigned int theStationMask = muon.stationMask(arbitrationType);
331  unsigned int theRequiredStationMask = RequiredStationMask(muon, maxChamberDist, maxChamberDistPull, arbitrationType);
332 
333  // Require that there be at least a minimum number of segments
334  int numSegs = 0;
335  int numRequiredStations = 0;
336  for(int it = 0; it < 8; ++it) {
337  if(theStationMask & 1<<it) ++numSegs;
338  if(theRequiredStationMask & 1<<it) ++numRequiredStations;
339  }
340 
341  // Make sure the minimum number of matches is not greater than
342  // the number of required stations but still greater than zero
343  if (syncMinNMatchesNRequiredStationsInBarrelOnly) {
344  // Note that we only do this in the barrel region!
345  if (fabs(muon.eta()) < 1.2) {
346  if(minNumberOfMatches > numRequiredStations)
347  minNumberOfMatches = numRequiredStations;
348  if(minNumberOfMatches < 1) //SK: this only happens for negative values
349  minNumberOfMatches = 1;
350  }
351  } else {
352  if(minNumberOfMatches > numRequiredStations)
353  minNumberOfMatches = numRequiredStations;
354  if(minNumberOfMatches < 1) //SK: this only happens for negative values
355  minNumberOfMatches = 1;
356  }
357 
358  if(numSegs >= minNumberOfMatches) goodMuon = 1;
359 
360  // Require that last required station have segment
361  // If there are zero required stations keep track
362  // of the last station with a segment so that we may
363  // apply the quality cuts below to it instead
364  int lastSegBit = 0;
365  if(theRequiredStationMask) {
366  for(int stationIdx = 7; stationIdx >= 0; --stationIdx)
367  if(theRequiredStationMask & 1<<stationIdx){
368  if(theStationMask & 1<<stationIdx) {
369  lastSegBit = stationIdx;
370  goodMuon &= 1;
371  break;
372  } else {
373  goodMuon = false;
374  break;
375  }
376  }
377  } else {
378  for(int stationIdx = 7; stationIdx >= 0; --stationIdx)
379  if(theStationMask & 1<<stationIdx) {
380  lastSegBit = stationIdx;
381  break;
382  }
383  }
384 
385  if(!goodMuon) return false;
386 
387  // Impose pull cuts on last segment
388  int station = 0, detector = 0;
389  station = lastSegBit < 4 ? lastSegBit+1 : lastSegBit-3;
390  detector = lastSegBit < 4 ? 1 : 2;
391 
392  // Check x information
393  if(fabs(muon.pullX(station,detector,arbitrationType,1)) > maxAbsPullX &&
394  fabs(muon.dX(station,detector,arbitrationType)) > maxAbsDx)
395  return false;
396 
397  if(applyAlsoAngularCuts && fabs(muon.pullDxDz(station,detector,arbitrationType,1)) > maxAbsPullX)
398  return false;
399 
400  // Is this a tight algorithm, i.e. do we bother to check y information?
401  if (maxAbsDy < 999999) { // really if maxAbsDy < 1E9 as currently defined
402 
403  // Check y information
404  if (detector == 2) { // CSC
405  if(fabs(muon.pullY(station,2,arbitrationType,1)) > maxAbsPullY &&
406  fabs(muon.dY(station,2,arbitrationType)) > maxAbsDy)
407  return false;
408 
409  if(applyAlsoAngularCuts && fabs(muon.pullDyDz(station,2,arbitrationType,1)) > maxAbsPullY)
410  return false;
411  } else {
412  //
413  // In DT, if this is a "Tight" algorithm and the last segment is
414  // missing y information (always the case in station 4!!!), impose
415  // respective cuts on the next station in the stationMask that has
416  // a segment with y information. If there are no segments with y
417  // information then there is nothing to penalize. Should we
418  // penalize in Tight for having zero segments with y information?
419  // That is the fundamental question. Of course I am being uber
420  // paranoid; if this is a good muon then there will probably be at
421  // least one segment with y information but not always. Suppose
422  // somehow a muon only creates segments in station 4, then we
423  // definitely do not want to require that there be at least one
424  // segment with y information because we will lose it completely.
425  //
426 
427  for (int stationIdx = station; stationIdx > 0; --stationIdx) {
428  if(! (theStationMask & 1<<(stationIdx-1))) // don't bother if the station is not in the stationMask
429  continue;
430 
431  if(muon.dY(stationIdx,1,arbitrationType) > 999998) // no y-information
432  continue;
433 
434  if(fabs(muon.pullY(stationIdx,1,arbitrationType,1)) > maxAbsPullY &&
435  fabs(muon.dY(stationIdx,1,arbitrationType)) > maxAbsDy) {
436  return false;
437  }
438 
439  if(applyAlsoAngularCuts && fabs(muon.pullDyDz(stationIdx,1,arbitrationType,1)) > maxAbsPullY)
440  return false;
441 
442  // If we get this far then great this is a good muon
443  return true;
444  }
445  }
446  }
447 
448  return goodMuon;
449  } // TMLastStation
450 
451  // TMOneStation requires only that there be one "good" segment, regardless
452  // of the required stations. We do not penalize if there are absolutely zero
453  // segments with y information in the Tight algorithm. Maybe I'm being
454  // paranoid but so be it. If it's really a good muon then we will probably
455  // find at least one segment with both x and y information but you never
456  // know, and I don't want to deal with a potential inefficiency in the DT
457  // like we did with the original TMLastStation. Incidentally, not penalizing
458  // for total lack of y information in the Tight algorithm is what is done in
459  // the new TMLastStation
460  //
461  if (type == TMOneStation) {
462  unsigned int theStationMask = muon.stationMask(arbitrationType);
463 
464  // Of course there must be at least one segment
465  if (! theStationMask) return false;
466 
467  int station = 0, detector = 0;
468  // Keep track of whether or not there is a DT segment with y information.
469  // In the end, if it turns out there are absolutely zero DT segments with
470  // y information, require only that there was a segment with good x info.
471  // This of course only applies to the Tight algorithms.
472  bool existsGoodDTSegX = false;
473  bool existsDTSegY = false;
474 
475  // Impose cuts on the segments in the station mask until we find a good one
476  // Might as well start with the lowest bit to speed things up.
477  for(int stationIdx = 0; stationIdx <= 7; ++stationIdx)
478  if(theStationMask & 1<<stationIdx) {
479  station = stationIdx < 4 ? stationIdx+1 : stationIdx-3;
480  detector = stationIdx < 4 ? 1 : 2;
481 
482  if((fabs(muon.pullX(station,detector,arbitrationType,1)) > maxAbsPullX &&
483  fabs(muon.dX(station,detector,arbitrationType)) > maxAbsDx) ||
484  (applyAlsoAngularCuts && fabs(muon.pullDxDz(station,detector,arbitrationType,1)) > maxAbsPullX))
485  continue;
486  else if (detector == 1)
487  existsGoodDTSegX = true;
488 
489  // Is this a tight algorithm? If yes, use y information
490  if (maxAbsDy < 999999) {
491  if (detector == 2) { // CSC
492  if((fabs(muon.pullY(station,2,arbitrationType,1)) > maxAbsPullY &&
493  fabs(muon.dY(station,2,arbitrationType)) > maxAbsDy) ||
494  (applyAlsoAngularCuts && fabs(muon.pullDyDz(station,2,arbitrationType,1)) > maxAbsPullY))
495  continue;
496  } else {
497 
498  if(muon.dY(station,1,arbitrationType) > 999998) // no y-information
499  continue;
500  else
501  existsDTSegY = true;
502 
503  if((fabs(muon.pullY(station,1,arbitrationType,1)) > maxAbsPullY &&
504  fabs(muon.dY(station,1,arbitrationType)) > maxAbsDy) ||
505  (applyAlsoAngularCuts && fabs(muon.pullDyDz(station,1,arbitrationType,1)) > maxAbsPullY)) {
506  continue;
507  }
508  }
509  }
510 
511  // If we get this far then great this is a good muon
512  return true;
513  }
514 
515  // If we get this far then for sure there are no "good" CSC segments. For
516  // DT, check if there were any segments with y information. If there
517  // were none, but there was a segment with good x, then we're happy. If
518  // there WERE segments with y information, then they must have been shit
519  // since we are here so fail it. Of course, if this is a Loose algorithm
520  // then fail immediately since if we had good x we would already have
521  // returned true
522  if (maxAbsDy < 999999) {
523  if (existsDTSegY)
524  return false;
525  else if (existsGoodDTSegX)
526  return true;
527  } else
528  return false;
529  } // TMOneStation
530 
531  return goodMuon;
532 }
type
Definition: HCALResponse.h:22
bool isMatchesValid() const
Definition: Muon.h:139
float dY(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:344
virtual double eta() const
momentum pseudorapidity
float pullDxDz(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration, bool includeSegmentError=true) const
Definition: Muon.cc:391
unsigned int stationMask(ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:113
float pullY(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration, bool includeSegmentError=true) const
Definition: Muon.cc:380
unsigned int RequiredStationMask(const reco::Muon &muon, double maxChamberDist, double maxChamberDistPull, reco::Muon::ArbitrationType arbitrationType)
float dX(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:336
float pullDyDz(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration, bool includeSegmentError=true) const
Definition: Muon.cc:401
float pullX(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration, bool includeSegmentError=true) const
Definition: Muon.cc:370
bool muon::isHighPtMuon ( const reco::Muon muon,
const reco::Vertex vtx,
reco::TunePType  tunePType 
)

Definition at line 746 of file MuonSelectors.cc.

References reco::defaultTuneP, first, reco::Muon::globalTrack(), reco::improvedTuneP, reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), reco::Muon::numberOfMatchedStations(), reco::Vertex::position(), and tevOptimized().

Referenced by pat::Muon::isHighPtMuon().

746  {
747 
748  bool muID = muon.isGlobalMuon() && muon.globalTrack()->hitPattern().numberOfValidMuonHits() >0 && (muon.numberOfMatchedStations() > 1);
749  if(!muID) return false;
750 
751  if(tunePType == reco::improvedTuneP){
752  // Get the optimized track
753  reco::TrackRef cktTrack = (muon::tevOptimized(muon, 200, 17., 40., 0.25)).first;
754 
755 
756  bool momQuality = cktTrack->ptError()/cktTrack->pt() < 0.3;
757 
758 
759  bool hits = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 && muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
760 
761 
762 
763  bool ip = fabs(cktTrack->dxy(vtx.position())) < 0.2 && fabs(cktTrack->dz(vtx.position())) < 0.5;
764 
765 
766 
767  return muID && hits && momQuality && ip;}
768 
769  else if(tunePType == reco::defaultTuneP){
770  // Get the optimized track
771  reco::TrackRef cktTrack = (muon::tevOptimized(muon, 200, 4., 6., -1)).first;
772 
773  bool hits = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 8 && muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
774 
775  bool ip = fabs(cktTrack->dxy(vtx.position())) < 0.2 && fabs(cktTrack->dz(vtx.position())) < 0.5;
776 
777  return muID && hits && ip;}
778 
779  else return false;
780 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isGlobalMuon() const
Definition: Muon.h:211
const Point & position() const
position
Definition: Vertex.h:93
bool first
Definition: L1TdeRCT.cc:94
int numberOfMatchedStations(ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:100
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55
bool muon::isLooseMuon ( const reco::Muon muon)

Definition at line 725 of file MuonSelectors.cc.

References reco::Muon::isGlobalMuon(), reco::Muon::isPFMuon(), and reco::Muon::isTrackerMuon().

Referenced by pat::Muon::isLooseMuon().

725  {
726  return muon.isPFMuon() && ( muon.isGlobalMuon() || muon.isTrackerMuon());
727 }
bool isTrackerMuon() const
Definition: Muon.h:212
bool isGlobalMuon() const
Definition: Muon.h:211
bool isPFMuon() const
Definition: Muon.h:215
bool muon::isSoftMuon ( const reco::Muon muon,
const reco::Vertex vtx 
)

Definition at line 729 of file MuonSelectors.cc.

References reco::TrackBase::highPurity, reco::Muon::innerTrack(), isGoodMuon(), reco::Vertex::position(), and TMOneStationTight.

Referenced by pat::Muon::isSoftMuon().

729  {
730 
731  bool muID = muon::isGoodMuon(muon, TMOneStationTight);
732 
733  if(!muID) return false;
734 
735  bool layers = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
736  muon.innerTrack()->hitPattern().pixelLayersWithMeasurement() > 0;
737 
738  bool ishighq = muon.innerTrack()->quality(reco::Track::highPurity);
739 
740  bool ip = fabs(muon.innerTrack()->dxy(vtx.position())) < 0.3 && fabs(muon.innerTrack()->dz(vtx.position())) < 20.;
741 
742  return layers && ip && ishighq;
743 
744 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
const Point & position() const
position
Definition: Vertex.h:93
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
bool muon::isTightMuon ( const reco::Muon muon,
const reco::Vertex vtx 
)

Definition at line 709 of file MuonSelectors.cc.

References GlobalMuonPromptTight, reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), isGoodMuon(), reco::Muon::isPFMuon(), reco::Muon::muonBestTrack(), reco::Muon::numberOfMatchedStations(), and reco::Vertex::position().

Referenced by RecoMuonValidator::analyze(), and pat::Muon::isTightMuon().

709  {
710 
711  if(!muon.isPFMuon() || !muon.isGlobalMuon() ) return false;
712 
713  bool muID = isGoodMuon(muon,GlobalMuonPromptTight) && (muon.numberOfMatchedStations() > 1);
714 
715 
716  bool hits = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
717  muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
718 
719 
720  bool ip = fabs(muon.muonBestTrack()->dxy(vtx.position())) < 0.2 && fabs(muon.muonBestTrack()->dz(vtx.position())) < 0.5;
721 
722  return muID && hits && ip;
723 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isGlobalMuon() const
Definition: Muon.h:211
const Point & position() const
position
Definition: Vertex.h:93
virtual TrackRef muonBestTrack() const
Definition: Muon.h:64
bool isGoodMuon(const reco::Muon &muon, SelectionType type, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
main GoodMuon wrapper call
int numberOfMatchedStations(ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:100
bool isPFMuon() const
Definition: Muon.h:215
reco::Muon::MuonTrackTypePair muon::muonBestTrack ( const reco::Muon muon,
reco::TunePType  tunePType 
)

Definition at line 167 of file MuonCocktails.cc.

References cocktailInputIsOK(), reco::Muon::combinedMuon(), reco::defaultTuneP, reco::improvedTuneP, reco::Muon::InnerTrack, reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), reco::Muon::OuterTrack, reco::Muon::outerTrack(), sigmaSwitch(), and tevOptimized().

Referenced by pat::PATMuonProducer::fillMuon(), pat::Muon::improvedMuonBestTrack(), pat::Muon::muonBestTrack(), and pat::PATMuonProducer::produce().

167  {
168 
169  reco::Muon::MuonTrackTypePair newBestTrack;
170 
171  if(muon.isGlobalMuon()){
172  if(muon::cocktailInputIsOK(muon)){
173  if(tunePType == reco::improvedTuneP) newBestTrack = muon::tevOptimized(muon, 200, 17., 40., 0.25);
174  else if (tunePType == reco::defaultTuneP) newBestTrack = muon::tevOptimized(muon, 200, 4., 6., -1);
175  else edm::LogError("MuonCocktails|muonBestTrack") << "TuneP configuration not known";
176  }
177  else newBestTrack = muon::sigmaSwitch(muon.combinedMuon(),muon.innerTrack());
178  }
179  else{
180  if(muon.isTrackerMuon()) newBestTrack = std::make_pair(muon.innerTrack(), muon.InnerTrack);
181  else if(!muon.isTrackerMuon() && muon.isStandAloneMuon())
182  newBestTrack = std::make_pair(muon.outerTrack(), muon.OuterTrack);
183  else
184  edm::LogError("MuonCocktails|muonBestTrack") << "Orphan best track this must not happend!";
185  }
186  return newBestTrack;
187 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isTrackerMuon() const
Definition: Muon.h:212
bool isGlobalMuon() const
Definition: Muon.h:211
bool cocktailInputIsOK(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack)
bool isStandAloneMuon() const
Definition: Muon.h:213
reco::Muon::MuonTrackTypePair sigmaSwitch(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const double nSigma=2., const double ptThreshold=200.)
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:52
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:56
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:41
bool muon::overlap ( const reco::Muon muon1,
const reco::Muon muon2,
double  pullX = 1.0,
double  pullY = 1.0,
bool  checkAdjacentChambers = false 
)

Definition at line 640 of file MuonSelectors.cc.

References abs, CSCDetId::chamber(), MuonSubdetId::CSC, CSCDetId::endcap(), reco::Muon::matches(), reco::Muon::numberOfMatches(), reco::LeafCandidate::pt(), CSCDetId::ring(), reco::Muon::SegmentAndTrackArbitration, mathSSE::sqrt(), and CSCDetId::station().

Referenced by CSCCFEBData::digis(), TopDiLeptonOffline::MonitorEnsemble::fill(), ggPFClusters::getPFSuperclusterOverlap(), main(), IsolationProducerForTracks::produce(), MatchedProbeMaker< T >::produce(), CSCEventData::selfTest(), CMSMidpointAlgorithm::splitAndMerge(), edm::EventSelector::testSelectionOverlap(), and PFBlockAlgo::testSuperClusterPFCluster().

642 {
643  unsigned int nMatches1 = muon1.numberOfMatches(reco::Muon::SegmentAndTrackArbitration);
644  unsigned int nMatches2 = muon2.numberOfMatches(reco::Muon::SegmentAndTrackArbitration);
645  unsigned int betterMuon = ( muon1.pt() > muon2.pt() ? 1 : 2 );
646  for ( std::vector<reco::MuonChamberMatch>::const_iterator chamber1 = muon1.matches().begin();
647  chamber1 != muon1.matches().end(); ++chamber1 )
648  for ( std::vector<reco::MuonChamberMatch>::const_iterator chamber2 = muon2.matches().begin();
649  chamber2 != muon2.matches().end(); ++chamber2 )
650  {
651 
652  // if ( (chamber1->segmentMatches.empty() || chamber2->segmentMatches.empty()) ) continue;
653 
654  // handle case where both muons have information about the same chamber
655  // here we know how close they are
656  if ( chamber1->id == chamber2->id ){
657  // found the same chamber
658  if ( fabs(chamber1->x-chamber2->x) <
659  pullX * sqrt(chamber1->xErr*chamber1->xErr+chamber2->xErr*chamber2->xErr) )
660  {
661  if ( betterMuon == 1 )
662  nMatches2--;
663  else
664  nMatches1--;
665  if ( nMatches1==0 || nMatches2==0 ) return true;
666  continue;
667  }
668  if ( fabs(chamber1->y-chamber2->y) <
669  pullY * sqrt(chamber1->yErr*chamber1->yErr+chamber2->yErr*chamber2->yErr) )
670  {
671  if ( betterMuon == 1 )
672  nMatches2--;
673  else
674  nMatches1--;
675  if ( nMatches1==0 || nMatches2==0 ) return true;
676  }
677  } else {
678  if ( ! checkAdjacentChambers ) continue;
679  // check if tracks are pointing into overlaping region of the CSC detector
680  if ( chamber1->id.subdetId() != MuonSubdetId::CSC ||
681  chamber2->id.subdetId() != MuonSubdetId::CSC ) continue;
682  CSCDetId id1(chamber1->id);
683  CSCDetId id2(chamber2->id);
684  if ( id1.endcap() != id2.endcap() ) continue;
685  if ( id1.station() != id2.station() ) continue;
686  if ( id1.ring() != id2.ring() ) continue;
687  if ( abs(id1.chamber() - id2.chamber())>1 ) continue;
688  // FIXME: we don't handle 18->1; 36->1 transitions since
689  // I don't know how to check for sure how many chambers
690  // are there. Probably need to hard code some checks.
691 
692  // Now we have to make sure that both tracks are close to an edge
693  // FIXME: ignored Y coordinate for now
694  if ( fabs(chamber1->edgeX) > chamber1->xErr*pullX ) continue;
695  if ( fabs(chamber2->edgeX) > chamber2->xErr*pullX ) continue;
696  if ( chamber1->x * chamber2->x < 0 ) { // check if the same edge
697  if ( betterMuon == 1 )
698  nMatches2--;
699  else
700  nMatches1--;
701  if ( nMatches1==0 || nMatches2==0 ) return true;
702  }
703  }
704  }
705  return false;
706 }
#define abs(x)
Definition: mlp_lapack.h:159
static const int CSC
Definition: MuonSubdetId.h:15
T sqrt(T t)
Definition: SSEVec.h:46
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:56
virtual double pt() const
transverse momentum
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:141
unsigned int muon::RequiredStationMask ( const reco::Muon muon,
double  maxChamberDist,
double  maxChamberDistPull,
reco::Muon::ArbitrationType  arbitrationType 
)

Definition at line 52 of file MuonSelectors.cc.

References reco::Muon::trackDist(), and reco::Muon::trackDistErr().

Referenced by isGoodMuon().

56 {
57  unsigned int theMask = 0;
58 
59  for(int stationIdx = 1; stationIdx < 5; ++stationIdx)
60  for(int detectorIdx = 1; detectorIdx < 3; ++detectorIdx)
61  if(muon.trackDist(stationIdx,detectorIdx,arbitrationType) < maxChamberDist &&
62  muon.trackDist(stationIdx,detectorIdx,arbitrationType)/muon.trackDistErr(stationIdx,detectorIdx,arbitrationType) < maxChamberDistPull)
63  theMask += 1<<((stationIdx-1)+4*(detectorIdx-1));
64 
65  return theMask;
66 }
float trackDistErr(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:707
float trackDist(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:690
float muon::segmentCompatibility ( const reco::Muon muon,
reco::Muon::ArbitrationType  arbitrationType = reco::Muon::SegmentAndTrackArbitration 
)

Definition at line 74 of file MuonSelectors.cc.

References reco::Muon::dX(), reco::Muon::dY(), i, siStripFEDMonitor_P5_cff::Max, reco::Muon::pullX(), reco::Muon::pullY(), reco::Muon::segmentX(), and reco::Muon::trackDist().

Referenced by HiggsDQM::analyze(), MuonIdVal::analyze(), MuonCosmicCompatibilityFiller::checkMuonSegments(), PFRecoTauDiscriminationAgainstMuon::discriminate(), TauDiscriminationAgainstMuon< TauType, TauDiscriminator >::evaluateMuonVeto(), isGoodMuon(), pat::MuonSelector::muIdSelection_(), and pat::Muon::segmentCompatibility().

74  {
75  bool use_weight_regain_at_chamber_boundary = true;
76  bool use_match_dist_penalty = true;
77 
78  int nr_of_stations_crossed = 0;
79  int nr_of_stations_with_segment = 0;
80  std::vector<int> stations_w_track(8);
81  std::vector<int> station_has_segmentmatch(8);
82  std::vector<int> station_was_crossed(8);
83  std::vector<float> stations_w_track_at_boundary(8);
84  std::vector<float> station_weight(8);
85  int position_in_stations = 0;
86  float full_weight = 0.;
87 
88  for(int i = 1; i<=8; ++i) {
89  // ********************************************************;
90  // *** fill local info for this muon (do some counting) ***;
91  // ************** begin ***********************************;
92  if(i<=4) { // this is the section for the DTs
93  if( muon.trackDist(i,1,arbitrationType) < 999999 ) { //current "raw" info that a track is close to a chamber
94  ++nr_of_stations_crossed;
95  station_was_crossed[i-1] = 1;
96  if(muon.trackDist(i,1,arbitrationType) > -10. ) stations_w_track_at_boundary[i-1] = muon.trackDist(i,1,arbitrationType);
97  else stations_w_track_at_boundary[i-1] = 0.;
98  }
99  if( muon.segmentX(i,1,arbitrationType) < 999999 ) { //current "raw" info that a segment is matched to the current track
100  ++nr_of_stations_with_segment;
101  station_has_segmentmatch[i-1] = 1;
102  }
103  }
104  else { // this is the section for the CSCs
105  if( muon.trackDist(i-4,2,arbitrationType) < 999999 ) { //current "raw" info that a track is close to a chamber
106  ++nr_of_stations_crossed;
107  station_was_crossed[i-1] = 1;
108  if(muon.trackDist(i-4,2,arbitrationType) > -10. ) stations_w_track_at_boundary[i-1] = muon.trackDist(i-4,2,arbitrationType);
109  else stations_w_track_at_boundary[i-1] = 0.;
110  }
111  if( muon.segmentX(i-4,2,arbitrationType) < 999999 ) { //current "raw" info that a segment is matched to the current track
112  ++nr_of_stations_with_segment;
113  station_has_segmentmatch[i-1] = 1;
114  }
115  }
116  // rough estimation of chamber border efficiency (should be parametrized better, this is just a quick guess):
117  // TF1 * merf = new TF1("merf","-0.5*(TMath::Erf(x/6.)-1)",-100,100);
118  // use above value to "unpunish" missing segment if close to border, i.e. rather than not adding any weight, add
119  // the one from the function. Only for dist ~> -10 cm, else full punish!.
120 
121  // ********************************************************;
122  // *** fill local info for this muon (do some counting) ***;
123  // ************** end *************************************;
124  }
125 
126  // ********************************************************;
127  // *** calculate weights for each station *****************;
128  // ************** begin ***********************************;
129  // const float slope = 0.5;
130  // const float attenuate_weight_regain = 1.;
131  // if attenuate_weight_regain < 1., additional punishment if track is close to boundary and no segment
132  const float attenuate_weight_regain = 0.5;
133 
134  for(int i = 1; i<=8; ++i) { // loop over all possible stations
135 
136  // first set all weights if a station has been crossed
137  // later penalize if a station did not have a matching segment
138 
139  //old logic if(station_has_segmentmatch[i-1] > 0 ) { // the track has an associated segment at the current station
140  if( station_was_crossed[i-1] > 0 ) { // the track crossed this chamber (or was nearby)
141  // - Apply a weight depending on the "depth" of the muon passage.
142  // - The station_weight is later reduced for stations with badly matched segments.
143  // - Even if there is no segment but the track passes close to a chamber boundary, the
144  // weight is set non zero and can go up to 0.5 of the full weight if the track is quite
145  // far from any station.
146  ++position_in_stations;
147 
148  switch ( nr_of_stations_crossed ) { // define different weights depending on how many stations were crossed
149  case 1 :
150  station_weight[i-1] = 1.;
151  break;
152  case 2 :
153  if ( position_in_stations == 1 ) station_weight[i-1] = 0.33;
154  else station_weight[i-1] = 0.67;
155  break;
156  case 3 :
157  if ( position_in_stations == 1 ) station_weight[i-1] = 0.23;
158  else if( position_in_stations == 2 ) station_weight[i-1] = 0.33;
159  else station_weight[i-1] = 0.44;
160  break;
161  case 4 :
162  if ( position_in_stations == 1 ) station_weight[i-1] = 0.10;
163  else if( position_in_stations == 2 ) station_weight[i-1] = 0.20;
164  else if( position_in_stations == 3 ) station_weight[i-1] = 0.30;
165  else station_weight[i-1] = 0.40;
166  break;
167 
168  default :
169 // LogTrace("MuonIdentification")<<" // Message: A muon candidate track has more than 4 stations with matching segments.";
170 // LogTrace("MuonIdentification")<<" // Did not expect this - please let me know: ibloch@fnal.gov";
171  // for all other cases
172  station_weight[i-1] = 1./nr_of_stations_crossed;
173  }
174 
175  if( use_weight_regain_at_chamber_boundary ) { // reconstitute some weight if there is no match but the segment is close to a boundary:
176  if(station_has_segmentmatch[i-1] <= 0 && stations_w_track_at_boundary[i-1] != 0. ) {
177  // if segment is not present but track in inefficient region, do not count as "missing match" but add some reduced weight.
178  // original "match weight" is currently reduced by at least attenuate_weight_regain, variing with an error function down to 0 if the track is
179  // inside the chamber.
180  station_weight[i-1] = station_weight[i-1]*attenuate_weight_regain*0.5*(TMath::Erf(stations_w_track_at_boundary[i-1]/6.)+1.); // remark: the additional scale of 0.5 normalizes Err to run from 0 to 1 in y
181  }
182  else if(station_has_segmentmatch[i-1] <= 0 && stations_w_track_at_boundary[i-1] == 0.) { // no segment match and track well inside chamber
183  // full penalization
184  station_weight[i-1] = 0.;
185  }
186  }
187  else { // always fully penalize tracks with no matching segment, whether the segment is close to the boundary or not.
188  if(station_has_segmentmatch[i-1] <= 0) station_weight[i-1] = 0.;
189  }
190 
191  if( station_has_segmentmatch[i-1] > 0 && 42 == 42 ) { // if track has matching segment, but the matching is not high quality, penalize
192  if(i<=4) { // we are in the DTs
193  if( muon.dY(i,1,arbitrationType) < 999999 && muon.dX(i,1,arbitrationType) < 999999) { // have both X and Y match
194  if(
195  TMath::Sqrt(TMath::Power(muon.pullX(i,1,arbitrationType),2.)+TMath::Power(muon.pullY(i,1,arbitrationType),2.))> 1. ) {
196  // reduce weight
197  if(use_match_dist_penalty) {
198  // only use pull if 3 sigma is not smaller than 3 cm
199  if(TMath::Sqrt(TMath::Power(muon.dX(i,1,arbitrationType),2.)+TMath::Power(muon.dY(i,1,arbitrationType),2.)) < 3. && TMath::Sqrt(TMath::Power(muon.pullX(i,1,arbitrationType),2.)+TMath::Power(muon.pullY(i,1,arbitrationType),2.)) > 3. ) {
200  station_weight[i-1] *= 1./TMath::Power(
201  TMath::Max((double)TMath::Sqrt(TMath::Power(muon.dX(i,1,arbitrationType),2.)+TMath::Power(muon.dY(i,1,arbitrationType),2.)),(double)1.),.25);
202  }
203  else {
204  station_weight[i-1] *= 1./TMath::Power(
205  TMath::Sqrt(TMath::Power(muon.pullX(i,1,arbitrationType),2.)+TMath::Power(muon.pullY(i,1,arbitrationType),2.)),.25);
206  }
207  }
208  }
209  }
210  else if (muon.dY(i,1,arbitrationType) >= 999999) { // has no match in Y
211  if( muon.pullX(i,1,arbitrationType) > 1. ) { // has a match in X. Pull larger that 1 to avoid increasing the weight (just penalize, don't anti-penalize)
212  // reduce weight
213  if(use_match_dist_penalty) {
214  // only use pull if 3 sigma is not smaller than 3 cm
215  if( muon.dX(i,1,arbitrationType) < 3. && muon.pullX(i,1,arbitrationType) > 3. ) {
216  station_weight[i-1] *= 1./TMath::Power(TMath::Max((double)muon.dX(i,1,arbitrationType),(double)1.),.25);
217  }
218  else {
219  station_weight[i-1] *= 1./TMath::Power(muon.pullX(i,1,arbitrationType),.25);
220  }
221  }
222  }
223  }
224  else { // has no match in X
225  if( muon.pullY(i,1,arbitrationType) > 1. ) { // has a match in Y. Pull larger that 1 to avoid increasing the weight (just penalize, don't anti-penalize)
226  // reduce weight
227  if(use_match_dist_penalty) {
228  // only use pull if 3 sigma is not smaller than 3 cm
229  if( muon.dY(i,1,arbitrationType) < 3. && muon.pullY(i,1,arbitrationType) > 3. ) {
230  station_weight[i-1] *= 1./TMath::Power(TMath::Max((double)muon.dY(i,1,arbitrationType),(double)1.),.25);
231  }
232  else {
233  station_weight[i-1] *= 1./TMath::Power(muon.pullY(i,1,arbitrationType),.25);
234  }
235  }
236  }
237  }
238  }
239  else { // We are in the CSCs
240  if(
241  TMath::Sqrt(TMath::Power(muon.pullX(i-4,2,arbitrationType),2.)+TMath::Power(muon.pullY(i-4,2,arbitrationType),2.)) > 1. ) {
242  // reduce weight
243  if(use_match_dist_penalty) {
244  // only use pull if 3 sigma is not smaller than 3 cm
245  if(TMath::Sqrt(TMath::Power(muon.dX(i-4,2,arbitrationType),2.)+TMath::Power(muon.dY(i-4,2,arbitrationType),2.)) < 3. && TMath::Sqrt(TMath::Power(muon.pullX(i-4,2,arbitrationType),2.)+TMath::Power(muon.pullY(i-4,2,arbitrationType),2.)) > 3. ) {
246  station_weight[i-1] *= 1./TMath::Power(
247  TMath::Max((double)TMath::Sqrt(TMath::Power(muon.dX(i-4,2,arbitrationType),2.)+TMath::Power(muon.dY(i-4,2,arbitrationType),2.)),(double)1.),.25);
248  }
249  else {
250  station_weight[i-1] *= 1./TMath::Power(
251  TMath::Sqrt(TMath::Power(muon.pullX(i-4,2,arbitrationType),2.)+TMath::Power(muon.pullY(i-4,2,arbitrationType),2.)),.25);
252  }
253  }
254  }
255  }
256  }
257 
258  // Thoughts:
259  // - should penalize if the segment has only x OR y info
260  // - should also use the segment direction, as it now works!
261 
262  }
263  else { // track did not pass a chamber in this station - just reset weight
264  station_weight[i-1] = 0.;
265  }
266 
267  //increment final weight for muon:
268  full_weight += station_weight[i-1];
269  }
270 
271  // if we don't expect any matches, we set the compatibility to
272  // 0.5 as the track is as compatible with a muon as it is with
273  // background - we should maybe rather set it to -0.5!
274  if( nr_of_stations_crossed == 0 ) {
275  // full_weight = attenuate_weight_regain*0.5;
276  full_weight = 0.5;
277  }
278 
279  // ********************************************************;
280  // *** calculate weights for each station *****************;
281  // ************** end *************************************;
282 
283  return full_weight;
284 
285 }
int i
Definition: DBlmapReader.cc:9
float dY(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:344
float pullY(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration, bool includeSegmentError=true) const
Definition: Muon.cc:380
float segmentX(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:412
float trackDist(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:690
float dX(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:336
float pullX(int station, int muonSubdetId, ArbitrationType type=SegmentAndTrackArbitration, bool includeSegmentError=true) const
Definition: Muon.cc:370
SelectionType muon::selectionTypeFromString ( const std::string &  label)

Definition at line 8 of file MuonSelectors.cc.

References All, AllArbitrated, AllGlobalMuons, AllStandAloneMuons, AllTrackerMuons, edm::hlt::Exception, newFWLiteAna::found, GlobalMuonPromptTight, GMStaChiCompatibility, GMTkChiCompatibility, GMTkKinkTight, i, muon::SelectionTypeStringToEnum::label, TM2DCompatibilityLoose, TM2DCompatibilityTight, TMLastStationAngLoose, TMLastStationAngTight, TMLastStationLoose, TMLastStationOptimizedBarrelLowPtLoose, TMLastStationOptimizedBarrelLowPtTight, TMLastStationOptimizedLowPtLoose, TMLastStationOptimizedLowPtTight, TMLastStationTight, TMOneStationAngLoose, TMOneStationAngTight, TMOneStationLoose, TMOneStationTight, TrackerMuonArbitrated, relativeConstraints::value, and muon::SelectionTypeStringToEnum::value.

Referenced by pat::Muon::muonID(), MuonSelectionTypeValueMapProducer::MuonSelectionTypeValueMapProducer(), and MuonTrackProducer::produce().

9 {
10  static SelectionTypeStringToEnum selectionTypeStringToEnumMap[] = {
11  { "All", All },
12  { "AllGlobalMuons", AllGlobalMuons },
13  { "AllStandAloneMuons", AllStandAloneMuons },
14  { "AllTrackerMuons", AllTrackerMuons },
15  { "TrackerMuonArbitrated", TrackerMuonArbitrated },
16  { "AllArbitrated", AllArbitrated },
17  { "GlobalMuonPromptTight", GlobalMuonPromptTight },
18  { "TMLastStationLoose", TMLastStationLoose },
19  { "TMLastStationTight", TMLastStationTight },
20  { "TM2DCompatibilityLoose", TM2DCompatibilityLoose },
21  { "TM2DCompatibilityTight", TM2DCompatibilityTight },
22  { "TMOneStationLoose", TMOneStationLoose },
23  { "TMOneStationTight", TMOneStationTight },
24  { "TMLastStationOptimizedLowPtLoose", TMLastStationOptimizedLowPtLoose },
25  { "TMLastStationOptimizedLowPtTight", TMLastStationOptimizedLowPtTight },
26  { "GMTkChiCompatibility", GMTkChiCompatibility },
27  { "GMStaChiCompatibility", GMStaChiCompatibility},
28  { "GMTkKinkTight", GMTkKinkTight},
29  { "TMLastStationAngLoose", TMLastStationAngLoose },
30  { "TMLastStationAngTight", TMLastStationAngTight },
31  { "TMOneStationAngLoose", TMOneStationAngLoose },
32  { "TMOneStationAngTight", TMOneStationAngTight },
33  { "TMLastStationOptimizedBarrelLowPtLoose", TMLastStationOptimizedBarrelLowPtLoose },
34  { "TMLastStationOptimizedBarrelLowPtTight", TMLastStationOptimizedBarrelLowPtTight },
35  { 0, (SelectionType)-1 }
36  };
37 
39  bool found = false;
40  for(int i = 0; selectionTypeStringToEnumMap[i].label && (! found); ++i)
41  if (! strcmp(label.c_str(), selectionTypeStringToEnumMap[i].label)) {
42  found = true;
43  value = selectionTypeStringToEnumMap[i].value;
44  }
45 
46  // in case of unrecognized selection type
47  if (! found) throw cms::Exception("MuonSelectorError") << label << " is not a recognized SelectionType";
48  return value;
49 }
int i
Definition: DBlmapReader.cc:9
SelectionType
Selector type.
Definition: MuonSelectors.h:19
int muon::sharedSegments ( const reco::Muon muon1,
const reco::Muon muon2,
unsigned int  segmentArbitrationMask = reco::MuonSegmentMatch::BestInChamberByDR 
)

Determine the number of shared segments between two muons. Comparison is done using the segment references in the reco::Muon object.

Definition at line 783 of file MuonSelectors.cc.

References reco::Muon::matches(), and run_regression::ret.

783  {
784  int ret = 0;
785 
786  // Will do with a stupid double loop, since creating and filling a map is probably _more_ inefficient for a single lookup.
787  for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch = mu.matches().begin();
788  chamberMatch != mu.matches().end(); ++chamberMatch) {
789  if (chamberMatch->segmentMatches.empty()) continue;
790  for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch2 = mu2.matches().begin();
791  chamberMatch2 != mu2.matches().end(); ++chamberMatch2) {
792  if (chamberMatch2->segmentMatches.empty()) continue;
793  if (chamberMatch2->id() != chamberMatch->id()) continue;
794  for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
795  segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch) {
796  if (!segmentMatch->isMask(segmentArbitrationMask)) continue;
797  for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch2 = chamberMatch2->segmentMatches.begin();
798  segmentMatch2 != chamberMatch2->segmentMatches.end(); ++segmentMatch2) {
799  if (!segmentMatch2->isMask(segmentArbitrationMask)) continue;
800  if ((segmentMatch->cscSegmentRef.isNonnull() && segmentMatch->cscSegmentRef == segmentMatch2->cscSegmentRef) ||
801  (segmentMatch-> dtSegmentRef.isNonnull() && segmentMatch-> dtSegmentRef == segmentMatch2-> dtSegmentRef) ) {
802  ++ret;
803  } // is the same
804  } // segment of mu2 in chamber
805  } // segment of mu1 in chamber
806  } // chamber of mu2
807  } // chamber of mu1
808 
809  return ret;
810 }
const int mu
Definition: Constants.h:23
reco::Muon::MuonTrackTypePair muon::sigmaSwitch ( const reco::TrackRef combinedTrack,
const reco::TrackRef trackerTrack,
const double  nSigma = 2.,
const double  ptThreshold = 200. 
)

Definition at line 119 of file MuonCocktails.cc.

References reco::Muon::CombinedTrack, delta, reco::Muon::InnerTrack, and dtDQMClient_cfg::threshold.

Referenced by MuonIdProducer::makeMuon(), muonBestTrack(), and sigmaSwitch().

122  {
123  // If either the global or tracker-only fits have pT below threshold
124  // (default 200 GeV), return the tracker-only fit.
125  if (combinedTrack->pt() < ptThreshold || trackerTrack->pt() < ptThreshold)
126  return make_pair(trackerTrack,reco::Muon::InnerTrack);
127 
128  // If both are above the pT threshold, compare the difference in
129  // q/p: if less than two sigma of the tracker-only track, switch to
130  // global. Otherwise, use tracker-only.
131  const double delta = fabs(trackerTrack->qoverp() - combinedTrack->qoverp());
132  const double threshold = nSigma * trackerTrack->qoverpError();
133  return delta > threshold ? make_pair(trackerTrack,reco::Muon::InnerTrack) : make_pair(combinedTrack,reco::Muon::CombinedTrack);
134 }
dbl * delta
Definition: mlp_gen.cc:36
reco::Muon::MuonTrackTypePair muon::sigmaSwitch ( const reco::Muon muon,
const double  nSigma = 2.,
const double  ptThreshold = 200. 
)
inline

Definition at line 94 of file MuonCocktails.h.

References reco::Muon::globalTrack(), reco::Muon::innerTrack(), and sigmaSwitch().

96  {
97  return muon::sigmaSwitch(muon.globalTrack(),
98  muon.innerTrack(),
99  nSigma,
100  ptThreshold);
101  }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
reco::Muon::MuonTrackTypePair sigmaSwitch(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const double nSigma=2., const double ptThreshold=200.)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55
reco::Muon::MuonTrackTypePair muon::tevOptimized ( const reco::TrackRef combinedTrack,
const reco::TrackRef trackerTrack,
const reco::TrackRef tpfmsTrack,
const reco::TrackRef pickyTrack,
const double  ptThreshold = 200.,
const double  tune1 = 4.,
const double  tune2 = 6.,
const double  dptcut = -1. 
)

Definition at line 9 of file MuonCocktails.cc.

References reco::Muon::CombinedTrack, first, i, reco::Muon::InnerTrack, reco::Muon::Picky, reco::Muon::TPFMS, trackProbability(), and TrackValidation_HighPurity_cff::valid.

Referenced by isHighPtMuon(), MuonIdProducer::makeMuon(), muonBestTrack(), MuonsFromRefitTracksProducer::produce(), and tevOptimized().

16  {
17 
18  // Array for convenience below.
19  const reco::Muon::MuonTrackTypePair refit[4] = {
20  make_pair(trackerTrack, reco::Muon::InnerTrack),
21  make_pair(combinedTrack,reco::Muon::CombinedTrack),
22  make_pair(tpfmsTrack, reco::Muon::TPFMS),
23  make_pair(pickyTrack, reco::Muon::Picky)
24  };
25 
26  // Calculate the log(tail probabilities). If there's a problem,
27  // signify this with prob == 0. The current problems recognized are:
28  // the track being not available, whether the (re)fit failed or it's
29  // just not in the event, or if the (re)fit ended up with no valid
30  // hits.
31  double prob[4] = {0.,0.,0.,0.};
32  bool valid[4] = {0,0,0,0};
33 
34  double dptmin = 1.;
35 
36  if (dptcut>0) {
37  for (unsigned int i = 0; i < 4; ++i)
38  if (refit[i].first.isNonnull())
39  if (refit[i].first->ptError()/refit[i].first->pt()<dptmin) dptmin = refit[i].first->ptError()/refit[i].first->pt();
40 
41  if (dptmin>dptcut) dptcut = dptmin+0.15;
42  }
43 
44  for (unsigned int i = 0; i < 4; ++i)
45  if (refit[i].first.isNonnull()){
46  valid[i] = true;
47  if (refit[i].first->numberOfValidHits() && (refit[i].first->ptError()/refit[i].first->pt()<dptcut || dptcut<0))
48  prob[i] = muon::trackProbability(refit[i].first);
49  }
50 
51 
52  // Start with picky.
53  int chosen = 3;
54 
55  // If there's a problem with picky, make the default one of the
56  // other tracks. Try TPFMS first, then global, then tracker-only.
57  if (prob[3] == 0.) {
58 
59  // split so that passing dptcut<0 recreates EXACTLY the old tuneP behavior
60  if (dptcut>0) {
61  if (prob[0] > 0.) chosen = 0;
62  else if (prob[2] > 0.) chosen = 2;
63  else if (prob[1] > 0.) chosen = 1;
64  } else {
65  if (prob[2] > 0.) chosen = 2;
66  else if (prob[1] > 0.) chosen = 1;
67  else if (prob[0] > 0.) chosen = 0;
68  }
69  }
70 
71  // Now the algorithm: switch from picky to tracker-only if the
72  // difference, log(tail prob(picky)) - log(tail prob(tracker-only))
73  // is greater than a tuned value. Then compare the
74  // so-picked track to TPFMS in the same manner using another tuned
75  // value.
76  if (prob[0] > 0. && prob[3] > 0. && (prob[3] - prob[0]) > tune1)
77  chosen = 0;
78  if (prob[2] > 0. && (prob[chosen] - prob[2]) > tune2)
79  chosen = 2;
80 
81  // Sanity checks
82  if (chosen == 3 && !valid[3] ) chosen = 2;
83  if (chosen == 2 && !valid[2] ) chosen = 1;
84  if (chosen == 1 && !valid[1] ) chosen = 0;
85 
86  // Done. If pT of the chosen track (or pT of the tracker track) is below the threshold value, return the tracker track.
87  if (valid[chosen] && refit[chosen].first->pt() < ptThreshold && prob[0] > 0.) return make_pair(trackerTrack,reco::Muon::InnerTrack);
88  if (trackerTrack->pt() < ptThreshold && prob[0] > 0.) return make_pair(trackerTrack,reco::Muon::InnerTrack);
89 
90  // Return the chosen track (which can be the global track in
91  // very rare cases).
92  return refit[chosen];
93 }
int i
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
double trackProbability(const reco::TrackRef track)
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:41
reco::Muon::MuonTrackTypePair muon::tevOptimized ( const reco::Muon muon,
const double  ptThreshold = 200.,
const double  tune1 = 4.,
const double  tune2 = 6.,
const double  dptcut = -1. 
)
inline

Definition at line 32 of file MuonCocktails.h.

References reco::Muon::globalTrack(), reco::Muon::innerTrack(), reco::Muon::pickyTrack(), tevOptimized(), and reco::Muon::tpfmsTrack().

36  {
37  return tevOptimized(muon.globalTrack(),
38  muon.innerTrack(),
39  muon.tpfmsTrack(),
40  muon.pickyTrack(),
41  ptThreshold,
42  tune1,
43  tune2,
44  dptcut);
45  }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
virtual TrackRef tpfmsTrack() const
Definition: Muon.h:58
virtual TrackRef pickyTrack() const
Definition: Muon.h:59
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:55
reco::Muon::MuonTrackTypePair muon::tevOptimized ( const reco::TrackRef combinedTrack,
const reco::TrackRef trackerTrack,
const reco::TrackToTrackMap tevMap1,
const reco::TrackToTrackMap tevMap2,
const reco::TrackToTrackMap tevMap3,
const double  ptThreshold = 200.,
const double  tune1 = 4.,
const double  tune2 = 6.,
const double  dptcut = -1. 
)
inline

Definition at line 57 of file MuonCocktails.h.

References getTevRefitTrack(), and tevOptimized().

65  {
66  return tevOptimized(combinedTrack,
67  trackerTrack,
68  getTevRefitTrack(combinedTrack, tevMap2),
69  getTevRefitTrack(combinedTrack, tevMap3),
70  ptThreshold,
71  tune1,
72  tune2,
73  dptcut);
74  }
reco::TrackRef getTevRefitTrack(const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
reco::Muon::MuonTrackTypePair muon::tevOptimized ( const reco::Muon muon,
const reco::TrackToTrackMap tevMap1,
const reco::TrackToTrackMap tevMap2,
const reco::TrackToTrackMap tevMap3 
)
inline

Definition at line 76 of file MuonCocktails.h.

References reco::Muon::combinedMuon(), getTevRefitTrack(), tevOptimized(), and reco::Muon::track().

79  {
80  return tevOptimized(muon.combinedMuon(),
81  muon.track(),
82  getTevRefitTrack(muon.combinedMuon(), tevMap2),
83  getTevRefitTrack(muon.combinedMuon(), tevMap3));
84  }
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:50
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:56
reco::TrackRef getTevRefitTrack(const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
reco::Muon::MuonTrackTypePair tevOptimized(const reco::TrackRef &combinedTrack, const reco::TrackRef &trackerTrack, const reco::TrackRef &tpfmsTrack, const reco::TrackRef &pickyTrack, const double ptThreshold=200., const double tune1=4., const double tune2=6., const double dptcut=-1.)
Definition: MuonCocktails.cc:9
reco::Muon::MuonTrackTypePair muon::TMR ( const reco::TrackRef trackerTrack,
const reco::TrackRef fmsTrack,
const double  tune = 4. 
)

Definition at line 139 of file MuonCocktails.cc.

References reco::Muon::InnerTrack, edm::Ref< C, T, F >::isNonnull(), reco::Muon::None, reco::Muon::TPFMS, and trackProbability().

141  {
142  double probTK = 0;
143  double probFMS = 0;
144 
145  if (trackerTrack.isNonnull() && trackerTrack->numberOfValidHits())
146  probTK = muon::trackProbability(trackerTrack);
147  if (fmsTrack.isNonnull() && fmsTrack->numberOfValidHits())
148  probFMS = muon::trackProbability(fmsTrack);
149 
150  bool TKok = probTK > 0;
151  bool FMSok = probFMS > 0;
152 
153  if (TKok && FMSok) {
154  if (probFMS - probTK > tune)
155  return make_pair(trackerTrack,reco::Muon::InnerTrack);
156  else
157  return make_pair(fmsTrack,reco::Muon::TPFMS);
158  }
159  else if (FMSok)
160  return make_pair(fmsTrack,reco::Muon::TPFMS);
161  else if (TKok)
162  return make_pair(trackerTrack,reco::Muon::InnerTrack);
163  else
164  return make_pair(reco::TrackRef(),reco::Muon::None);
165 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:250
double trackProbability(const reco::TrackRef track)
double muon::trackProbability ( const reco::TrackRef  track)

Definition at line 98 of file MuonCocktails.cc.

References create_public_lumi_plots::log.

Referenced by HistogramProbabilityEstimator::probability(), tevOptimized(), tevOptimizedTMR(), and TMR().

98  {
99 
100  int nDOF = (int)track->ndof();
101  if ( nDOF > 0 && track->chi2()> 0) {
102  return -log(TMath::Prob(track->chi2(), nDOF));
103  } else {
104  return 0.0;
105  }
106 
107 }