#include <RecoLocalMuon/DTRecHit/plugins/DTTime2DriftParametrization.h>
Public Member Functions | |
bool | computeDriftDistance_mean (double time, double alpha, double by, double bz, short interpolate, drift_distance *dx) const |
Compute the drift distance and relative errors (cm). | |
bool | computeDriftDistance_mode (double time, double alpha, double by, double bz, short interpolate, drift_distance *dx) const |
Compute the drift distance and relative errors (cm). | |
DTTime2DriftParametrization () | |
Constructor. | |
virtual | ~DTTime2DriftParametrization () |
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_x (double, double *) const |
double | MB_DT_dist (double, double *) const |
unsigned short | MB_DT_drift_distance (double time, double alpha, double by, double bz, drift_distance *DX, short interpolate) const |
Calculate drift distance and spread. | |
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 |
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_x [N_alpha][N_By][N_Bz][N_Par_x] |
static const double | velocitySkew |
Classes | |
struct | drift_distance |
Structure used to return output values. More... |
The two public methods act as an interface for the parametrization converting the reference frame and the units accordingly to CMSSW convention.
Definition at line 23 of file DTTime2DriftParametrization.h.
DTTime2DriftParametrization::DTTime2DriftParametrization | ( | ) |
DTTime2DriftParametrization::~DTTime2DriftParametrization | ( | ) | [virtual] |
bool DTTime2DriftParametrization::computeDriftDistance_mean | ( | double | time, | |
double | alpha, | |||
double | by, | |||
double | bz, | |||
short | interpolate, | |||
drift_distance * | dx | |||
) | const |
Compute the drift distance and relative errors (cm).
The drift distance is computed as the MEAN value of the distance distribution for this particular time. This method takes care of the conversions of units and reference frame used by CMSSW and the parametrization. time is in ns, alpha (=atan(x/-z)) in rad, by and bz are the magnetic field in the layer RF. False is returned if the parametrization fails
Definition at line 63 of file DTTime2DriftParametrization.cc.
References DTTime2DriftParametrization::drift_distance::delta_x, max, MB_DT_drift_distance(), Geom::pi(), funct::sqrt(), DTTime2DriftParametrization::drift_distance::v_drift, DTTime2DriftParametrization::drift_distance::x_drift, DTTime2DriftParametrization::drift_distance::x_width_m, and DTTime2DriftParametrization::drift_distance::x_width_p.
Referenced by DTParametrizedDriftAlgo::compute().
00068 { 00069 // NOTE: This method takes care of convertion of the units in order to use the CMSSW conventions 00070 00071 // The convention used by the parametrization for the reference frame are different 00072 // with respect to CMSSW 00073 // X_par = X_CMSSW; Y_par=Z_CMSSW; Z_par = -Y_CMSSW 00074 float By_par = bz; // Bnorm 00075 float Bz_par = -by; // Bwire 00076 00077 // Express alpha in degrees 00078 float alpha_par = alpha * 180./Geom::pi(); 00079 00080 //-------------------------------------------------------------------- 00081 // Calculate the drift distance and the resolution from the parametrization 00082 unsigned short flag = 00083 MB_DT_drift_distance(time, alpha_par, By_par, Bz_par, dx, interpolate); 00084 00085 if(flag!=1) 00086 return false; 00087 00088 // Convert from mm (used by the parametrization) to cm (used by CMSSW) 00089 dx->v_drift = dx->v_drift/10.; 00090 dx->x_drift = dx->x_drift/10.; 00091 dx->delta_x = dx->delta_x/10.; 00092 dx->x_width_m = dx->x_width_m/10.; 00093 dx->x_width_p = dx->x_width_p/10.; 00094 00095 // Correct drift time for the difference between mode and mean 00096 dx->x_drift = std::max(0.,dx->x_drift - (dx->x_width_p-dx->x_width_m)*sqrt(2./Geom::pi())); 00097 00098 return true; 00099 00100 }
bool DTTime2DriftParametrization::computeDriftDistance_mode | ( | double | time, | |
double | alpha, | |||
double | by, | |||
double | bz, | |||
short | interpolate, | |||
drift_distance * | dx | |||
) | const |
Compute the drift distance and relative errors (cm).
The drift distance is computed as the MODE value of the distance distribution for this particular time. This method takes care of the conversions of units and reference frame used by CMSSW and the parametrization. time is in ns, alpha (=atan(x/-z)) in rad, by and bz are the magnetic field in the layer RF. False is returned if the parametrization fails
Definition at line 26 of file DTTime2DriftParametrization.cc.
References DTTime2DriftParametrization::drift_distance::delta_x, MB_DT_drift_distance(), Geom::pi(), DTTime2DriftParametrization::drift_distance::v_drift, DTTime2DriftParametrization::drift_distance::x_drift, DTTime2DriftParametrization::drift_distance::x_width_m, and DTTime2DriftParametrization::drift_distance::x_width_p.
00031 { 00032 // NOTE: This method takes care of convertion of the units in order to use the CMSSW conventions 00033 00034 // The convention used by the parametrization for the reference frame are different 00035 // with respect to CMSSW 00036 // X_par = X_CMSSW; Y_par=Z_CMSSW; Z_par = -Y_CMSSW 00037 float By_par = bz; // Bnorm 00038 float Bz_par = -by; // Bwire 00039 00040 // Express alpha in degrees 00041 float alpha_par = alpha * 180./Geom::pi(); 00042 00043 //-------------------------------------------------------------------- 00044 // Calculate the drift distance and the resolution from the parametrization 00045 unsigned short flag = 00046 MB_DT_drift_distance(time, alpha_par, By_par, Bz_par, dx, interpolate); 00047 00048 if(flag!=1) 00049 return false; 00050 00051 // Convert from mm (used by the parametrization) to cm (used by CMSSW) 00052 dx->v_drift = dx->v_drift/10.; 00053 dx->x_drift = dx->x_drift/10.; 00054 dx->delta_x = dx->delta_x/10.; 00055 dx->x_width_m = dx->x_width_m/10.; 00056 dx->x_width_p = dx->x_width_p/10.; 00057 00058 return true; 00059 00060 }
unsigned short DTTime2DriftParametrization::MB_DT_Check_boundaries | ( | double | distime, | |
double | alpha, | |||
double | by, | |||
double | bz, | |||
short | ifl | |||
) | const [private] |
Referenced by MB_DT_drift_distance().
double DTTime2DriftParametrization::MB_DT_delta_x | ( | double | t, | |
double * | par | |||
) | const [private] |
Definition at line 241 of file DTTime2DriftParametrization.cc.
Referenced by MB_DT_drift_distance().
00242 { 00243 double t2 = t*t; 00244 00245 #ifdef MB_DT_DEBUG 00246 printf("MB_DT_delta_x: time = %f\n",t); 00247 #endif 00248 00249 // 00250 // Now distances are in microns. Divide by 1000 to get mm. 00251 // 00252 if ( t <= par[12] ) { return ( -0.001 * (par[1] + par[2] *t + par[3] *t2) ); } 00253 if ( t <= par[13] ) { return ( -0.001 * (par[4] + par[5] *t + par[6] *t2 + par[7]*t2*t + par[8]*t2*t2) ); } 00254 return ( -0.001 * (par[9] + par[10]*t + par[11]*t2) );
double DTTime2DriftParametrization::MB_DT_dist | ( | double | time, | |
double * | par | |||
) | const [private] |
Definition at line 257 of file DTTime2DriftParametrization.cc.
Referenced by MB_DT_drift_distance().
00258 { 00259 return ( time * par[0] ); // par[0] is the drift velocity, 'dist' is the linear part of the drift distance
unsigned short DTTime2DriftParametrization::MB_DT_drift_distance | ( | double | time, | |
double | alpha, | |||
double | by, | |||
double | bz, | |||
drift_distance * | DX, | |||
short | interpolate | |||
) | const [private] |
Calculate drift distance and spread.
Definition at line 102 of file DTTime2DriftParametrization.cc.
References alpha_value, By_value, Bz_value, DTTime2DriftParametrization::drift_distance::delta_x, fun_sigma_t, fun_x, i, j, MB_DT_Check_boundaries(), MB_DT_delta_x(), MB_DT_dist(), MB_DT_Get_grid_points(), MB_DT_MLInterpolation(), MB_DT_sigma_t_m(), MB_DT_sigma_t_p(), N_Par_x, N_Sigma_t, DTTime2DriftParametrization::drift_distance::v_drift, DTTime2DriftParametrization::drift_distance::x_drift, DTTime2DriftParametrization::drift_distance::x_width_m, and DTTime2DriftParametrization::drift_distance::x_width_p.
Referenced by computeDriftDistance_mean(), and computeDriftDistance_mode().
00107 { 00108 unsigned short i, j, n_func, ial, iby, ibz; 00109 unsigned short i_alpha, i_By, i_Bz; 00110 unsigned short j_alpha, j_By, j_Bz; 00111 00112 double OffSet; 00113 double par_x[N_Par_x]; 00114 double par_sigma_t[N_Sigma_t]; 00115 00116 double V_al[3], V_by[3], V_bz[3]; 00117 00118 double DXV_v_drift [N_Func]; 00119 double DXV_x_drift [N_Func]; 00120 double DXV_delta_x [N_Func]; 00121 double DXV_x_width_m[N_Func]; 00122 double DXV_x_width_p[N_Func]; 00123 00124 DX->v_drift = -1; 00125 DX->x_drift = -1; 00126 DX->delta_x = -1; 00127 DX->x_width_m = -1; 00128 DX->x_width_p = -1; 00129 00130 /* Check 'interpolate' and initialize DXV */ 00131 00132 switch(interpolate) { 00133 case 1: n_func = N_Func; 00134 for ( j=0 ; j<N_Func ; j++ ) { 00135 DXV_v_drift[j] = -1; 00136 DXV_x_drift[j] = -1; 00137 DXV_delta_x[j] = -1; 00138 DXV_x_width_m[j] = -1; 00139 DXV_x_width_p[j] = -1; 00140 } 00141 break ; 00142 00143 case 0: n_func = 1; 00144 break ; 00145 00146 default: printf ("*** ERROR, MB_DT_drift_distance: invalid interpolate value = %d\n",interpolate); 00147 return (0); 00148 } 00149 00150 #ifdef MB_DT_DEBUG 00151 00152 /* Dump input values */ 00153 00154 printf ("\nMB_DT_drift_distance: Function called with values:\n\n"); 00155 printf ("MB_DT_drift_distance: time = %f\n",time ); 00156 printf ("MB_DT_drift_distance: alpha = %f\n",alpha); 00157 printf ("MB_DT_drift_distance: by = %f\n",by ); 00158 printf ("MB_DT_drift_distance: bz = %f\n",bz ); 00159 00160 #endif 00161 00162 /* Take into account the symmetries of the parametrisations */ 00163 00164 by = fabs(by); // f-1 (By) = f-1 (-By) 00165 00166 if ( bz < 0 ) { // f-1 (alpha,Bz) = f-1 (-alpha, -Bz) 00167 bz = -bz; 00168 alpha = -alpha; 00169 } 00170 00171 /* Check boundaries of the variables and take the closest values */ 00172 00173 MB_DT_Check_boundaries (time, alpha, by, bz, -1) ; 00174 00175 MB_DT_Get_grid_points (alpha, by, bz, &i_alpha, &i_By, &i_Bz, &j_alpha, &j_By, &j_Bz) ; 00176 00177 #ifdef MB_DT_DEBUG 00178 printf("MB_DT_drift_distance:\n"); 00179 printf("MB_DT_drift_distance: i_alpha j_alpha alpha_value's %d %d %.0f %.0f\n",i_alpha,j_alpha,alpha_value[i_alpha],alpha_value[j_alpha]); 00180 printf("MB_DT_drift_distance: i_By j_By By_value's %d %d %.2f %.2f\n",i_By ,j_By , By_value[i_By] , By_value[j_By]); 00181 printf("MB_DT_drift_distance: i_Bz j_Bz Bz_value's %d %d %.2f %.2f\n",i_Bz ,j_Bz , Bz_value[i_Bz] , Bz_value[j_Bz]); 00182 #endif 00183 00184 /* Get the parametrisations for the different grid points */ 00185 00186 for ( j=0 ; j<n_func ; j++ ) { 00187 00188 ial = (j&4) ? j_alpha : i_alpha; 00189 iby = (j&2) ? j_By : i_By ; 00190 ibz = (j&1) ? j_Bz : i_Bz ; 00191 00192 for ( i=0 ; i<N_Par_x ; i++ ) par_x[i] = fun_x[ial][iby][ibz][i]; 00193 for ( i=0 ; i<N_Sigma_t ; i++ ) par_sigma_t[i] = fun_sigma_t[ial][iby][ibz][i]; 00194 00195 OffSet = par_x[N_Par_x-1]; 00196 00197 DXV_v_drift[j] = par_x[0]; // drift velocity 00198 DXV_delta_x[j] = MB_DT_delta_x (time, par_x); // deviation from linearity 00199 DXV_x_drift[j] = MB_DT_dist (time, par_x) + DXV_delta_x[j] - OffSet*par_x[0]; // drift distance to the wire (signed) 00200 DXV_x_width_m[j] = MB_DT_sigma_t_m (DXV_x_drift[j], par_sigma_t) * DXV_v_drift[j]; // distance width ~ vd * sigma_t(x) (minus, left) 00201 DXV_x_width_p[j] = MB_DT_sigma_t_p (DXV_x_drift[j], par_sigma_t) * DXV_v_drift[j]; // distance width ~ vd * sigma_t(x) (plus, right) 00202 00203 #ifdef MB_DT_DEBUG 00204 printf("MB_DT_drift_LOOP: OffSet = %f\n",OffSet); 00205 printf("MB_DT_drift_LOOP: time, v_drift, x_drift, lin, x_width_m, x_width_p = %f %f %f %f %f %f\n", 00206 time, DXV_v_drift[j], DXV_x_drift[j], DXV_delta_x[j], DXV_x_width_m[j], DXV_x_width_p[j]) ; 00207 #endif 00208 } 00209 00210 /* Return interpolated or grid values */ 00211 00212 if ( interpolate == 0 ) { 00213 00214 DX->v_drift = DXV_v_drift[0]; 00215 DX->delta_x = DXV_delta_x[0]; 00216 DX->x_drift = DXV_x_drift[0]; 00217 DX->x_width_m = DXV_x_width_m[0]; 00218 DX->x_width_p = DXV_x_width_p[0]; 00219 } 00220 else { 00221 00222 V_al[0] = alpha ; V_al[1] = alpha_value[i_alpha] ; V_al[2] = alpha_value[j_alpha]; 00223 V_by[0] = by ; V_by[1] = By_value[i_By] ; V_by[2] = By_value[j_By]; 00224 V_bz[0] = bz ; V_bz[1] = Bz_value[i_Bz] ; V_bz[2] = Bz_value[j_Bz]; 00225 00226 DX->v_drift = MB_DT_MLInterpolation (V_al, V_by, V_bz, DXV_v_drift ); 00227 DX->delta_x = MB_DT_MLInterpolation (V_al, V_by, V_bz, DXV_delta_x ); 00228 DX->x_drift = MB_DT_MLInterpolation (V_al, V_by, V_bz, DXV_x_drift ); 00229 DX->x_width_m = MB_DT_MLInterpolation (V_al, V_by, V_bz, DXV_x_width_m); 00230 DX->x_width_p = MB_DT_MLInterpolation (V_al, V_by, V_bz, DXV_x_width_p); 00231 } 00232 00233 #ifdef MB_DT_DEBUG 00234 printf("MB_DT_drift_distance: time, v_drift, x_drift, lin, x_width_m, x_width_p = %f %f %f %f %f %f\n", 00235 time, DX->v_drift, DX->x_drift, DX->delta_x, DX->x_width_m, DX->x_width_p) ; 00236 #endif 00237 00238 return (1);
void DTTime2DriftParametrization::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_distance().
void DTTime2DriftParametrization::MB_DT_Get_grid_values | ( | double | Var, | |
unsigned short * | pi, | |||
unsigned short * | pj, | |||
short | Initial, | |||
unsigned short | N, | |||
const double * | Values | |||
) | const [private] |
double DTTime2DriftParametrization::MB_DT_MLInterpolation | ( | double * | al, | |
double * | by, | |||
double * | bz, | |||
double * | f | |||
) | const [private] |
Referenced by MB_DT_drift_distance().
double DTTime2DriftParametrization::MB_DT_sigma_t_m | ( | double | , | |
double * | ||||
) | const [private] |
Referenced by MB_DT_drift_distance().
double DTTime2DriftParametrization::MB_DT_sigma_t_p | ( | double | , | |
double * | ||||
) | const [private] |
Referenced by MB_DT_drift_distance().
const double DTTime2DriftParametrization::alpha_value[N_alpha] [static, private] |
const double DTTime2DriftParametrization::By_value[N_By] [static, private] |
const double DTTime2DriftParametrization::Bz_value[N_Bz] [static, private] |
const double DTTime2DriftParametrization::fun_sigma_t[N_alpha][N_By][N_Bz][N_Sigma_t] [static, private] |
const double DTTime2DriftParametrization::fun_x [static, private] |
const double DTTime2DriftParametrization::velocitySkew [static, private] |
Definition at line 119 of file DTTime2DriftParametrization.h.