Functions | |
reco::TrackRef | findOppositeTrack (const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05) |
std::pair< double, double > | matchTracks (const reco::Track &ref, const reco::Track &probe) |
reco::TrackRef muonid::findOppositeTrack | ( | const edm::Handle< reco::TrackCollection > & | collection, |
const reco::Track & | muon, | ||
double | angleMatch = 0.01 , |
||
double | momentumMatch = 0.05 |
||
) |
Definition at line 29 of file MuonCosmicsId.cc.
References i, match(), and matchTracks().
Referenced by MuonCosmicCompatibilityFiller::backToBack2LegCosmic(), CosmicsMuonIdProducer::produce(), and TrajectorySeedFromMuonProducer::produce().
{ for (unsigned int i=0; i<tracks->size(); ++i){ // When both tracks are reconstructed as outside going, sign is -1 // otherwise it's +1. There is also a crazy case of both are outside // going, then sign is -1 as well. const std::pair<double,double>& match = matchTracks(muonTrack,tracks->at(i)); if ( match.first < angleMatch && match.second < momentumMatch ) return reco::TrackRef(tracks,i); } return reco::TrackRef(); }
std::pair< double, double > muonid::matchTracks | ( | const reco::Track & | ref, |
const reco::Track & | probe | ||
) |
Definition at line 12 of file MuonCosmicsId.cc.
References directionAlongMomentum(), reco::TrackBase::p(), reco::TrackBase::pt(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), query::result, and mathSSE::sqrt().
Referenced by findOppositeTrack().
{ std::pair<double,double> result(0,0); // When both tracks are reconstructed as outside going, sign is -1 // otherwise it's +1. There is also a crazy case of both are outside // going, then sign is -1 as well. int match_sign = directionAlongMomentum(ref)==directionAlongMomentum(probe) ? -1 : +1; double sprod = ref.px()*probe.px() + ref.py()*probe.py() + ref.pz()*probe.pz(); double argCos = match_sign*(sprod/ref.p()/probe.p()); if (argCos < -1.0) argCos = -1.0; if (argCos > 1.0) argCos = 1.0; result.first = acos( argCos ); result.second = fabs(probe.pt()-ref.pt())/sqrt(ref.pt()*probe.pt()); //SK: take a geom-mean pt return result; }