21 #include "boost/multi_array.hpp" 48 LogDebug(
"PixelCPEClusterRepair::(constructor)") << endl;
56 <<
"\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " 57 << (*templateDBobject_).version() <<
"\n\n";
62 <<
"\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version " 63 << (*templateDBobject_).version() <<
"\n\n";
67 LogDebug(
"PixelCPEClusterRepair") <<
"Loading templates for barrel and forward from ASCII files." << endl;
76 <<
"\nERROR: Template ID " <<
barrelTemplateID_ <<
" not loaded correctly from text file. Reconstruction will fail.\n\n";
80 <<
"\nERROR: Template ID " << forwardTemplateID_ <<
" not loaded correctly from text file. Reconstruction will fail.\n\n";
84 LogDebug(
"PixelCPEClusterRepair::PixelCPEClusterRepair:") <<
85 "Template speed = " <<
speed_ <<
"\n";
91 if ( conf.
exists(
"MinProbY") )
96 if ( conf.
exists(
"MaxSizeMismatchInY") )
133 bool filled_from_2d =
false;
137 <<
"A non-pixel detector type in here?";
143 if(ID0!=ID)
edm::LogError(
"PixelCPEClusterRepair") <<
" different id"<< ID<<
" "<<ID0<<endl;
179 <<
"@SUB = PixelCPEClusterRepair::localPosition" 180 <<
"Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! ";
190 int irow =
int(pix.x);
191 int icol =
int(pix.y);
195 mrow -= row_offset; mrow+=1; mrow =
std::min(mrow,cluster_matrix_size_x);
196 mcol -= col_offset; mcol+=1; mcol =
std::min(mcol,cluster_matrix_size_y);
197 assert(mrow>0); assert(mcol>0);
201 bool xdouble[mrow], ydouble[mcol];
203 for (
int irow = 0; irow < mrow; ++irow)
207 for (
int icol = 0; icol < mcol; ++icol)
211 float clustMatrix[mrow][mcol];
212 float clustMatrix2[mrow][mcol];
220 memset( clustMatrix, 0,
sizeof(
float)*mrow*mcol );
224 int irow =
int(pix.x) - row_offset;
225 int icol =
int(pix.y) - col_offset;
227 if ( (irow<mrow) & (icol<mcol) ) clustMatrix[irow][icol] =
float(pix.adc);
232 memcpy( clustMatrix2, clustMatrix,
sizeof(
float)*mrow*mcol);
235 theClusterParam.
ierr = 0;
236 theClusterParam.
ierr2 = 0;
243 filled_from_2d =
true;
244 callTempReco2D( theDetParam, theClusterParam, clusterPayload2d, ID, lp );
249 callTempReco1D( theDetParam, theClusterParam, clusterPayload, ID, lp );
256 callTempReco2D( theDetParam, theClusterParam, clusterPayload2d, ID, lp );
257 filled_from_2d =
true;
268 theClusterParamBase.
qBin_ = theClusterParam.
qBin_;
298 float nonsense = -99999.9f;
302 theClusterParam.
qBin_ = 0;
309 float locBz = theDetParam.
bz;
310 float locBx = theDetParam.
bx;
312 const bool deadpix =
false;
313 std::vector<std::pair<int, int> > zeropix;
314 int nypix =0, nxpix = 0;
316 theClusterParam.
ierr =
323 theClusterParam.
qBin_,
332 LogDebug(
"PixelCPEClusterRepair::localPosition") <<
333 "reconstruction failed with error " << theClusterParam.
ierr <<
"\n";
336 theClusterParam.
qBin_ = 0;
341 float lorentz_drift = -999.9;
343 lorentz_drift = 60.0f;
345 lorentz_drift = 10.0f;
355 <<
"@SUB = PixelCPEClusterRepair::localPosition" 356 <<
"Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! ";
399 float nonsense = -99999.9f;
403 theClusterParam.
qBin_ = 0;
410 float locBz = theDetParam.
bz;
411 float locBx = theDetParam.
bx;
426 float edgeTypeY = theClusterParam.
edgeTypeY_ ;
437 if(clusterPayload.
mrow > 4){
440 theClusterParam.
ierr2 = 8;
444 theClusterParam.
ierr2 =
454 theClusterParam.
qBin_,
463 LogDebug(
"PixelCPEClusterRepair::localPosition") <<
464 "2D reconstruction failed with error " << theClusterParam.
ierr2 <<
"\n";
467 theClusterParam.
qBin_ = 0;
470 float lorentz_drift = -999.9;
472 lorentz_drift = 60.0f;
474 lorentz_drift = 10.0f;
484 <<
"@SUB = PixelCPEClusterRepair::localPosition" 485 <<
"Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! ";
521 float xerr = 0.0f, yerr = 0.0f;
530 <<
"A non-pixel detector type in here?";
534 xerr = 55.0f * micronsToCm;
535 yerr = 36.0f * micronsToCm;
538 xerr = 42.0f * micronsToCm;
539 yerr = 39.0f * micronsToCm;
573 <<
" ErrX = " << xerr <<
" ErrY = " << yerr;
577 if ( !(xerr > 0.0
f) )
579 <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
581 if ( !(yerr > 0.0
f) )
583 <<
"\nERROR: Negative pixel error yerr = " << yerr <<
"\n\n";
LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
T getParameter(std::string const &) const
Point3DBase< Scalar, LocalTag > LocalPoint
std::vector< SiPixelTemplateStore > thePixelTemp_
int PixelTempReco2D(int id, float cotalpha, float cotbeta, float locBz, float locBx, int edgeflagy, int edgeflagx, ClusMatrix &cluster, SiPixelTemplate2D &templ, float &yrec, float &sigmay, float &xrec, float &sigmax, float &probxy, float &probQ, int &qbin, float &deltay, int &npixel)
short getTemplateID(const uint32_t &detid) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const SiPixelCluster * theCluster
bool isBarrel(GeomDetEnumerators::SubDetector m)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
int PixelTempReco1D(int id, float cotalpha, float cotbeta, float locBz, float locBx, ClusMatrix &cluster, SiPixelTemplate &templ, float &yrec, float &sigmay, float &proby, float &xrec, float &sigmax, float &probx, int &qbin, int speed, bool deadpix, std::vector< std::pair< int, int > > &zeropix, float &probQ, int &nypix, int &nxpix)
ClusterParam * createClusterParam(const SiPixelCluster &cl) const override
const PixelGeomDetUnit * theDet
GeomDetType::SubDetector thePart
const RectangularPixelTopology * theRecTopol
PixelCPEClusterRepair(edm::ParameterSet const &conf, const MagneticField *, const TrackerGeometry &, const TrackerTopology &, const SiPixelLorentzAngle *, const SiPixelTemplateDBObject *, const SiPixel2DTemplateDBObject *)
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
const PixelTopology * theTopol
bool LoadTemplatesFromDB_
float clsleny()
y-size of smaller interpolated template in pixels
const SiPixelTemplateDBObject * templateDBobject_
virtual float localX(float mpX) const =0
DetId geographicalId() const
The label of this GeomDet.
~PixelCPEClusterRepair() override
std::vector< SiPixelTemplateStore2D > thePixelTemp2D_
void callTempReco2D(DetParam const &theDetParam, ClusterParamTemplate &theClusterParam, SiPixelTemplateReco2D::ClusMatrix &clusterPayload, int ID, LocalPoint &lp) const
bool isEndcap(GeomDetEnumerators::SubDetector m)
bool isItBigPixelInY(const int iybin) const override
bool isItBigPixelInX(const int ixbin) const override
Topology::LocalTrackPred loc_trk_pred
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore2D > &pixelTemp, std::string dir="")
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
void callTempReco1D(DetParam const &theDetParam, ClusterParamTemplate &theClusterParam, SiPixelTemplateReco::ClusMatrix &clusterPayload, int ID, LocalPoint &lp) const
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
Pixel cluster – collection of neighboring pixels above threshold.
virtual float localY(float mpY) const =0
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override