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() [1/2]

Lut::Lut ( )
inline

Definition at line 33 of file Lut.h.

33 {};

◆ Lut() [2/2]

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(), dqmMemoryStats::float, m_d, m_pitch_d_ST, m_ST, m_wheel, m_Xcn, DTConfigLUTs::Wheel(), and DTConfigLUTs::Xcn().

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

◆ ~Lut()

Lut::~Lut ( )

Definition at line 39 of file Lut.cc.

39 {}

Member Function Documentation

◆ DSPtoIEEE32()

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

◆ get_k()

int Lut::get_k ( int  addr) const

Definition at line 107 of file Lut.cc.

References generateTowerEtThresholdLUT::addr, ANGRESOL, CELL_PITCH, dqmMemoryStats::float, mps_fire::i, m_ST, m_wheel, SL_D, and x.

Referenced by DTTracoChip::calculateAngles().

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

◆ get_x()

int Lut::get_x ( int  addr) const

Definition at line 121 of file Lut.cc.

References a, generateTowerEtThresholdLUT::addr, b, dqmMemoryStats::float, mps_fire::i, m_d, m_pitch_d_ST, m_wheel, m_Xcn, POSRESOL, SL_DIFF, and x.

Referenced by DTTracoChip::calculateAngles().

121  {
122  int i;
123  float a, b, x;
124 
125  if (addr <= 511) // LUT outer
126  {
127  i = addr;
128  b = m_d + SL_DIFF;
129  } else if (addr <= 1023) // LUT inner
130  {
131  i = addr - 512;
132  b = m_d - SL_DIFF;
133  } else // LUT correlati
134  {
135  i = addr - 1024;
136  b = m_d;
137  }
138  a = m_Xcn - (m_pitch_d_ST * (float)i * (float)m_wheel);
139  x = a / b;
140 
141  x = atanf(x);
142  x = x * POSRESOL;
143 
144  return (int)x;
145 }
float m_Xcn
Definition: Lut.h:50
float m_pitch_d_ST
Definition: Lut.h:55
float m_d
Definition: Lut.h:49
#define POSRESOL
Definition: Lut.h:26
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
int m_wheel
Definition: Lut.h:52
#define SL_DIFF
Definition: Lut.h:29

◆ IEEE32toDSP()

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

◆ setForTestBeam()

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

Definition at line 41 of file Lut.cc.

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

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

Member Data Documentation

◆ _conf_luts

const DTConfigLUTs* Lut::_conf_luts
private

Definition at line 57 of file Lut.h.

Referenced by Lut().

◆ m_d

float Lut::m_d

Definition at line 49 of file Lut.h.

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

◆ m_pitch_d_ST

float Lut::m_pitch_d_ST
private

Definition at line 55 of file Lut.h.

Referenced by get_x(), and Lut().

◆ m_ST

int Lut::m_ST

Definition at line 51 of file Lut.h.

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

◆ m_wheel

int Lut::m_wheel

Definition at line 52 of file Lut.h.

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

◆ m_Xcn

float Lut::m_Xcn

Definition at line 50 of file Lut.h.

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