CMS 3D CMS Logo

PixelErrorParametrization Class Reference

#include <RecoLocalTracker/SiPixelRecHits/interface/PixelErrorParametrization.h>

List of all members.

Public Member Functions

std::pair< float, float > getError (GeomDetType::SubDetector pixelPart, int sizex, int sizey, float alpha, float beta, bool bigInX=false, bool bigInY=false)
 Returns error (sigma) for local x and y coordinates.
 PixelErrorParametrization (edm::ParameterSet const &conf)
 ~PixelErrorParametrization ()

Private Types

typedef std::vector
< std::vector< float > > 
P2D
typedef std::vector
< std::vector< std::vector
< float > > > 
P3D

Private Member Functions

int betaIndex (int &, std::vector< float > &, float &)
float error_XB (int sizex, float alpha, float beta, bool bigInX)
float error_XF (int sizex, float alpha, float beta, bool bigInX)
float error_YB (int sizey, float alpha, float beta, bool bigInY)
float error_YF (int sizey, float alpha, float beta, bool bigInY)
float interpolation (std::vector< float > &, float &, std::pair< float, float > &)
float linParametrize (bool &, int &, int &, float &)
float quadParametrize (bool &, int &, int &, float &)
void readF (P3D &vec3D, const std::string &prefix, const std::string &postfix1, const std::string &postfix2)
std::vector< float > readVec (const std::string &name)
void readXB (P3D &vec3D, const std::string &prefix, const std::string &postfix1, const std::string &postfix2)
void readYB (P3D &vec3D, const std::string &prefix, const std::string &postfix1, const std::string &postfix2)

Private Attributes

float a_bin
float a_max
float a_min
P2D bbins_xb
std::vector< float > bbins_xf
std::vector< std::pair< float,
float > > 
brange_yb
std::pair< float, float > brange_yf
std::string theParametrizationType
bool useNewParametrization
bool useSigma
std::vector< float > vec_error_XB
std::vector< float > vec_error_XF
std::vector< float > vec_error_YB
std::vector< float > vec_error_YF
P3D xbarrel_3D
P3D xforward_3D
P3D ybarrel_3D
P3D yforward_3D
float ys_bh [6]
float ys_bl [6]


Detailed Description

Definition at line 23 of file PixelErrorParametrization.h.


Member Typedef Documentation

typedef std::vector<std::vector<float> > PixelErrorParametrization::P2D [private]

Definition at line 54 of file PixelErrorParametrization.h.

typedef std::vector<std::vector<std::vector<float> > > PixelErrorParametrization::P3D [private]

Definition at line 53 of file PixelErrorParametrization.h.


Constructor & Destructor Documentation

PixelErrorParametrization::PixelErrorParametrization ( edm::ParameterSet const &  conf  ) 

Definition at line 56 of file PixelErrorParametrization.cc.

References a_bin, a_max, a_min, bbins_xb, brange_yb, brange_yf, error, Exception, file, mergeAndRegister_online::fname, edm::FileInPath::fullPath(), edm::ParameterSet::getParameter(), int, LogDebug, NULL, readF(), readXB(), readYB(), size, theParametrizationType, useNewParametrization, useSigma, vec_error_XB, vec_error_XF, vec_error_YB, vec_error_YF, xbarrel_3D, xforward_3D, ybarrel_3D, yforward_3D, ys_bh, and ys_bl.

00057 {
00058   // static SimpleConfigurable<string> paramType("oscar", "CMSsimulation");
00059   theParametrizationType = 
00060     conf.getParameter<string>("PixelErrorParametrization");
00061   
00062   useNewParametrization =  conf.getParameter<bool>("UseNewParametrization");
00063   
00064   useSigma = conf.getParameter<bool>("UseSigma");
00065 
00066   if ( !useNewParametrization )
00067     {
00068       if (verbose)
00069         {
00070           LogDebug ("PixelErrorParametrization::PixelErrorParametrization") 
00071             << " Using OLD pixel hit error parameterization !!!" ;
00072         }
00073       
00075       // define alpha and beta ranges-bins for Y BARREL errors 
00077       
00078       // MAGIC NUMBERS: alpha bins 
00079       a_min = 1.37078;
00080       a_max = 1.77078;
00081       a_bin = 0.1;
00082       
00083       // MAGIC NUMBERS: beta ranges depending on y cluster size
00084       brange_yb.resize(6);
00085       brange_yb[0] = pair<float,float>(0., 0.6);   // ysize=1   // Gavril: this only defines 2 ranges 
00086       brange_yb[1] = pair<float,float>(0.1, 0.9);     // ysize = 2
00087       brange_yb[2] = pair<float,float>(0.6, 1.05);  // ysize = 3
00088       brange_yb[3] = pair<float,float>(0.9, 1.15);  // ysize = 4 
00089       brange_yb[4] = pair<float,float>(1.05, 1.22); // ysize = 5
00090       brange_yb[5] = pair<float,float>(1.15, 1.41); // ysize >= 6 
00091       
00092       // fill Y-BARREL matrix with sigma from gaussian fit 
00093       // of residuals
00094       // fill with the resolution points in order 
00095       // to make an error interpolation 
00096       
00097       readYB( ybarrel_3D, "yres_npix", "_alpha", "_b.vec");
00098       
00099       // define alpha and beta range/bins for X-BARREL errors
00100       
00101       // MAGIC NUMBERS:
00102       // abs(pi/2-beta) bins depending on X cluster size
00103       bbins_xb.resize(3);
00104       // xsize = 1 all beta range
00105       (bbins_xb[0]).resize(1); 
00106       (bbins_xb[0])[0] = 100.; 
00107       // xsize = 2 4 beta-bins
00108       (bbins_xb[1]).resize(3);
00109       (bbins_xb[1])[0] = 0.7; 
00110       (bbins_xb[1])[1] = 1.; 
00111       (bbins_xb[1])[2] = 1.2; 
00112       // xsize >= 3 same 4 beta-bins as for xsize=2 // Gavril: checked with Susanna and fixed index from "1" to "2", 03/16/07
00113       (bbins_xb[2]).resize(3);
00114       (bbins_xb[2])[0] = 0.7; 
00115       (bbins_xb[2])[1] = 1.; 
00116       (bbins_xb[2])[2] = 1.2; 
00117       
00118       // fill X-BARREL matrix with parameters to perform a 
00119       // linear parametrization of x erros
00120       // for each beta bin: p1 + p2*alpha
00121       
00122       readXB( xbarrel_3D, "xpar_npix", "_beta", "_b.vec");
00123       
00124       // define alpha and beta range/bins for Y-FORWARD errors
00125       
00126       // MAGIC NUMBERS:
00127       // abs(pi/2-beta) range independent on Y cluster size
00128       brange_yf = pair<float,float>(0.3, 0.4);     
00129       
00130       // fill Y-FORWARD matrix with parameters to perform  
00131       // a parametrization of Y erros
00132       // for npix=1 and all alpha range:
00133       // p1 + p2*beta + p3*beta**2 + p4*beta**3 + p5*beta**4
00134       // for npix>=2 and all alpha range:
00135       // p1 + p2*beta + p3*beta**2 
00136       
00137       readF( yforward_3D, "ypar_npix", "_alpha", "_f.vec");
00138       
00139       // fill X-FORWARD matrix with parameters to perform  
00140       // a linear parametrization on alpha for all beta range
00141       
00142       readF( xforward_3D, "xpar_npix", "_beta", "_f.vec");
00143     }     
00144   else
00145     {
00146       if (verbose)
00147         {
00148           LogDebug ("PixelErrorParametrization::PixelErrorParametrization") 
00149             << " Using NEW pixel hit error parameterization !!!" ;
00150         }
00151       
00152       a_min = 1.37078;
00153       a_max = 1.77078;
00154       a_bin = 0.1;
00155       
00156       ys_bl[0] = 0.05;
00157       ys_bh[0] = 0.50;
00158       
00159       ys_bl[1] = 0.15; 
00160       ys_bh[1] = 0.90;
00161       
00162       ys_bl[2] = 0.70; 
00163       ys_bh[2] = 1.05;
00164       
00165       ys_bl[3] = 0.95; 
00166       ys_bh[3] = 1.15;
00167       
00168       ys_bl[4] = 1.15; 
00169       ys_bh[4] = 1.20;
00170       
00171       ys_bl[5] = 1.20; 
00172       ys_bh[5] = 1.40;
00173       
00174       edm::FileInPath file( "RecoLocalTracker/SiPixelRecHits/data/residuals.dat" );
00175       const char* fname = (file.fullPath()).c_str();
00176       
00177       FILE* datfile;
00178       
00179       if ( (datfile=fopen(fname,"r")) == NULL ) 
00180         throw cms::Exception("FileNotFound")
00181           << "PixelErrorParameterization::PixelErrorParameterization - Input file not found";
00182       
00183       vec_error_XB.clear();
00184       vec_error_YB.clear();
00185       vec_error_XF.clear();
00186       vec_error_YF.clear();
00187       
00188       while ( !feof(datfile) ) 
00189         {
00190           int detid      = -999;
00191           int size       = -999;
00192           int angle_ind1 = -999;
00193           int angle_ind2 = -999;
00194           float sigma    = -999.9;
00195           float rms      = -999.9;
00196           
00197           fscanf( datfile,
00198                   "%d %d %d %d %f %f \n", 
00199                   &detid, &size, &angle_ind1, &angle_ind2, &sigma, &rms );
00200           
00201           float error = -9999.9;
00202           if ( useSigma )
00203             {
00204               if (verbose)
00205                 LogDebug ("PixelErrorParametrization::PixelErrorParametrization") 
00206                   << " Use error = Gaussian sigma" ;
00207               error = sigma;
00208             }
00209           else 
00210             {
00211               if (verbose)
00212                 LogDebug ("PixelErrorParametrization::PixelErrorParametrization") 
00213                   << " Use error = RMS" ;
00214               error = rms;
00215             }
00216                   
00217           if      ( detid == 1 )
00218             vec_error_YB.push_back( error );
00219           else if ( detid == 2 )
00220             vec_error_XB.push_back( error );
00221           else if ( detid == 3 )
00222             vec_error_YF.push_back( error );
00223           else if ( detid == 4 )
00224             vec_error_XF.push_back( error );
00225           else 
00226             {
00227               throw cms::Exception("PixelErrorParametrization::PixelErrorParametrization")
00228                 << " Wrong ID !!!";
00229             }
00230         }
00231       
00232       int n_entries_yb = 240; // number of Y barrel constants to be read from the residuals.dat file
00233       if ( (int)vec_error_YB.size() != n_entries_yb )
00234         {
00235           throw cms::Exception(" PixelErrorParametrization::PixelErrorParametrization: ") 
00236             << " Number of Y barrel constants read different than expected !!!" 
00237             << " Expected " << n_entries_yb << " and found " << (int)vec_error_YB.size();
00238         }
00239       int n_entries_xb = 120; // number of X barrel constants to be read from the residuals.dat file
00240       if ( (int)vec_error_XB.size() != n_entries_xb )
00241         {
00242           throw cms::Exception(" PixelErrorParametrization::PixelErrorParametrization: ")
00243             << " Number of X barrel constants read different than expected !!!"
00244             << " Expected " << n_entries_xb << " and found " << (int)vec_error_XB.size();
00245         }
00246       int n_entries_yf = 20; // number of Y forward constants to be read from the residuals.dat file
00247       if ( (int)vec_error_YF.size() != n_entries_yf )
00248         {
00249           throw cms::Exception(" PixelErrorParametrization::PixelErrorParametrization: ")
00250             << " Number of Y forward constants read different than expected !!!"
00251             << " Expected " << n_entries_yf << " and found " << (int)vec_error_YF.size();
00252         }
00253       int n_entries_xf = 20; // number of X barrel constants to be read from the residuals.dat file
00254       if ( (int)vec_error_XF.size() != n_entries_xf )
00255         {
00256           throw cms::Exception(" PixelErrorParametrization::PixelErrorParametrization: ")
00257             << " Number of X forward constants read different than expected !!!"
00258             << " Expected " << n_entries_xf << " and found " << (int)vec_error_XF.size();
00259         }
00260   
00261     }
00262   
00263 }

PixelErrorParametrization::~PixelErrorParametrization (  ) 

Definition at line 269 of file PixelErrorParametrization.cc.

00269 {}


Member Function Documentation

int PixelErrorParametrization::betaIndex ( int ,
std::vector< float > &  ,
float &   
) [private]

Referenced by error_XB().

float PixelErrorParametrization::error_XB ( int  sizex,
float  alpha,
float  beta,
bool  bigInX 
) [private]

Definition at line 317 of file PixelErrorParametrization.cc.

References aa_max, aa_min, bbins_xb, betaIndex(), error_xb_big_pix, Exception, index, int, LogDebug, math_pi, min, pitch_x, quadParametrize(), funct::sqrt(), useNewParametrization, and vec_error_XB.

Referenced by getError().

00318 {
00319   if ( !useNewParametrization )
00320     {
00321       LogDebug("PixelErrorParametrization::error_XB") << "I'M AT THE BEGIN IN ERROR XB METHOD";
00322       bool barrelPart = true;
00323       // find size index
00324       int i_size = min(sizex-1,2);
00325       
00326       // find beta index
00327       int i_beta = betaIndex(i_size, bbins_xb[i_size], beta);
00328       
00329       // if ( i_size==0 ) return linParametrize(barrelPart, i_size, i_beta, alpha);
00330       //else return quadParametrize(barrelPart, i_size, i_beta, alpha);
00331       
00332       // Gavril: fix for big pixels at the module center
00333       //double pitch_x = 0.0100;
00334       if ( bigInX && sizex == 1 )
00335         return pitch_x/sqrt(12.0);
00336       else
00337         return quadParametrize(barrelPart, i_size, i_beta, alpha);
00338     }
00339   else
00340     {
00341       float error_xb = -999.9;
00342       
00343       /*
00344         if ( verbose )
00345         {
00346         cout << " ---------- 2 ) error_XB: " << endl;
00347         cout << " sizex = "  << sizex  << endl;
00348         cout << " alpha = "  << alpha  << endl;
00349         cout << " beta  = "  << beta   << endl;
00350         cout << " bigInX = " << bigInX << endl;
00351         }
00352       */
00353 
00354       if ( bigInX && sizex == 1 )
00355         {
00356           //error_xb = pitch_x/sqrt(12.0);
00357           error_xb = error_xb_big_pix;
00358         }
00359       else
00360         {
00361           float alpha_rad = fabs(alpha);
00362           //float beta_rad  = fabs(beta);
00363           float betap_rad = fabs( math_pi/2.0 - beta );
00364           //float alphap_rad = fabs( math_pi/2.0 - alpha );
00365           
00366           if ( sizex > 3 ) sizex = 3;
00367           
00368           int ind_sizex = sizex - 1;
00369           int ind_beta  = -999;
00370           int ind_alpha = -999;
00371           
00372           if      (                     betap_rad <= 0.7 ) ind_beta = 0;
00373           else if ( 0.7 <  betap_rad && betap_rad <= 1.0 ) ind_beta = 1;
00374           else if ( 1.0 <  betap_rad && betap_rad <= 1.2 ) ind_beta = 2;
00375           else if ( 1.2 <= betap_rad                     ) ind_beta = 3;
00376           else 
00377             {
00378               throw cms::Exception("PixelErrorParametrization::error_XB") << " Wrong betap_rad = " << betap_rad;
00379             }
00380 
00381           if      ( alpha_rad <= aa_min[ind_sizex] ) ind_alpha = 0;
00382           else if ( alpha_rad >= aa_max[ind_sizex] ) ind_alpha = 9;
00383           else
00384             ind_alpha = (int) ( ( alpha_rad - aa_min[ind_sizex] ) / ( ( aa_max[ind_sizex] - aa_min[ind_sizex] ) / 10.0 ) );  
00385 
00386           /*
00387             if ( verbose )
00388             {
00389             cout << "ind_sizex = " << ind_sizex << endl;
00390             cout << "ind_alpha = " << ind_alpha << endl;
00391             cout << "ind_beta  = " << ind_beta  << endl;
00392             }
00393           */
00394 
00395           // There are 4 beta bins with 10 alpha bins  for each sizex
00396           int index = 40*ind_sizex + 10*ind_beta + ind_alpha;
00397           
00398           if ( index < 0 || index >= 120  )
00399             {
00400               throw cms::Exception(" PixelErrorParametrization::error_XB") << " Wrong index !!!";
00401             }
00402           
00403           error_xb = vec_error_XB[index];
00404           
00405         }
00406       
00407       //if ( verbose )
00408       //cout << "error_xb = " << error_xb << endl;
00409         
00410       return error_xb;
00411     }
00412   
00413 }

float PixelErrorParametrization::error_XF ( int  sizex,
float  alpha,
float  beta,
bool  bigInX 
) [private]

Definition at line 416 of file PixelErrorParametrization.cc.

References error_xf_big_pix, Exception, index, int, linParametrize(), LogDebug, math_pi, min, pitch_x, funct::sqrt(), useNewParametrization, and vec_error_XF.

Referenced by getError().

00417 {
00418   if ( !useNewParametrization )
00419     {
00420       LogDebug("PixelErrorParametrization::error_XF") << "I'M AT THE BEGIN IN ERROR XF METHOD";
00421       
00422       bool barrelPart = false;
00423       //symmetrization w.r.t. orthogonal direction
00424       float alpha_prime = fabs(3.14159/2.-alpha);
00425       // find x size index
00426       int i_size = min(sizex-1,2);
00427       // no beta parametrization!!!
00428       int i_beta = 0;
00429       // find beta index
00430       // int i_beta = betaIndex(i_size, bbins_xf, beta);
00431       LogDebug("PixelErrorParametrization::error_XF") << "size index = " << i_size
00432                                                       << "no beta index, "
00433                                                       << " alphaprime = " << alpha_prime;
00434       //double pitch_x = 0.0100;
00435       if ( bigInX && sizex == 1 )
00436         return pitch_x/sqrt(12.0);
00437       else
00438         return linParametrize(barrelPart, i_size, i_beta, alpha_prime);
00439     }
00440   else
00441     {
00442       float error_xf = -999.9;
00443       
00444       /*
00445         if ( verbose )
00446         {
00447         cout << " ---------- 4 ) error_XF:" << endl;
00448         cout << " sizex = "  << sizex  << endl;
00449         cout << " alpha = "  << alpha  << endl;
00450         cout << " beta  = "  << beta   << endl;
00451         cout << " bigInX = " << bigInX << endl;
00452         }
00453       */
00454 
00455       if ( bigInX && sizex == 1 )
00456         {
00457           //error_xf = pitch_x/sqrt(12.0);
00458           error_xf = error_xf_big_pix;
00459         }
00460       else
00461         {
00462           //float alpha_rad = fabs(alpha);
00463           //float beta_rad  = fabs(beta);
00464           //float betap_rad = fabs( math_pi/2.0 - beta );
00465           float alphap_rad = fabs( math_pi/2.0 - alpha );
00466           
00467           if ( sizex > 2 ) sizex = 2;
00468           
00469           int ind_sizex = sizex - 1;
00470           int ind_alpha  = -9999; 
00471           
00472           if ( sizex == 1 )
00473             {
00474               if      ( alphap_rad <= 0.15 ) ind_alpha = 0;
00475               else if ( alphap_rad >= 0.30 ) ind_alpha = 9;
00476               else 
00477                 ind_alpha = (int) ( ( alphap_rad - 0.15 ) / ( ( 0.30 - 0.15 ) / 10.0 ) );  
00478             }
00479           if ( sizex > 1 )
00480             {
00481               if      ( alphap_rad <= 0.15 ) ind_alpha = 0;
00482               else if ( alphap_rad >= 0.50 ) ind_alpha = 9;
00483               else 
00484                 ind_alpha = (int) ( ( alphap_rad - 0.15 ) / ( ( 0.50 - 0.15 ) / 10.0 ) );  
00485             }
00486           
00487           /*
00488             if ( verbose )
00489             {
00490             cout << "ind_sizex = " << ind_sizex << endl;
00491             cout << "ind_alpha = " << ind_alpha << endl;
00492             }
00493           */
00494 
00495           int index = 10*ind_sizex + ind_alpha;
00496           
00497           if ( index < 0 || index >= 20  )
00498             {
00499               throw cms::Exception(" PixelErrorParametrization::error_XF") << " Wrong index !!!";
00500             }
00501           
00502           error_xf = vec_error_XF[index];
00503           
00504         }
00505       
00506       //if ( verbose )
00507       //cout << "error_xf = " << error_xf << endl;
00508       
00509       return error_xf;
00510     }
00511   
00512 }

float PixelErrorParametrization::error_YB ( int  sizey,
float  alpha,
float  beta,
bool  bigInY 
) [private]

Definition at line 515 of file PixelErrorParametrization.cc.

References a_bin, a_max, a_min, brange_yb, error_yb_big_pix, Exception, first, index, int, interpolation(), LogDebug, math_pi, min, pitch_y, edm::second(), funct::sqrt(), useNewParametrization, vec_error_YB, ybarrel_3D, ys_bh, and ys_bl.

Referenced by getError().

00516 {  
00517   if ( !useNewParametrization )
00518     {
00519       LogDebug("PixelErrorParametrization::error_YB") << "I'M AT THE BEGIN IN ERROR YB METHOD";
00520       
00521       //double pitch_y = 0.0150;
00522       
00523       if ( bigInY && sizey == 1 )
00524         {
00525           return pitch_y/sqrt(12.0);
00526         }
00527       else
00528         {
00529           int i_alpha;
00530           int i_size = min(sizey-1,5);
00531           
00532           LogDebug("PixelErrorParametrization::error_YB") << "I found size index = " << i_size;
00533           
00534           if (sizey < 4) 
00535             {      // 3 alpha bins
00536               if (alpha <= a_min + a_bin) 
00537                 { 
00538                   i_alpha = 0;
00539                 } 
00540               else if (alpha < a_max-a_bin) 
00541                 {
00542                   i_alpha = 1;
00543                 }
00544               else 
00545                 {
00546                   i_alpha = 2; 
00547                 }
00548             }
00549           else
00550             { // 1 alpha bin 
00551               i_alpha = 0;
00552             }
00553           
00554           LogDebug("PixelErrorParametrization::error_YB") << "I found alpha index = " << i_alpha;
00555           
00556           // vector of beta parametrization
00557           //vector<float> ybarrel_1D = (ybarrel_3D[i_size])[i_alpha];
00558           vector<float>& ybarrel_1D = (ybarrel_3D[i_size])[i_alpha]; // suggestion to speed up the code by Patrick/Vincenzo
00559           
00560           LogDebug("PixelErrorParametrization::error_YB") << " beta vec has dimensions = " << ybarrel_1D.size()
00561                                                           << " beta = " << beta 
00562                                                           << " beta max = " << brange_yb[i_size].second 
00563                                                           << " beta min = " << brange_yb[i_size].first;
00564           
00565           // beta --> abs(pi/2-beta) to be symmetric w.r.t. pi/2 axis
00566           float beta_prime = fabs(3.14159/2.-beta);
00567           
00568           if ( beta_prime <= brange_yb[i_size].first )// Gavril: brange_yb[0].first == 0.0; when i_size==0, beta_prime is never less than 0
00569             { 
00570               return ybarrel_1D[0];
00571             }
00572           else if ( beta_prime >= brange_yb[i_size].second )
00573             {
00574               //return ybarrel_1D[ybarrel_1D.size()-1];
00575               return pitch_y / sqrt(12.0); // Gavril: we are in un-physical beta_prime range; return large error, 03/27/07 
00576             } 
00577           else 
00578             {
00579               return interpolation(ybarrel_1D, beta_prime, brange_yb[i_size] );
00580             }  
00581         }
00582     }
00583   else
00584     {
00585       float error_yb = -999.9;
00586       
00587       /*
00588         if ( verbose )
00589         {
00590         cout << " ---------- 1 ) error_YB:" << endl;
00591         cout << " sizey = "  << sizey  << endl;
00592         cout << " alpha = "  << alpha  << endl;
00593         cout << " beta  = "  << beta   << endl;
00594         cout << " bigInY = " << bigInY << endl; 
00595         }
00596       */
00597 
00598       if ( bigInY && sizey == 1 )
00599         {
00600           //error_yb = pitch_y/sqrt(12.0);
00601           error_yb = error_yb_big_pix;
00602         }
00603       else
00604         {
00605           float alpha_rad = fabs(alpha);
00606           //float beta_rad  = fabs(beta);
00607           float betap_rad = fabs( math_pi/2.0 - beta );
00608           //float alphap_rad = fabs( math_pi/2.0 - alpha );
00609           
00610           if ( sizey > 6 ) sizey = 6;
00611           
00612           int ind_sizey = sizey - 1;
00613           int ind_alpha = -9999;
00614           int ind_beta  = -9999; 
00615           
00616           if      ( alpha_rad <= a_min ) ind_alpha = 0;
00617           else if ( alpha_rad >= a_max ) ind_alpha = 3;
00618           else if ( alpha_rad > a_min && 
00619                     alpha_rad < a_max ) 
00620             {
00621               double binw = ( a_max - a_min ) / 4.0;
00622               ind_alpha = (int)( ( alpha_rad - a_min ) / binw );
00623             }           
00624           else
00625             {
00626               throw cms::Exception(" PixelErrorParametrization::error_YB") << " Wrong alpha_rad = " << alpha_rad;
00627               
00628             }
00629 
00630           if      ( betap_rad <= ys_bl[sizey-1] ) ind_beta = 0;
00631           else if ( betap_rad >= ys_bh[sizey-1] ) ind_beta = 9;
00632           else if ( betap_rad >  ys_bl[sizey-1] && 
00633                     betap_rad <  ys_bh[sizey-1] ) 
00634             {
00635               double binw = ( ys_bh[sizey-1] - ys_bl[sizey-1] ) / 8.0;
00636               ind_beta = 1 + (int)( ( betap_rad - ys_bl[sizey-1] ) / binw );
00637             }           
00638           else 
00639             {
00640               throw cms::Exception(" PixelErrorParametrization::error_YB") << " Wrong betap_rad = " << betap_rad;
00641             }
00642 
00643           /*
00644             if ( verbose )
00645             {
00646             cout << "ind_sizey = " << ind_sizey << endl;
00647             cout << "ind_alpha = " << ind_alpha << endl;
00648             cout << "ind_beta  = " << ind_beta  << endl;
00649             }
00650           */
00651 
00652           int index = 40*ind_sizey + 10*ind_alpha + ind_beta;
00653           
00654           if ( index < 0 || index >= 240  )
00655             {
00656               throw cms::Exception(" PixelErrorParametrization::error_YB") << " Wrong index !!!";
00657             }
00658           
00659           error_yb = vec_error_YB[index];
00660           
00661         }
00662       
00663       //if ( verbose )
00664       //cout << "error_yb = " << error_yb << endl;
00665       
00666       return error_yb; 
00667     }
00668 
00669 }

float PixelErrorParametrization::error_YF ( int  sizey,
float  alpha,
float  beta,
bool  bigInY 
) [private]

Definition at line 672 of file PixelErrorParametrization.cc.

References brange_yf, error_yf_big_pix, Exception, index, int, LogDebug, math_pi, min, pitch_y, funct::pow(), funct::sqrt(), useNewParametrization, vec_error_YF, and yforward_3D.

Referenced by getError().

00673 {
00674   if ( !useNewParametrization )
00675     {
00676       LogDebug("PixelErrorParametrization::error_YF") << "I'M AT THE BEGIN IN ERROR YF METHOD";
00677       
00678       float err_par = 0.0;
00679       //double pitch_y = 0.0150;
00680       
00681       if ( bigInY && sizey == 1 )
00682         {
00683           err_par = pitch_y/sqrt(12.0);
00684         }
00685       else
00686         {
00687           // find y size index
00688           int i_size = min(sizey-1,1);
00689           // no parametrization in alpha
00690           int i_alpha = 0;
00691           // beta --> abs(pi/2-beta) to be symmetric w.r.t. pi/2 axis
00692           float beta_prime = fabs(3.14159/2.-beta);
00693           if (beta_prime < brange_yf.first) beta_prime = brange_yf.first;
00694           if (beta_prime > brange_yf.second) beta_prime = brange_yf.second;
00695           err_par = 0.0;
00696           for(int ii=0; ii < (int)( (yforward_3D[i_size])[i_alpha] ).size(); ii++){
00697             err_par += ( (yforward_3D[i_size])[i_alpha] )[ii] * pow(beta_prime,ii);
00698           }
00699         }
00700       
00701       return err_par; 
00702     }
00703   else
00704     {
00705       float error_yf = -999.9;
00706       
00707       /*
00708         if ( verbose )
00709         {
00710         cout << " ---------- 3 ) error_YF:" << endl;
00711         cout << " sizey = "  << sizey  << endl;
00712         cout << " alpha = "  << alpha  << endl;
00713         cout << " beta  = "  << beta   << endl;
00714         cout << " bigInY = " << bigInY << endl;
00715         }
00716       */
00717 
00718       if ( bigInY && sizey == 1 )
00719         {
00720           //error_yf = pitch_y/sqrt(12.0);
00721           error_yf = error_yf_big_pix;
00722         }
00723       else
00724         {
00725           //float alpha_rad = fabs(alpha);
00726           //float beta_rad  = fabs(beta);
00727           float betap_rad = fabs( math_pi/2.0 - beta );
00728           //float alphap_rad = fabs( math_pi/2.0 - alpha );
00729           
00730           if ( sizey > 2 ) sizey = 2;
00731           
00732           int ind_sizey = sizey - 1;
00733           int ind_beta  = -9999; 
00734           
00735           if      ( betap_rad <= 0.3 ) ind_beta = 0;
00736           else if ( betap_rad >= 0.4 ) ind_beta = 9;
00737           else 
00738             ind_beta = (int) ( ( betap_rad - 0.3 ) / ( ( 0.4 - 0.3 ) / 10.0 ) );  
00739           
00740           /*
00741             if ( verbose )
00742             {
00743             cout << "ind_sizey = " << ind_sizey << endl;
00744             cout << "ind_beta  = " << ind_beta  << endl;
00745             }
00746           */
00747 
00748           int index = 10*ind_sizey + ind_beta;
00749           
00750           if ( index < 0 || index >= 20  )
00751             {
00752               throw cms::Exception(" PixelErrorParametrization::error_YF") << " Wrong index !!!";
00753             }
00754           
00755           error_yf = vec_error_YF[index];
00756           
00757         }
00758       
00759       //if ( verbose )
00760       //cout << "error_yf = " << error_yf << endl;
00761       
00762       return error_yf; 
00763     }
00764     
00765 }

pair< float, float > PixelErrorParametrization::getError ( GeomDetType::SubDetector  pixelPart,
int  sizex,
int  sizey,
float  alpha,
float  beta,
bool  bigInX = false,
bool  bigInY = false 
)

Returns error (sigma) for local x and y coordinates.

Temporary patch for CMSSW_1_3_0. Handle NANs received from bad tracks to avoid job crash and return binary errors.

Definition at line 277 of file PixelErrorParametrization.cc.

References element(), error_XB(), error_XF(), error_YB(), error_YF(), Exception, edm::isnan(), LogDebug, GeomDetEnumerators::PixelBarrel, GeomDetEnumerators::PixelEndcap, and funct::sqrt().

Referenced by PixelCPEParmError::localError(), and SiPixelGaussianSmearingRecHitConverterAlgorithm::smearHit().

00281 {
00282   pair<float,float> element;
00283   
00288   if( isnan(alpha) || isnan(beta) ) 
00289     {
00290       LogError ("NANcatched") << "PixelErrorParametrization::getError: NAN catched in angles alpha or beta" ; 
00291       
00292       element = pair<float,float>(0.010/sqrt(12.), 0.015/sqrt(12.));
00293       return element;
00294     }
00295   
00296   switch (pixelPart) 
00297     {
00298     case GeomDetEnumerators::PixelBarrel:
00299       element = pair<float,float>(error_XB(sizex, alpha, beta, bigInX), // Gavril: add big pixel flag here. 03/27/07
00300                                   error_YB(sizey, alpha, beta, bigInY));
00301       break;
00302     case GeomDetEnumerators::PixelEndcap:
00303       element =  pair<float,float>(error_XF(sizex, alpha, beta, bigInX),
00304                                    error_YF(sizey, alpha, beta, bigInY));
00305       break;
00306     default:
00307       throw cms::Exception("PixelErrorParametrization::getError") 
00308         << "Non-pixel detector type !!!" ;
00309     }
00310   
00311   LogDebug ("PixelErrorParametrization::getError") << " ErrorMatrix gives error: " 
00312                                                    << element.first << " , " << element.second;
00313   
00314   return element;
00315 }

float PixelErrorParametrization::interpolation ( std::vector< float > &  ,
float &  ,
std::pair< float, float > &   
) [private]

Referenced by error_YB().

float PixelErrorParametrization::linParametrize ( bool barrelPart,
int i_size,
int i_angle1,
float &  angle2 
) [private]

Definition at line 855 of file PixelErrorParametrization.cc.

References LogDebug, xbarrel_3D, and xforward_3D.

Referenced by error_XF().

00857 {
00858   LogDebug("PixelErrorParametrization::linParametrize") << "We are in linParametrize metod"
00859                                                         << "barrel? " << barrelPart
00860                                                         << "size index = " << i_size
00861                                                         << "angle index = " << i_angle1
00862                                                         << "angle variable = " << angle2;
00863   
00864   float par0 = 0;
00865   float par1 = 0;
00866   if (barrelPart) {
00867     par0 = ((xbarrel_3D[i_size])[i_angle1])[0]; 
00868     par1 = ((xbarrel_3D[i_size])[i_angle1])[1]; 
00869   } else {
00870     par0 = ((xforward_3D[i_size])[i_angle1])[0]; 
00871     par1 = ((xforward_3D[i_size])[i_angle1])[1]; 
00872   }
00873 
00874   LogDebug("PixelErrorParametrization::linParametrize") << "PAR0 = " << par0
00875                                                         << "PAR1 = " << par1
00876                                                         << "PAR1 = " << angle2
00877                                                         << "X error = " << (par0 + par1*angle2);
00878   
00879   return par0 + par1*angle2;
00880 }

float PixelErrorParametrization::quadParametrize ( bool barrelPart,
int i_size,
int i_angle1,
float &  angle2 
) [private]

Definition at line 889 of file PixelErrorParametrization.cc.

References LogDebug, xbarrel_3D, and xforward_3D.

Referenced by error_XB().

00891 {
00892   LogDebug("PixelErrorParametrization::quadParametrize") << "barrel? " << barrelPart
00893                                                          << "size index = " << i_size
00894                                                          << "angle index = " << i_angle1
00895                                                          << "angle variable = " << angle2;
00896   
00897   float par0 = 0;
00898   float par1 = 0;
00899   float par2 = 0;
00900   if (barrelPart) {
00901     par0 = ((xbarrel_3D[i_size])[i_angle1])[0]; 
00902     par1 = ((xbarrel_3D[i_size])[i_angle1])[1]; 
00903     par2 = ((xbarrel_3D[i_size])[i_angle1])[2]; 
00904   } else {
00905     par0 = ((xforward_3D[i_size])[i_angle1])[0]; 
00906     par1 = ((xforward_3D[i_size])[i_angle1])[1]; 
00907     par2 = ((xforward_3D[i_size])[i_angle1])[2]; 
00908   }
00909 
00910   LogDebug("PixelErrorParametrization::quadParametrize") << "PAR0 = " << par0
00911                                                          << "PAR1 = " << par1
00912                                                          << "PAR2 = " << par1
00913                                                          << "ANGLE = " << angle2
00914                                                          << "X error = " << (par0 + par1*angle2 + par2*angle2*angle2);
00915   
00916   return par0 + par1*angle2 + par2*angle2*angle2;
00917 }

void PixelErrorParametrization::readF ( P3D vec3D,
const std::string &  prefix,
const std::string &  postfix1,
const std::string &  postfix2 
) [private]

Referenced by PixelErrorParametrization().

std::vector<float> PixelErrorParametrization::readVec ( const std::string &  name  )  [private]

void PixelErrorParametrization::readXB ( P3D vec3D,
const std::string &  prefix,
const std::string &  postfix1,
const std::string &  postfix2 
) [private]

Referenced by PixelErrorParametrization().

void PixelErrorParametrization::readYB ( P3D vec3D,
const std::string &  prefix,
const std::string &  postfix1,
const std::string &  postfix2 
) [private]

Referenced by PixelErrorParametrization().


Member Data Documentation

float PixelErrorParametrization::a_bin [private]

Definition at line 41 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

float PixelErrorParametrization::a_max [private]

Definition at line 40 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

float PixelErrorParametrization::a_min [private]

Definition at line 39 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

P2D PixelErrorParametrization::bbins_xb [private]

Definition at line 78 of file PixelErrorParametrization.h.

Referenced by error_XB(), and PixelErrorParametrization().

std::vector<float> PixelErrorParametrization::bbins_xf [private]

Definition at line 96 of file PixelErrorParametrization.h.

std::vector< std::pair<float,float> > PixelErrorParametrization::brange_yb [private]

Definition at line 69 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

std::pair<float,float> PixelErrorParametrization::brange_yf [private]

Definition at line 87 of file PixelErrorParametrization.h.

Referenced by error_YF(), and PixelErrorParametrization().

std::string PixelErrorParametrization::theParametrizationType [private]

Definition at line 52 of file PixelErrorParametrization.h.

Referenced by PixelErrorParametrization().

bool PixelErrorParametrization::useNewParametrization [private]

Definition at line 58 of file PixelErrorParametrization.h.

Referenced by error_XB(), error_XF(), error_YB(), error_YF(), and PixelErrorParametrization().

bool PixelErrorParametrization::useSigma [private]

Definition at line 61 of file PixelErrorParametrization.h.

Referenced by PixelErrorParametrization().

std::vector<float> PixelErrorParametrization::vec_error_XB [private]

Definition at line 47 of file PixelErrorParametrization.h.

Referenced by error_XB(), and PixelErrorParametrization().

std::vector<float> PixelErrorParametrization::vec_error_XF [private]

Definition at line 49 of file PixelErrorParametrization.h.

Referenced by error_XF(), and PixelErrorParametrization().

std::vector<float> PixelErrorParametrization::vec_error_YB [private]

Definition at line 46 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

std::vector<float> PixelErrorParametrization::vec_error_YF [private]

Definition at line 48 of file PixelErrorParametrization.h.

Referenced by error_YF(), and PixelErrorParametrization().

P3D PixelErrorParametrization::xbarrel_3D [private]

Definition at line 74 of file PixelErrorParametrization.h.

Referenced by linParametrize(), PixelErrorParametrization(), and quadParametrize().

P3D PixelErrorParametrization::xforward_3D [private]

Definition at line 92 of file PixelErrorParametrization.h.

Referenced by linParametrize(), PixelErrorParametrization(), and quadParametrize().

P3D PixelErrorParametrization::ybarrel_3D [private]

Definition at line 66 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

P3D PixelErrorParametrization::yforward_3D [private]

Definition at line 83 of file PixelErrorParametrization.h.

Referenced by error_YF(), and PixelErrorParametrization().

float PixelErrorParametrization::ys_bh[6] [private]

Definition at line 44 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().

float PixelErrorParametrization::ys_bl[6] [private]

Definition at line 43 of file PixelErrorParametrization.h.

Referenced by error_YB(), and PixelErrorParametrization().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:30:01 2009 for CMSSW by  doxygen 1.5.4