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, RPCMu }
 
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,
  RPCMuLoose = 24
}
 Selector type. More...
 

Functions

float caloCompatibility (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 &)
 
bool isLooseMuon (const reco::Muon &)
 
bool isSoftMuon (const reco::Muon &, const reco::Vertex &)
 
bool isTightMuon (const reco::Muon &, const reco::Vertex &)
 
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=17., const double tune2=40., const double dptcut=0.25)
 
reco::Muon::MuonTrackTypePair tevOptimized (const reco::Muon &muon, const double ptThreshold=200., const double tune1=17., const double tune2=40., const double dptcut=0.25)
 
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=17., const double tune2=40., const double dptcut=0.25)
 
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 
RPCMu 

Definition at line 63 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 
RPCMuLoose 

Definition at line 17 of file MuonSelectors.h.

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

Function Documentation

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

Definition at line 71 of file MuonSelectors.cc.

References reco::Muon::caloCompatibility().

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

71  {
72  return muon.caloCompatibility();
73 }
float caloCompatibility() const
Definition: Muon.h:150
reco::TrackRef muon::getTevRefitTrack ( const reco::TrackRef combinedTrack,
const reco::TrackToTrackMap map 
)

Definition at line 109 of file MuonCocktails.cc.

References edm::AssociationMap< edm::OneToOne< reco::TrackCollection, reco::TrackCollection > >::const_iterator, edm::AssociationMap< Tag >::end(), and edm::AssociationMap< Tag >::find().

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 567 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::isRPCMuon(), reco::Muon::isStandAloneMuon(), reco::Muon::isTrackerMuon(), reco::Muon::numberOfMatches(), reco::Muon::outerTrack(), reco::LeafCandidate::pt(), RPCMu, RPCMuLoose, 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 ExampleMuonAnalyzer::analyze(), 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(), MuonRefProducer::produce(), MuonSelectionTypeValueMapProducer::produce(), SoftLepton::produce(), and FourVectorHLTOffline::selectMuons().

569 {
570  switch (type)
571  {
572  case muon::All:
573  return true;
574  break;
576  return muon.isGlobalMuon();
577  break;
579  return muon.isTrackerMuon();
580  break;
582  return muon.isStandAloneMuon();
583  break;
585  return muon.isTrackerMuon() && muon.numberOfMatches(arbitrationType)>0;
586  break;
587  case muon::AllArbitrated:
588  return ! muon.isTrackerMuon() || muon.numberOfMatches(arbitrationType)>0;
589  break;
591  return muon.isGlobalMuon() && muon.globalTrack()->normalizedChi2()<10. && muon.globalTrack()->hitPattern().numberOfValidMuonHits() >0;
592  break;
593  // For "Loose" algorithms we choose maximum y quantity cuts of 1E9 instead of
594  // 9999 as before. We do this because the muon methods return 999999 (note
595  // there are six 9's) when the requested information is not available. For
596  // example, if a muon fails to traverse the z measuring superlayer in a station
597  // in the DT, then all methods involving segmentY in this station return
598  // 999999 to demonstrate that the information is missing. In order to not
599  // penalize muons for missing y information in Loose algorithms where we do
600  // not care at all about y information, we raise these limits. In the
601  // TMLastStation and TMOneStation algorithms we actually use this huge number
602  // to determine whether to consider y information at all.
604  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,true,false);
605  break;
607  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,true,false);
608  break;
610  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,false);
611  break;
613  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,false);
614  break;
616  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
617  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,false);
618  else
619  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,false,false);
620  break;
622  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
623  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,false);
624  else
625  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,false,false);
626  break;
627  //compatibility loose
629  return muon.isTrackerMuon() && isGoodMuon(muon,TM2DCompatibility,0.7,arbitrationType);
630  break;
631  //compatibility tight
633  return muon.isTrackerMuon() && isGoodMuon(muon,TM2DCompatibility,1.0,arbitrationType);
634  break;
636  return muon.isGlobalMuon() && muon.isQualityValid() && fabs(muon.combinedQuality().trkRelChi2 - muon.innerTrack()->normalizedChi2()) < 2.0;
637  break;
639  return muon.isGlobalMuon() && muon.isQualityValid() && fabs(muon.combinedQuality().staRelChi2 - muon.outerTrack()->normalizedChi2()) < 2.0;
640  break;
641  case muon::GMTkKinkTight:
642  return muon.isGlobalMuon() && muon.isQualityValid() && muon.combinedQuality().trkKink < 100.0;
643  break;
645  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,false,true);
646  break;
648  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,false,true);
649  break;
651  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,true);
652  break;
654  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,true);
655  break;
657  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
658  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,1E9,1E9,1E9,1E9,arbitrationType,false,false);
659  else
660  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,1E9,1E9,-3,-3,arbitrationType,true,false);
661  break;
663  if (muon.pt() < 8. && fabs(muon.eta()) < 1.2)
664  return muon.isTrackerMuon() && isGoodMuon(muon,TMOneStation,1,3,3,3,3,1E9,1E9,arbitrationType,false,false);
665  else
666  return muon.isTrackerMuon() && isGoodMuon(muon,TMLastStation,2,3,3,3,3,-3,-3,arbitrationType,true,false);
667  break;
668  case muon::RPCMuLoose:
669  return muon.isRPCMuon() && isGoodMuon(muon, RPCMu, 2, 20, 4, 1e9, 1e9, 1e9, 1e9, arbitrationType, false, false);
670  break;
671  default:
672  return false;
673  }
674 }
type
Definition: HCALResponse.h:21
virtual TrackRef innerTrack() const
Definition: Muon.h:48
bool isTrackerMuon() const
Definition: Muon.h:219
bool isGlobalMuon() const
Definition: Muon.h:218
float trkKink
value of the kink algorithm applied to the inner track stub
Definition: MuonQuality.h:11
bool isStandAloneMuon() const
Definition: Muon.h:220
float trkRelChi2
chi2 value for the inner track stub with respect to the global track
Definition: MuonQuality.h:15
bool isRPCMuon() const
Definition: Muon.h:223
MuonQuality combinedQuality() const
get energy deposition information
Definition: Muon.h:121
bool isQualityValid() const
Definition: Muon.h:119
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
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:60
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
float staRelChi2
chi2 value for the outer track stub with respect to the global track
Definition: MuonQuality.h:17
virtual float pt() const GCC11_FINAL
transverse momentum
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:54
bool muon::isGoodMuon ( const reco::Muon muon,
AlgorithmType  type,
double  minCompatibility,
reco::Muon::ArbitrationType  arbitrationType 
)

Definition at line 289 of file MuonSelectors.cc.

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

292  {
293  if (!muon.isMatchesValid()) return false;
294  bool goodMuon = false;
295 
296  switch( type ) {
297  case TM2DCompatibility:
298  // Simplistic first cut in the 2D segment- vs calo-compatibility plane. Will have to be refined!
299  if( ( (0.8*caloCompatibility( muon ))+(1.2*segmentCompatibility( muon, arbitrationType )) ) > minCompatibility ) goodMuon = true;
300  else goodMuon = false;
301  return goodMuon;
302  break;
303  default :
304  // LogTrace("MuonIdentification")<<" // Invalid Algorithm Type called!";
305  goodMuon = false;
306  return goodMuon;
307  break;
308  }
309 }
type
Definition: HCALResponse.h:21
bool isMatchesValid() const
Definition: Muon.h:138
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 311 of file MuonSelectors.cc.

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

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

Definition at line 785 of file MuonSelectors.cc.

References reco::Muon::bestTrack(), reco::TrackBase::dz(), reco::Muon::globalTrack(), reco::Muon::innerTrack(), reco::Muon::isGlobalMuon(), reco::Muon::muonBestTrack(), reco::Muon::numberOfMatchedStations(), and reco::Vertex::position().

Referenced by MuonKinVsEtaAnalyzer::analyze(), and pat::Muon::isHighPtMuon().

785  {
786  bool muID = muon.isGlobalMuon() && muon.globalTrack()->hitPattern().numberOfValidMuonHits() >0 && (muon.numberOfMatchedStations() > 1);
787  if(!muID) return false;
788 
789  bool hits = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
790  muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
791 
792  bool momQuality = muon.muonBestTrack()->ptError()/muon.muonBestTrack()->pt() < 0.3;
793 
794  bool ip = fabs(muon.muonBestTrack()->dxy(vtx.position())) < 0.2 && fabs(muon.bestTrack()->dz(vtx.position())) < 0.5;
795 
796  return muID && hits && momQuality && ip;
797 
798 }
virtual TrackRef innerTrack() const
Definition: Muon.h:48
bool isGlobalMuon() const
Definition: Muon.h:218
const Point & position() const
position
Definition: Vertex.h:92
virtual const Track * bestTrack() const
best track pointer
Definition: Muon.h:61
virtual TrackRef muonBestTrack() const
Definition: Muon.h:63
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:125
int numberOfMatchedStations(ArbitrationType type=SegmentAndTrackArbitration) const
Definition: Muon.cc:110
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:54
bool muon::isLooseMuon ( const reco::Muon muon)

Definition at line 762 of file MuonSelectors.cc.

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

Referenced by MuonKinVsEtaAnalyzer::analyze(), PFMuonAlgo::isLooseMuon(), pat::Muon::isLooseMuon(), and PFMuonAlgo::reconstructMuon().

762  {
763  return muon.isPFMuon() && ( muon.isGlobalMuon() || muon.isTrackerMuon());
764 }
bool isTrackerMuon() const
Definition: Muon.h:219
bool isGlobalMuon() const
Definition: Muon.h:218
bool isPFMuon() const
Definition: Muon.h:222
bool muon::isSoftMuon ( const reco::Muon muon,
const reco::Vertex vtx 
)

Definition at line 767 of file MuonSelectors.cc.

References reco::Muon::innerTrack(), isGoodMuon(), LayerTriplets::layers(), reco::Vertex::position(), and TMOneStationTight.

Referenced by DiMuonHistograms::analyze(), MuonKinVsEtaAnalyzer::analyze(), and pat::Muon::isSoftMuon().

767  {
768 
769  bool muID = muon::isGoodMuon(muon, TMOneStationTight);
770 
771  if(!muID) return false;
772 
773  bool layers = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
774  muon.innerTrack()->hitPattern().pixelLayersWithMeasurement() > 1;
775 
776  bool chi2 = muon.innerTrack()->normalizedChi2() < 1.8;
777 
778  bool ip = fabs(muon.innerTrack()->dxy(vtx.position())) < 3. && fabs(muon.innerTrack()->dz(vtx.position())) < 30.;
779 
780  return muID && layers && ip && chi2 ;
781 }
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
virtual TrackRef innerTrack() const
Definition: Muon.h:48
const Point & position() const
position
Definition: Vertex.h:92
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 745 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(), DiMuonHistograms::analyze(), MuonKinVsEtaAnalyzer::analyze(), EfficiencyAnalyzer::analyze(), MuonPFAnalyzer::analyze(), MuonRecoOneHLT::analyze(), L1TEfficiencyMuons_Offline::getTightMuons(), and pat::Muon::isTightMuon().

745  {
746 
747  if(!muon.isPFMuon() || !muon.isGlobalMuon() ) return false;
748 
749  bool muID = isGoodMuon(muon,GlobalMuonPromptTight) && (muon.numberOfMatchedStations() > 1);
750 
751 
752  bool hits = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
753  muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;
754 
755 
756  bool ip = fabs(muon.muonBestTrack()->dxy(vtx.position())) < 0.2 && fabs(muon.muonBestTrack()->dz(vtx.position())) < 0.5;
757 
758  return muID && hits && ip;
759 }
virtual TrackRef innerTrack() const
Definition: Muon.h:48
bool isGlobalMuon() const
Definition: Muon.h:218
const Point & position() const
position
Definition: Vertex.h:92
virtual TrackRef muonBestTrack() const
Definition: Muon.h:63
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:110
bool isPFMuon() const
Definition: Muon.h:222
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 676 of file MuonSelectors.cc.

References funct::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(), main(), IsolationProducerForTracks::produce(), MatchedProbeMaker< T >::produce(), CSCEventData::selfTest(), CMSMidpointAlgorithm::splitAndMerge(), edm::EventSelector::testSelectionOverlap(), and PFBlockAlgo::testSuperClusterPFCluster().

678 {
679  unsigned int nMatches1 = muon1.numberOfMatches(reco::Muon::SegmentAndTrackArbitration);
680  unsigned int nMatches2 = muon2.numberOfMatches(reco::Muon::SegmentAndTrackArbitration);
681  unsigned int betterMuon = ( muon1.pt() > muon2.pt() ? 1 : 2 );
682  for ( std::vector<reco::MuonChamberMatch>::const_iterator chamber1 = muon1.matches().begin();
683  chamber1 != muon1.matches().end(); ++chamber1 )
684  for ( std::vector<reco::MuonChamberMatch>::const_iterator chamber2 = muon2.matches().begin();
685  chamber2 != muon2.matches().end(); ++chamber2 )
686  {
687 
688  // if ( (chamber1->segmentMatches.empty() || chamber2->segmentMatches.empty()) ) continue;
689 
690  // handle case where both muons have information about the same chamber
691  // here we know how close they are
692  if ( chamber1->id == chamber2->id ){
693  // found the same chamber
694  if ( fabs(chamber1->x-chamber2->x) <
695  pullX * sqrt(chamber1->xErr*chamber1->xErr+chamber2->xErr*chamber2->xErr) )
696  {
697  if ( betterMuon == 1 )
698  nMatches2--;
699  else
700  nMatches1--;
701  if ( nMatches1==0 || nMatches2==0 ) return true;
702  continue;
703  }
704  if ( fabs(chamber1->y-chamber2->y) <
705  pullY * sqrt(chamber1->yErr*chamber1->yErr+chamber2->yErr*chamber2->yErr) )
706  {
707  if ( betterMuon == 1 )
708  nMatches2--;
709  else
710  nMatches1--;
711  if ( nMatches1==0 || nMatches2==0 ) return true;
712  }
713  } else {
714  if ( ! checkAdjacentChambers ) continue;
715  // check if tracks are pointing into overlaping region of the CSC detector
716  if ( chamber1->id.subdetId() != MuonSubdetId::CSC ||
717  chamber2->id.subdetId() != MuonSubdetId::CSC ) continue;
718  CSCDetId id1(chamber1->id);
719  CSCDetId id2(chamber2->id);
720  if ( id1.endcap() != id2.endcap() ) continue;
721  if ( id1.station() != id2.station() ) continue;
722  if ( id1.ring() != id2.ring() ) continue;
723  if ( abs(id1.chamber() - id2.chamber())>1 ) continue;
724  // FIXME: we don't handle 18->1; 36->1 transitions since
725  // I don't know how to check for sure how many chambers
726  // are there. Probably need to hard code some checks.
727 
728  // Now we have to make sure that both tracks are close to an edge
729  // FIXME: ignored Y coordinate for now
730  if ( fabs(chamber1->edgeX) > chamber1->xErr*pullX ) continue;
731  if ( fabs(chamber2->edgeX) > chamber2->xErr*pullX ) continue;
732  if ( chamber1->x * chamber2->x < 0 ) { // check if the same edge
733  if ( betterMuon == 1 )
734  nMatches2--;
735  else
736  nMatches1--;
737  if ( nMatches1==0 || nMatches2==0 ) return true;
738  }
739  }
740  }
741  return false;
742 }
static const int CSC
Definition: MuonSubdetId.h:13
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int numberOfMatches(ArbitrationType type=SegmentAndTrackArbitration) const
get number of chambers with matched segments
Definition: Muon.cc:60
std::vector< MuonChamberMatch > & matches()
get muon matching information
Definition: Muon.h:140
virtual float pt() const GCC11_FINAL
transverse momentum
unsigned int muon::RequiredStationMask ( const reco::Muon muon,
double  maxChamberDist,
double  maxChamberDistPull,
reco::Muon::ArbitrationType  arbitrationType 
)

Definition at line 54 of file MuonSelectors.cc.

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

Referenced by isGoodMuon().

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

Definition at line 76 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 ExampleMuonAnalyzer::analyze(), HiggsDQM::analyze(), MuonIdVal::analyze(), MuonCosmicCompatibilityFiller::checkMuonSegments(), PFRecoTauDiscriminationAgainstMuon::discriminate(), TauDiscriminationAgainstMuon< TauType, TauDiscriminator >::evaluateMuonVeto(), isGoodMuon(), pat::MuonSelector::muIdSelection_(), and pat::Muon::segmentCompatibility().

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

Definition at line 9 of file MuonSelectors.cc.

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

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

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

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

Referenced by modules::MuonCleanerBySegmentsT< T >::produce().

800  {
801  int ret = 0;
802 
803  // Will do with a stupid double loop, since creating and filling a map is probably _more_ inefficient for a single lookup.
804  for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch = mu.matches().begin();
805  chamberMatch != mu.matches().end(); ++chamberMatch) {
806  if (chamberMatch->segmentMatches.empty()) continue;
807  for(std::vector<reco::MuonChamberMatch>::const_iterator chamberMatch2 = mu2.matches().begin();
808  chamberMatch2 != mu2.matches().end(); ++chamberMatch2) {
809  if (chamberMatch2->segmentMatches.empty()) continue;
810  if (chamberMatch2->id() != chamberMatch->id()) continue;
811  for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
812  segmentMatch != chamberMatch->segmentMatches.end(); ++segmentMatch) {
813  if (!segmentMatch->isMask(segmentArbitrationMask)) continue;
814  for(std::vector<reco::MuonSegmentMatch>::const_iterator segmentMatch2 = chamberMatch2->segmentMatches.begin();
815  segmentMatch2 != chamberMatch2->segmentMatches.end(); ++segmentMatch2) {
816  if (!segmentMatch2->isMask(segmentArbitrationMask)) continue;
817  if ((segmentMatch->cscSegmentRef.isNonnull() && segmentMatch->cscSegmentRef == segmentMatch2->cscSegmentRef) ||
818  (segmentMatch-> dtSegmentRef.isNonnull() && segmentMatch-> dtSegmentRef == segmentMatch2-> dtSegmentRef) ) {
819  ++ret;
820  } // is the same
821  } // segment of mu2 in chamber
822  } // segment of mu1 in chamber
823  } // chamber of mu2
824  } // chamber of mu1
825 
826  return ret;
827 }
const int mu
Definition: Constants.h:22
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(), 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 91 of file MuonCocktails.h.

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

93  {
94  return muon::sigmaSwitch(muon.globalTrack(),
95  muon.innerTrack(),
96  nSigma,
97  ptThreshold);
98  }
virtual TrackRef innerTrack() const
Definition: Muon.h:48
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:54
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 = 17.,
const double  tune2 = 40.,
const double  dptcut = 0.25 
)

Definition at line 9 of file MuonCocktails.cc.

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

Referenced by MuonIdProducer::makeMuon(), MuonsFromRefitTracksProducer::produce(), PFMuonAlgo::reconstructMuon(), 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:79
double trackProbability(const reco::TrackRef track)
std::pair< TrackRef, Muon::MuonTrackType > MuonTrackTypePair
Definition: Muon.h:40
reco::Muon::MuonTrackTypePair muon::tevOptimized ( const reco::Muon muon,
const double  ptThreshold = 200.,
const double  tune1 = 17.,
const double  tune2 = 40.,
const double  dptcut = 0.25 
)
inline

Definition at line 29 of file MuonCocktails.h.

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

33  {
34  return tevOptimized(muon.globalTrack(),
35  muon.innerTrack(),
36  muon.tpfmsTrack(),
37  muon.pickyTrack(),
38  ptThreshold,
39  tune1,
40  tune2,
41  dptcut);
42  }
virtual TrackRef innerTrack() const
Definition: Muon.h:48
virtual TrackRef tpfmsTrack() const
Definition: Muon.h:57
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=17., const double tune2=40., const double dptcut=0.25)
Definition: MuonCocktails.cc:9
virtual TrackRef pickyTrack() const
Definition: Muon.h:58
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:54
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 = 17.,
const double  tune2 = 40.,
const double  dptcut = 0.25 
)
inline

Definition at line 54 of file MuonCocktails.h.

References getTevRefitTrack(), and tevOptimized().

62  {
63  return tevOptimized(combinedTrack,
64  trackerTrack,
65  getTevRefitTrack(combinedTrack, tevMap2),
66  getTevRefitTrack(combinedTrack, tevMap3),
67  ptThreshold,
68  tune1,
69  tune2,
70  dptcut);
71  }
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=17., const double tune2=40., const double dptcut=0.25)
Definition: MuonCocktails.cc:9
reco::TrackRef getTevRefitTrack(const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
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 73 of file MuonCocktails.h.

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

76  {
77  return tevOptimized(muon.combinedMuon(),
78  muon.track(),
79  getTevRefitTrack(muon.combinedMuon(), tevMap2),
80  getTevRefitTrack(muon.combinedMuon(), tevMap3));
81  }
virtual TrackRef track() const
reference to a Track
Definition: Muon.h:49
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=17., const double tune2=40., const double dptcut=0.25)
Definition: MuonCocktails.cc:9
virtual TrackRef combinedMuon() const
reference to a stand-alone muon Track
Definition: Muon.h:55
reco::TrackRef getTevRefitTrack(const reco::TrackRef &combinedTrack, const reco::TrackToTrackMap &map)
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 }