CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonArbitrationMethods.h
Go to the documentation of this file.
1 #ifndef MuonIdentification_MuonArbitrationMethods_h
2 #define MuonIdentification_MuonArbitrationMethods_h
3 
5 
6 // Author: Jake Ribnik (UCSB)
7 
11  SortMuonSegmentMatches( unsigned int flag ) {
12  flag_ = flag;
13  }
15  bool operator() ( std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> p1,
16  std::pair<reco::MuonChamberMatch*,reco::MuonSegmentMatch*> p2 )
17  {
18  reco::MuonChamberMatch* cm1 = p1.first;
19  reco::MuonSegmentMatch* sm1 = p1.second;
20  reco::MuonChamberMatch* cm2 = p2.first;
21  reco::MuonSegmentMatch* sm2 = p2.second;
22 
26  return fabs(sm1->x-cm1->x) < fabs(sm2->x-cm2->x);
30  {
31  if((! sm1->hasZed()) || (! sm2->hasZed())) // no y information so return dx
32  return fabs(sm1->x-cm1->x) < fabs(sm2->x-cm2->x);
33  return sqrt(pow(sm1->x-cm1->x,2)+pow(sm1->y-cm1->y,2)) <
34  sqrt(pow(sm2->x-cm2->x,2)+pow(sm2->y-cm2->y,2));
35  }
39  return fabs(sm1->dXdZ-cm1->dXdZ) < fabs(sm2->dXdZ-cm2->dXdZ);
43  {
44  if((! sm1->hasZed()) || (! sm2->hasZed())) // no y information so return dx
45  return fabs(sm1->dXdZ-cm1->dXdZ) < fabs(sm2->dXdZ-cm2->dXdZ);
46  return sqrt(pow(sm1->dXdZ-cm1->dXdZ,2)+pow(sm1->dYdZ-cm1->dYdZ,2)) <
47  sqrt(pow(sm2->dXdZ-cm2->dXdZ,2)+pow(sm2->dYdZ-cm2->dYdZ,2));
48  }
49 
50  return false; // is this appropriate? fix this
51  }
52 
53  unsigned int flag_;
54 };
55 
56 #endif
static const unsigned int BestInStationByDRSlope
static const unsigned int BelongsToTrackByDXSlope
static const unsigned int BestInStationByDR
SortMuonSegmentMatches(unsigned int flag)
constructor takes arbitration type
T sqrt(T t)
Definition: SSEVec.h:18
static const unsigned int BestInChamberByDX
static const unsigned int BestInChamberByDR
double p2[4]
Definition: TauolaWrapper.h:90
static const unsigned int BestInStationByDXSlope
static const unsigned int BestInChamberByDXSlope
static const unsigned int BelongsToTrackByDRSlope
static const unsigned int BelongsToTrackByDR
static const unsigned int BelongsToTrackByDX
double p1[4]
Definition: TauolaWrapper.h:89
functor predicate for standard library sort algorithm
static const unsigned int BestInStationByDX
static const unsigned int BestInChamberByDRSlope
bool operator()(std::pair< reco::MuonChamberMatch *, reco::MuonSegmentMatch * > p1, std::pair< reco::MuonChamberMatch *, reco::MuonSegmentMatch * > p2)
sorts vector of pairs of chamber and segment pointers
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40