CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelTemplate2D.h
Go to the documentation of this file.
1 //
2 // SiPixelTemplate2D.h (v1.03)
3 //
4 // Full 2-D templates for cluster splitting, simulated cluster reweighting, and improved cluster probability
5 //
6 // Created by Morris Swartz on 12/01/09.
7 // V1.01 - fix qavg_ filling
8 // V1.02 - Add locBz to test if FPix use is out of range
9 // V1.03 - Fix edge checking on final template to increase template size and to properly truncate cluster
10 //
11 //
12 
13 // Build the template storage structure from several pieces
14 
15 #ifndef SiPixelTemplate2D_h
16 #define SiPixelTemplate2D_h 1
17 
19 
20 #include<vector>
21 #include<cassert>
22 #include "boost/multi_array.hpp"
23 
24 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
27 #endif
28 
30  int runnum;
31  float cotalpha;
32  float cotbeta;
33  float costrk[3];
34  float qavg;
35  float pixmax;
36  float sxymax;
37  int iymin;
38  int iymax;
39  int jxmin;
40  int jxmax;
41  float xypar[2][5];
42  float lanpar[2][5];
43  float xytemp[7][7][T2YSIZE][T2XSIZE];
44  float chi2avg[4];
45  float chi2min[4];
46  float chi2avgone;
47  float chi2minone;
48  float spare[20];
49 } ;
50 
51 
52 
53 
55  char title[80];
56  int ID;
58  float Bfield;
59  int NTy;
60  int NTyx;
61  int NTxx;
62  int Dtype;
63  float Vbias;
64  float temperature;
65  float fluence;
66  float qscale;
67  float s50;
68  float lorywidth;
69  float lorxwidth;
70  float xsize;
71  float ysize;
72  float zsize;
73 } ;
74 
75 
76 
79  boost::multi_array<SiPixelTemplateEntry2D,2> entry;
80 } ;
81 
82 
83 
84 
85 
86 // ******************************************************************************************
104 // ******************************************************************************************
106  public:
107  SiPixelTemplate2D(const std::vector< SiPixelTemplateStore2D > & thePixelTemp) : thePixelTemp_(thePixelTemp) {id_current_ = -1; index_id_ = -1; cota_current_ = 0.; cotb_current_ = 0.;}
108  static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from the
109  // file with the index (int) filenum
110 
111 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
112  static bool pushfile(const SiPixelTemplateDBObject& dbobject, std::vector< SiPixelTemplateStore2D > & thePixelTemp_); // load the private store with info from db
113 #endif
114 
115 
116 // Interpolate input alpha and beta angles to produce a working template for each individual hit.
117 
118  bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector<bool>& ydouble, std::vector<bool>& xdouble, float template2d[BXM2][BYM2]);
119 
120 // Overload to allow user to avoid the locBz information
121 
122  bool xytemp(int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector<bool>& ydouble, std::vector<bool>& xdouble, float template2d[BXM2][BYM2]);
123 
124 // Get pixel signal uncertainties
125 
126  void xysigma2(float qpixel, int index, float& xysig2);
127 
128 // Get the interpolated Landau distribution parameters
129 
130  void landau_par(float lanpar[2][5]);
131 
132  float qavg() {return qavg_;}
133  float pixmax() {return pixmax_;}
134  float qscale() {return qscale_;}
135  float s50() {return s50_;}
136  float sxymax() {return sxymax_;}
137  float xytemp(int j, int i) {
138 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
139  if(j < 0 || j > BXM3 || i < 0 || i > BYM3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::xytemp called with illegal indices = " << j << "," << i << std::endl;}
140 #else
141  assert((j>=0 && j<BYM2) && (i>=0 && i<BYM2));
142 #endif
143  return xytemp_[j][i];}
144  float chi2avg(int i) {
145 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
146  if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::chi2yavg called with illegal index = " << i << std::endl;}
147 #else
148  assert(i>=0 && i<4);
149 #endif
150  return chi2avg_[i];}
151  float chi2min(int i) {
152 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
153  if(i < 0 || i > 3) {throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::chi2ymin called with illegal index = " << i << std::endl;}
154 #else
155  assert(i>=0 && i<4);
156 #endif
157  return chi2min_[i];}
158  float chi2avgone() {return chi2avgone_;}
159  float chi2minone() {return chi2minone_;}
160  float lorywidth() {return lorywidth_;}
161  float lorxwidth() {return lorxwidth_;}
162  float xsize() {return xsize_;}
163  float ysize() {return ysize_;}
164  float zsize() {return zsize_;}
165  int storesize() {return (int)thePixelTemp_.size();}
166 
167  private:
168 
169  // Keep current template interpolaion parameters
170 
172  int index_id_;
175  int Nyx_;
176  int Nxx_;
177  int Dtype_;
178  float cotbeta0_;
179  float cotbeta1_;
180  float deltacotb_;
181  float cotalpha0_;
182  float cotalpha1_;
183  float deltacota_;
184  int iy0_;
185  int iy1_;
186  float adcotb_;
187  int jx0_;
188  int jx1_;
189  float adcota_;
190  bool success_;
191 
192 
193  // Keep results of last interpolation to return through member functions
194 
195  float qavg_;
196  float pixmax_;
197  float qscale_;
198  float s50_;
199  float sxymax_;
200  float xytemp_[BXM2][BYM2];
201  float xypary0x0_[2][5];
202  float xypary1x0_[2][5];
203  float xypary0x1_[2][5];
204  float lanpar_[2][5];
205  float chi2avg_[4];
206  float chi2min_[4];
207  float chi2avgone_;
208  float chi2minone_;
209  float lorywidth_;
210  float lorxwidth_;
211  float xsize_;
212  float ysize_;
213  float zsize_;
214 
215  // The actual template store is a std::vector container
216 
217  const std::vector< SiPixelTemplateStore2D > & thePixelTemp_;
218 } ;
219 
220 
221 #endif
float pixmax
maximum charge for individual pixels in cluster
float chi2avg[4]
average chi^2 in 4 charge bins
float adcotb_
fractional pixel distance of cot(beta) from iy0_
float deltacota_
cot(alpha) bin size
float qscale
Charge scaling to match cmssw and pixelav.
int i
Definition: DBlmapReader.cc:9
float xsize()
pixel x-size (microns)
int jx1_
index of next-nearest cot(alpha) bin
float chi2avgone
average y chi^2 for 1 pixel clusters
float qavg
average cluster charge for this set of track angles
float Vbias
detector bias potential in Volts
float lorxwidth
estimate of x-lorentz width from single pixel offset
int runnum
&lt; Basic template entry corresponding to a single set of track angles
int jx0_
index of nearest cot(alpha) bin
float ysize
pixel size (for future use in upgraded geometry)
float deltacotb_
cot(beta) bin size
SiPixelTemplateHeader2D head
&lt; template storage structure
float qavg_
average cluster charge for this set of track angles
float cotalpha1_
maximum cot(alpha) covered
float xsize_
Pixel x-size.
int Dtype_
flags BPix (=0) or FPix (=1)
void xysigma2(float qpixel, int index, float &xysig2)
float xytemp(int j, int i)
current 2-d template
float sxymax
average pixel signal for use of the error parameterization
#define BXM3
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > &thePixelTemp_)
float xypar[2][5]
pixel uncertainty parameterization
float chi2avgone_
average chi^2 for 1 pixel clusters
float chi2min_[4]
minimum of chi^2 in 4 charge bins
float chi2minone
minimum of y chi^2 for 1 pixel clusters
float xypary0x1_[2][5]
Polynomial error parameterization at ix1,iy0.
float sxymax_
average pixel signal for y-projection of cluster
int Nxx_
number of cot(alpha)-entries (rows) in template
int index_id_
current index
float s50()
1/2 of the pixel threshold signal in adc units
boost::multi_array< SiPixelTemplateEntry2D, 2 > entry
use 2d entry to store [47][5] barrel entries or [5][9] fpix entries
float cotbeta
cot(beta) is proportional to cluster length in y and is basis of interpolation
float xytemp_[BXM2][BYM2]
templates for y-reconstruction (binned over 5 central pixels)
#define BXM2
bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[BXM2][BYM2])
int iymax
the maximum nonzero pixel yindex in template (saves time during interpolation)
float adcota_
fractional pixel distance of cot(alpha) from jx0_
#define T2XSIZE
float chi2min(int i)
minimum chi^2 in 4 charge bins
int storesize()
return the size of the template store (the number of stored IDs
int iymin
the minimum nonzero pixel yindex in template (saves time during interpolation)
float chi2avgone()
//!&lt; average y chi^2 for 1 pixel clusters
int ID
template ID number
int NTxx
number of Template x-entries in each slice
float s50_
1/2 of the pixel threshold signal in adc units
float cotbeta0_
minimum cot(beta) covered
int jxmax
the maximum nonzero pixel xindex in template (saves time during interpolation)
float lanpar[2][5]
pixel landau distribution parameters
float xsize
pixel size (for future use in upgraded geometry)
int j
Definition: DBlmapReader.cc:9
float costrk[3]
direction cosines of tracks used to generate this entry
float chi2minone_
minimum of chi^2 for 1 pixel clusters
#define BYM2
int jxmin
the minimum nonzero pixel xindex in template (saves time during interpolation)
float chi2minone()
//!&lt; minimum of y chi^2 for 1 pixel clusters
float cotalpha0_
minimum cot(alpha) covered
#define BYM3
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float lorywidth()
signed lorentz y-width (microns)
char title[80]
&lt; template header structure
int iy1_
index of next-nearest cot(beta) bin
float zsize
pixel size (for future use in upgraded geometry)
float xytemp[7][7][T2YSIZE][T2XSIZE]
templates for y-reconstruction (binned over 1 central pixel)
float zsize_
Pixel z-size (thickness)
SiPixelTemplate2D(const std::vector< SiPixelTemplateStore2D > &thePixelTemp)
Default constructor.
int Nyx_
number of cot(beta)-entries (columns) in template
float lorywidth
estimate of y-lorentz width from single pixel offset
float lanpar_[2][5]
Interpolated Landau parameters.
float chi2avg_[4]
average chi^2 in 4 charge bins
float cota_current_
current cot alpha
float pixmax()
maximum pixel charge
float lorxwidth_
Lorentz x-width.
float chi2avg(int i)
average chi^2 in 4 charge bins
float lorxwidth()
signed lorentz x-width (microns)
int NTy
number of Template y entries (= 0 for 2-D templates)
float sxymax()
max pixel signal for pixel error calculation
float pixmax_
maximum pixel charge
float cotbeta1_
maximum cot(beta) covered
int Dtype
detector type (0=BPix, 1=FPix)
float ysize()
pixel y-size (microns)
float qscale()
charge scaling factor
float xypary1x0_[2][5]
Polynomial error parameterization at ix0,iy1.
float qavg()
average cluster charge for this set of track angles
float chi2min[4]
minimum of chi^2 in 4 charge bins
bool success_
true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded)
float ysize_
Pixel y-size.
void landau_par(float lanpar[2][5])
Return the Landau probability parameters for this set of cot(alpha, cot(beta)
float xypary0x0_[2][5]
Polynomial error parameterization at ix0,iy0.
float cotb_current_
current cot beta
int templ_version
Version number of the template to ensure code compatibility.
float zsize()
pixel z-size or thickness (microns)
float s50
1/2 of the readout threshold in ADC units
float temperature
detector temperature in deg K
float Bfield
Bfield in Tesla.
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
float qscale_
charge scaling factor
#define T2YSIZE
int iy0_
index of nearest cot(beta) bin
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
float fluence
radiation fluence in n_eq/cm^2
int NTyx
number of Template y-slices of x entries
int id_current_
current id