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 25 of file DTDriftTimeParametrization.h.

Constructor & Destructor Documentation

◆ DTDriftTimeParametrization()

DTDriftTimeParametrization::DTDriftTimeParametrization ( )

Constructor.

Definition at line 28 of file DTDriftTimeParametrization.cc.

28 {}

◆ ~DTDriftTimeParametrization()

DTDriftTimeParametrization::~DTDriftTimeParametrization ( )
virtual

Destructor.

Definition at line 30 of file DTDriftTimeParametrization.cc.

30 {}

Member Function Documentation

◆ MB_DT_Check_boundaries()

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().

◆ MB_DT_delta_t()

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

Definition at line 208 of file DTDriftTimeParametrization.cc.

References x, and testProducerWithPsetDescEmpty_cfi::x2.

Referenced by MB_DT_drift_time().

208  {
209  double x2,
210  x = fabs(dist); // the parametrisations are symmetric under 'distance'
211 
212 #ifdef MB_DT_DEBUG
213  printf("MB_DT_delta_t: distance = %f\n", dist);
214 #endif
215 
216  if (x > 20.5)
217  x = 20.5;
218 
219  x2 = x * x;
220 
221  if (x <= par[15]) {
222  return (par[1] + par[2] * x + par[3] * x2);
223  }
224  if (x <= par[16]) {
225  return (par[4] + par[5] * x + par[6] * x2 + par[7] * x2 * x + par[8] * x2 * x2);
226  }
227  if (x <= par[17]) {
228  return (par[9] + par[10] * x + par[11] * x2);
229  }
230  return (par[12] + par[13] * x + par[14] * x2);
231 }

◆ MB_DT_drift_time()

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 32 of file DTDriftTimeParametrization.cc.

References isotrackApplyRegressor::alpha, alpha_value, By_value, Bz_value, GeomDetEnumerators::DT, fun_sigma_t, fun_t, mps_fire::i, HiCaloJetParameters_cff::interpolate, dqmiolumiharvest::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, and x.

Referenced by DTDigitizer::driftTimeFromParametrization().

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

◆ MB_DT_Get_grid_points()

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().

◆ MB_DT_Get_grid_values()

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

◆ MB_DT_MLInterpolation()

double DTDriftTimeParametrization::MB_DT_MLInterpolation ( double *  al,
double *  by,
double *  bz,
double *  f 
) const
private

Referenced by MB_DT_drift_time().

◆ MB_DT_sigma_t_m()

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

Referenced by MB_DT_drift_time().

◆ MB_DT_sigma_t_p()

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

Referenced by MB_DT_drift_time().

◆ MB_DT_time()

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

Definition at line 203 of file DTDriftTimeParametrization.cc.

Referenced by MB_DT_drift_time().

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

Member Data Documentation

◆ alpha_value

const double DTDriftTimeParametrization::alpha_value[11]
staticprivate

Definition at line 66 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

◆ By_value

const double DTDriftTimeParametrization::By_value[5]
staticprivate

Definition at line 67 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

◆ Bz_value

const double DTDriftTimeParametrization::Bz_value[5]
staticprivate

Definition at line 68 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

◆ fun_sigma_t

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

Definition at line 72 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

◆ fun_t

const double DTDriftTimeParametrization::fun_t
staticprivate

Definition at line 71 of file DTDriftTimeParametrization.h.

Referenced by MB_DT_drift_time().

◆ velocitySkew

const double DTDriftTimeParametrization::velocitySkew
staticprivate

Definition at line 75 of file DTDriftTimeParametrization.h.