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  //-----------------------------------------------------------------------------
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  bool first_is_big,
26  bool last_is_big,
27  float eff_charge_cut_low,
28  float eff_charge_cut_high,
29  float size_cut
30  ) {
31  //cout<<" in PixelCPEGeneric:generic_position_formula - "<<endl; //dk
32 
33  float geom_center = 0.5f * (upper_edge_first_pix + lower_edge_last_pix);
34 
35  //--- The case of only one pixel in this projection is separate. Note that
36  //--- here first_pix == last_pix, so the average of the two is still the
37  //--- center of the pixel.
38  if (size == 1) {
39  return geom_center;
40  }
41 
42  //--- Width of the clusters minus the edge (first and last) pixels.
43  //--- In the note, they are denoted x_F and x_L (and y_F and y_L)
44  float W_inner = lower_edge_last_pix - upper_edge_first_pix; // in cm
45 
46  //--- Predicted charge width from geometry
47  float W_pred = theThickness * cot_angle // geometric correction (in cm)
48  - lorentz_shift; // (in cm) &&& check fpix!
49 
50  //cout<<" in PixelCPEGeneric:generic_position_formula - "<<W_inner<<" "<<W_pred<<endl; //dk
51 
52  //--- Total length of the two edge pixels (first+last)
53  float sum_of_edge = 2.0f;
54  if (first_is_big)
55  sum_of_edge += 1.0f;
56  if (last_is_big)
57  sum_of_edge += 1.0f;
58 
59  //--- The `effective' charge width -- particle's path in first and last pixels only
60  float W_eff = std::abs(W_pred) - W_inner;
61 
62  //--- If the observed charge width is inconsistent with the expectations
63  //--- based on the track, do *not* use W_pred-W_innner. Instead, replace
64  //--- it with an *average* effective charge width, which is the average
65  //--- length of the edge pixels.
66  //
67  // bool usedEdgeAlgo = false;
68  if ((size >= size_cut) || ((W_eff / pitch < eff_charge_cut_low) | (W_eff / pitch > eff_charge_cut_high))) {
69  W_eff = pitch * 0.5f * sum_of_edge; // ave. length of edge pixels (first+last) (cm)
70  // usedEdgeAlgo = true;
71  }
72 
73  //--- Finally, compute the position in this projection
74  float Qdiff = Q_l - Q_f;
75  float Qsum = Q_l + Q_f;
76 
77  //--- Temporary fix for clusters with both first and last pixel with charge = 0
78  if (Qsum == 0)
79  Qsum = 1.0f;
80 
81  //float hit_pos = geom_center + 0.5f*(Qdiff/Qsum) * W_eff + half_lorentz_shift;
82  float hit_pos = geom_center + 0.5f * (Qdiff / Qsum) * W_eff;
83 
84  return hit_pos;
85  }
86 
87 } // namespace SiPixelUtils
SiPixelUtils
Definition: SiPixelUtils.h:4
SiPixelUtils.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
SiPixelUtils::generic_position_formula
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, bool first_is_big, bool last_is_big, float eff_charge_cut_low, float eff_charge_cut_high, float size_cut)
Definition: SiPixelUtils.cc:16
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443