CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Static Private Attributes
DTDriftTimeParametrization Class Reference

#include <DTDriftTimeParametrization.h>

Classes

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

Public Member Functions

 DTDriftTimeParametrization ()
 Constructor. More...
 
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. More...
 
virtual ~DTDriftTimeParametrization ()
 Destructor. More...
 

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 [11]
 
static const double By_value [5]
 
static const double Bz_value [5]
 
static const double fun_sigma_t [11][5][5][7]
 
static const double fun_t [11][5][5][19]
 
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.nosp@m..Gar.nosp@m.cia@c.nosp@m.iema.nosp@m.t.es, Jesus.nosp@m..Pue.nosp@m.rta@c.nosp@m.iema.nosp@m.t.es

Definition at line 27 of file DTDriftTimeParametrization.h.

Constructor & Destructor Documentation

DTDriftTimeParametrization::DTDriftTimeParametrization ( )

Constructor.

Definition at line 30 of file DTDriftTimeParametrization.cc.

30 {}
DTDriftTimeParametrization::~DTDriftTimeParametrization ( )
virtual

Destructor.

Definition at line 32 of file DTDriftTimeParametrization.cc.

32 {}

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 fun_t, N_alpha, N_By, N_Bz, N_Par_t, and x.

Referenced by MB_DT_drift_time().

189  {
190  double x2, x = fabs(dist); // the parametrisations are symmetric under 'distance'
191 
192 #ifdef MB_DT_DEBUG
193  printf("MB_DT_delta_t: distance = %f\n",dist);
194 #endif
195 
196  if (x > 20.5) x = 20.5;
197 
198  x2 = x*x;
199 
200  if ( x <= par[15] ) { return ( par[1] + par[2] *x + par[3] *x2 ); }
201  if ( x <= par[16] ) { return ( par[4] + par[5] *x + par[6] *x2 + par[7]*x2*x + par[8]*x2*x2 ); }
202  if ( x <= par[17] ) { return ( par[9] + par[10]*x + par[11]*x2 ); }
203  return ( par[12] + par[13]*x + par[14]*x2 );
204 }
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().

40  {
41  unsigned short i, j, n_func, ial, iby, ibz;
42  unsigned short i_alpha, i_By, i_Bz;
43  unsigned short j_alpha, j_By, j_Bz;
44 
45  double dist;
46  double OffSet;
47  double par_t[N_Par_t];
48  double par_sigma_t[N_Sigma_t];
49 
50  double V_al[3], V_by[3], V_bz[3];
51 
52  double DTV_v_drift [N_Func];
53  double DTV_t_drift [N_Func];
54  double DTV_delta_t [N_Func];
55  double DTV_t_width_m[N_Func];
56  double DTV_t_width_p[N_Func];
57 
58  DT->v_drift = -1;
59  DT->t_drift = -1;
60  DT->delta_t = -1;
61  DT->t_width_m = -1;
62  DT->t_width_p = -1;
63 
64 /* Check 'interpolate' and initialize DTV */
65 
66  switch(interpolate) {
67  case 1: n_func = N_Func;
68  for ( j=0 ; j<N_Func ; j++ ) {
69  DTV_v_drift[j] = -1;
70  DTV_t_drift[j] = -1;
71  DTV_delta_t[j] = -1;
72  DTV_t_width_m[j] = -1;
73  DTV_t_width_p[j] = -1;
74  }
75  break ;
76 
77  case 0: n_func = 1;
78  break ;
79 
80  default: printf ("*** ERROR, MB_DT_drift_time: invalid interpolate value = %d\n",interpolate);
81  return (0);
82  }
83 
84 #ifdef MB_DT_DEBUG
85 
86 /* Dump input values */
87 
88  printf ("\nMB_DT_drift_time: Function called with values:\n\n");
89  printf ("MB_DT_drift_time: x = %f\n",x );
90  printf ("MB_DT_drift_time: alpha = %f\n",alpha);
91  printf ("MB_DT_drift_time: by = %f\n",by );
92  printf ("MB_DT_drift_time: bz = %f\n",bz );
93  printf ("MB_DT_drift_time: ifl = %d\n",ifl );
94 
95 #endif
96 
97 /* Take into account the symmetries of the parametrisations */
98 
99  if ( ifl<0 ) {
100  printf ("*** ERROR, MB_DT_drift_time: invalid ifl value = %d\n",ifl);
101  return (0);
102  }
103 
104  dist = ( ifl == 0 ) ? x : x-DT_Cell_HalfWidth; // dist = [-21,21] mm
105 
106  by = fabs(by); // f (By) = f (-By)
107 
108  if ( bz < 0 ) { // f (alpha, Bz) = f (-alpha, -Bz)
109  bz = -bz;
110  alpha = -alpha;
111  }
112 
113 /* Check boundaries of the variables and take the closest values */
114 
115  MB_DT_Check_boundaries (dist, alpha, by, bz, ifl) ;
116 
117  MB_DT_Get_grid_points (alpha, by, bz, &i_alpha, &i_By, &i_Bz, &j_alpha, &j_By, &j_Bz) ;
118 
119 #ifdef MB_DT_DEBUG
120  printf("MB_DT_drift_time:\n");
121  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]);
122  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]);
123  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]);
124 #endif
125 
126 /* Get the parametrisations for the different grid points */
127 
128  for ( j=0 ; j<n_func ; j++ ) {
129 
130  ial = (j&4) ? j_alpha : i_alpha;
131  iby = (j&2) ? j_By : i_By ;
132  ibz = (j&1) ? j_Bz : i_Bz ;
133 
134  for ( i=0 ; i<N_Par_t ; i++ ) par_t[i] = fun_t[ial][iby][ibz][i];
135  for ( i=0 ; i<N_Sigma_t ; i++ ) par_sigma_t[i] = fun_sigma_t[ial][iby][ibz][i];
136 
137  OffSet = par_t[N_Par_t-1];
138 
139  DTV_v_drift[j] = par_t[0]; // drift velocity
140  DTV_delta_t[j] = MB_DT_delta_t (dist, par_t); // deviation from linearity
141  DTV_t_drift[j] = MB_DT_time (dist, par_t) + DTV_delta_t[j] + OffSet; // drift time
142  DTV_t_width_m[j] = MB_DT_sigma_t_m (dist, par_sigma_t); // time width (minus, left)
143  DTV_t_width_p[j] = MB_DT_sigma_t_p (dist, par_sigma_t); // time width (plus, right)
144 
145 #ifdef MB_DT_DEBUG
146  printf("MB_DT_drift_LOOP: OffSet = %f\n",OffSet);
147  printf("MB_DT_drift_LOOP: dist, v_drift, t_drift, lin, t_width_m, t_width_p = %f %f %f %f %f %f\n",
148  dist, DTV_v_drift[j], DTV_t_drift[j], DTV_delta_t[j], DTV_t_width_m[j], DTV_t_width_p[j]) ;
149 #endif
150  }
151 
152 /* Return interpolated or grid values */
153 
154  if ( interpolate == 0 ) {
155 
156  DT->v_drift = DTV_v_drift[0];
157  DT->delta_t = DTV_delta_t[0];
158  DT->t_drift = DTV_t_drift[0];
159  DT->t_width_m = DTV_t_width_m[0];
160  DT->t_width_p = DTV_t_width_p[0];
161  }
162  else {
163 
164  V_al[0] = alpha ; V_al[1] = alpha_value[i_alpha] ; V_al[2] = alpha_value[j_alpha];
165  V_by[0] = by ; V_by[1] = By_value[i_By] ; V_by[2] = By_value[j_By];
166  V_bz[0] = bz ; V_bz[1] = Bz_value[i_Bz] ; V_bz[2] = Bz_value[j_Bz];
167 
168  DT->v_drift = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_v_drift );
169  DT->delta_t = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_delta_t );
170  DT->t_drift = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_drift );
171  DT->t_width_m = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_width_m);
172  DT->t_width_p = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_width_p);
173  }
174 
175 #ifdef MB_DT_DEBUG
176  printf("MB_DT_drift_time: dist, v_drift, t_drift, lin, t_width_m, t_width_p = %f %f %f %f %f %f\n",
177  dist, DT->v_drift, DT->t_drift, DT->delta_t, DT->t_width_m, DT->t_width_p) ;
178 #endif
179 
180  return (1);
181 }
unsigned short MB_DT_Check_boundaries(double distime, double alpha, double by, double bz, short ifl) const
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
#define N_Par_t
static const double alpha_value[11]
double MB_DT_time(double, double *) const
double MB_DT_sigma_t_p(double, double *) const
int j
Definition: DBlmapReader.cc:9
static const double fun_sigma_t[11][5][5][7]
double MB_DT_delta_t(double, double *) const
double MB_DT_sigma_t_m(double, double *) const
double MB_DT_MLInterpolation(double *al, double *by, double *bz, double *f) 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
static const double fun_t[11][5][5][19]
#define N_Sigma_t
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().

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

Member Data Documentation

const double DTDriftTimeParametrization::alpha_value[11]
staticprivate

Definition at line 84 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::By_value[5]
staticprivate

Definition at line 85 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::Bz_value[5]
staticprivate

Definition at line 86 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::fun_sigma_t[11][5][5][7]
staticprivate

Definition at line 90 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

const double DTDriftTimeParametrization::fun_t
staticprivate

Definition at line 89 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_delta_t(), and MB_DT_drift_time().

const double DTDriftTimeParametrization::velocitySkew
staticprivate

Definition at line 93 of file DTDriftTimeParametrization.h.