CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Static Private Attributes

DTDriftTimeParametrization Class Reference

#include <DTDriftTimeParametrization.h>

List of all members.

Classes

struct  drift_time
 Structure used to return output values. More...

Public Member Functions

 DTDriftTimeParametrization ()
 Constructor.
unsigned short MB_DT_drift_time (double x, double alpha, double by, double bz, short ifl, drift_time *DT, short interpolate) const
 Calculate drift time and spread.
virtual ~DTDriftTimeParametrization ()
 Destructor.

Private Member Functions

unsigned short MB_DT_Check_boundaries (double distime, double alpha, double by, double bz, short ifl) const
double MB_DT_delta_t (double, double *) const
void MB_DT_Get_grid_points (double alpha, double by, double bz, unsigned short *p_alpha, unsigned short *p_By, unsigned short *p_Bz, unsigned short *q_alpha, unsigned short *q_By, unsigned short *q_Bz) const
void MB_DT_Get_grid_values (double Var, unsigned short *pi, unsigned short *pj, short Initial, unsigned short N, const double *Values) const
double MB_DT_MLInterpolation (double *al, double *by, double *bz, double *f) const
double MB_DT_sigma_t_m (double, double *) const
double MB_DT_sigma_t_p (double, double *) const
double MB_DT_time (double, double *) const

Static Private Attributes

static const double alpha_value [N_alpha]
static const double By_value [N_By]
static const double Bz_value [N_Bz]
static const double fun_sigma_t [N_alpha][N_By][N_Bz][N_Sigma_t]
static const double fun_t [N_alpha][N_By][N_Bz][N_Par_t]
static const double velocitySkew

Detailed Description

Version 2.1 - November 18, 2003

MB_DT_drift_time() Calculates the drift time (ns)

See usage details in the README file delivered with the distribution.

Authors: Pablo Garcia-Abia and Jesus Puerta (CIEMAT, Madrid) Email: Pablo.Garcia@ciemat.es, Jesus.Puerta@ciemat.es

Definition at line 27 of file DTDriftTimeParametrization.h.


Constructor & Destructor Documentation

DTDriftTimeParametrization::DTDriftTimeParametrization ( )

Constructor.

Definition at line 30 of file DTDriftTimeParametrization.cc.

{}
DTDriftTimeParametrization::~DTDriftTimeParametrization ( ) [virtual]

Destructor.

Definition at line 32 of file DTDriftTimeParametrization.cc.

{}

Member Function Documentation

unsigned short DTDriftTimeParametrization::MB_DT_Check_boundaries ( double  distime,
double  alpha,
double  by,
double  bz,
short  ifl 
) const [private]

Referenced by MB_DT_drift_time().

double DTDriftTimeParametrization::MB_DT_delta_t ( double  dist,
double *  par 
) const [private]

Definition at line 189 of file DTDriftTimeParametrization.cc.

References x.

Referenced by MB_DT_drift_time().

                                                                                {
      double x2, x = fabs(dist);   // the parametrisations are symmetric under 'distance'

#ifdef MB_DT_DEBUG
      printf("MB_DT_delta_t:  distance = %f\n",dist);
#endif

      if (x > 20.5) x = 20.5;

      x2 = x*x;

      if ( x <= par[15] ) { return ( par[1]  + par[2] *x + par[3] *x2 ); }
      if ( x <= par[16] ) { return ( par[4]  + par[5] *x + par[6] *x2 + par[7]*x2*x + par[8]*x2*x2 ); }
      if ( x <= par[17] ) { return ( par[9]  + par[10]*x + par[11]*x2 ); }
                            return ( par[12] + par[13]*x + par[14]*x2 );
}
unsigned short DTDriftTimeParametrization::MB_DT_drift_time ( double  x,
double  alpha,
double  by,
double  bz,
short  ifl,
drift_time DT,
short  interpolate 
) const

Calculate drift time and spread.

Definition at line 34 of file DTDriftTimeParametrization.cc.

References alpha, alpha_value, By_value, Bz_value, DTDriftTimeParametrization::drift_time::delta_t, fun_sigma_t, fun_t, i, j, MB_DT_Check_boundaries(), MB_DT_delta_t(), MB_DT_Get_grid_points(), MB_DT_MLInterpolation(), MB_DT_sigma_t_m(), MB_DT_sigma_t_p(), MB_DT_time(), N_Par_t, N_Sigma_t, DTDriftTimeParametrization::drift_time::t_drift, DTDriftTimeParametrization::drift_time::t_width_m, DTDriftTimeParametrization::drift_time::t_width_p, and DTDriftTimeParametrization::drift_time::v_drift.

Referenced by DTDigitizer::driftTimeFromParametrization().

                                                                                         {
      unsigned short i, j, n_func, ial, iby, ibz;
      unsigned short i_alpha, i_By, i_Bz;
      unsigned short j_alpha, j_By, j_Bz;

      double dist;
      double OffSet;
      double par_t[N_Par_t];
      double par_sigma_t[N_Sigma_t];

      double V_al[3], V_by[3], V_bz[3];

      double DTV_v_drift  [N_Func];
      double DTV_t_drift  [N_Func];
      double DTV_delta_t  [N_Func];
      double DTV_t_width_m[N_Func];
      double DTV_t_width_p[N_Func];

      DT->v_drift   = -1;
      DT->t_drift   = -1;
      DT->delta_t   = -1;
      DT->t_width_m = -1;
      DT->t_width_p = -1;

/* Check 'interpolate' and initialize DTV */

      switch(interpolate) {
         case 1:  n_func = N_Func;
                  for ( j=0 ; j<N_Func ; j++ ) {
                     DTV_v_drift[j]   = -1;
                     DTV_t_drift[j]   = -1;
                     DTV_delta_t[j]   = -1;
                     DTV_t_width_m[j] = -1;
                     DTV_t_width_p[j] = -1;
                  }
                  break ;

         case 0:  n_func = 1;
                  break ;

         default: printf ("*** ERROR, MB_DT_drift_time:  invalid interpolate value = %d\n",interpolate);
                  return (0);
      }

#ifdef MB_DT_DEBUG

/* Dump input values */

      printf ("\nMB_DT_drift_time:  Function called with values:\n\n");
      printf ("MB_DT_drift_time:    x     = %f\n",x    );
      printf ("MB_DT_drift_time:    alpha = %f\n",alpha);
      printf ("MB_DT_drift_time:    by    = %f\n",by   );
      printf ("MB_DT_drift_time:    bz    = %f\n",bz   );
      printf ("MB_DT_drift_time:    ifl   = %d\n",ifl  );

#endif

/* Take into account the symmetries of the parametrisations */

      if ( ifl<0 ) {
         printf ("*** ERROR, MB_DT_drift_time:  invalid ifl value = %d\n",ifl);
         return (0);
      }

      dist = ( ifl == 0 ) ? x : x-DT_Cell_HalfWidth;   // dist = [-21,21] mm

      by = fabs(by);         //  f (By) = f (-By)

      if ( bz < 0 ) {        //  f (alpha, Bz) = f (-alpha, -Bz)
         bz    = -bz;
         alpha = -alpha;
      }

/* Check boundaries of the variables and take the closest values */

      MB_DT_Check_boundaries (dist, alpha, by, bz, ifl) ;

      MB_DT_Get_grid_points (alpha, by, bz, &i_alpha, &i_By, &i_Bz, &j_alpha, &j_By, &j_Bz) ;

#ifdef MB_DT_DEBUG
      printf("MB_DT_drift_time:\n");
      printf("MB_DT_drift_time:  i_alpha j_alpha alpha_value's %d %d %.0f %.0f\n",i_alpha,j_alpha,alpha_value[i_alpha],alpha_value[j_alpha]);
      printf("MB_DT_drift_time:  i_By    j_By    By_value's    %d %d %.2f %.2f\n",i_By   ,j_By   ,   By_value[i_By]   ,   By_value[j_By]);
      printf("MB_DT_drift_time:  i_Bz    j_Bz    Bz_value's    %d %d %.2f %.2f\n",i_Bz   ,j_Bz   ,   Bz_value[i_Bz]   ,   Bz_value[j_Bz]);
#endif

/* Get the parametrisations for the different grid points */

      for ( j=0 ; j<n_func ; j++ ) {

         ial = (j&4) ? j_alpha : i_alpha;
         iby = (j&2) ? j_By    : i_By   ;
         ibz = (j&1) ? j_Bz    : i_Bz   ;

         for ( i=0 ; i<N_Par_t   ; i++ ) par_t[i]       =       fun_t[ial][iby][ibz][i];
         for ( i=0 ; i<N_Sigma_t ; i++ ) par_sigma_t[i] = fun_sigma_t[ial][iby][ibz][i];

         OffSet = par_t[N_Par_t-1];

         DTV_v_drift[j]   = par_t[0];                                           // drift velocity
         DTV_delta_t[j]   = MB_DT_delta_t (dist, par_t);                        // deviation from linearity
         DTV_t_drift[j]   = MB_DT_time (dist, par_t) + DTV_delta_t[j] + OffSet; // drift time
         DTV_t_width_m[j] = MB_DT_sigma_t_m (dist, par_sigma_t);                // time width (minus, left)
         DTV_t_width_p[j] = MB_DT_sigma_t_p (dist, par_sigma_t);                // time width (plus, right)

#ifdef MB_DT_DEBUG
         printf("MB_DT_drift_LOOP: OffSet = %f\n",OffSet);
         printf("MB_DT_drift_LOOP: dist, v_drift, t_drift, lin, t_width_m, t_width_p = %f %f %f %f %f %f\n",
                                   dist, DTV_v_drift[j], DTV_t_drift[j], DTV_delta_t[j], DTV_t_width_m[j], DTV_t_width_p[j]) ;
#endif
      }

/* Return interpolated or grid values */

      if ( interpolate == 0 ) {

         DT->v_drift   = DTV_v_drift[0];
         DT->delta_t   = DTV_delta_t[0];
         DT->t_drift   = DTV_t_drift[0];
         DT->t_width_m = DTV_t_width_m[0];
         DT->t_width_p = DTV_t_width_p[0];
      }
      else {

         V_al[0] = alpha ; V_al[1] = alpha_value[i_alpha] ; V_al[2] = alpha_value[j_alpha];
         V_by[0] = by    ; V_by[1] =    By_value[i_By]    ; V_by[2] =    By_value[j_By];
         V_bz[0] = bz    ; V_bz[1] =    Bz_value[i_Bz]    ; V_bz[2] =    Bz_value[j_Bz];

         DT->v_drift   = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_v_drift  );
         DT->delta_t   = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_delta_t  );
         DT->t_drift   = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_drift  );
         DT->t_width_m = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_width_m);
         DT->t_width_p = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_width_p);
      }

#ifdef MB_DT_DEBUG
         printf("MB_DT_drift_time: dist, v_drift, t_drift, lin, t_width_m, t_width_p = %f %f %f %f %f %f\n",
                                   dist, DT->v_drift, DT->t_drift, DT->delta_t, DT->t_width_m, DT->t_width_p) ;
#endif

      return (1);
}
void DTDriftTimeParametrization::MB_DT_Get_grid_points ( double  alpha,
double  by,
double  bz,
unsigned short *  p_alpha,
unsigned short *  p_By,
unsigned short *  p_Bz,
unsigned short *  q_alpha,
unsigned short *  q_By,
unsigned short *  q_Bz 
) const [private]

Referenced by MB_DT_drift_time().

void DTDriftTimeParametrization::MB_DT_Get_grid_values ( double  Var,
unsigned short *  pi,
unsigned short *  pj,
short  Initial,
unsigned short  N,
const double *  Values 
) const [private]
double DTDriftTimeParametrization::MB_DT_MLInterpolation ( double *  al,
double *  by,
double *  bz,
double *  f 
) const [private]

Referenced by MB_DT_drift_time().

double DTDriftTimeParametrization::MB_DT_sigma_t_m ( double  ,
double *   
) const [private]

Referenced by MB_DT_drift_time().

double DTDriftTimeParametrization::MB_DT_sigma_t_p ( double  ,
double *   
) const [private]

Referenced by MB_DT_drift_time().

double DTDriftTimeParametrization::MB_DT_time ( double  dist,
double *  par 
) const [private]

Definition at line 184 of file DTDriftTimeParametrization.cc.

Referenced by MB_DT_drift_time().

                                                                             {
  return ( fabs(dist)/par[0] );        // par[0] is the drift velocity, 'time' is the linear part of the drift time
}

Member Data Documentation

const double DTDriftTimeParametrization::alpha_value[N_alpha] [static, private]

Definition at line 84 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::By_value[N_By] [static, private]

Definition at line 85 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::Bz_value[N_Bz] [static, private]

Definition at line 86 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::fun_sigma_t[N_alpha][N_By][N_Bz][N_Sigma_t] [static, private]

Definition at line 90 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::fun_t [static, private]

Definition at line 89 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::velocitySkew [static, private]

Definition at line 93 of file DTDriftTimeParametrization.h.