CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiPixelTemplateReco.h
Go to the documentation of this file.
1 //
2 // SiPixelTemplateReco.cc (Version 10.00)
3 //
4 // Add goodness-of-fit to algorithm, include single pixel clusters in chi2 calculation
5 // Try "decapitation" of large single pixels
6 // Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias
7 // Add cot(beta) reflection to reduce y-entries and more sophisticated x-interpolation
8 // Fix small double pixel bug with decapitation (2.41 5-Mar-2007).
9 // Fix pseudopixel bug causing possible memory overwrite (2.42 12-Mar-2007)
10 // Adjust template binning to span 3 (or 4) central pixels and implement improved (faster) chi2min search
11 // Replace internal containers with static arrays
12 // Add external threshold to calls to ysigma2 and xsigma2, use sorted signal heights to guarrantee min clust size = 2
13 // Use denser search over larger bin range for clusters with big pixels.
14 // Use single calls to template object to load template arrays (had been many)
15 // Add speed switch to trade-off speed and robustness
16 // Add qmin and re-define qbin to flag low-q clusters
17 // Add qscale to match charge scales
18 // Return error if no pixels in cluster
19 // Replace 4 cout's with LogError's
20 // Add LogDebug I/O to report various common errors
21 // Incorporate "cluster repair" to handle dead pixels
22 // Take truncation size from new pixmax information
23 // Change to allow template sizes to be changed at compile time
24 // Move interpolation range error to LogDebug
25 // Add qbin = 5 and change 1-pixel probability to use new template info
26 // Add floor for probabilities (no exact zeros)
27 // Replace asserts with exceptions in CMSSW
28 // Change calling sequence to handle cot(beta)<0 for FPix cosmics
29 //
30 // V7.00 - Decouple BPix and FPix information into separate templates
31 // Pass all containers by alias to prevent excessive cpu-usage (v7.01)
32 // Slightly modify search bin range to avoid problem with single pixel clusters + large Lorentz drift (V7.02)
33 //
34 // V8.00 - Add 2D probabilities, take pixel sizes from the template
35 // V8.05 - Shift 2-D cluster to center on the buffer
36 // V8.06 - Add locBz to the 2-D template (causes failover to the simple template when the cotbeta-locBz correlation is incorrect ... ie for non-IP tracks).
37 // - include minimum value for prob2D (1.e-30)
38 // V8.07 - Tune 2-d probability: consider only pixels above threshold and use threshold value for zero signal pixels (non-zero template)
39 // V8.10 - Remove 2-d probability for ineffectiveness and replace with simple cluster charge probability
40 // V8.11 - Change probQ to upper tail probability always (rather than two-sided tail probability)
41 // V8.20 - Use template cytemp/cxtemp methods to center the data cluster in the right place when the template becomes asymmetric after irradiation
42 // V8.25 - Incorporate VIs speed improvements
43 // V8.26 - Fix centering problem for small signals
44 // V9.00 - Set QProb = Q/Q_avg when calcultion is turned off, use fbin definitions of Qbin
45 // V10.00 - Use new template object to reco Phase 1 FPix hits
46 //
47 //
48 //
49 // Created by Morris Swartz on 10/27/06.
50 //
51 //
52 
53 #ifndef SiPixelTemplateReco_h
54 #define SiPixelTemplateReco_h 1
55 
56 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
59 #else
60 #include "SiPixelTemplateDefs.h"
61 #include "SiPixelTemplate.h"
62 #endif
63 
64 #define N2D 500
65 
66 #include <vector>
67 
68 #ifndef SiPixelTemplateClusMatrix
69 #define SiPixelTemplateClusMatrix 1
70 
71 namespace SiPixelTemplateReco {
72 
73  struct ClusMatrix {
74  float& operator()(int x, int y) { return matrix[mcol * x + y]; }
75  float operator()(int x, int y) const { return matrix[mcol * x + y]; }
76  float* matrix;
77  bool const* xdouble;
78  bool const* ydouble;
79  int mrow, mcol;
80  };
81 #endif
82 
83  int PixelTempReco1D(int id,
84  float cotalpha,
85  float cotbeta,
86  float locBz,
87  float locBx,
88  ClusMatrix& cluster,
89  SiPixelTemplate& templ,
90  float& yrec,
91  float& sigmay,
92  float& proby,
93  float& xrec,
94  float& sigmax,
95  float& probx,
96  int& qbin,
97  int speed,
98  bool deadpix,
99  std::vector<std::pair<int, int> >& zeropix,
100  float& probQ,
101  int& nypix,
102  int& nxpix);
103 
104  int PixelTempReco1D(int id,
105  float cotalpha,
106  float cotbeta,
107  float locBz,
108  float locBx,
109  ClusMatrix& cluster,
110  SiPixelTemplate& templ,
111  float& yrec,
112  float& sigmay,
113  float& proby,
114  float& xrec,
115  float& sigmax,
116  float& probx,
117  int& qbin,
118  int speed,
119  float& probQ);
120 
121  int PixelTempReco1D(int id,
122  float cotalpha,
123  float cotbeta,
124  ClusMatrix& cluster,
125  SiPixelTemplate& templ,
126  float& yrec,
127  float& sigmay,
128  float& proby,
129  float& xrec,
130  float& sigmax,
131  float& probx,
132  int& qbin,
133  int speed,
134  float& probQ);
135 
136  int PixelTempReco1D(int id,
137  float cotalpha,
138  float cotbeta,
139  ClusMatrix& cluster,
140  SiPixelTemplate& templ,
141  float& yrec,
142  float& sigmay,
143  float& proby,
144  float& xrec,
145  float& sigmax,
146  float& probx,
147  int& qbin,
148  int speed);
149 }
150 
151 #endif
float operator()(int x, int y) const
int PixelTempReco1D(int id, float cotalpha, float cotbeta, float locBz, float locBx, ClusMatrix &cluster, SiPixelTemplate &templ, float &yrec, float &sigmay, float &proby, float &xrec, float &sigmax, float &probx, int &qbin, int speed, bool deadpix, std::vector< std::pair< int, int > > &zeropix, float &probQ, int &nypix, int &nxpix)