|
||||
File indexing completed on 2024-04-06 12:02:36
0001 // 0002 // SiPixelTemplate.h (v10.24) 0003 // 0004 // Add goodness-of-fit info and spare entries to templates, version number in template header, more error checking 0005 // Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias 0006 // Add cot(beta) reflection to reduce y-entries and more sophisticated x-interpolation 0007 // Fix small index searching bug in interpolate method 0008 // Change interpolation indexing to avoid complier complaining about possible un-initialized variables 0009 // Replace containers with static arrays in calls to ysigma2 and xsigma2 0010 // Add external threshold to calls to ysigma2 and xsigma2, fix parameter signal max for xsigma2 0011 // Return to 5 pixel spanning but adjust boundaries to use only when needed 0012 // Implement improved (faster) chi2min search that depends on pixel types 0013 // Fill template arrays in single calls to this object 0014 // Add qmin to the template 0015 // Add qscale to match charge scales 0016 // Small improvement to x-chisquare interpolation 0017 // Enlarge SiPixelTemplateStore to accommodate larger templates and increased alpha acceptance (reduce PT threshold to ~200 MeV) 0018 // Store x and y cluster sizes in fractional pixels to facilitate cluster splitting 0019 // Keep interpolated central 9 template bins in private storage and expand/shift in the getter functions (faster for speed=2/3) and easier to build 3d templates 0020 // Store error and bias information for the simple chi^2 min position analysis (no interpolation or Q_{FB} corrections) to use in cluster splitting 0021 // To save time, the gaussian centers and sigma are not interpolated right now (they aren't currently used). They can be restored by un-commenting lines in the interpolate method. 0022 // Add a new method to calculate qbin for input cotbeta and cluster charge. To be used for error estimation of merged clusters in PixelCPEGeneric. 0023 // Add bias info for Barrel and FPix separately in the header 0024 // Improve the charge estimation for larger cot(alpha) tracks 0025 // Change interpolate method to return false boolean if track angles are outside of range 0026 // Add template info and method for truncation information 0027 // Change to allow template sizes to be changed at compile time 0028 // Fix bug in track angle checking 0029 // Accommodate Dave's new DB pushfile which overloads the old method (file input) 0030 // Add CPEGeneric error information and expand qbin method to access useful info for PixelCPEGeneric 0031 // Fix large cot(alpha) bug in qmin interpolation 0032 // Add second qmin to allow a qbin=5 state 0033 // Use interpolated chi^2 info for one-pixel clusters 0034 // Separate BPix and FPix charge scales and thresholds 0035 // Fix DB pushfile version number checking bug. 0036 // Remove assert from qbin method 0037 // Replace asserts with exceptions in CMSSW 0038 // Change calling sequence to interpolate method to handle cot(beta)<0 for FPix cosmics 0039 // Add getter for pixelav Lorentz width estimates to qbin method 0040 // Add check on template size to interpolate and qbin methods 0041 // Add qbin population information, charge distribution information 0042 // 0043 // V7.00 - Decouple BPix and FPix information into separate templates 0044 // Add methods to facilitate improved cluster splitting 0045 // Fix small charge scaling bug (affects FPix only) 0046 // Change y-slice used for the x-template to be closer to the actual cotalpha-cotbeta point 0047 // (there is some weak breakdown of x-y factorization in the FPix after irradiation) 0048 // 0049 // V8.00 - Add method to calculate a simple 2D template 0050 // Reorganize the interpolate method to extract header info only once per ID 0051 // V8.01 - Improve simple template normalization 0052 // V8.05 - Change qbin normalization to work better after irradiation 0053 // V8.10 - Add Vavilov distribution interpolation 0054 // V8.11 - Renormalize the x-templates for Guofan's cluster size calculation 0055 // V8.12 - Technical fix to qavg issue. 0056 // V8.13 - Fix qbin and fastsim interpolaters to avoid changing class variables 0057 // V8.20 - Add methods to identify the central pixels in the x- and y-templates (to help align templates with clusters in radiation damaged detectors) 0058 // Rename class variables from pxxxx (private xxxx) to xxxx_ to follow standard convention. 0059 // Add compiler option to store the template entries in BOOST multiarrays of structs instead of simple c arrays 0060 // (allows dynamic resizing template storage and has bounds checking but costs ~10% in execution time). 0061 // V8.21 - Add new qbin method to use in cluster splitting 0062 // V8.23 - Replace chi-min position errors with merged cluster chi2 probability info 0063 // V8.25 - Incorporate VI's speed changes into the current version 0064 // V8.26 - Modify the Vavilov lookups to work better with the FPix (offset y-templates) 0065 // V8.30 - Change the splitting template generation and access to improve speed and eliminate triple index boost::multiarray 0066 // V8.31 - Add correction factor: measured/true charge 0067 // V8.31 - Fix version number bug in db object I/O (pushfile) 0068 // V8.32 - Check for illegal qmin during loading 0069 // V8.33 - Fix small type conversion warnings 0070 // V8.40 - Incorporate V.I. optimizations 0071 // V9.00 - Expand header to include multi and single dcol thresholds, LA biases, and (variable) Qbin definitions 0072 // V9.01 - Protect against negative error squared 0073 // V10.00 - Update to work with Phase 1 FPix. Fix some code problems introduced by other maintainers. 0074 // V10.01 - Fix initialization style as suggested by S. Krutelyov 0075 // V10.10 - Add class variables and methods to correctly calculate the probabilities of single pixel clusters 0076 // V10.11 - Allow subdetector ID=5 for FPix R2P2 [allows better internal labeling of templates] 0077 // V10.12 - Enforce minimum signal size in pixel charge uncertainty calculation 0078 // V10.13 - Update the variable size [SI_PIXEL_TEMPLATE_USE_BOOST] option so that it works with VI's enhancements 0079 // V10.20 - Add directory path selection to the ascii pushfile method 0080 // V10.21 - Address runtime issues in pushfile() for gcc 7.X due to using tempfile as char string + misc. cleanup [Petar] 0081 // V10.22 - Move templateStore to the heap, fix variable name in pushfile() [Petar] 0082 // V10.24 - Add sideload() + associated gymnastics [Petar and Oz] 0083 0084 // Created by Morris Swartz on 10/27/06. 0085 // 0086 // 0087 0088 // Build the template storage structure from several pieces 0089 0090 #ifndef SiPixelTemplate_h 0091 #define SiPixelTemplate_h 1 0092 0093 #include "SiPixelTemplateDefs.h" 0094 0095 #include <vector> 0096 #include <cassert> 0097 #include "boost/multi_array.hpp" 0098 0099 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0100 #include "CondFormats/SiPixelObjects/interface/SiPixelTemplateDBObject.h" 0101 #include "FWCore/Utilities/interface/Exception.h" 0102 #endif 0103 0104 struct SiPixelTemplateEntry { //!< Basic template entry corresponding to a single set of track angles 0105 int runnum; //!< number of pixelav run used to generate this entry 0106 float alpha; //!< alpha track angle (defined in CMS CMS IN 2004/014) 0107 float cotalpha; //!< cot(alpha) is proportional to cluster length in x and is basis of interpolation 0108 float beta; //!< beta track angle (defined in CMS CMS IN 2004/014) 0109 float cotbeta; //!< cot(beta) is proportional to cluster length in y and is basis of interpolation 0110 float costrk[3]; //!< direction cosines of tracks used to generate this entry 0111 float qavg; //!< average cluster charge for this set of track angles (now includes threshold effects) 0112 float pixmax; //!< maximum charge for individual pixels in cluster 0113 float symax; //!< average pixel signal for y-projection of cluster 0114 float dyone; //!< mean offset/correction for one pixel y-clusters 0115 float syone; //!< rms for one pixel y-clusters 0116 float sxmax; //!< average pixel signal for x-projection of cluster 0117 float dxone; //!< mean offset/correction for one pixel x-clusters 0118 float sxone; //!< rms for one pixel x-clusters 0119 float dytwo; //!< mean offset/correction for one double-pixel y-clusters 0120 float sytwo; //!< rms for one double-pixel y-clusters 0121 float dxtwo; //!< mean offset/correction for one double-pixel x-clusters 0122 float sxtwo; //!< rms for one double-pixel x-clusters 0123 float qmin; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) 0124 float qmin2; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) 0125 float yavggen[4]; //!< generic algorithm: average y-bias of reconstruction binned in 4 charge bins 0126 float yrmsgen[4]; //!< generic algorithm: average y-rms of reconstruction binned in 4 charge bins 0127 float xavggen[4]; //!< generic algorithm: average x-bias of reconstruction binned in 4 charge bins 0128 float xrmsgen[4]; //!< generic algorithm: average x-rms of reconstruction binned in 4 charge bins 0129 0130 float clsleny; //!< cluster y-length in pixels at signal height symax/2 0131 float clslenx; //!< cluster x-length in pixels at signal height sxmax/2 0132 float mpvvav; //!< most probable charge in Vavilov distribution (not actually for larger kappa) 0133 float sigmavav; //!< "sigma" scale fctor for Vavilov distribution 0134 float kappavav; //!< kappa parameter for Vavilov distribution 0135 float mpvvav2; //!< most probable charge in Vavilov distribution for 2 merged clusters (not actually for larger kappa) 0136 float sigmavav2; //!< "sigma" scale fctor for Vavilov distribution for 2 merged clusters 0137 float kappavav2; //!< kappa parameter for Vavilov distribution for 2 merged clusters 0138 float ypar[2][5]; //!< projected y-pixel uncertainty parameterization 0139 float ytemp[9][TYSIZE]; //!< templates for y-reconstruction (binned over 1 central pixel) 0140 float xpar[2][5]; //!< projected x-pixel uncertainty parameterization 0141 float xtemp[9][TXSIZE]; //!< templates for x-reconstruction (binned over 1 central pixel) 0142 float yavg[4]; //!< average y-bias of reconstruction binned in 4 charge bins 0143 float yrms[4]; //!< average y-rms of reconstruction binned in 4 charge bins 0144 float ygx0[4]; //!< average y0 from Gaussian fit binned in 4 charge bins 0145 float ygsig[4]; //!< average sigma_y from Gaussian fit binned in 4 charge bins 0146 float yflpar[4][6]; //!< Aqfl-parameterized y-correction in 4 charge bins 0147 float xavg[4]; //!< average x-bias of reconstruction binned in 4 charge bins 0148 float xrms[4]; //!< average x-rms of reconstruction binned in 4 charge bins 0149 float xgx0[4]; //!< average x0 from Gaussian fit binned in 4 charge bins 0150 float xgsig[4]; //!< average sigma_x from Gaussian fit binned in 4 charge bins 0151 float xflpar[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins 0152 float chi2yavg[4]; //!< average y chi^2 in 4 charge bins 0153 float chi2ymin[4]; //!< minimum of y chi^2 in 4 charge bins 0154 float chi2xavg[4]; //!< average x chi^2 in 4 charge bins 0155 float chi2xmin[4]; //!< minimum of x chi^2 in 4 charge bins 0156 float chi2yavgone; //!< average y chi^2 for 1 pixel clusters 0157 float chi2yminone; //!< minimum of y chi^2 for 1 pixel clusters 0158 float chi2xavgone; //!< average x chi^2 for 1 pixel clusters 0159 float chi2xminone; //!< minimum of x chi^2 for 1 pixel clusters 0160 float yavgc2m[4]; //!< 1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins 0161 float yrmsc2m[4]; //!< 1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins 0162 float chi2yavgc2m[4]; //!< 1st pass chi2 min search: average y chi^2 in 4 charge bins (merged clusters) 0163 float chi2yminc2m[4]; //!< 1st pass chi2 min search: minimum of y chi^2 in 4 charge bins (merged clusters) 0164 float xavgc2m[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins 0165 float xrmsc2m[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins 0166 float chi2xavgc2m[4]; //!< 1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters) 0167 float chi2xminc2m[4]; //!< 1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters) 0168 float ygx0gen[4]; //!< generic algorithm: average y0 from Gaussian fit binned in 4 charge bins 0169 float ygsiggen[4]; //!< generic algorithm: average sigma_y from Gaussian fit binned in 4 charge bins 0170 float xgx0gen[4]; //!< generic algorithm: average x0 from Gaussian fit binned in 4 charge bins 0171 float xgsiggen[4]; //!< generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins 0172 float qbfrac[3]; //!< fraction of sample in qbin = 0-2 (>=3 is the complement) 0173 float fracyone; //!< fraction of sample with ysize = 1 0174 float fracxone; //!< fraction of sample with xsize = 1 0175 float fracytwo; //!< fraction of double pixel sample with ysize = 1 0176 float fracxtwo; //!< fraction of double pixel sample with xsize = 1 0177 float qavg_avg; //!< average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) 0178 float r_qMeas_qTrue; //!< ratio of measured to true cluster charge 0179 float spare[1]; 0180 }; 0181 0182 struct SiPixelTemplateHeader { //!< template header structure 0183 int ID; //!< template ID number 0184 int NTy; //!< number of Template y entries 0185 int NTyx; //!< number of Template y-slices of x entries 0186 int NTxx; //!< number of Template x-entries in each slice 0187 int Dtype; //!< detector type (0=BPix, 1=FPix) 0188 float qscale; //!< Charge scaling to match cmssw and pixelav 0189 float lorywidth; //!< estimate of y-lorentz width for optimal resolution 0190 float lorxwidth; //!< estimate of x-lorentz width for optimal resolution 0191 float lorybias; //!< estimate of y-lorentz bias 0192 float lorxbias; //!< estimate of x-lorentz bias 0193 float Vbias; //!< detector bias potential in Volts 0194 float temperature; //!< detector temperature in deg K 0195 float fluence; //!< radiation fluence in n_eq/cm^2 0196 float s50; //!< 1/2 of the multihit dcol threshold in electrons 0197 float ss50; //!< 1/2 of the single hit dcol threshold in electrons 0198 char title[80]; //!< template title 0199 int templ_version; //!< Version number of the template to ensure code compatibility 0200 float Bfield; //!< Bfield in Tesla 0201 float fbin[3]; //!< The QBin definitions in Q_clus/Q_avg 0202 float xsize; //!< pixel size (for future use in upgraded geometry) 0203 float ysize; //!< pixel size (for future use in upgraded geometry) 0204 float zsize; //!< pixel size (for future use in upgraded geometry) 0205 }; 0206 0207 struct SiPixelTemplateStore { //!< template storage structure 0208 SiPixelTemplateHeader head; 0209 #ifndef SI_PIXEL_TEMPLATE_USE_BOOST 0210 std::array<float, TEMP_ENTRY_SIZEY> cotbetaY; 0211 std::array<float, TEMP_ENTRY_SIZEX_B> cotbetaX; 0212 std::array<float, TEMP_ENTRY_SIZEX_A> cotalphaX; 0213 //!< 60 y templates spanning cluster lengths from 0px to +18px 0214 SiPixelTemplateEntry enty[TEMP_ENTRY_SIZEY]; 0215 //!< 60 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 60 slices 0216 SiPixelTemplateEntry entx[TEMP_ENTRY_SIZEX_B][TEMP_ENTRY_SIZEX_A]; 0217 #else 0218 std::vector<float> cotbetaY; 0219 std::vector<float> cotbetaX; 0220 std::vector<float> cotalphaX; 0221 boost::multi_array<SiPixelTemplateEntry, 1> enty; //!< use 1d entry to store [60] entries 0222 //!< use 2d entry to store [60][60] entries 0223 boost::multi_array<SiPixelTemplateEntry, 2> entx; 0224 #endif 0225 }; 0226 0227 // ****************************************************************************************** 0228 //! \class SiPixelTemplate 0229 //! 0230 //! A template management class. SiPixelTemplate contains thePixelTemp 0231 //! (a std::vector of SiPixelTemplateStore, each of which is a collection of many 0232 //! SiPixelTemplateEntries). Each SiPixelTemplateStore corresponds to a given detector 0233 //! condition, and is valid for a range of runs. We allow more than one Store since the 0234 //! may change over time. 0235 //! 0236 //! This class reads templates from files via pushfile() method. 0237 //! 0238 //! The main functionality of SiPixelTemplate is interpolate(), which produces a template 0239 //! on the fly, given a specific track's alpha and beta. The results are kept in data 0240 //! members and accessed via inline getters. 0241 //! 0242 //! The resulting template is then used by PixelTempReco2D() (a global function) which 0243 //! get the reference for SiPixelTemplate & templ and uses the current template to 0244 //! reconstruct the SiPixelRecHit. 0245 // ****************************************************************************************** 0246 class SiPixelTemplate { 0247 public: 0248 SiPixelTemplate(const std::vector<SiPixelTemplateStore>& thePixelTemp) : thePixelTemp_(thePixelTemp) { 0249 id_current_ = -1; 0250 index_id_ = -1; 0251 cota_current_ = 0.; 0252 cotb_current_ = 0.; 0253 entry_sideloaded_ = nullptr; 0254 } //!< Constructor for cases in which template store already exists 0255 0256 // Load the private store with info from the file with the index (int) filenum from directory dir: 0257 // ${dir}template_summary_zp${filenum}.out 0258 #ifdef SI_PIXEL_TEMPLATE_STANDALONE 0259 static bool pushfile(int filenum, std::vector<SiPixelTemplateStore>& pixelTemp, std::string dir = ""); 0260 0261 // For calibrations only: load precalculated values -- no interpolation. 0262 void sideload(SiPixelTemplateEntry* entry, 0263 int iDtype, 0264 float locBx, 0265 float locBz, 0266 float lorwdy, 0267 float lorwdx, 0268 float q50, 0269 float fbin[3], 0270 float xsize, 0271 float ysize, 0272 float zsize); 0273 0274 #else 0275 static bool pushfile(int filenum, 0276 std::vector<SiPixelTemplateStore>& pixelTemp, 0277 // *&^%$#@! Different default dir -- remove once FastSim is updated. 0278 std::string dir = "CalibTracker/SiPixelESProducers/data/"); 0279 0280 //load from DB (default in CMSSW) 0281 static bool pushfile(const SiPixelTemplateDBObject& dbobject, 0282 std::vector<SiPixelTemplateStore>& pixelTemp); // load the private store with info from db 0283 #endif 0284 0285 // initialize the rest; 0286 static void postInit(std::vector<SiPixelTemplateStore>& thePixelTemp_); 0287 0288 // Interpolate input alpha and beta angles to produce a working template for each individual hit. 0289 bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx); 0290 0291 // Interpolate input alpha and beta angles to produce a working template for each individual hit. 0292 bool interpolate(int id, float cotalpha, float cotbeta, float locBz); 0293 0294 // overload for compatibility. 0295 bool interpolate(int id, float cotalpha, float cotbeta); 0296 0297 // retreive interpolated templates. 0298 void ytemp(int fybin, int lybin, float ytemplate[41][BYSIZE]); 0299 0300 void xtemp(int fxbin, int lxbin, float xtemplate[41][BXSIZE]); 0301 0302 //Method to estimate the central pixel of the interpolated y-template 0303 int cytemp(); 0304 0305 //Method to estimate the central pixel of the interpolated x-template 0306 int cxtemp(); 0307 0308 //Methods to build templates from two interpolated clusters (for splitting) 0309 void ytemp3d_int(int nypix, int& nybins); 0310 0311 void ytemp3d(int j, int k, std::vector<float>& ytemplate); 0312 0313 void xtemp3d_int(int nxpix, int& nxbins); 0314 0315 void xtemp3d(int j, int k, std::vector<float>& xtemplate); 0316 0317 // Convert vector of projected signals into uncertainties for fitting. 0318 void ysigma2(int fypix, int lypix, float sythr, float ysum[BYSIZE], float ysig2[BYSIZE]); 0319 0320 void ysigma2(float qpixel, int index, float& ysig2); 0321 0322 void xsigma2(int fxpix, int lxpix, float sxthr, float xsum[BXSIZE], float xsig2[BXSIZE]); 0323 0324 // Interpolate qfl correction in y. 0325 float yflcorr(int binq, float qfly); 0326 0327 // Interpolate qfl correction in x. 0328 float xflcorr(int binq, float qflx); 0329 0330 int qbin(int id, 0331 float cotalpha, 0332 float cotbeta, 0333 float locBz, 0334 float locBx, 0335 float qclus, 0336 float& pixmx, 0337 float& sigmay, 0338 float& deltay, 0339 float& sigmax, 0340 float& deltax, 0341 float& sy1, 0342 float& dy1, 0343 float& sy2, 0344 float& dy2, 0345 float& sx1, 0346 float& dx1, 0347 float& sx2, 0348 float& dx2); 0349 0350 int qbin(int id, 0351 float cotalpha, 0352 float cotbeta, 0353 float locBz, 0354 float qclus, 0355 float& pixmx, 0356 float& sigmay, 0357 float& deltay, 0358 float& sigmax, 0359 float& deltax, 0360 float& sy1, 0361 float& dy1, 0362 float& sy2, 0363 float& dy2, 0364 float& sx1, 0365 float& dx1, 0366 float& sx2, 0367 float& dx2); 0368 0369 // Overload to use for cluster splitting 0370 int qbin(int id, float cotalpha, float cotbeta, float qclus); 0371 0372 // Overload to keep legacy interface 0373 int qbin(int id, float cotbeta, float qclus); 0374 0375 // Method to return template errors for fastsim 0376 void temperrors(int id, 0377 float cotalpha, 0378 float cotbeta, 0379 int qBin, 0380 float& sigmay, 0381 float& sigmax, 0382 float& sy1, 0383 float& sy2, 0384 float& sx1, 0385 float& sx2); 0386 0387 //Method to return qbin and size probabilities for fastsim 0388 void qbin_dist(int id, 0389 float cotalpha, 0390 float cotbeta, 0391 float qbin_frac[4], 0392 float& ny1_frac, 0393 float& ny2_frac, 0394 float& nx1_frac, 0395 float& nx2_frac); 0396 0397 //Method to calculate simple 2D templates 0398 bool simpletemplate2D( 0399 float xhitp, float yhitp, std::vector<bool>& ydouble, std::vector<bool>& xdouble, float template2d[BXM2][BYM2]); 0400 0401 //Method to interpolate Vavilov distribution parameters 0402 void vavilov_pars(double& mpv, double& sigma, double& kappa); 0403 0404 //Method to interpolate 2-cluster Vavilov distribution parameters 0405 void vavilov2_pars(double& mpv, double& sigma, double& kappa); 0406 0407 float qavg() { return qavg_; } //!< average cluster charge for this set of track angles 0408 float pixmax() { return pixmax_; } //!< maximum pixel charge 0409 float qscale() { return qscale_; } //!< charge scaling factor 0410 float s50() { return s50_; } //!< 1/2 of the pixel threshold signal in electrons 0411 float ss50() { return ss50_; } //!< 1/2 of the single pixel per double column threshold in electrons 0412 float symax() { return symax_; } //!< average pixel signal for y-projection of cluster 0413 float dyone() { return dyone_; } //!< mean offset/correction for one pixel y-clusters 0414 float syone() { return syone_; } //!< rms for one pixel y-clusters 0415 float dytwo() { return dytwo_; } //!< mean offset/correction for one double-pixel y-clusters 0416 float sytwo() { return sytwo_; } //!< rms for one double-pixel y-clusters 0417 float sxmax() { return sxmax_; } //!< average pixel signal for x-projection of cluster 0418 float dxone() { return dxone_; } //!< mean offset/correction for one pixel x-clusters 0419 float sxone() { return sxone_; } //!< rms for one pixel x-clusters 0420 float dxtwo() { return dxtwo_; } //!< mean offset/correction for one double-pixel x-clusters 0421 float sxtwo() { return sxtwo_; } //!< rms for one double-pixel x-clusters 0422 float qmin() { return qmin_; } //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) 0423 float qmin(int i) { 0424 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0425 if (i < 0 || i > 1) { 0426 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::qmin called with illegal index = " << i << std::endl; 0427 } 0428 #else 0429 assert(i >= 0 && i < 2); 0430 #endif 0431 if (i == 0) { 0432 return qmin_; 0433 } else { 0434 return qmin2_; 0435 } 0436 } //!< minimum cluster charge for valid hit (keeps 99.9% or 99.8% of simulated hits) 0437 float clsleny() { return clsleny_; } //!< y-size of smaller interpolated template in pixels 0438 float clslenx() { return clslenx_; } //!< x-size of smaller interpolated template in pixels 0439 float yratio() { return yratio_; } //!< fractional distance in y between cotbeta templates 0440 float yxratio() { return yxratio_; } //!< fractional distance in y between cotalpha templates slices 0441 float xxratio() { return xxratio_; } //!< fractional distance in x between cotalpha templates 0442 float yavg(int i) { 0443 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0444 if (i < 0 || i > 3) { 0445 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yavg called with illegal index = " << i << std::endl; 0446 } 0447 #else 0448 assert(i >= 0 && i < 4); 0449 #endif 0450 return yavg_[i]; 0451 } //!< average y-bias of reconstruction binned in 4 charge bins 0452 float yrms(int i) { 0453 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0454 if (i < 0 || i > 3) { 0455 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yrms called with illegal index = " << i << std::endl; 0456 } 0457 #else 0458 assert(i >= 0 && i < 4); 0459 #endif 0460 return yrms_[i]; 0461 } //!< average y-rms of reconstruction binned in 4 charge bins 0462 float ygx0(int i) { 0463 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0464 if (i < 0 || i > 3) { 0465 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::ygx0 called with illegal index = " << i << std::endl; 0466 } 0467 #else 0468 assert(i >= 0 && i < 4); 0469 #endif 0470 return ygx0_[i]; 0471 } //!< average y0 from Gaussian fit binned in 4 charge bins 0472 float ygsig(int i) { 0473 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0474 if (i < 0 || i > 3) { 0475 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::ygsig called with illegal index = " << i << std::endl; 0476 } 0477 #else 0478 assert(i >= 0 && i < 4); 0479 #endif 0480 return ygsig_[i]; 0481 } //!< average sigma_y from Gaussian fit binned in 4 charge bins 0482 float xavg(int i) { 0483 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0484 if (i < 0 || i > 3) { 0485 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xavg called with illegal index = " << i << std::endl; 0486 } 0487 #else 0488 assert(i >= 0 && i < 4); 0489 #endif 0490 return xavg_[i]; 0491 } //!< average x-bias of reconstruction binned in 4 charge bins 0492 float xrms(int i) { 0493 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0494 if (i < 0 || i > 3) { 0495 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xrms called with illegal index = " << i << std::endl; 0496 } 0497 #else 0498 assert(i >= 0 && i < 4); 0499 #endif 0500 return xrms_[i]; 0501 } //!< average x-rms of reconstruction binned in 4 charge bins 0502 float xgx0(int i) { 0503 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0504 if (i < 0 || i > 3) { 0505 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xgx0 called with illegal index = " << i << std::endl; 0506 } 0507 #else 0508 assert(i >= 0 && i < 4); 0509 #endif 0510 return xgx0_[i]; 0511 } //!< average x0 from Gaussian fit binned in 4 charge bins 0512 float xgsig(int i) { 0513 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0514 if (i < 0 || i > 3) { 0515 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xgsig called with illegal index = " << i << std::endl; 0516 } 0517 #else 0518 assert(i >= 0 && i < 4); 0519 #endif 0520 return xgsig_[i]; 0521 } //!< average sigma_x from Gaussian fit binned in 4 charge bins 0522 float chi2yavg(int i) { 0523 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0524 if (i < 0 || i > 3) { 0525 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2yavg called with illegal index = " << i << std::endl; 0526 } 0527 #else 0528 assert(i >= 0 && i < 4); 0529 #endif 0530 return chi2yavg_[i]; 0531 } //!< average y chi^2 in 4 charge bins 0532 float chi2ymin(int i) { 0533 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0534 if (i < 0 || i > 3) { 0535 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2ymin called with illegal index = " << i << std::endl; 0536 } 0537 #else 0538 assert(i >= 0 && i < 4); 0539 #endif 0540 return chi2ymin_[i]; 0541 } //!< minimum y chi^2 in 4 charge bins 0542 float chi2xavg(int i) { 0543 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0544 if (i < 0 || i > 3) { 0545 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xavg called with illegal index = " << i << std::endl; 0546 } 0547 #else 0548 assert(i >= 0 && i < 4); 0549 #endif 0550 return chi2xavg_[i]; 0551 } //!< averaage x chi^2 in 4 charge bins 0552 float chi2xmin(int i) { 0553 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0554 if (i < 0 || i > 3) { 0555 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xmin called with illegal index = " << i << std::endl; 0556 } 0557 #else 0558 assert(i >= 0 && i < 4); 0559 #endif 0560 return chi2xmin_[i]; 0561 } //!< minimum y chi^2 in 4 charge bins 0562 float yavgc2m(int i) { 0563 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0564 if (i < 0 || i > 3) { 0565 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yavgc2m called with illegal index = " << i << std::endl; 0566 } 0567 #else 0568 assert(i >= 0 && i < 4); 0569 #endif 0570 return yavgc2m_[i]; 0571 } //!< 1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins 0572 float yrmsc2m(int i) { 0573 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0574 if (i < 0 || i > 3) { 0575 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yrmsc2m called with illegal index = " << i << std::endl; 0576 } 0577 #else 0578 assert(i >= 0 && i < 4); 0579 #endif 0580 return yrmsc2m_[i]; 0581 } //!< 1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins 0582 float chi2yavgc2m(int i) { 0583 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0584 if (i < 0 || i > 3) { 0585 throw cms::Exception("DataCorrupt") 0586 << "SiPixelTemplate::chi2yavgc2m called with illegal index = " << i << std::endl; 0587 } 0588 #else 0589 assert(i >= 0 && i < 4); 0590 #endif 0591 return chi2yavgc2m_[i]; 0592 } //!< 1st pass chi2 min search: average y-chisq for merged clusters 0593 float chi2yminc2m(int i) { 0594 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0595 if (i < 0 || i > 3) { 0596 throw cms::Exception("DataCorrupt") 0597 << "SiPixelTemplate::chi2yminc2m called with illegal index = " << i << std::endl; 0598 } 0599 #else 0600 assert(i >= 0 && i < 4); 0601 #endif 0602 return chi2yminc2m_[i]; 0603 } //!< 1st pass chi2 min search: minimum y-chisq for merged clusters 0604 float xavgc2m(int i) { 0605 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0606 if (i < 0 || i > 3) { 0607 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xavgc2m called with illegal index = " << i << std::endl; 0608 } 0609 #else 0610 assert(i >= 0 && i < 4); 0611 #endif 0612 return xavgc2m_[i]; 0613 } //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins 0614 float xrmsc2m(int i) { 0615 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0616 if (i < 0 || i > 3) { 0617 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xrmsc2m called with illegal index = " << i << std::endl; 0618 } 0619 #else 0620 assert(i >= 0 && i < 4); 0621 #endif 0622 return xrmsc2m_[i]; 0623 } //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins 0624 float chi2xavgc2m(int i) { 0625 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0626 if (i < 0 || i > 3) { 0627 throw cms::Exception("DataCorrupt") 0628 << "SiPixelTemplate::chi2xavgc2m called with illegal index = " << i << std::endl; 0629 } 0630 #else 0631 assert(i >= 0 && i < 4); 0632 #endif 0633 return chi2xavgc2m_[i]; 0634 } //!< 1st pass chi2 min search: average x-chisq for merged clusters 0635 float chi2xminc2m(int i) { 0636 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0637 if (i < 0 || i > 3) { 0638 throw cms::Exception("DataCorrupt") 0639 << "SiPixelTemplate::chi2xminc2m called with illegal index = " << i << std::endl; 0640 } 0641 #else 0642 assert(i >= 0 && i < 4); 0643 #endif 0644 return chi2xminc2m_[i]; 0645 } //!< 1st pass chi2 min search: minimum x-chisq for merged clusters 0646 float fbin(int i) { 0647 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0648 if (i < 0 || i > 2) { 0649 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::fbin called with illegal index = " << i << std::endl; 0650 } 0651 #else 0652 assert(i >= 0 && i < 3); 0653 #endif 0654 return fbin_[i]; 0655 } //!< Return lower bound of Qbin definition 0656 0657 float chi2yavgone() { return chi2yavgone_; } //!< //!< average y chi^2 for 1 pixel clusters 0658 float chi2yminone() { return chi2yminone_; } //!< //!< minimum of y chi^2 for 1 pixel clusters 0659 float chi2xavgone() { return chi2xavgone_; } //!< //!< average x chi^2 for 1 pixel clusters 0660 float chi2xminone() { return chi2xminone_; } //!< //!< minimum of x chi^2 for 1 pixel clusters 0661 float lorywidth() { return lorywidth_; } //!< signed lorentz y-width (microns) 0662 float lorxwidth() { return lorxwidth_; } //!< signed lorentz x-width (microns) 0663 //float lorybias() {return lorywidth_;} //!< signed lorentz y-width (microns) 0664 //float lorxbias() {return lorxwidth_;} //!< signed lorentz x-width (microns) 0665 float lorybias() { return lorybias_; } //!< signed lorentz y-width (microns) 0666 float lorxbias() { return lorxbias_; } //!< signed lorentz x-width (microns) 0667 float mpvvav() { return mpvvav_; } //!< most probable charge in Vavilov distribution (not actually for larger kappa) 0668 float sigmavav() { return sigmavav_; } //!< "sigma" scale fctor for Vavilov distribution 0669 float kappavav() { return kappavav_; } //!< kappa parameter for Vavilov distribution 0670 float mpvvav2() { 0671 return mpvvav2_; 0672 } //!< most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) 0673 float sigmavav2() { return sigmavav2_; } //!< "sigma" scale fctor for 2-cluster Vavilov distribution 0674 float kappavav2() { return kappavav2_; } //!< kappa parameter for 2-cluster Vavilov distribution 0675 float xsize() { return xsize_; } //!< pixel x-size (microns) 0676 float ysize() { return ysize_; } //!< pixel y-size (microns) 0677 float zsize() { return zsize_; } //!< pixel z-size or thickness (microns) 0678 float r_qMeas_qTrue() { return r_qMeas_qTrue_; } //!< ratio of measured to true cluster charge 0679 float fracyone() { return fracyone_; } //!< The simulated fraction of single pixel y-clusters 0680 float fracxone() { return fracxone_; } //!< The simulated fraction of single pixel x-clusters 0681 float fracytwo() { return fracytwo_; } //!< The simulated fraction of single double-size pixel y-clusters 0682 float fracxtwo() { return fracxtwo_; } //!< The simulated fraction of single double-size pixel x-clusters 0683 // float yspare(int i) {assert(i>=0 && i<5); return pyspare[i];} //!< vector of 5 spares interpolated in beta only 0684 // float xspare(int i) {assert(i>=0 && i<10); return pxspare[i];} //!< vector of 10 spares interpolated in alpha and beta 0685 0686 private: 0687 // Keep current template interpolaion parameters 0688 0689 int id_current_; //!< current id 0690 int index_id_; //!< current index 0691 float cota_current_; //!< current cot alpha 0692 float cotb_current_; //!< current cot beta 0693 float abs_cotb_; //!< absolute value of cot beta 0694 int dtype_; //!< flags BPix (=0) or FPix (=1) 0695 bool flip_y_; //!< flip y sign-sensitive quantities 0696 bool flip_x_; //!< flip x sign-sensitive quantities 0697 bool success_; //!< true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) 0698 0699 // Keep results of last interpolation to return through member functions 0700 0701 float qavg_; //!< average cluster charge for this set of track angles 0702 float pixmax_; //!< maximum pixel charge 0703 float qscale_; //!< charge scaling factor 0704 float s50_; //!< 1/2 of the pixel single col threshold signal in electrons 0705 float ss50_; //!< 1/2 of the pixel double col threshold signal in electrons 0706 float symax_; //!< average pixel signal for y-projection of cluster 0707 float syparmax_; //!< maximum pixel signal for parameterization of y uncertainties 0708 float dyone_; //!< mean offset/correction for one pixel y-clusters 0709 float syone_; //!< rms for one pixel y-clusters 0710 float dytwo_; //!< mean offset/correction for one double-pixel y-clusters 0711 float sytwo_; //!< rms for one double-pixel y-clusters 0712 float sxmax_; //!< average pixel signal for x-projection of cluster 0713 float sxparmax_; //!< maximum pixel signal for parameterization of x uncertainties 0714 float dxone_; //!< mean offset/correction for one pixel x-clusters 0715 float sxone_; //!< rms for one pixel x-clusters 0716 float dxtwo_; //!< mean offset/correction for one double-pixel x-clusters 0717 float sxtwo_; //!< rms for one double-pixel x-clusters 0718 float qmin_; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) 0719 float clsleny_; //!< y-cluster length of smaller interpolated template in pixels 0720 float clslenx_; //!< x-cluster length of smaller interpolated template in pixels 0721 float scalexavg_; //!< average x-error scale factor 0722 float scaleyavg_; //!< average y-error scale factor 0723 float delyavg_; //!< average difference between clsleny_ and cluster length [with threshold effects] 0724 float delysig_; //!< rms of difference between clsleny_ and cluster length [with threshold effects] 0725 float scalex_[4]; //!< x-error scale factor in charge bins 0726 float scaley_[4]; //!< y-error scale factor in charge bins 0727 float offsetx_[4]; //!< x-offset in charge bins 0728 float offsety_[4]; //!< y-offset in charge bins 0729 0730 float yratio_; //!< fractional distance in y between cotbeta templates 0731 float yparl_[2][5]; //!< projected y-pixel uncertainty parameterization for smaller cotbeta 0732 float yparh_[2][5]; //!< projected y-pixel uncertainty parameterization for larger cotbeta 0733 float xparly0_[2][5]; //!< projected x-pixel uncertainty parameterization for smaller cotbeta (central alpha) 0734 float xparhy0_[2][5]; //!< projected x-pixel uncertainty parameterization for larger cotbeta (central alpha) 0735 float ytemp_[9][BYSIZE]; //!< templates for y-reconstruction (binned over 5 central pixels) 0736 float yxratio_; //!< fractional distance in y between x-slices of cotalpha templates 0737 float xxratio_; //!< fractional distance in x between cotalpha templates 0738 float xpar0_[2][5]; //!< projected x-pixel uncertainty parameterization for central cotalpha 0739 float xparl_[2][5]; //!< projected x-pixel uncertainty parameterization for smaller cotalpha 0740 float xparh_[2][5]; //!< projected x-pixel uncertainty parameterization for larger cotalpha 0741 float xtemp_[9][BXSIZE]; //!< templates for x-reconstruction (binned over 5 central pixels) 0742 float yavg_[4]; //!< average y-bias of reconstruction binned in 4 charge bins 0743 float yrms_[4]; //!< average y-rms of reconstruction binned in 4 charge bins 0744 float ygx0_[4]; //!< average y0 from Gaussian fit binned in 4 charge bins 0745 float ygsig_[4]; //!< average sigma_y from Gaussian fit binned in 4 charge bins 0746 float yflparl_[4][6]; //!< Aqfl-parameterized y-correction in 4 charge bins for smaller cotbeta 0747 float yflparh_[4][6]; //!< Aqfl-parameterized y-correction in 4 charge bins for larger cotbeta 0748 float xavg_[4]; //!< average x-bias of reconstruction binned in 4 charge bins 0749 float xrms_[4]; //!< average x-rms of reconstruction binned in 4 charge bins 0750 float xgx0_[4]; //!< average x0 from Gaussian fit binned in 4 charge bins 0751 float xgsig_[4]; //!< sigma from Gaussian fit binned in 4 charge bins 0752 float xflparll_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, cotalpha 0753 float xflparlh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, larger cotalpha 0754 float xflparhl_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, smaller cotalpha 0755 float xflparhh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, cotalpha 0756 float chi2yavg_[4]; //!< average y chi^2 in 4 charge bins 0757 float chi2ymin_[4]; //!< minimum of y chi^2 in 4 charge bins 0758 float chi2xavg_[4]; //!< average x chi^2 in 4 charge bins 0759 float chi2xmin_[4]; //!< minimum of x chi^2 in 4 charge bins 0760 float yavgc2m_[4]; //!< 1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins 0761 float yrmsc2m_[4]; //!< 1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins 0762 float chi2yavgc2m_[4]; //!< 1st pass chi2 min search: average y-chisq for merged clusters 0763 float chi2yminc2m_[4]; //!< 1st pass chi2 min search: minimum y-chisq for merged clusters 0764 float xavgc2m_[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins 0765 float xrmsc2m_[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins 0766 float chi2xavgc2m_[4]; //!< 1st pass chi2 min search: average x-chisq for merged clusters 0767 float chi2xminc2m_[4]; //!< 1st pass chi2 min search: minimum x-chisq for merged clusters 0768 float chi2yavgone_; //!< average y chi^2 for 1 pixel clusters 0769 float chi2yminone_; //!< minimum of y chi^2 for 1 pixel clusters 0770 float chi2xavgone_; //!< average x chi^2 for 1 pixel clusters 0771 float chi2xminone_; //!< minimum of x chi^2 for 1 pixel clusters 0772 float qmin2_; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) 0773 float mpvvav_; //!< most probable charge in Vavilov distribution (not actually for larger kappa) 0774 float sigmavav_; //!< "sigma" scale fctor for Vavilov distribution 0775 float kappavav_; //!< kappa parameter for Vavilov distribution 0776 float mpvvav2_; //!< most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) 0777 float sigmavav2_; //!< "sigma" scale fctor for 2-cluster Vavilov distribution 0778 float kappavav2_; //!< kappa parameter for 2-cluster Vavilov distribution 0779 float lorywidth_; //!< Lorentz y-width (sign corrected for fpix frame) 0780 float lorxwidth_; //!< Lorentz x-width 0781 float lorybias_; //!< Lorentz y-bias 0782 float lorxbias_; //!< Lorentz x-bias 0783 float xsize_; //!< Pixel x-size 0784 float ysize_; //!< Pixel y-size 0785 float zsize_; //!< Pixel z-size (thickness) 0786 float qavg_avg_; //!< average of cluster charge less than qavg 0787 float nybins_; //!< number of bins in each dimension of the y-splitting template 0788 float nxbins_; //!< number of bins in each dimension of the x-splitting template 0789 float r_qMeas_qTrue_; //!< ratio of measured to true cluster charges 0790 float fbin_[3]; //!< The QBin definitions in Q_clus/Q_avg 0791 float fracyone_; //!< The simulated fraction of single pixel y-clusters 0792 float fracxone_; //!< The simulated fraction of single pixel x-clusters 0793 float fracytwo_; //!< The simulated fraction of single double-size pixel y-clusters 0794 float fracxtwo_; //!< The simulated fraction of single double-size pixel x-clusters 0795 boost::multi_array<float, 2> temp2dy_; //!< 2d-primitive for spltting 3-d template 0796 boost::multi_array<float, 2> temp2dx_; //!< 2d-primitive for spltting 3-d template 0797 0798 // Pointers to presently interpolated point: 0799 const SiPixelTemplateEntry* enty0_; // enty[ilow] 0800 const SiPixelTemplateEntry* enty1_; // enty[iylow][ilow] 0801 0802 const SiPixelTemplateEntry* entx00_; // entx[iylow][ilow] 0803 const SiPixelTemplateEntry* entx02_; 0804 const SiPixelTemplateEntry* entx20_; 0805 const SiPixelTemplateEntry* entx22_; 0806 const SiPixelTemplateEntry* entx21_; 0807 0808 // Pointer to the sideloaded Entry: use this one if set. 0809 const SiPixelTemplateEntry* entry_sideloaded_; 0810 0811 // The actual template store is a std::vector container 0812 const std::vector<SiPixelTemplateStore>& thePixelTemp_; 0813 }; 0814 0815 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |