CbmRoot
L1Triplet.h
Go to the documentation of this file.
1 #ifndef L1Triplet_H
2 #define L1Triplet_H
3 #include "../CbmL1Def.h"
4 class L1Triplet {
5 public:
6  // static bool compareChain(const L1Triplet *a, const L1Triplet *b){
7  // return a->chi2Chain < b->chi2Chain;
8  // }
9  // int sta;
10  // int por;
11  // int tr;
12  // int loc;
13 
14 private:
15  unsigned int first_neighbour;
17  unsigned char bl; // level
18 
19  unsigned char st; // staL (4b), staM-1-staL (2b), staR-2-staL (2b)
20  fscal b1; // qp (8b)
22 
23  THitI w0; // left hit (16b) index in vStsHits array
24  THitI w1; // middle hit(16b)
25  THitI w2; // right hit(16b)
26  // unsigned char b0; // chi2(5b) + level(3b)
27 
28 
29 public:
30  // std::vector<unsigned int> neighbours;
31 
32  static bool compare(const L1Triplet* a,
33  const L1Triplet* b) { // sort in back order
34  return ((a->GetLHit() > b->GetLHit()))
35  || ((a->GetLHit() == b->GetLHit()) && (a->GetMHit() < b->GetMHit()))
36  || ((a->GetLHit() == b->GetLHit()) && (a->GetMHit() == b->GetMHit())
37  && (a->GetRHit() < b->GetRHit()));
38  // return a.GetLHit() > b.GetLHit();
39  }
40 
41  static bool compare(const L1Triplet& a,
42  const L1Triplet& b) { // sort in back order
43  return ((a.GetLHit() > b.GetLHit()))
44  || ((a.GetLHit() == b.GetLHit()) && (a.GetMHit() < b.GetMHit()))
45  || ((a.GetLHit() == b.GetLHit()) && (a.GetMHit() == b.GetMHit())
46  && (a.GetRHit() < b.GetRHit()));
47  // return a.GetLHit() > b.GetLHit();
48  }
49 
50  // static bool compareLevel(const L1Triplet *a, const L1Triplet *b){ // sort in back order
51  // return ( a->GetLevel() > b->GetLevel() );
52  //
53  // }
54 
55  static bool compareLevel(const L1Triplet& a,
56  const L1Triplet& b) { // sort in back order
57  return (a.GetLevel() > b.GetLevel());
58  }
59 
60  static bool compareLevelT(const L1Triplet a,
61  const L1Triplet b) { // sort in back order
62  return (a.GetLevel() > b.GetLevel());
63  }
64 
65 
68 
69 
71  : first_neighbour(0)
72  , last_neighbour(0)
73  , bl()
74  , st()
75  , b1(0)
76  , chi2double(0)
77  , w0()
78  , w1()
79  , w2()
80 
81  , Cqp(0)
82  , tx(0)
83  , ty(0)
84  , Ctx(0)
85  , Cty(0) {};
86 
87  void Set(unsigned int iHitL,
88  unsigned int iHitM,
89  unsigned int iHitR,
90  unsigned int iStaL,
91  unsigned int iStaM,
92  unsigned int iStaR,
93  unsigned char Level,
94  fscal Qp,
95  fscal Chi2,
96  fscal /*time_*/ = 0,
97  fscal _Cqp = 0,
98  int /*_n*/ = 0) {
99  w0 = iHitL;
100  w1 = iHitM;
101  w2 = iHitR;
102 
103  // Chi2 = sqrt(fabs(Chi2))*31./3.5 ; // 3.5 == 31
104  chi2double = Chi2;
105  // if( Chi2>31 || !finite(Chi2) ) Chi2 = 31;
106  // b0 = ( (static_cast<unsigned char>( Chi2 ))<<3 ) + (Level%8);
107  b1 = Qp;
108  bl = Level;
109 
110  st = (iStaL << 4) + ((iStaM - iStaL - 1) << 2) + (iStaR - iStaL - 2);
111  // time = time_;
112  Cqp = _Cqp;
113  // n = _n;
114  }
115 
116  void SetLevel(unsigned char Level) { bl = Level; }
117 
118 
119  THitI GetLHit() const { return w0; }
120  THitI GetMHit() const { return w1; }
121  THitI GetRHit() const { return w2; }
122  char GetNNeighbours() const { return last_neighbour; }
123  void SetNNeighbours(unsigned char n) { last_neighbour = n; }
124  unsigned int GetFNeighbour() const { return first_neighbour; }
125  void SetFNeighbour(unsigned int n) { first_neighbour = n; }
126 
127  // unsigned int GetFirstNeighbour() const {
128  // return w1;
129  // }
130  // unsigned int GetNNeighbours() const {
131  // return w2;
132  // }
133 
134  unsigned char GetLevel() const {
135  // return b0%8;
136  return bl;
137  }
138 
139  fscal GetQp() const { return b1; }
140 
141  fscal GetChi2() const {
142  // float x = (b0>>3)*3.5/31.;
143  // return x*x;
144  return chi2double;
145  }
146 
147  fscal Time() const {
148  // float x = (b0>>3)*3.5/31.;
149  // return x*x;
150  // return time;
151  return -111.;
152  }
153 
154  fscal GetQpOrig() { return b1; }
155 
156  int GetLSta() const { return st >> 4; }
157 
158  int GetMSta() const { return ((st % 16) >> 2) + GetLSta() + 1; }
159 
160  int GetRSta() const { return (st % 4) + GetLSta() + 2; }
161 };
162 
163 #endif
fscal
float fscal
Definition: L1/vectors/P4_F32vec4.h:250
L1Triplet::st
unsigned char st
Definition: L1Triplet.h:19
L1Triplet::w1
THitI w1
Definition: L1Triplet.h:24
L1Triplet::Set
void Set(unsigned int iHitL, unsigned int iHitM, unsigned int iHitR, unsigned int iStaL, unsigned int iStaM, unsigned int iStaR, unsigned char Level, fscal Qp, fscal Chi2, fscal=0, fscal _Cqp=0, int=0)
Definition: L1Triplet.h:87
L1Triplet::Cty
fscal Cty
Definition: L1Triplet.h:67
L1Triplet
Definition: L1Triplet.h:4
L1Triplet::bl
unsigned char bl
Definition: L1Triplet.h:17
L1Triplet::GetFNeighbour
unsigned int GetFNeighbour() const
Definition: L1Triplet.h:124
L1Triplet::GetRSta
int GetRSta() const
Definition: L1Triplet.h:160
L1Triplet::L1Triplet
L1Triplet()
Definition: L1Triplet.h:70
L1Triplet::GetRHit
THitI GetRHit() const
Definition: L1Triplet.h:121
L1Triplet::SetFNeighbour
void SetFNeighbour(unsigned int n)
Definition: L1Triplet.h:125
L1Triplet::Time
fscal Time() const
Definition: L1Triplet.h:147
L1Triplet::Cqp
fscal Cqp
Definition: L1Triplet.h:66
THitI
unsigned int THitI
Definition: L1StsHit.h:8
L1Triplet::GetChi2
fscal GetChi2() const
Definition: L1Triplet.h:141
L1Triplet::Ctx
fscal Ctx
Definition: L1Triplet.h:67
L1Triplet::compare
static bool compare(const L1Triplet &a, const L1Triplet &b)
Definition: L1Triplet.h:41
L1Triplet::tx
fscal tx
Definition: L1Triplet.h:67
L1Triplet::ty
fscal ty
Definition: L1Triplet.h:67
L1Triplet::SetLevel
void SetLevel(unsigned char Level)
Definition: L1Triplet.h:116
L1Triplet::GetLevel
unsigned char GetLevel() const
Definition: L1Triplet.h:134
L1Triplet::GetLHit
THitI GetLHit() const
Definition: L1Triplet.h:119
L1Triplet::compare
static bool compare(const L1Triplet *a, const L1Triplet *b)
Definition: L1Triplet.h:32
L1Triplet::GetMSta
int GetMSta() const
Definition: L1Triplet.h:158
L1Triplet::GetQp
fscal GetQp() const
Definition: L1Triplet.h:139
L1Triplet::GetNNeighbours
char GetNNeighbours() const
Definition: L1Triplet.h:122
L1Triplet::w0
THitI w0
Definition: L1Triplet.h:23
L1Triplet::b1
fscal b1
Definition: L1Triplet.h:20
L1Triplet::chi2double
fscal chi2double
Definition: L1Triplet.h:21
L1Triplet::first_neighbour
unsigned int first_neighbour
Definition: L1Triplet.h:15
L1Triplet::GetMHit
THitI GetMHit() const
Definition: L1Triplet.h:120
L1Triplet::last_neighbour
char last_neighbour
Definition: L1Triplet.h:16
L1Triplet::GetQpOrig
fscal GetQpOrig()
Definition: L1Triplet.h:154
L1Triplet::SetNNeighbours
void SetNNeighbours(unsigned char n)
Definition: L1Triplet.h:123
L1Triplet::compareLevel
static bool compareLevel(const L1Triplet &a, const L1Triplet &b)
Definition: L1Triplet.h:55
L1Triplet::w2
THitI w2
Definition: L1Triplet.h:25
L1Triplet::compareLevelT
static bool compareLevelT(const L1Triplet a, const L1Triplet b)
Definition: L1Triplet.h:60
L1Triplet::GetLSta
int GetLSta() const
Definition: L1Triplet.h:156