Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
RecoMuon
MuonIdentification
src
MuonCosmicsId.cc
Go to the documentation of this file.
1
#include "
RecoMuon/MuonIdentification/interface/MuonCosmicsId.h
"
2
#include "
DataFormats/TrackReco/interface/Track.h
"
3
4
bool
directionAlongMomentum
(
const
reco::Track
& track){
5
// check is done in 2D
6
return
(track.
innerPosition
().x()-track.
vx
())*track.
px
() +
7
(track.
innerPosition
().y()-track.
vy
())*track.
py
() > 0;
8
}
9
10
// returns angle and dPt/Pt
11
std::pair<double, double>
12
muonid::matchTracks
(
const
reco::Track
& ref,
const
reco::Track
& probe)
13
{
14
std::pair<double,double>
result
(0,0);
15
// When both tracks are reconstructed as outside going, sign is -1
16
// otherwise it's +1. There is also a crazy case of both are outside
17
// going, then sign is -1 as well.
18
int
match_sign =
directionAlongMomentum
(ref)==
directionAlongMomentum
(probe) ? -1 : +1;
19
double
sprod = ref.
px
()*probe.
px
() + ref.
py
()*probe.
py
() + ref.
pz
()*probe.
pz
();
20
double
argCos = match_sign*(sprod/ref.
p
()/probe.
p
());
21
if
(argCos < -1.0) argCos = -1.0;
22
if
(argCos > 1.0) argCos = 1.0;
23
result.first = acos( argCos );
24
result.second = fabs(probe.
pt
()-ref.
pt
())/
sqrt
(ref.
pt
()*probe.
pt
());
//SK: take a geom-mean pt
25
return
result
;
26
}
27
28
reco::TrackRef
29
muonid::findOppositeTrack
(
const
edm::Handle<reco::TrackCollection>
&
tracks
,
30
const
reco::Track
& muonTrack,
31
double
angleMatch,
32
double
momentumMatch)
33
{
34
for
(
unsigned
int
i
=0;
i
<tracks->size(); ++
i
){
35
// When both tracks are reconstructed as outside going, sign is -1
36
// otherwise it's +1. There is also a crazy case of both are outside
37
// going, then sign is -1 as well.
38
const
std::pair<double,double>&
match
=
matchTracks
(muonTrack,tracks->at(
i
));
39
if
( match.first < angleMatch && match.second < momentumMatch )
40
return
reco::TrackRef
(tracks,
i
);
41
}
42
return
reco::TrackRef
();
43
44
}
reco::TrackBase::p
double p() const
momentum vector magnitude
Definition:
TrackBase.h:129
i
int i
Definition:
DBlmapReader.cc:9
muonid::findOppositeTrack
reco::TrackRef findOppositeTrack(const edm::Handle< reco::TrackCollection > &collection, const reco::Track &muon, double angleMatch=0.01, double momentumMatch=0.05)
Definition:
MuonCosmicsId.cc:29
MuonCosmicsId.h
reco::TrackBase::px
double px() const
x coordinate of momentum vector
Definition:
TrackBase.h:133
edm::Handle< reco::TrackCollection >
muonid::matchTracks
std::pair< double, double > matchTracks(const reco::Track &ref, const reco::Track &probe)
Definition:
MuonCosmicsId.cc:12
reco::Track::innerPosition
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition:
Track.h:42
directionAlongMomentum
bool directionAlongMomentum(const reco::Track &track)
Definition:
MuonCosmicsId.cc:4
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:48
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition:
TrackBase.h:131
query.result
tuple result
Definition:
query.py:137
reco::TrackBase::pz
double pz() const
z coordinate of momentum vector
Definition:
TrackBase.h:137
testEve_cfg.tracks
tuple tracks
Definition:
testEve_cfg.py:39
reco::TrackRef
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition:
TrackFwd.h:14
reco::Track
Definition:
Track.h:27
reco::TrackBase::vy
double vy() const
y coordinate of the reference point on track
Definition:
TrackBase.h:145
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:6
Track.h
edm::Ref
Definition:
AssociativeIterator.h:52
reco::TrackBase::py
double py() const
y coordinate of momentum vector
Definition:
TrackBase.h:135
reco::TrackBase::vx
double vx() const
x coordinate of the reference point on track
Definition:
TrackBase.h:143
Generated for CMSSW Reference Manual by
1.8.5