![]() |
![]() |
#include <SimMuon/DTDigitizer/src/DTDriftTimeParametrization.h>
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 |
Classes | |
struct | drift_time |
Structure used to return output values. More... |
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.
DTDriftTimeParametrization::DTDriftTimeParametrization | ( | ) |
DTDriftTimeParametrization::~DTDriftTimeParametrization | ( | ) | [virtual] |
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 187 of file DTDriftTimeParametrization.cc.
References x.
Referenced by MB_DT_drift_time().
00189 { 00190 double x2, x = fabs(dist); // the parametrisations are symmetric under 'distance' 00191 00192 #ifdef MB_DT_DEBUG 00193 printf("MB_DT_delta_t: distance = %f\n",dist); 00194 #endif 00195 00196 if (x > 20.5) x = 20.5; 00197 00198 x2 = x*x; 00199 00200 if ( x <= par[15] ) { return ( par[1] + par[2] *x + par[3] *x2 ); } 00201 if ( x <= par[16] ) { return ( par[4] + par[5] *x + par[6] *x2 + par[7]*x2*x + par[8]*x2*x2 ); } 00202 if ( x <= par[17] ) { return ( par[9] + par[10]*x + par[11]*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 33 of file DTDriftTimeParametrization.cc.
References alpha_value, By_value, Bz_value, DTDriftTimeParametrization::drift_time::delta_t, dist(), 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().
00040 { 00041 unsigned short i, j, n_func, ial, iby, ibz; 00042 unsigned short i_alpha, i_By, i_Bz; 00043 unsigned short j_alpha, j_By, j_Bz; 00044 00045 double dist; 00046 double OffSet; 00047 double par_t[N_Par_t]; 00048 double par_sigma_t[N_Sigma_t]; 00049 00050 double V_al[3], V_by[3], V_bz[3]; 00051 00052 double DTV_v_drift [N_Func]; 00053 double DTV_t_drift [N_Func]; 00054 double DTV_delta_t [N_Func]; 00055 double DTV_t_width_m[N_Func]; 00056 double DTV_t_width_p[N_Func]; 00057 00058 DT->v_drift = -1; 00059 DT->t_drift = -1; 00060 DT->delta_t = -1; 00061 DT->t_width_m = -1; 00062 DT->t_width_p = -1; 00063 00064 /* Check 'interpolate' and initialize DTV */ 00065 00066 switch(interpolate) { 00067 case 1: n_func = N_Func; 00068 for ( j=0 ; j<N_Func ; j++ ) { 00069 DTV_v_drift[j] = -1; 00070 DTV_t_drift[j] = -1; 00071 DTV_delta_t[j] = -1; 00072 DTV_t_width_m[j] = -1; 00073 DTV_t_width_p[j] = -1; 00074 } 00075 break ; 00076 00077 case 0: n_func = 1; 00078 break ; 00079 00080 default: printf ("*** ERROR, MB_DT_drift_time: invalid interpolate value = %d\n",interpolate); 00081 return (0); 00082 } 00083 00084 #ifdef MB_DT_DEBUG 00085 00086 /* Dump input values */ 00087 00088 printf ("\nMB_DT_drift_time: Function called with values:\n\n"); 00089 printf ("MB_DT_drift_time: x = %f\n",x ); 00090 printf ("MB_DT_drift_time: alpha = %f\n",alpha); 00091 printf ("MB_DT_drift_time: by = %f\n",by ); 00092 printf ("MB_DT_drift_time: bz = %f\n",bz ); 00093 printf ("MB_DT_drift_time: ifl = %d\n",ifl ); 00094 00095 #endif 00096 00097 /* Take into account the symmetries of the parametrisations */ 00098 00099 if ( ifl<0 ) { 00100 printf ("*** ERROR, MB_DT_drift_time: invalid ifl value = %d\n",ifl); 00101 return (0); 00102 } 00103 00104 dist = ( ifl == 0 ) ? x : x-DT_Cell_HalfWidth; // dist = [-21,21] mm 00105 00106 by = fabs(by); // f (By) = f (-By) 00107 00108 if ( bz < 0 ) { // f (alpha, Bz) = f (-alpha, -Bz) 00109 bz = -bz; 00110 alpha = -alpha; 00111 } 00112 00113 /* Check boundaries of the variables and take the closest values */ 00114 00115 MB_DT_Check_boundaries (dist, alpha, by, bz, ifl) ; 00116 00117 MB_DT_Get_grid_points (alpha, by, bz, &i_alpha, &i_By, &i_Bz, &j_alpha, &j_By, &j_Bz) ; 00118 00119 #ifdef MB_DT_DEBUG 00120 printf("MB_DT_drift_time:\n"); 00121 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]); 00122 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]); 00123 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]); 00124 #endif 00125 00126 /* Get the parametrisations for the different grid points */ 00127 00128 for ( j=0 ; j<n_func ; j++ ) { 00129 00130 ial = (j&4) ? j_alpha : i_alpha; 00131 iby = (j&2) ? j_By : i_By ; 00132 ibz = (j&1) ? j_Bz : i_Bz ; 00133 00134 for ( i=0 ; i<N_Par_t ; i++ ) par_t[i] = fun_t[ial][iby][ibz][i]; 00135 for ( i=0 ; i<N_Sigma_t ; i++ ) par_sigma_t[i] = fun_sigma_t[ial][iby][ibz][i]; 00136 00137 OffSet = par_t[N_Par_t-1]; 00138 00139 DTV_v_drift[j] = par_t[0]; // drift velocity 00140 DTV_delta_t[j] = MB_DT_delta_t (dist, par_t); // deviation from linearity 00141 DTV_t_drift[j] = MB_DT_time (dist, par_t) + DTV_delta_t[j] + OffSet; // drift time 00142 DTV_t_width_m[j] = MB_DT_sigma_t_m (dist, par_sigma_t); // time width (minus, left) 00143 DTV_t_width_p[j] = MB_DT_sigma_t_p (dist, par_sigma_t); // time width (plus, right) 00144 00145 #ifdef MB_DT_DEBUG 00146 printf("MB_DT_drift_LOOP: OffSet = %f\n",OffSet); 00147 printf("MB_DT_drift_LOOP: dist, v_drift, t_drift, lin, t_width_m, t_width_p = %f %f %f %f %f %f\n", 00148 dist, DTV_v_drift[j], DTV_t_drift[j], DTV_delta_t[j], DTV_t_width_m[j], DTV_t_width_p[j]) ; 00149 #endif 00150 } 00151 00152 /* Return interpolated or grid values */ 00153 00154 if ( interpolate == 0 ) { 00155 00156 DT->v_drift = DTV_v_drift[0]; 00157 DT->delta_t = DTV_delta_t[0]; 00158 DT->t_drift = DTV_t_drift[0]; 00159 DT->t_width_m = DTV_t_width_m[0]; 00160 DT->t_width_p = DTV_t_width_p[0]; 00161 } 00162 else { 00163 00164 V_al[0] = alpha ; V_al[1] = alpha_value[i_alpha] ; V_al[2] = alpha_value[j_alpha]; 00165 V_by[0] = by ; V_by[1] = By_value[i_By] ; V_by[2] = By_value[j_By]; 00166 V_bz[0] = bz ; V_bz[1] = Bz_value[i_Bz] ; V_bz[2] = Bz_value[j_Bz]; 00167 00168 DT->v_drift = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_v_drift ); 00169 DT->delta_t = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_delta_t ); 00170 DT->t_drift = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_drift ); 00171 DT->t_width_m = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_width_m); 00172 DT->t_width_p = MB_DT_MLInterpolation (V_al, V_by, V_bz, DTV_t_width_p); 00173 } 00174 00175 #ifdef MB_DT_DEBUG 00176 printf("MB_DT_drift_time: dist, v_drift, t_drift, lin, t_width_m, t_width_p = %f %f %f %f %f %f\n", 00177 dist, DT->v_drift, DT->t_drift, DT->delta_t, DT->t_width_m, DT->t_width_p) ; 00178 #endif 00179
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] |
const double DTDriftTimeParametrization::alpha_value[N_alpha] [static, private] |
const double DTDriftTimeParametrization::By_value[N_By] [static, private] |
const double DTDriftTimeParametrization::Bz_value[N_Bz] [static, private] |
const double DTDriftTimeParametrization::fun_sigma_t[N_alpha][N_By][N_Bz][N_Sigma_t] [static, private] |
const double DTDriftTimeParametrization::fun_t [static, private] |
const double DTDriftTimeParametrization::velocitySkew [static, private] |
Definition at line 93 of file DTDriftTimeParametrization.h.