![]() |
|
|||
File indexing completed on 2025-06-25 05:15:51
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 with y Gaussian Parameter interpolation to be used with goodEdge reconstruction algorithm 0289 // Interpolate input alpha and beta angles to produce a working template for each individual hit. 0290 bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx, bool goodEdgeAlgo = false); 0291 0292 // Interpolate input alpha and beta angles to produce a working template for each individual hit. 0293 bool interpolate(int id, float cotalpha, float cotbeta, float locBz); 0294 0295 // overload for compatibility. 0296 bool interpolate(int id, float cotalpha, float cotbeta); 0297 0298 // retreive interpolated templates. 0299 void ytemp(int fybin, int lybin, float ytemplate[41][BYSIZE]); 0300 0301 void xtemp(int fxbin, int lxbin, float xtemplate[41][BXSIZE]); 0302 0303 //Method to estimate the central pixel of the interpolated y-template 0304 int cytemp(); 0305 0306 //Method to estimate the central pixel of the interpolated x-template 0307 int cxtemp(); 0308 0309 //Methods to build templates from two interpolated clusters (for splitting) 0310 void ytemp3d_int(int nypix, int& nybins); 0311 0312 void ytemp3d(int j, int k, std::vector<float>& ytemplate); 0313 0314 void xtemp3d_int(int nxpix, int& nxbins); 0315 0316 void xtemp3d(int j, int k, std::vector<float>& xtemplate); 0317 0318 // Convert vector of projected signals into uncertainties for fitting. 0319 void ysigma2(int fypix, int lypix, float sythr, float ysum[BYSIZE], float ysig2[BYSIZE]); 0320 0321 void ysigma2(float qpixel, int index, float& ysig2); 0322 0323 void xsigma2(int fxpix, int lxpix, float sxthr, float xsum[BXSIZE], float xsig2[BXSIZE]); 0324 0325 // Interpolate qfl correction in y. 0326 float yflcorr(int binq, float qfly); 0327 0328 // Interpolate qfl correction in x. 0329 float xflcorr(int binq, float qflx); 0330 0331 int qbin(int id, 0332 float cotalpha, 0333 float cotbeta, 0334 float locBz, 0335 float locBx, 0336 float qclus, 0337 float& pixmx, 0338 float& sigmay, 0339 float& deltay, 0340 float& sigmax, 0341 float& deltax, 0342 float& sy1, 0343 float& dy1, 0344 float& sy2, 0345 float& dy2, 0346 float& sx1, 0347 float& dx1, 0348 float& sx2, 0349 float& dx2); 0350 0351 int qbin(int id, 0352 float cotalpha, 0353 float cotbeta, 0354 float locBz, 0355 float qclus, 0356 float& pixmx, 0357 float& sigmay, 0358 float& deltay, 0359 float& sigmax, 0360 float& deltax, 0361 float& sy1, 0362 float& dy1, 0363 float& sy2, 0364 float& dy2, 0365 float& sx1, 0366 float& dx1, 0367 float& sx2, 0368 float& dx2); 0369 0370 // Overload to use for cluster splitting 0371 int qbin(int id, float cotalpha, float cotbeta, float qclus); 0372 0373 // Overload to keep legacy interface 0374 int qbin(int id, float cotbeta, float qclus); 0375 0376 // Method to return template errors for fastsim 0377 void temperrors(int id, 0378 float cotalpha, 0379 float cotbeta, 0380 int qBin, 0381 float& sigmay, 0382 float& sigmax, 0383 float& sy1, 0384 float& sy2, 0385 float& sx1, 0386 float& sx2); 0387 0388 //Method to return qbin and size probabilities for fastsim 0389 void qbin_dist(int id, 0390 float cotalpha, 0391 float cotbeta, 0392 float qbin_frac[4], 0393 float& ny1_frac, 0394 float& ny2_frac, 0395 float& nx1_frac, 0396 float& nx2_frac); 0397 0398 //Method to calculate simple 2D templates 0399 bool simpletemplate2D( 0400 float xhitp, float yhitp, std::vector<bool>& ydouble, std::vector<bool>& xdouble, float template2d[BXM2][BYM2]); 0401 0402 //Method to interpolate Vavilov distribution parameters 0403 void vavilov_pars(double& mpv, double& sigma, double& kappa); 0404 0405 //Method to interpolate 2-cluster Vavilov distribution parameters 0406 void vavilov2_pars(double& mpv, double& sigma, double& kappa); 0407 0408 float qavg() { return qavg_; } //!< average cluster charge for this set of track angles 0409 float pixmax() { return pixmax_; } //!< maximum pixel charge 0410 float qscale() { return qscale_; } //!< charge scaling factor 0411 float s50() { return s50_; } //!< 1/2 of the pixel threshold signal in electrons 0412 float ss50() { return ss50_; } //!< 1/2 of the single pixel per double column threshold in electrons 0413 float symax() { return symax_; } //!< average pixel signal for y-projection of cluster 0414 float dyone() { return dyone_; } //!< mean offset/correction for one pixel y-clusters 0415 float syone() { return syone_; } //!< rms for one pixel y-clusters 0416 float dytwo() { return dytwo_; } //!< mean offset/correction for one double-pixel y-clusters 0417 float sytwo() { return sytwo_; } //!< rms for one double-pixel y-clusters 0418 float sxmax() { return sxmax_; } //!< average pixel signal for x-projection of cluster 0419 float dxone() { return dxone_; } //!< mean offset/correction for one pixel x-clusters 0420 float sxone() { return sxone_; } //!< rms for one pixel x-clusters 0421 float dxtwo() { return dxtwo_; } //!< mean offset/correction for one double-pixel x-clusters 0422 float sxtwo() { return sxtwo_; } //!< rms for one double-pixel x-clusters 0423 float qmin() { return qmin_; } //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) 0424 float qmin(int i) { 0425 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0426 if (i < 0 || i > 1) { 0427 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::qmin called with illegal index = " << i << std::endl; 0428 } 0429 #else 0430 assert(i >= 0 && i < 2); 0431 #endif 0432 if (i == 0) { 0433 return qmin_; 0434 } else { 0435 return qmin2_; 0436 } 0437 } //!< minimum cluster charge for valid hit (keeps 99.9% or 99.8% of simulated hits) 0438 float clsleny() { return clsleny_; } //!< y-size of smaller interpolated template in pixels 0439 float clslenx() { return clslenx_; } //!< x-size of smaller interpolated template in pixels 0440 float yratio() { return yratio_; } //!< fractional distance in y between cotbeta templates 0441 float yxratio() { return yxratio_; } //!< fractional distance in y between cotalpha templates slices 0442 float xxratio() { return xxratio_; } //!< fractional distance in x between cotalpha templates 0443 float yavg(int i) { 0444 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0445 if (i < 0 || i > 3) { 0446 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yavg called with illegal index = " << i << std::endl; 0447 } 0448 #else 0449 assert(i >= 0 && i < 4); 0450 #endif 0451 return yavg_[i]; 0452 } //!< average y-bias of reconstruction binned in 4 charge bins 0453 float yrms(int i) { 0454 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0455 if (i < 0 || i > 3) { 0456 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yrms called with illegal index = " << i << std::endl; 0457 } 0458 #else 0459 assert(i >= 0 && i < 4); 0460 #endif 0461 return yrms_[i]; 0462 } //!< average y-rms of reconstruction binned in 4 charge bins 0463 float ygx0(int i) { 0464 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0465 if (i < 0 || i > 3) { 0466 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::ygx0 called with illegal index = " << i << std::endl; 0467 } 0468 #else 0469 assert(i >= 0 && i < 4); 0470 #endif 0471 return ygx0_[i]; 0472 } //!< average y0 from Gaussian fit binned in 4 charge bins 0473 float ygsig(int i) { 0474 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0475 if (i < 0 || i > 3) { 0476 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::ygsig called with illegal index = " << i << std::endl; 0477 } 0478 #else 0479 assert(i >= 0 && i < 4); 0480 #endif 0481 return ygsig_[i]; 0482 } //!< average sigma_y from Gaussian fit binned in 4 charge bins 0483 float xavg(int i) { 0484 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0485 if (i < 0 || i > 3) { 0486 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xavg called with illegal index = " << i << std::endl; 0487 } 0488 #else 0489 assert(i >= 0 && i < 4); 0490 #endif 0491 return xavg_[i]; 0492 } //!< average x-bias of reconstruction binned in 4 charge bins 0493 float xrms(int i) { 0494 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0495 if (i < 0 || i > 3) { 0496 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xrms called with illegal index = " << i << std::endl; 0497 } 0498 #else 0499 assert(i >= 0 && i < 4); 0500 #endif 0501 return xrms_[i]; 0502 } //!< average x-rms of reconstruction binned in 4 charge bins 0503 float xgx0(int i) { 0504 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0505 if (i < 0 || i > 3) { 0506 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xgx0 called with illegal index = " << i << std::endl; 0507 } 0508 #else 0509 assert(i >= 0 && i < 4); 0510 #endif 0511 return xgx0_[i]; 0512 } //!< average x0 from Gaussian fit binned in 4 charge bins 0513 float xgsig(int i) { 0514 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0515 if (i < 0 || i > 3) { 0516 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xgsig called with illegal index = " << i << std::endl; 0517 } 0518 #else 0519 assert(i >= 0 && i < 4); 0520 #endif 0521 return xgsig_[i]; 0522 } //!< average sigma_x from Gaussian fit binned in 4 charge bins 0523 float chi2yavg(int i) { 0524 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0525 if (i < 0 || i > 3) { 0526 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2yavg called with illegal index = " << i << std::endl; 0527 } 0528 #else 0529 assert(i >= 0 && i < 4); 0530 #endif 0531 return chi2yavg_[i]; 0532 } //!< average y chi^2 in 4 charge bins 0533 float chi2ymin(int i) { 0534 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0535 if (i < 0 || i > 3) { 0536 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2ymin called with illegal index = " << i << std::endl; 0537 } 0538 #else 0539 assert(i >= 0 && i < 4); 0540 #endif 0541 return chi2ymin_[i]; 0542 } //!< minimum y chi^2 in 4 charge bins 0543 float chi2xavg(int i) { 0544 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0545 if (i < 0 || i > 3) { 0546 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xavg called with illegal index = " << i << std::endl; 0547 } 0548 #else 0549 assert(i >= 0 && i < 4); 0550 #endif 0551 return chi2xavg_[i]; 0552 } //!< averaage x chi^2 in 4 charge bins 0553 float chi2xmin(int i) { 0554 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0555 if (i < 0 || i > 3) { 0556 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::chi2xmin called with illegal index = " << i << std::endl; 0557 } 0558 #else 0559 assert(i >= 0 && i < 4); 0560 #endif 0561 return chi2xmin_[i]; 0562 } //!< minimum y chi^2 in 4 charge bins 0563 float yavgc2m(int i) { 0564 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0565 if (i < 0 || i > 3) { 0566 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yavgc2m called with illegal index = " << i << std::endl; 0567 } 0568 #else 0569 assert(i >= 0 && i < 4); 0570 #endif 0571 return yavgc2m_[i]; 0572 } //!< 1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins 0573 float yrmsc2m(int i) { 0574 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0575 if (i < 0 || i > 3) { 0576 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::yrmsc2m called with illegal index = " << i << std::endl; 0577 } 0578 #else 0579 assert(i >= 0 && i < 4); 0580 #endif 0581 return yrmsc2m_[i]; 0582 } //!< 1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins 0583 float chi2yavgc2m(int i) { 0584 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0585 if (i < 0 || i > 3) { 0586 throw cms::Exception("DataCorrupt") 0587 << "SiPixelTemplate::chi2yavgc2m called with illegal index = " << i << std::endl; 0588 } 0589 #else 0590 assert(i >= 0 && i < 4); 0591 #endif 0592 return chi2yavgc2m_[i]; 0593 } //!< 1st pass chi2 min search: average y-chisq for merged clusters 0594 float chi2yminc2m(int i) { 0595 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0596 if (i < 0 || i > 3) { 0597 throw cms::Exception("DataCorrupt") 0598 << "SiPixelTemplate::chi2yminc2m called with illegal index = " << i << std::endl; 0599 } 0600 #else 0601 assert(i >= 0 && i < 4); 0602 #endif 0603 return chi2yminc2m_[i]; 0604 } //!< 1st pass chi2 min search: minimum y-chisq for merged clusters 0605 float xavgc2m(int i) { 0606 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0607 if (i < 0 || i > 3) { 0608 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xavgc2m called with illegal index = " << i << std::endl; 0609 } 0610 #else 0611 assert(i >= 0 && i < 4); 0612 #endif 0613 return xavgc2m_[i]; 0614 } //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins 0615 float xrmsc2m(int i) { 0616 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0617 if (i < 0 || i > 3) { 0618 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::xrmsc2m called with illegal index = " << i << std::endl; 0619 } 0620 #else 0621 assert(i >= 0 && i < 4); 0622 #endif 0623 return xrmsc2m_[i]; 0624 } //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins 0625 float chi2xavgc2m(int i) { 0626 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0627 if (i < 0 || i > 3) { 0628 throw cms::Exception("DataCorrupt") 0629 << "SiPixelTemplate::chi2xavgc2m called with illegal index = " << i << std::endl; 0630 } 0631 #else 0632 assert(i >= 0 && i < 4); 0633 #endif 0634 return chi2xavgc2m_[i]; 0635 } //!< 1st pass chi2 min search: average x-chisq for merged clusters 0636 float chi2xminc2m(int i) { 0637 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0638 if (i < 0 || i > 3) { 0639 throw cms::Exception("DataCorrupt") 0640 << "SiPixelTemplate::chi2xminc2m called with illegal index = " << i << std::endl; 0641 } 0642 #else 0643 assert(i >= 0 && i < 4); 0644 #endif 0645 return chi2xminc2m_[i]; 0646 } //!< 1st pass chi2 min search: minimum x-chisq for merged clusters 0647 float fbin(int i) { 0648 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 0649 if (i < 0 || i > 2) { 0650 throw cms::Exception("DataCorrupt") << "SiPixelTemplate::fbin called with illegal index = " << i << std::endl; 0651 } 0652 #else 0653 assert(i >= 0 && i < 3); 0654 #endif 0655 return fbin_[i]; 0656 } //!< Return lower bound of Qbin definition 0657 0658 float chi2yavgone() { return chi2yavgone_; } //!< //!< average y chi^2 for 1 pixel clusters 0659 float chi2yminone() { return chi2yminone_; } //!< //!< minimum of y chi^2 for 1 pixel clusters 0660 float chi2xavgone() { return chi2xavgone_; } //!< //!< average x chi^2 for 1 pixel clusters 0661 float chi2xminone() { return chi2xminone_; } //!< //!< minimum of x chi^2 for 1 pixel clusters 0662 float lorywidth() { return lorywidth_; } //!< signed lorentz y-width (microns) 0663 float lorxwidth() { return lorxwidth_; } //!< signed lorentz x-width (microns) 0664 //float lorybias() {return lorywidth_;} //!< signed lorentz y-width (microns) 0665 //float lorxbias() {return lorxwidth_;} //!< signed lorentz x-width (microns) 0666 float lorybias() { return lorybias_; } //!< signed lorentz y-width (microns) 0667 float lorxbias() { return lorxbias_; } //!< signed lorentz x-width (microns) 0668 float mpvvav() { return mpvvav_; } //!< most probable charge in Vavilov distribution (not actually for larger kappa) 0669 float sigmavav() { return sigmavav_; } //!< "sigma" scale fctor for Vavilov distribution 0670 float kappavav() { return kappavav_; } //!< kappa parameter for Vavilov distribution 0671 float mpvvav2() { 0672 return mpvvav2_; 0673 } //!< most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) 0674 float sigmavav2() { return sigmavav2_; } //!< "sigma" scale fctor for 2-cluster Vavilov distribution 0675 float kappavav2() { return kappavav2_; } //!< kappa parameter for 2-cluster Vavilov distribution 0676 float xsize() { return xsize_; } //!< pixel x-size (microns) 0677 float ysize() { return ysize_; } //!< pixel y-size (microns) 0678 float zsize() { return zsize_; } //!< pixel z-size or thickness (microns) 0679 float r_qMeas_qTrue() { return r_qMeas_qTrue_; } //!< ratio of measured to true cluster charge 0680 float fracyone() { return fracyone_; } //!< The simulated fraction of single pixel y-clusters 0681 float fracxone() { return fracxone_; } //!< The simulated fraction of single pixel x-clusters 0682 float fracytwo() { return fracytwo_; } //!< The simulated fraction of single double-size pixel y-clusters 0683 float fracxtwo() { return fracxtwo_; } //!< The simulated fraction of single double-size pixel x-clusters 0684 // float yspare(int i) {assert(i>=0 && i<5); return pyspare[i];} //!< vector of 5 spares interpolated in beta only 0685 // float xspare(int i) {assert(i>=0 && i<10); return pxspare[i];} //!< vector of 10 spares interpolated in alpha and beta 0686 0687 private: 0688 // Keep current template interpolaion parameters 0689 0690 int id_current_; //!< current id 0691 int index_id_; //!< current index 0692 float cota_current_; //!< current cot alpha 0693 float cotb_current_; //!< current cot beta 0694 float abs_cotb_; //!< absolute value of cot beta 0695 int dtype_; //!< flags BPix (=0) or FPix (=1) 0696 bool flip_y_; //!< flip y sign-sensitive quantities 0697 bool flip_x_; //!< flip x sign-sensitive quantities 0698 bool success_; //!< true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) 0699 0700 // Keep results of last interpolation to return through member functions 0701 0702 float qavg_; //!< average cluster charge for this set of track angles 0703 float pixmax_; //!< maximum pixel charge 0704 float qscale_; //!< charge scaling factor 0705 float s50_; //!< 1/2 of the pixel single col threshold signal in electrons 0706 float ss50_; //!< 1/2 of the pixel double col threshold signal in electrons 0707 float symax_; //!< average pixel signal for y-projection of cluster 0708 float syparmax_; //!< maximum pixel signal for parameterization of y uncertainties 0709 float dyone_; //!< mean offset/correction for one pixel y-clusters 0710 float syone_; //!< rms for one pixel y-clusters 0711 float dytwo_; //!< mean offset/correction for one double-pixel y-clusters 0712 float sytwo_; //!< rms for one double-pixel y-clusters 0713 float sxmax_; //!< average pixel signal for x-projection of cluster 0714 float sxparmax_; //!< maximum pixel signal for parameterization of x uncertainties 0715 float dxone_; //!< mean offset/correction for one pixel x-clusters 0716 float sxone_; //!< rms for one pixel x-clusters 0717 float dxtwo_; //!< mean offset/correction for one double-pixel x-clusters 0718 float sxtwo_; //!< rms for one double-pixel x-clusters 0719 float qmin_; //!< minimum cluster charge for valid hit (keeps 99.9% of simulated hits) 0720 float clsleny_; //!< y-cluster length of smaller interpolated template in pixels 0721 float clslenx_; //!< x-cluster length of smaller interpolated template in pixels 0722 float scalexavg_; //!< average x-error scale factor 0723 float scaleyavg_; //!< average y-error scale factor 0724 float delyavg_; //!< average difference between clsleny_ and cluster length [with threshold effects] 0725 float delysig_; //!< rms of difference between clsleny_ and cluster length [with threshold effects] 0726 float scalex_[4]; //!< x-error scale factor in charge bins 0727 float scaley_[4]; //!< y-error scale factor in charge bins 0728 float offsetx_[4]; //!< x-offset in charge bins 0729 float offsety_[4]; //!< y-offset in charge bins 0730 0731 float yratio_; //!< fractional distance in y between cotbeta templates 0732 float yparl_[2][5]; //!< projected y-pixel uncertainty parameterization for smaller cotbeta 0733 float yparh_[2][5]; //!< projected y-pixel uncertainty parameterization for larger cotbeta 0734 float xparly0_[2][5]; //!< projected x-pixel uncertainty parameterization for smaller cotbeta (central alpha) 0735 float xparhy0_[2][5]; //!< projected x-pixel uncertainty parameterization for larger cotbeta (central alpha) 0736 float ytemp_[9][BYSIZE]; //!< templates for y-reconstruction (binned over 5 central pixels) 0737 float yxratio_; //!< fractional distance in y between x-slices of cotalpha templates 0738 float xxratio_; //!< fractional distance in x between cotalpha templates 0739 float xpar0_[2][5]; //!< projected x-pixel uncertainty parameterization for central cotalpha 0740 float xparl_[2][5]; //!< projected x-pixel uncertainty parameterization for smaller cotalpha 0741 float xparh_[2][5]; //!< projected x-pixel uncertainty parameterization for larger cotalpha 0742 float xtemp_[9][BXSIZE]; //!< templates for x-reconstruction (binned over 5 central pixels) 0743 float yavg_[4]; //!< average y-bias of reconstruction binned in 4 charge bins 0744 float yrms_[4]; //!< average y-rms of reconstruction binned in 4 charge bins 0745 float ygx0_[4]; //!< average y0 from Gaussian fit binned in 4 charge bins 0746 float ygsig_[4]; //!< average sigma_y from Gaussian fit binned in 4 charge bins 0747 float yflparl_[4][6]; //!< Aqfl-parameterized y-correction in 4 charge bins for smaller cotbeta 0748 float yflparh_[4][6]; //!< Aqfl-parameterized y-correction in 4 charge bins for larger cotbeta 0749 float xavg_[4]; //!< average x-bias of reconstruction binned in 4 charge bins 0750 float xrms_[4]; //!< average x-rms of reconstruction binned in 4 charge bins 0751 float xgx0_[4]; //!< average x0 from Gaussian fit binned in 4 charge bins 0752 float xgsig_[4]; //!< sigma from Gaussian fit binned in 4 charge bins 0753 float xflparll_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, cotalpha 0754 float xflparlh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for smaller cotbeta, larger cotalpha 0755 float xflparhl_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, smaller cotalpha 0756 float xflparhh_[4][6]; //!< Aqfl-parameterized x-correction in 4 charge bins for larger cotbeta, cotalpha 0757 float chi2yavg_[4]; //!< average y chi^2 in 4 charge bins 0758 float chi2ymin_[4]; //!< minimum of y chi^2 in 4 charge bins 0759 float chi2xavg_[4]; //!< average x chi^2 in 4 charge bins 0760 float chi2xmin_[4]; //!< minimum of x chi^2 in 4 charge bins 0761 float yavgc2m_[4]; //!< 1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins 0762 float yrmsc2m_[4]; //!< 1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins 0763 float chi2yavgc2m_[4]; //!< 1st pass chi2 min search: average y-chisq for merged clusters 0764 float chi2yminc2m_[4]; //!< 1st pass chi2 min search: minimum y-chisq for merged clusters 0765 float xavgc2m_[4]; //!< 1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins 0766 float xrmsc2m_[4]; //!< 1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins 0767 float chi2xavgc2m_[4]; //!< 1st pass chi2 min search: average x-chisq for merged clusters 0768 float chi2xminc2m_[4]; //!< 1st pass chi2 min search: minimum x-chisq for merged clusters 0769 float chi2yavgone_; //!< average y chi^2 for 1 pixel clusters 0770 float chi2yminone_; //!< minimum of y chi^2 for 1 pixel clusters 0771 float chi2xavgone_; //!< average x chi^2 for 1 pixel clusters 0772 float chi2xminone_; //!< minimum of x chi^2 for 1 pixel clusters 0773 float qmin2_; //!< tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits) 0774 float mpvvav_; //!< most probable charge in Vavilov distribution (not actually for larger kappa) 0775 float sigmavav_; //!< "sigma" scale fctor for Vavilov distribution 0776 float kappavav_; //!< kappa parameter for Vavilov distribution 0777 float mpvvav2_; //!< most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) 0778 float sigmavav2_; //!< "sigma" scale fctor for 2-cluster Vavilov distribution 0779 float kappavav2_; //!< kappa parameter for 2-cluster Vavilov distribution 0780 float lorywidth_; //!< Lorentz y-width (sign corrected for fpix frame) 0781 float lorxwidth_; //!< Lorentz x-width 0782 float lorybias_; //!< Lorentz y-bias 0783 float lorxbias_; //!< Lorentz x-bias 0784 float xsize_; //!< Pixel x-size 0785 float ysize_; //!< Pixel y-size 0786 float zsize_; //!< Pixel z-size (thickness) 0787 float qavg_avg_; //!< average of cluster charge less than qavg 0788 float nybins_; //!< number of bins in each dimension of the y-splitting template 0789 float nxbins_; //!< number of bins in each dimension of the x-splitting template 0790 float r_qMeas_qTrue_; //!< ratio of measured to true cluster charges 0791 float fbin_[3]; //!< The QBin definitions in Q_clus/Q_avg 0792 float fracyone_; //!< The simulated fraction of single pixel y-clusters 0793 float fracxone_; //!< The simulated fraction of single pixel x-clusters 0794 float fracytwo_; //!< The simulated fraction of single double-size pixel y-clusters 0795 float fracxtwo_; //!< The simulated fraction of single double-size pixel x-clusters 0796 boost::multi_array<float, 2> temp2dy_; //!< 2d-primitive for spltting 3-d template 0797 boost::multi_array<float, 2> temp2dx_; //!< 2d-primitive for spltting 3-d template 0798 0799 // Pointers to presently interpolated point: 0800 const SiPixelTemplateEntry* enty0_; // enty[ilow] 0801 const SiPixelTemplateEntry* enty1_; // enty[iylow][ilow] 0802 0803 const SiPixelTemplateEntry* entx00_; // entx[iylow][ilow] 0804 const SiPixelTemplateEntry* entx02_; 0805 const SiPixelTemplateEntry* entx20_; 0806 const SiPixelTemplateEntry* entx22_; 0807 const SiPixelTemplateEntry* entx21_; 0808 0809 // Pointer to the sideloaded Entry: use this one if set. 0810 const SiPixelTemplateEntry* entry_sideloaded_; 0811 0812 // The actual template store is a std::vector container 0813 const std::vector<SiPixelTemplateStore>& thePixelTemp_; 0814 }; 0815 0816 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |