CMS 3D CMS Logo

SiPixelUtils.cc
Go to the documentation of this file.
1 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3 #else
4 #include "SiPixelUtils.h"
5 #endif
6 
7 #include <cmath>
8 
9 namespace siPixelUtils {
10 
11  //-----------------------------------------------------------------------------
15  //-----------------------------------------------------------------------------
16  float generic_position_formula(int size,
17  int q_f,
18  int q_l,
19  float upper_edge_first_pix,
20  float lower_edge_last_pix,
21  float lorentz_shift,
22  float theThickness, //detector thickness
23  float cot_angle,
24  float pitch,
25  float pitchfraction_first,
26  float pitchfraction_last,
27  float eff_charge_cut_low,
28  float eff_charge_cut_high,
29  float size_cut
30  ) {
31  float geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix);
32 
33  //--- The case of only one pixel in this projection is separate. Note that
34  //--- here first_pix == last_pix, so the average of the two is still the
35  //--- center of the pixel.
36  if (size == 1) {
37  return geom_center;
38  }
39 
40  //--- Width of the clusters minus the edge (first and last) pixels.
41  //--- In the note, they are denoted x_F and x_L (and y_F and y_L)
42  float w_inner = lower_edge_last_pix - upper_edge_first_pix; // in cm
43 
44  //--- Predicted charge width from geometry
45  float w_pred = theThickness * cot_angle // geometric correction (in cm)
46  - lorentz_shift; // (in cm) &&& check fpix!
47 
48  //--- Total length of the two edge pixels (first+last)
49  float sum_of_edge = pitchfraction_first + pitchfraction_last;
50 
51  //--- The `effective' charge width -- particle's path in first and last pixels only
52  float w_eff = std::abs(w_pred) - w_inner;
53 
54  //--- If the observed charge width is inconsistent with the expectations
55  //--- based on the track, do *not* use w_pred-w_innner. Instead, replace
56  //--- it with an *average* effective charge width, which is the average
57  //--- length of the edge pixels.
58  //
59  // bool usedEdgeAlgo = false;
60  if ((size >= size_cut) || ((w_eff / pitch < eff_charge_cut_low) | (w_eff / pitch > eff_charge_cut_high))) {
61  w_eff = pitch * 0.5f * sum_of_edge; // ave. length of edge pixels (first+last) (cm)
62  // usedEdgeAlgo = true;
63  }
64 
65  //--- Finally, compute the position in this projection
66  float q_diff = q_l - q_f;
67  float q_sum = q_l + q_f;
68 
69  //--- Temporary fix for clusters with both first and last pixel with charge = 0
70  if (q_sum == 0)
71  q_sum = 1.0f;
72 
73  float hit_pos = geom_center + 0.5f * (q_diff / q_sum) * w_eff;
74 
75  return hit_pos;
76  }
77 } // namespace siPixelUtils
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float generic_position_formula(int size, int q_f, int q_l, float upper_edge_first_pix, float lower_edge_last_pix, float lorentz_shift, float theThickness, float cot_angle, float pitch, float pitchfraction_first, float pitchfraction_last, float eff_charge_cut_low, float eff_charge_cut_high, float size_cut)
Definition: SiPixelUtils.cc:16