CMS 3D CMS Logo

SiPixelTemplate.h

Go to the documentation of this file.
00001 //
00002 //  SiPixelTemplate.h (v5.00)
00003 //
00004 //  Add goodness-of-fit info and spare entries to templates, version number in template header, more error checking
00005 //  Add correction for (Q_F-Q_L)/(Q_F+Q_L) bias
00006 //  Add cot(beta) reflection to reduce y-entries and more sophisticated x-interpolation
00007 //  Fix small index searching bug in interpolate method
00008 //  Change interpolation indexing to avoid complier complaining about possible un-initialized variables
00009 //  Replace containers with static arrays in calls to ysigma2 and xsigma2
00010 //  Add external threshold to calls to ysigma2 and xsigma2, fix parameter signal max for xsigma2
00011 //  Return to 5 pixel spanning but adjust boundaries to use only when needed
00012 //  Implement improved (faster) chi2min search that depends on pixel types
00013 //  Fill template arrays in single calls to this object
00014 //  Add qmin to the template
00015 //  Add qscale to match charge scales
00016 //  Small improvement to x-chisquare interpolation
00017 //  Enlarge SiPixelTemplateStore to accommodate larger templates and increased alpha acceptance (reduce PT threshold to ~200 MeV)
00018 //  Store x and y cluster sizes in fractional pixels to facilitate cluster splitting
00019 //  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
00020 //  Store error and bias information for the simple chi^2 min position analysis (no interpolation or Q_{FB} corrections) to use in cluster splitting
00021 //  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.
00022 //  Add a new method to calculate qbin for input cotbeta and cluster charge.  To be used for error estimation of merged clusters in PixelCPEGeneric.
00023 //  Add bias info for Barrel and FPix separately in the header
00024 //  Improve the charge estimation for larger cot(alpha) tracks
00025 //  Change interpolate method to return false boolean if track angles are outside of range
00026 //  Add template info and method for truncation information
00027 //  Change to allow template sizes to be changed at compile time
00028 //
00029 // Created by Morris Swartz on 10/27/06.
00030 // Copyright 2006 __TheJohnsHopkinsUniversity__. All rights reserved.
00031 //
00032 //
00033  
00034 // Build the template storage structure from several pieces 
00035 
00036 #ifndef SiPixelTemplate_h
00037 #define SiPixelTemplate_h 1
00038 
00039 #define TYSIZE 21
00040 #define TYTEN 210 // = 10*TYSIZE
00041 #define BYSIZE TYSIZE+4
00042 #define BHY 12 // = BYSIZE/2
00043 #define BYM1 TYSIZE+3
00044 #define BYM2 TYSIZE+2
00045 #define BYM3 TYSIZE+1
00046 #define TXSIZE 13
00047 #define BXSIZE TXSIZE+4
00048 #define BHX 8 // = BXSIZE/2
00049 #define BXM1 TXSIZE+3
00050 #define BXM2 TXSIZE+2
00051 #define BXM3 TXSIZE+1
00052 
00053 #include<vector>
00054 #include<cassert>
00055 #include "boost/multi_array.hpp"
00056 
00057 typedef boost::multi_array<float, 3> array_3d;
00058 
00059 struct SiPixelTemplateEntry { 
00060   int runnum;              
00061   float alpha;             
00062   float cotalpha;          
00063   float beta;              
00064   float cotbeta;           
00065   float costrk[3];            
00066   float qavg;              
00067   float pixmax;            
00068   float symax;             
00069   float dyone;             
00070   float syone;             
00071   float sxmax;             
00072   float dxone;             
00073   float sxone;             
00074   float dytwo;             
00075   float sytwo;             
00076   float dxtwo;             
00077   float sxtwo;             
00078   float qmin;              
00079   float clsleny;           
00080   float clslenx;           
00081   float ypar[2][5];        
00082   float ytemp[9][TYSIZE];  
00083   float xpar[2][5];        
00084   float xtemp[9][TXSIZE];  
00085   float yavg[4];           
00086   float yrms[4];           
00087   float ygx0[4];           
00088   float ygsig[4];          
00089   float yflpar[4][6];      
00090   float xavg[4];           
00091   float xrms[4];           
00092   float xgx0[4];           
00093   float xgsig[4];          
00094   float xflpar[4][6];      
00095   float chi2yavg[4];       
00096   float chi2ymin[4];       
00097   float chi2xavg[4];       
00098   float chi2xmin[4];       
00099   float yavgc2m[4];        
00100   float yrmsc2m[4];        
00101   float ygx0c2m[4];        
00102   float ygsigc2m[4];       
00103   float xavgc2m[4];        
00104   float xrmsc2m[4];        
00105   float xgx0c2m[4];        
00106   float xgsigc2m[4];       
00107   float yspare[10];       
00108   float xspare[10];       
00109 } ;
00110 
00111 
00112 
00113 
00114 struct SiPixelTemplateHeader {           
00115   char title[80];         
00116   int ID;                 
00117   int NBy;                
00118   int NByx;               
00119   int NBxx;               
00120   int NFy;                
00121   int NFyx;               
00122   int NFxx;               
00123   float Bbias;            
00124   float Fbias;            
00125   float temperature;      
00126   float fluence;          
00127   float qscale;           
00128   float s50;              
00129   int templ_version;      
00130 } ;
00131 
00132 
00133 
00134 
00135 
00136 struct SiPixelTemplateStore { 
00137   SiPixelTemplateHeader head;
00138   SiPixelTemplateEntry entby[60];     
00139   SiPixelTemplateEntry entbx[5][29];  
00140   SiPixelTemplateEntry entfy[16];     
00141   SiPixelTemplateEntry entfx[3][29];   
00142 } ;
00143 
00144 
00145 
00146 
00147 
00148 // ******************************************************************************************
00166 // ******************************************************************************************
00167 class SiPixelTemplate {
00168  public:
00169   SiPixelTemplate() {id_current = -1; index_id = -1; cota_current = 0.; cotb_current = 0.; fpix_current=false;} 
00170   bool pushfile(int filenum);     // load the private store with info from the 
00171                                   // file with the index (int) filenum
00172   
00173   // Interpolate input alpha and beta angles to produce a working template for each individual hit. 
00174   bool interpolate(int id, bool fpix, float cotalpha, float cotbeta);
00175   
00176   // retreive interpolated templates. 
00177   void ytemp(int fybin, int lybin, float ytemplate[41][BYSIZE]);
00178   
00179   void xtemp(int fxbin, int fxbin, float xtemplate[41][BXSIZE]);
00180   
00181   // new methods to build templates from two interpolated clusters (for splitting) 
00182   void ytemp3d(int nypix, array_3d& ytemplate);
00183   
00184   void xtemp3d(int nxpix, array_3d& xtemplate);
00185   
00186   // Convert vector of projected signals into uncertainties for fitting. 
00187   void ysigma2(int fypix, int lypix, float sythr, float ysum[BYSIZE], float ysig2[BYSIZE]);
00188   
00189   void xsigma2(int fxpix, int lxpix, float sxthr, float xsum[BXSIZE], float xsig2[BXSIZE]);
00190   
00191   // Interpolate qfl correction in y. 
00192   float yflcorr(int binq, float qfly);
00193   
00194   // Interpolate qfl correction in x. 
00195   float xflcorr(int binq, float qflx);
00196   
00197   // Interpolate input beta angle to estimate the average charge and return qbin flag for input cluster charge. 
00198   int qbin(int id, bool fpix, float cotbeta, float qclus);
00199   
00200   float qavg() {return pqavg;}        
00201   float pixmax() {return ppixmax;}         
00202   float qscale() {return pqscale;}         
00203   float s50() {return ps50;}               
00204   float symax() {return psymax;}             
00205   float dyone() {return pdyone;}             
00206   float syone() {return psyone;}             
00207   float dytwo() {return pdytwo;}             
00208   float sytwo() {return psytwo;}            
00209   float sxmax() {return psxmax;}            
00210   float dxone() {return pdxone;}             
00211   float sxone() {return psxone;}             
00212   float dxtwo() {return pdxtwo;}             
00213   float sxtwo() {return psxtwo;}             
00214   float qmin() {return pqmin;}               
00215   float clsleny() {return pclsleny;}         
00216   float clslenx() {return pclslenx;}         
00217   float yratio() {return pyratio;}            
00218   float yxratio() {return pyxratio;}           
00219   float xxratio() {return pxxratio;}           
00220   float yavg(int i) {assert(i>=0 && i<4); return pyavg[i];}         
00221   float yrms(int i) {assert(i>=0 && i<4); return pyrms[i];}         
00222   float ygx0(int i) {assert(i>=0 && i<4); return pygx0[i];}         
00223   float ygsig(int i) {assert(i>=0 && i<4); return pygsig[i];}       
00224   float xavg(int i) {assert(i>=0 && i<4); return pxavg[i];}         
00225   float xrms(int i) {assert(i>=0 && i<4); return pxrms[i];}         
00226   float xgx0(int i) {assert(i>=0 && i<4); return pxgx0[i];}         
00227   float xgsig(int i) {assert(i>=0 && i<4); return pxgsig[i];}       
00228   float chi2yavg(int i) {assert(i>=0 && i<4); return pchi2yavg[i];} 
00229   float chi2ymin(int i) {assert(i>=0 && i<4); return pchi2ymin[i];} 
00230   float chi2xavg(int i) {assert(i>=0 && i<4); return pchi2xavg[i];} 
00231   float chi2xmin(int i) {assert(i>=0 && i<4); return pchi2xmin[i];} 
00232   float yavgc2m(int i) {assert(i>=0 && i<4); return pyavgc2m[i];}   
00233   float yrmsc2m(int i) {assert(i>=0 && i<4); return pyrmsc2m[i];}   
00234   float ygx0c2m(int i) {assert(i>=0 && i<4); return pygx0c2m[i];}   
00235   float ygsigc2m(int i) {assert(i>=0 && i<4); return pygsigc2m[i];} 
00236   float xavgc2m(int i) {assert(i>=0 && i<4); return pxavgc2m[i];}   
00237   float xrmsc2m(int i) {assert(i>=0 && i<4); return pxrmsc2m[i];}   
00238   float xgx0c2m(int i) {assert(i>=0 && i<4); return pxgx0c2m[i];}   
00239   float xgsigc2m(int i) {assert(i>=0 && i<4); return pxgsigc2m[i];} 
00240 //  float yspare(int i) {assert(i>=0 && i<10); return pyspare[i];}    //!< vector of 10 spares interpolated in beta only
00241 //  float xspare(int i) {assert(i>=0 && i<10); return pxspare[i];}    //!< vector of 10 spares interpolated in alpha and beta
00242   
00243   
00244  private:
00245   
00246   // Keep current template interpolaion parameters      
00247   
00248   int id_current;           
00249   int index_id;             
00250   float cota_current;       
00251   float cotb_current;       
00252   float abs_cotb;           
00253   bool fpix_current;        
00254   
00255   
00256   // Keep results of last interpolation to return through member functions
00257   
00258   float pqavg;              
00259   float ppixmax;            
00260   float pqscale;            
00261   float ps50;               
00262   float psymax;             
00263   float psyparmax;          
00264   float pdyone;             
00265   float psyone;             
00266   float pdytwo;             
00267   float psytwo;             
00268   float psxmax;             
00269   float psxparmax;          
00270   float pdxone;             
00271   float psxone;             
00272   float pdxtwo;             
00273   float psxtwo;             
00274   float pqmin;              
00275   float pclsleny;           
00276   float pclslenx;           
00277   float pyratio;            
00278   float pyparl[2][5];       
00279   float pyparh[2][5];       
00280   float pxparly0[2][5];     
00281   float pxparhy0[2][5];     
00282   float pytemp[9][BYSIZE];  
00283   float pyxratio;           
00284   float pxxratio;           
00285   float pxpar0[2][5];       
00286   float pxparl[2][5];       
00287   float pxparh[2][5];       
00288   float pxtemp[9][BXSIZE];  
00289   float pyavg[4];           
00290   float pyrms[4];           
00291   float pygx0[4];           
00292   float pygsig[4];          
00293   float pyflparl[4][6];     
00294   float pyflparh[4][6];     
00295   float pxavg[4];           
00296   float pxrms[4];           
00297   float pxgx0[4];           
00298   float pxgsig[4];           
00299   float pxflparll[4][6];    
00300   float pxflparlh[4][6];    
00301   float pxflparhl[4][6];    
00302   float pxflparhh[4][6];    
00303   float pchi2yavg[4];       
00304   float pchi2ymin[4];       
00305   float pchi2xavg[4];       
00306   float pchi2xmin[4];       
00307   float pyavgc2m[4];        
00308   float pyrmsc2m[4];        
00309   float pygx0c2m[4];        
00310   float pygsigc2m[4];       
00311   float pxavgc2m[4];        
00312   float pxrmsc2m[4];        
00313   float pxgx0c2m[4];        
00314   float pxgsigc2m[4];       
00315   float pyspare[10];        
00316   float pxspare[10];        
00317   
00318   // The actual template store is a std::vector container
00319 
00320   std::vector< SiPixelTemplateStore > thePixelTemp;
00321 } ;
00322 
00323 
00324 #endif

Generated on Tue Jun 9 17:26:46 2009 for CMSSW by  doxygen 1.5.4