CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
SortMuonSegmentMatches Struct Reference

functor predicate for standard library sort algorithm More...

#include <MuonArbitrationMethods.h>

Public Member Functions

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 More...
 
 SortMuonSegmentMatches (unsigned int flag)
 constructor takes arbitration type More...
 

Public Attributes

unsigned int flag_
 

Detailed Description

functor predicate for standard library sort algorithm

Definition at line 12 of file MuonArbitrationMethods.h.

Constructor & Destructor Documentation

◆ SortMuonSegmentMatches()

SortMuonSegmentMatches::SortMuonSegmentMatches ( unsigned int  flag)
inline

constructor takes arbitration type

Definition at line 14 of file MuonArbitrationMethods.h.

14 { flag_ = flag; }

References RemoveAddSevLevel::flag, and flag_.

Member Function Documentation

◆ operator()()

bool SortMuonSegmentMatches::operator() ( std::pair< reco::MuonChamberMatch *, reco::MuonSegmentMatch * >  p1,
std::pair< reco::MuonChamberMatch *, reco::MuonSegmentMatch * >  p2 
)
inline

sorts vector of pairs of chamber and segment pointers

Definition at line 16 of file MuonArbitrationMethods.h.

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 
25  return fabs(sm1->x - cm1->x) < fabs(sm2->x - cm2->x);
28  if ((!sm1->hasZed()) || (!sm2->hasZed())) // no y information so return dx
29  return fabs(sm1->x - cm1->x) < fabs(sm2->x - cm2->x);
30  return sqrt(pow(sm1->x - cm1->x, 2) + pow(sm1->y - cm1->y, 2)) <
31  sqrt(pow(sm2->x - cm2->x, 2) + pow(sm2->y - cm2->y, 2));
32  }
36  return fabs(sm1->dXdZ - cm1->dXdZ) < fabs(sm2->dXdZ - cm2->dXdZ);
40  if ((!sm1->hasZed()) || (!sm2->hasZed())) // no y information so return dx
41  return fabs(sm1->dXdZ - cm1->dXdZ) < fabs(sm2->dXdZ - cm2->dXdZ);
42  return sqrt(pow(sm1->dXdZ - cm1->dXdZ, 2) + pow(sm1->dYdZ - cm1->dYdZ, 2)) <
43  sqrt(pow(sm2->dXdZ - cm2->dXdZ, 2) + pow(sm2->dYdZ - cm2->dYdZ, 2));
44  }
45 
46  return false; // is this appropriate? fix this
47  }

References reco::MuonSegmentMatch::BelongsToTrackByDR, reco::MuonSegmentMatch::BelongsToTrackByDRSlope, reco::MuonSegmentMatch::BelongsToTrackByDX, reco::MuonSegmentMatch::BelongsToTrackByDXSlope, reco::MuonSegmentMatch::BestInChamberByDR, reco::MuonSegmentMatch::BestInChamberByDRSlope, reco::MuonSegmentMatch::BestInChamberByDX, reco::MuonSegmentMatch::BestInChamberByDXSlope, reco::MuonSegmentMatch::BestInStationByDR, reco::MuonSegmentMatch::BestInStationByDRSlope, reco::MuonSegmentMatch::BestInStationByDX, reco::MuonSegmentMatch::BestInStationByDXSlope, reco::MuonChamberMatch::dXdZ, reco::MuonSegmentMatch::dXdZ, reco::MuonChamberMatch::dYdZ, reco::MuonSegmentMatch::dYdZ, flag_, reco::MuonSegmentMatch::hasZed(), p1, p2, funct::pow(), mathSSE::sqrt(), reco::MuonChamberMatch::x, reco::MuonSegmentMatch::x, reco::MuonChamberMatch::y, and reco::MuonSegmentMatch::y.

Member Data Documentation

◆ flag_

unsigned int SortMuonSegmentMatches::flag_

Definition at line 49 of file MuonArbitrationMethods.h.

Referenced by operator()(), and SortMuonSegmentMatches().

reco::MuonSegmentMatch::BelongsToTrackByDXSlope
static const unsigned int BelongsToTrackByDXSlope
Definition: MuonSegmentMatch.h:26
reco::MuonChamberMatch::x
float x
Definition: MuonChamberMatch.h:19
reco::MuonSegmentMatch::BestInStationByDRSlope
static const unsigned int BestInStationByDRSlope
Definition: MuonSegmentMatch.h:23
reco::MuonChamberMatch::dYdZ
float dYdZ
Definition: MuonChamberMatch.h:24
reco::MuonSegmentMatch::y
float y
Definition: MuonSegmentMatch.h:35
reco::MuonSegmentMatch::BelongsToTrackByDR
static const unsigned int BelongsToTrackByDR
Definition: MuonSegmentMatch.h:25
reco::MuonSegmentMatch::BestInStationByDX
static const unsigned int BestInStationByDX
Definition: MuonSegmentMatch.h:20
reco::MuonSegmentMatch::hasZed
bool hasZed() const
Definition: MuonSegmentMatch.h:56
reco::MuonSegmentMatch::BelongsToTrackByDRSlope
static const unsigned int BelongsToTrackByDRSlope
Definition: MuonSegmentMatch.h:27
reco::MuonSegmentMatch::BestInStationByDXSlope
static const unsigned int BestInStationByDXSlope
Definition: MuonSegmentMatch.h:22
reco::MuonSegmentMatch
Definition: MuonSegmentMatch.h:12
reco::MuonSegmentMatch::BestInChamberByDX
static const unsigned int BestInChamberByDX
Definition: MuonSegmentMatch.h:16
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
reco::MuonSegmentMatch::dYdZ
float dYdZ
Definition: MuonSegmentMatch.h:39
reco::MuonChamberMatch::dXdZ
float dXdZ
Definition: MuonChamberMatch.h:23
p1
double p1[4]
Definition: TauolaWrapper.h:89
reco::MuonChamberMatch
Definition: MuonChamberMatch.h:10
reco::MuonSegmentMatch::dXdZ
float dXdZ
Definition: MuonSegmentMatch.h:38
reco::MuonSegmentMatch::BestInChamberByDRSlope
static const unsigned int BestInChamberByDRSlope
Definition: MuonSegmentMatch.h:19
reco::MuonChamberMatch::y
float y
Definition: MuonChamberMatch.h:20
reco::MuonSegmentMatch::BestInChamberByDXSlope
static const unsigned int BestInChamberByDXSlope
Definition: MuonSegmentMatch.h:18
reco::MuonSegmentMatch::BestInStationByDR
static const unsigned int BestInStationByDR
Definition: MuonSegmentMatch.h:21
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
SortMuonSegmentMatches::flag_
unsigned int flag_
Definition: MuonArbitrationMethods.h:49
reco::MuonSegmentMatch::BelongsToTrackByDX
static const unsigned int BelongsToTrackByDX
Definition: MuonSegmentMatch.h:24
reco::MuonSegmentMatch::x
float x
Definition: MuonSegmentMatch.h:34
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
reco::MuonSegmentMatch::BestInChamberByDR
static const unsigned int BestInChamberByDR
Definition: MuonSegmentMatch.h:17