BmnRoot
Loading...
Searching...
No Matches
L1Branch.h
Go to the documentation of this file.
1/*
2 *====================================================================
3 *
4 * CBM Level 1 Reconstruction
5 *
6 * Authors: I.Kisel, S.Gorbunov
7 *
8 * e-mail : ikisel@kip.uni-heidelberg.de
9 *
10 *====================================================================
11 *
12 * L1 branch class
13 *
14 *====================================================================
15 */
16
17#ifndef L1Branch_H
18#define L1Branch_H
19
20#include "L1StsHit.h"
21
22#include <vector>
23
24class L1Triplet;
25
27{
29 : Quality(0)
30 , Momentum(0)
31 , chi2(0)
32 , StsHits()
33 {
34 StsHits.resize(12);
35 }
36
37 unsigned short int Quality;
38 float Momentum, chi2;
39 std::vector<THitI> StsHits;
40
41 void Set(unsigned char iStation, unsigned char Length, float Chi2, float Qp)
42 {
43 unsigned short int ista = 16 - iStation;
44 float tmp = sqrt(Chi2) / 3.5 * 255;
45 if (tmp > 255)
46 tmp = 255;
47 unsigned short int chi_2 = 255 - static_cast<unsigned char>(tmp);
48 Quality = (Length << 12) + (ista << 8) + chi_2;
49 Momentum = 1.0 / fabs(Qp);
50 // chi2 = chi_2;
51 chi2 = Chi2;
52 }
53
54 void SetLength(unsigned char Length) { Quality += -(Quality >> 12) + (Length << 12); }
55
56 static bool compareChi2(const L1Branch& a, const L1Branch& b) { return (a.Quality > b.Quality); }
57 static bool comparePChi2(const L1Branch* a, const L1Branch* b) { return compareChi2(*a, *b); }
58 static bool compareMomentum(const L1Branch& a, const L1Branch& b) { return (a.Momentum > b.Momentum); }
59 static bool comparePMomentum(const L1Branch* a, const L1Branch* b) { return compareMomentum(*a, *b); }
60};
61
62#endif
friend F32vec4 sqrt(const F32vec4 &a)
Definition P4_F32vec4.h:34
friend F32vec4 fabs(const F32vec4 &a)
Definition P4_F32vec4.h:52
static bool compareChi2(const L1Branch &a, const L1Branch &b)
Definition L1Branch.h:56
float Momentum
Definition L1Branch.h:38
float chi2
Definition L1Branch.h:38
std::vector< THitI > StsHits
Definition L1Branch.h:39
void SetLength(unsigned char Length)
Definition L1Branch.h:54
static bool comparePMomentum(const L1Branch *a, const L1Branch *b)
Definition L1Branch.h:59
void Set(unsigned char iStation, unsigned char Length, float Chi2, float Qp)
Definition L1Branch.h:41
L1Branch()
Definition L1Branch.h:28
static bool comparePChi2(const L1Branch *a, const L1Branch *b)
Definition L1Branch.h:57
unsigned short int Quality
Definition L1Branch.h:37
static bool compareMomentum(const L1Branch &a, const L1Branch &b)
Definition L1Branch.h:58