CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
Lut Class Reference

#include <Lut.h>

Public Member Functions

void DSPtoIEEE32 (short DSPmantissa, short DSPexp, float *f)
 
int get_k (int addr) const
 
int get_x (int addr) const
 
void IEEE32toDSP (float f, short *DSPmantissa, short *DSPexp)
 
 Lut ()
 
 Lut (const DTConfigLUTs *conf, int ntc, float SL_shift)
 
void setForTestBeam (int station, int board, int traco)
 
 ~Lut ()
 

Public Attributes

float m_d
 
int m_ST
 
int m_wheel
 
float m_Xcn
 

Private Attributes

const DTConfigLUTs_conf_luts
 
float m_pitch_d_ST
 

Detailed Description

Class for computing single Traco LUT from given parameters

Author
S. Vanini

Definition at line 31 of file Lut.h.

Constructor & Destructor Documentation

Lut::Lut ( )
inline

Definition at line 34 of file Lut.h.

References DSPtoIEEE32(), f, get_k(), get_x(), IEEE32toDSP(), setForTestBeam(), relativeConstraints::station, and ~Lut().

34 {};
Lut::Lut ( const DTConfigLUTs conf,
int  ntc,
float  SL_shift 
)

Definition at line 14 of file Lut.cc.

References _conf_luts, DTConfigLUTs::BTIC(), CELL_PITCH, DTConfigLUTs::D(), objects.autophobj::float, m_d, m_pitch_d_ST, m_ST, m_wheel, m_Xcn, DTConfigLUTs::Wheel(), and DTConfigLUTs::Xcn().

14  : _conf_luts(conf) {
15 
16  // set parameters from configuration
17  m_d = _conf_luts->D();
18  m_ST = _conf_luts->BTIC();
20 
21  // 110208 SV TRACO hardware bug included: Xcn must be corrected because Xcn
22  // parameter has been inserted in hardware strings with the shift included,
23  // because TRACO doesn't apply shift in positive cases
24  float Xcn_corr = _conf_luts->Xcn();
25  if (SL_shift > 0) {
26  if (Xcn_corr > 0)
27  Xcn_corr = Xcn_corr - SL_shift;
28  if (Xcn_corr < 0)
29  Xcn_corr = Xcn_corr + SL_shift;
30  }
31 
32  m_Xcn = Xcn_corr - (CELL_PITCH * 4.0 * (float)(ntc - 1) * (float)m_wheel);
34 
35  // std::cout<< "Lut::Lut -> m_d " << m_d << " m_ST " << m_ST << " m_wheel "
36  // << m_wheel << " m_Xcn " << m_Xcn << " ntc " << ntc << std::endl;
37  return;
38 }
int m_ST
Definition: Lut.h:52
int Wheel() const
wheel sign (-1 or +1)
Definition: DTConfigLUTs.h:65
float m_Xcn
Definition: Lut.h:51
float m_pitch_d_ST
Definition: Lut.h:56
#define CELL_PITCH
Definition: Lut.h:28
float m_d
Definition: Lut.h:50
int BTIC() const
BTIC parameter.
Definition: DTConfigLUTs.h:56
float Xcn() const
Xcn: distance vertex to normal, unit cm.
Definition: DTConfigLUTs.h:62
int m_wheel
Definition: Lut.h:53
const DTConfigLUTs * _conf_luts
Definition: Lut.h:58
float D() const
d: distance vertex to normal, unit cm.
Definition: DTConfigLUTs.h:59
Lut::~Lut ( )

Definition at line 40 of file Lut.cc.

Referenced by Lut().

40 {}

Member Function Documentation

void Lut::DSPtoIEEE32 ( short  DSPmantissa,
short  DSPexp,
float *  f 
)

Referenced by Lut().

int Lut::get_k ( int  addr) const

Definition at line 109 of file Lut.cc.

References ANGRESOL, CELL_PITCH, objects.autophobj::float, mps_fire::i, m_ST, m_wheel, SL_D, and x.

Referenced by DTTracoChip::calculateAngles(), and Lut().

109  {
110  // FIX attenzione controlla addr - 511 o -512???
111  int i;
112  float x;
113  i = addr - 512;
114  x = (float)i * CELL_PITCH / (SL_D * m_ST);
115  x = atanf(x);
116  x = x * ANGRESOL;
117  if (m_wheel < 0)
118  x = -x;
119 
120  return (int)x;
121 }
#define ANGRESOL
Definition: Lut.h:25
int m_ST
Definition: Lut.h:52
#define CELL_PITCH
Definition: Lut.h:28
#define SL_D
Definition: Lut.h:27
int m_wheel
Definition: Lut.h:53
int Lut::get_x ( int  addr) const

Definition at line 123 of file Lut.cc.

References a, b, objects.autophobj::float, mps_fire::i, m_d, m_pitch_d_ST, m_wheel, m_Xcn, POSRESOL, SL_DIFF, and x.

Referenced by DTTracoChip::calculateAngles(), and Lut().

123  {
124  int i;
125  float a, b, x;
126 
127  if (addr <= 511) // LUT outer
128  {
129  i = addr;
130  b = m_d + SL_DIFF;
131  } else if (addr <= 1023) // LUT inner
132  {
133  i = addr - 512;
134  b = m_d - SL_DIFF;
135  } else // LUT correlati
136  {
137  i = addr - 1024;
138  b = m_d;
139  }
140  a = m_Xcn - (m_pitch_d_ST * (float)i * (float)m_wheel);
141  x = a / b;
142 
143  x = atanf(x);
144  x = x * POSRESOL;
145 
146  return (int)x;
147 }
float m_Xcn
Definition: Lut.h:51
return((rh^lh)&mask)
float m_pitch_d_ST
Definition: Lut.h:56
float m_d
Definition: Lut.h:50
#define POSRESOL
Definition: Lut.h:26
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
int m_wheel
Definition: Lut.h:53
#define SL_DIFF
Definition: Lut.h:29
void Lut::IEEE32toDSP ( float  f,
short *  DSPmantissa,
short *  DSPexp 
)

Referenced by Lut().

void Lut::setForTestBeam ( int  station,
int  board,
int  traco 
)

Definition at line 42 of file Lut.cc.

References m_d, m_ST, m_Xcn, and relativeConstraints::station.

Referenced by Lut().

42  {
43  // set parameters from fixed values for MB1 nd MB3 (used in Testbeams 2003
44  // 2004)
45  int nStat = station;
46  int nBoard = board;
47  int nTraco = traco;
48  float tracoPos[50];
49 
50  if (nStat == 1) {
51 
52  tracoPos[0] = -120.19;
53  tracoPos[1] = -103.39;
54  tracoPos[2] = -86.59;
55  tracoPos[3] = -69.80;
56  tracoPos[10] = -52.99;
57  tracoPos[11] = -36.19;
58  tracoPos[12] = -19.39;
59  tracoPos[13] = -2.59;
60  tracoPos[20] = 14.20;
61  tracoPos[21] = 31.00;
62  tracoPos[22] = 47.80;
63  tracoPos[23] = 64.60;
64  tracoPos[30] = 81.40;
65 
66  m_d = 431.175;
67  m_ST = 31;
68  float m_Xc = tracoPos[(nBoard * 10) + nTraco];
69  float m_Xn = +39.0;
70  m_Xcn = m_Xn - m_Xc;
71  // m_stsize = m_CELL_PITCH / m_ST;
72  // m_distp2 = 0.5 + ( 2.0 * m_CELL_H * m_ST / m_CELL_PITCH );
73  }
74 
75  if (nStat == 3) {
76  tracoPos[0] = -165.45;
77  tracoPos[1] = -148.65;
78  tracoPos[2] = -131.85;
79  tracoPos[3] = -115.05;
80  tracoPos[10] = -98.25;
81  tracoPos[11] = -81.45;
82  tracoPos[12] = -64.65;
83  tracoPos[13] = -47.85;
84  tracoPos[20] = -31.05;
85  tracoPos[21] = -14.25;
86  tracoPos[22] = 2.54;
87  tracoPos[23] = 19.34;
88  tracoPos[30] = 36.14;
89  tracoPos[31] = 52.94;
90  tracoPos[32] = 69.74;
91  tracoPos[33] = 86.54;
92  tracoPos[40] = 103.34;
93  tracoPos[41] = 120.14;
94  tracoPos[42] = 136.94;
95  tracoPos[43] = 153.74;
96 
97  m_d = 512.47;
98  m_ST = 31;
99  float m_Xc = tracoPos[(nBoard * 10) + nTraco];
100  float m_Xn = -21.0;
101  m_Xcn = m_Xn - m_Xc;
102  // m_stsize = m_CELL_PITCH / m_ST;
103  // m_distp2 = 0.5 + ( 2.0 * m_CELL_H * m_ST / m_CELL_PITCH );
104  }
105 
106  return;
107 }
int m_ST
Definition: Lut.h:52
float m_Xcn
Definition: Lut.h:51
float m_d
Definition: Lut.h:50

Member Data Documentation

const DTConfigLUTs* Lut::_conf_luts
private

Definition at line 58 of file Lut.h.

Referenced by Lut().

float Lut::m_d

Definition at line 50 of file Lut.h.

Referenced by get_x(), Lut(), and setForTestBeam().

float Lut::m_pitch_d_ST
private

Definition at line 56 of file Lut.h.

Referenced by get_x(), and Lut().

int Lut::m_ST

Definition at line 52 of file Lut.h.

Referenced by get_k(), Lut(), and setForTestBeam().

int Lut::m_wheel

Definition at line 53 of file Lut.h.

Referenced by get_k(), get_x(), and Lut().

float Lut::m_Xcn

Definition at line 51 of file Lut.h.

Referenced by get_x(), Lut(), and setForTestBeam().