00001
00002
00003
00004
00005 #include "Geometry/TrackerGeometryBuilder/interface/PixelGeomDetUnit.h"
00006 #include "Geometry/TrackerTopology/interface/RectangularPixelTopology.h"
00007
00008 #include "RecoLocalTracker/SiPixelRecHits/interface/PixelCPEParmError.h"
00009
00010
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012
00013
00014 #include "MagneticField/Engine/interface/MagneticField.h"
00015
00016 #include <iostream>
00017
00018
00019 using namespace std;
00020
00021 const float PI = 3.141593;
00022 const float degsPerRad = 57.29578;
00023
00024
00025
00026
00027
00028
00029 PixelCPEParmError::PixelCPEParmError(edm::ParameterSet const & conf,
00030 const MagneticField *mag, const SiPixelLorentzAngle * lorentzAngle)
00031 : PixelCPEBase(conf,mag,lorentzAngle)
00032 {
00033 pixelErrorParametrization_ = new PixelErrorParametrization(conf);
00034 }
00035
00036
00037
00038
00039 PixelCPEParmError::~PixelCPEParmError()
00040 {
00041 delete pixelErrorParametrization_ ;
00042 }
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 LocalError
00054 PixelCPEParmError::localError( const SiPixelCluster& cluster, const GeomDetUnit & det)const
00055 {
00056 setTheDet( det );
00057
00058
00059 float xerr = thePitchX / sqrt(12.);
00060 float yerr = thePitchY / sqrt(12.);
00061
00062
00063
00064 int maxPixelCol = cluster.maxPixelCol();
00065 int maxPixelRow = cluster.maxPixelRow();
00066 int minPixelCol = cluster.minPixelCol();
00067 int minPixelRow = cluster.minPixelRow();
00068
00069 bool edgex = (theTopol->isItEdgePixelInX(minPixelRow)) ||
00070 (theTopol->isItEdgePixelInX(maxPixelRow));
00071 bool edgey = (theTopol->isItEdgePixelInY(minPixelCol)) ||
00072 (theTopol->isItEdgePixelInY(maxPixelCol));
00073
00074
00075 bool bigInX = theTopol->containsBigPixelInX(minPixelRow, maxPixelRow);
00076 bool bigInY = theTopol->containsBigPixelInY(minPixelCol, maxPixelCol);
00077
00078 if (edgex && edgey) {
00079
00080
00081
00082 } else {
00083 pair<float,float> errPair =
00084 pixelErrorParametrization_->getError(thePart,
00085 cluster.sizeX(), cluster.sizeY(),
00086 alpha_ , beta_,
00087 bigInX , bigInY);
00088 if (!edgex) xerr = errPair.first;
00089 if (!edgey) yerr = errPair.second;
00090 }
00091
00092 if (theVerboseLevel > 9) {
00093 LogDebug("PixelCPEParmError") <<
00094 "Sizex = " << cluster.sizeX() << " Sizey = " << cluster.sizeY() <<
00095 " Edgex = " << edgex << " Edgey = " << edgey <<
00096 " ErrX = " << xerr << " ErrY = " << yerr;
00097 }
00098 return LocalError(xerr*xerr, 0,yerr*yerr);
00099 }
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110 float
00111 PixelCPEParmError::xpos(const SiPixelCluster& cluster) const {
00112 int size = cluster.sizeX();
00113
00114 if (size == 1) {
00115 float baryc = cluster.x();
00116
00117
00118 return theTopol->localX(baryc);
00119 }
00120
00121
00122 int imin = cluster.minPixelRow();
00123 int imax = cluster.maxPixelRow();
00124
00125
00126 float minEdge = theTopol->localX(float(imin+1));
00127 float maxEdge = theTopol->localX(float(imax));
00128 float center = (minEdge + maxEdge)/2.;
00129 float wInner = maxEdge-minEdge;
00130
00131
00132 const vector<SiPixelCluster::Pixel>& pixelsVec = cluster.pixels();
00133 float q1 = 0.;
00134 float q2 = 0.;
00135 xCharge(pixelsVec, imin, imax, q1, q2);
00136
00137
00138 float width = chargeWidthX() * thePitchX;
00139
00140
00141 float effWidth = fabs(width) - wInner;
00142
00143
00144 if( (effWidth>(2*thePitchX)) || (effWidth<0.) ) {
00145 effWidth=thePitchX;
00146 }
00147
00148
00149
00150 float pos = center + (q2-q1)/(2.*(q1+q2)) * effWidth;
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 return pos;
00162 }
00163
00164
00165
00166
00167
00168 float
00169 PixelCPEParmError::ypos(const SiPixelCluster& cluster) const
00170 {
00171
00172 int size = cluster.sizeY();
00173
00174 if (size == 1) {
00175 float baryc = cluster.y();
00176
00177
00178 return theTopol->localY(baryc);
00179 }
00180
00181
00182 int imin = cluster.minPixelCol();
00183 int imax = cluster.maxPixelCol();
00184
00185
00186 float minEdge = theTopol->localY(float(imin+1));
00187 float maxEdge = theTopol->localY(float(imax));
00188 float center = (minEdge + maxEdge)/2.;
00189 float wInner = maxEdge-minEdge;
00190
00191
00192 const vector<SiPixelCluster::Pixel>& pixelsVec = cluster.pixels();
00193 float q1 = 0.;
00194 float q2 = 0.;
00195 yCharge(pixelsVec, imin, imax, q1, q2);
00196
00197
00198 float width = (chargeWidthY()) * thePitchY;
00199 float effWidth = fabs(width) - wInner;
00200
00201
00202 if(effWidth>2*thePitchY) {
00203 float edgeLength = 2*thePitchY;
00204 if(RectangularPixelTopology::isItBigPixelInY(imin) )
00205 edgeLength += thePitchY;
00206 if(RectangularPixelTopology::isItBigPixelInY(imax) )
00207 edgeLength += thePitchY;
00208
00209 if(effWidth>edgeLength) effWidth=edgeLength/2.;
00210
00211 } else if(effWidth<0.) {
00212 effWidth=thePitchY;
00213 }
00214
00215
00216 float pos = center + (q2-q1)/(2.*(q1+q2)) * effWidth;
00217
00218
00219
00220
00221
00222
00223
00224 return pos;
00225 }
00226
00227
00228
00229
00230
00231 float
00232 PixelCPEParmError::chargeWidthX() const
00233 {
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246 float geomWidthX = theThickness * tan(PI/2 - alpha_)/thePitchX;
00247 if (thePart == GeomDetEnumerators::PixelBarrel){
00248 return (geomWidthX) + (2 * theLShiftX);
00249 } else {
00250 return fabs(geomWidthX) + (2 * fabs(theLShiftX));
00251 }
00252 }
00253
00254
00255
00256
00257
00258 float
00259 PixelCPEParmError::chargeWidthY() const
00260 {
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272 float geomWidthY = theThickness * tan(PI/2 - beta_)/thePitchY;
00273 if (thePart == GeomDetEnumerators::PixelBarrel) {
00274 return geomWidthY;
00275 } else {
00276 return fabs(geomWidthY);
00277 }
00278 }
00279
00280
00281
00282
00283