CMS 3D CMS Logo

SiPixelGenError.h
Go to the documentation of this file.
1 //
2 // SiPixelGenError.h (v2.20)
3 //
4 // Object to contain Lorentz drift and error information for the Generic Algorithm
5 //
6 // Created by Morris Swartz on 1/10/2014.
7 //
8 // Update for Phase 1 FPix, M.S. 1/15/17
9 // V2.01 - Allow subdetector ID=5 for FPix R2P2, Fix error message
10 // V2.10 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements
11 // V2.20 - Add directory path selection to the ascii pushfile method
12 // V2.21 - Move templateStore to the heap, fix variable name in pushfile()
13 // V2.30 - Fix interpolation of IrradiationBias corrections
14 
15 // Build the template storage structure from several pieces
16 
17 #ifndef SiPixelGenError_h
18 #define SiPixelGenError_h 1
19 
20 #include "SiPixelTemplateDefs.h"
21 
22 #include <vector>
23 #include <cassert>
24 #include "boost/multi_array.hpp"
25 
26 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
29 #endif
30 
32  int runnum;
33  float cotalpha;
34  float cotbeta;
35  float qavg;
36  float pixmax;
37  float dyone;
38  float syone;
39  float dxone;
40  float sxone;
41  float dytwo;
42  float sytwo;
43  float dxtwo;
44  float sxtwo;
45  float qmin;
46  float qmin2;
47  float yavggen[4];
48  float yrmsgen[4];
49  float xavggen[4];
50  float xrmsgen[4];
51 };
52 
54  int ID;
55  int NTy;
56  int NTyx;
57  int NTxx;
58  int Dtype;
59  float qscale;
60  float lorywidth;
61  float lorxwidth;
62  float lorybias;
63  float lorxbias;
64  float Vbias;
65  float temperature;
66  float fluence;
67  float s50;
68  float ss50;
69  char title[80];
71  float Bfield;
72  float fbin[3];
73  float xsize;
74  float ysize;
75  float zsize;
76 };
77 
80 #ifndef SI_PIXEL_TEMPLATE_USE_BOOST
88 #else
89  float* cotbetaY;
90  float* cotbetaX;
91  float* cotalphaX;
92  boost::multi_array<SiPixelGenErrorEntry, 1> enty;
93  boost::multi_array<SiPixelGenErrorEntry, 2> entx;
95 #endif
96 };
97 
98 // ******************************************************************************************
112 // ******************************************************************************************
114 public:
115  SiPixelGenError(const std::vector<SiPixelGenErrorStore>& thePixelTemp)
116  : id_current_(-1),
117  index_id_(-1),
118  lorxwidth_(0),
119  lorywidth_(0),
120  lorxbias_(0),
121  lorybias_(0),
122  fbin_{0, 0, 0},
123  xsize_(0),
124  ysize_(0),
125  zsize_(0),
126  thePixelTemp_(thePixelTemp) {}
127 
128  // Load the private store with info from the file with the index (int) filenum from directory dir:
129  // ${dir}generror_summary_zp${filenum}.out
130  static bool pushfile(int filenum, std::vector<SiPixelGenErrorStore>& pixelTemp, std::string dir = "");
131 
132 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
133  // load the private store with info from db
134  static bool pushfile(const SiPixelGenErrorDBObject& dbobject, std::vector<SiPixelGenErrorStore>& pixelTemp);
135 #endif
136 
137  // initialize the binary search information;
138  static void postInit(std::vector<SiPixelGenErrorStore>& thePixelTemp_);
139 
140  // Interpolate input beta angle to estimate the average charge. return qbin flag for input cluster charge, and estimate y/x errors and biases for the Generic Algorithm.
141  int qbin(int id,
142  float cotalpha,
143  float cotbeta,
144  float locBz,
145  float locBx,
146  float qclus,
147  bool irradiationCorrections,
148  int& pixmx,
149  float& sigmay,
150  float& deltay,
151  float& sigmax,
152  float& deltax,
153  float& sy1,
154  float& dy1,
155  float& sy2,
156  float& dy2,
157  float& sx1,
158  float& dx1,
159  float& sx2,
160  float& dx2);
161 
162  // Overload to provide backward compatibility
163 
164  int qbin(int id,
165  float cotalpha,
166  float cotbeta,
167  float locBz,
168  float locBx,
169  float qclus,
170  float& pixmx,
171  float& sigmay,
172  float& deltay,
173  float& sigmax,
174  float& deltax,
175  float& sy1,
176  float& dy1,
177  float& sy2,
178  float& dy2,
179  float& sx1,
180  float& dx1,
181  float& sx2,
182  float& dx2);
183  // Overloaded method to provide only the LA parameters
184  int qbin(int id);
185 
186  float lorywidth() { return lorywidth_; }
187  float lorxwidth() { return lorxwidth_; }
188  float lorybias() { return lorybias_; }
189  float lorxbias() { return lorxbias_; }
190 
191  float fbin(int i) {
192 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
193  if (i < 0 || i > 2) {
194  throw cms::Exception("DataCorrupt")
195  << "SiPixelTemplate::chi2xminc2m called with illegal index = " << i << std::endl;
196  }
197 #else
198  assert(i >= 0 && i < 3);
199 #endif
200  return fbin_[i];
201  }
202  float xsize() { return xsize_; }
203  float ysize() { return ysize_; }
204  float zsize() { return zsize_; }
205 
206 private:
207  // Keep current template interpolaion parameters
208 
210  int index_id_;
211 
212  // Keep results of last interpolation to return through member functions
213 
214  float lorxwidth_;
215  float lorywidth_;
216  float lorxbias_;
217  float lorybias_;
218  float fbin_[3];
219  float xsize_;
220  float ysize_;
221  float zsize_;
222 
223  // The actual template store is a std::vector container
224 
225  const std::vector<SiPixelGenErrorStore>& thePixelTemp_;
226 };
227 
228 #endif
const std::vector< SiPixelGenErrorStore > & thePixelTemp_
SiPixelGenErrorEntry enty[100]
60 x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 60 slice...
float xsize_
Pixel x-size.
float qavg
average cluster charge for this set of track angles (now includes threshold effects) ...
float ss50
1/2 of the single hit dcol threshold in electrons
float qmin
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)
float lorxbias_
Lorentz x-width.
float Bfield
Bfield in Tesla.
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
int runnum
< Basic template entry corresponding to a single set of track angles
float yrmsgen[4]
generic algorithm: average y-rms of reconstruction binned in 4 charge bins
float dxone
mean offset/correction for one pixel x-clusters
static bool pushfile(int filenum, std::vector< SiPixelGenErrorStore > &pixelTemp, std::string dir="")
float Vbias
detector bias potential in Volts
float xrmsgen[4]
generic algorithm: average x-rms of reconstruction binned in 4 charge bins
int NTxx
number of Template x-entries in each slice
float fbin[3]
The QBin definitions in Q_clus/Q_avg.
float syone
rms for one pixel y-clusters
float ysize_
Pixel y-size.
float zsize
pixel size (for future use in upgraded geometry)
#define TEMP_ENTRY_SIZEX_B
assert(be >=bs)
float s50
1/2 of the multihit dcol threshold in electrons
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float ysize()
pixel y-size (microns)
float lorxbias
estimate of x-lorentz bias
float fbin(int i)
Return lower bound of Qbin definition.
float temperature
detector temperature in deg K
int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, float qclus, bool irradiationCorrections, int &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
float xsize
pixel size (for future use in upgraded geometry)
static void postInit(std::vector< SiPixelGenErrorStore > &thePixelTemp_)
int templ_version
Version number of the template to ensure code compatibility.
float cotbeta
cot(beta) is proportional to cluster length in y and is basis of interpolation
float fbin_[3]
The QBin definitions in Q_clus/Q_avg.
int ID
< template header structure
#define TEMP_ENTRY_SIZEY
float sxone
rms for one pixel x-clusters
float fluence
radiation fluence in n_eq/cm^2
float dytwo
mean offset/correction for one double-pixel y-clusters
float zsize_
Pixel z-size (thickness)
float lorxwidth()
signed lorentz x-width (microns)
float xsize()
pixel x-size (microns)
int NTy
number of Template y entries
float qscale
Charge scaling to match cmssw and pixelav.
float dxtwo
mean offset/correction for one double-pixel x-clusters
SiPixelGenErrorHeader head
< template storage structure
float lorxwidth_
Lorentz x-width.
float ysize
pixel size (for future use in upgraded geometry)
char title[80]
template title
float sytwo
rms for one double-pixel y-clusters
float lorywidth
estimate of y-lorentz width for optimal resolution
float cotalphaX[80]
60 y templates spanning cluster lengths from 0px to +18px
float yavggen[4]
generic algorithm: average y-bias of reconstruction binned in 4 charge bins
float dyone
mean offset/correction for one pixel y-clusters
int id_current_
current id
float lorywidth()
signed lorentz y-width (microns)
SiPixelGenError(const std::vector< SiPixelGenErrorStore > &thePixelTemp)
Constructor for cases in which template store already exists.
float lorxbias()
signed lorentz x-bias (microns)
float zsize()
pixel z-size or thickness (microns)
int Dtype
detector type (0=BPix, 1=FPix)
int NTyx
number of Template y-slices of x entries
float lorybias_
Lorentz y-width (sign corrected for fpix frame)
SiPixelGenErrorEntry entx[80][80]
float xavggen[4]
generic algorithm: average x-bias of reconstruction binned in 4 charge bins
float pixmax
maximum charge for individual pixels in cluster
float sxtwo
rms for one double-pixel x-clusters
#define TEMP_ENTRY_SIZEX_A
int index_id_
current index
float lorybias()
signed lorentz y-bias (microns)
float lorybias
estimate of y-lorentz bias
float lorxwidth
estimate of x-lorentz width for optimal resolution