CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

Lut Class Reference

#include <Lut.h>

List of all members.

Public Member Functions

void DSPtoIEEE32 (short DSPmantissa, short DSPexp, float *f)
int get_k (int addr)
int get_x (int addr)
void IEEE32toDSP (float f, short *DSPmantissa, short *DSPexp)
 Lut (DTConfigLUTs *conf, int ntc, float SL_shift)
 Lut ()
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

DTConfigLUTs_conf_luts
float m_pitch_d_ST

Detailed Description

Class for computing single Traco LUT from given parameters

Date:
2011/02/10 12:41:00
Author:
S. Vanini

Definition at line 33 of file Lut.h.


Constructor & Destructor Documentation

Lut::Lut ( ) [inline]

Definition at line 36 of file Lut.h.

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

Definition at line 14 of file Lut.cc.

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

                                                   : _conf_luts(conf) {

  // set parameters from configuration
  m_d           = _conf_luts->D(); 
  m_ST          = _conf_luts->BTIC();
  m_wheel       = _conf_luts->Wheel();

  // 110208 SV TRACO hardware bug included: Xcn must be corrected because Xcn parameter has been
  // inserted in hardware strings with the shift included, because TRACO doesn't apply shift in positive cases
  float Xcn_corr    = _conf_luts->Xcn();
  if(SL_shift > 0){
    if(Xcn_corr > 0)
      Xcn_corr = Xcn_corr - SL_shift;
    if(Xcn_corr < 0)
      Xcn_corr = Xcn_corr + SL_shift;
  }
        
  m_Xcn         = Xcn_corr - (CELL_PITCH * 4.0 * (float)(ntc-1) * (float) m_wheel);
  m_pitch_d_ST  = CELL_PITCH / m_ST;


  //std::cout<< "Lut::Lut  ->  m_d " << m_d << " m_ST " << m_ST << " m_wheel " << m_wheel << " m_Xcn " << m_Xcn << " ntc " << ntc << std::endl;
  return;
}
Lut::~Lut ( )

Definition at line 39 of file Lut.cc.

{}

Member Function Documentation

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

Definition at line 109 of file Lut.cc.

References ANGRESOL, CELL_PITCH, i, m_ST, m_wheel, SL_D, and x.

Referenced by DTTracoChip::calculateAngles().

                         {
//FIX attenzione controlla addr - 511 o -512???
  int i;
  float x;
  i = addr - 512;
  x = (float)i * CELL_PITCH / ( SL_D * m_ST );
  x = atanf(x);
  x = x * ANGRESOL;
  if(m_wheel<0)
    x = -x;

  return (int)x;
}
int Lut::get_x ( int  addr)

Definition at line 123 of file Lut.cc.

References a, b, i, m_d, m_pitch_d_ST, m_wheel, m_Xcn, POSRESOL, SL_DIFF, and x.

Referenced by DTTracoChip::calculateAngles().

                         {
  int i;
  float a,b,x;

  if(addr<=511) //LUT outer
  {
        i=addr;
        b=m_d+SL_DIFF;
  }
  else if(addr<=1023) //LUT inner
  {
        i=addr-512;
        b=m_d-SL_DIFF;          
  }
  else  //LUT correlati
  {
        i=addr-1024;
        b=m_d;
  }
  a = m_Xcn - (m_pitch_d_ST * (float)i * (float)m_wheel);
  x = a/b;

  x = atanf(x);
  x = x * POSRESOL;

  return (int)x;
}
void Lut::IEEE32toDSP ( float  f,
short *  DSPmantissa,
short *  DSPexp 
)
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.

                                                            {
 // set parameters from fixed values for MB1 nd MB3 (used in Testbeams 2003 2004) 
  int nStat = station;
  int nBoard = board;
  int nTraco = traco;
  float tracoPos[50];

  if( nStat ==1 ){

    tracoPos[ 0] = -120.19;
    tracoPos[ 1] = -103.39;
    tracoPos[ 2] =  -86.59;
    tracoPos[ 3] =  -69.80;
    tracoPos[10] =  -52.99;
    tracoPos[11] =  -36.19;
    tracoPos[12] =  -19.39;
    tracoPos[13] =   -2.59;
    tracoPos[20] =   14.20;
    tracoPos[21] =   31.00;
    tracoPos[22] =   47.80;
    tracoPos[23] =   64.60;
    tracoPos[30] =   81.40;

    m_d  = 431.175;
    m_ST = 31;
    float m_Xc = tracoPos[ ( nBoard * 10 ) + nTraco ];
    float m_Xn = +39.0;
    m_Xcn =  m_Xn - m_Xc; 
    //m_stsize = m_CELL_PITCH / m_ST;
    //m_distp2 = 0.5 + ( 2.0 * m_CELL_H * m_ST / m_CELL_PITCH );
  }

  if( nStat ==3){
    tracoPos[ 0] = -165.45;
    tracoPos[ 1] = -148.65;
    tracoPos[ 2] = -131.85;
    tracoPos[ 3] = -115.05;
    tracoPos[10] =  -98.25;
    tracoPos[11] =  -81.45;
    tracoPos[12] =  -64.65;
    tracoPos[13] =  -47.85;
    tracoPos[20] =  -31.05;
    tracoPos[21] =  -14.25;
    tracoPos[22] =    2.54;
    tracoPos[23] =   19.34;
    tracoPos[30] =   36.14;
    tracoPos[31] =   52.94;
    tracoPos[32] =   69.74;
    tracoPos[33] =   86.54;
    tracoPos[40] =  103.34;
    tracoPos[41] =  120.14;
    tracoPos[42] =  136.94;
    tracoPos[43] =  153.74;

    m_d  = 512.47;
    m_ST = 31;
    float m_Xc = tracoPos[ ( nBoard * 10 ) + nTraco ];
    float m_Xn = -21.0;
    m_Xcn =  m_Xn - m_Xc; 
    //m_stsize = m_CELL_PITCH / m_ST;
    //m_distp2 = 0.5 + ( 2.0 * m_CELL_H * m_ST / m_CELL_PITCH );
  
  }

  return;
}

Member Data Documentation

Definition at line 60 of file Lut.h.

Referenced by Lut().

float Lut::m_d

Definition at line 52 of file Lut.h.

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

float Lut::m_pitch_d_ST [private]

Definition at line 58 of file Lut.h.

Referenced by get_x(), and Lut().

int Lut::m_ST

Definition at line 54 of file Lut.h.

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

Definition at line 55 of file Lut.h.

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

float Lut::m_Xcn

Definition at line 53 of file Lut.h.

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