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 callTempReco3D( theDetParam, theClusterParam, clusterPayload2d, ID, lp );
249 callTempReco2D( theDetParam, theClusterParam, clusterPayload, ID, lp );
271 callTempReco3D( theDetParam, theClusterParam, clusterPayload2d, ID, lp );
272 filled_from_2d =
true;
283 theClusterParamBase.
qBin_ = theClusterParam.
qBin_;
313 float nonsense = -99999.9f;
317 theClusterParam.
qBin_ = 0;
324 float locBz = theDetParam.
bz;
325 float locBx = theDetParam.
bx;
327 const bool deadpix =
false;
328 std::vector<std::pair<int, int> > zeropix;
329 int nypix =0, nxpix = 0;
331 theClusterParam.
ierr =
338 theClusterParam.
qBin_,
347 LogDebug(
"PixelCPEClusterRepair::localPosition") <<
348 "reconstruction failed with error " << theClusterParam.
ierr <<
"\n";
351 theClusterParam.
qBin_ = 0;
356 float lorentz_drift = -999.9;
358 lorentz_drift = 60.0f;
360 lorentz_drift = 10.0f;
370 <<
"@SUB = PixelCPEClusterRepair::localPosition" 371 <<
"Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! ";
414 float nonsense = -99999.9f;
418 theClusterParam.
qBin_ = 0;
425 float locBz = theDetParam.
bz;
426 float locBx = theDetParam.
bx;
441 float edgeTypeY = theClusterParam.
edgeTypeY_ ;
452 if(clusterPayload.
mrow > 4){
455 theClusterParam.
ierr2 = 8;
459 theClusterParam.
ierr2 =
469 theClusterParam.
qBin_,
478 LogDebug(
"PixelCPEClusterRepair::localPosition") <<
479 "3D reconstruction failed with error " << theClusterParam.
ierr2 <<
"\n";
482 theClusterParam.
qBin_ = 0;
485 float lorentz_drift = -999.9;
487 lorentz_drift = 60.0f;
489 lorentz_drift = 10.0f;
499 <<
"@SUB = PixelCPEClusterRepair::localPosition" 500 <<
"Should never be here. PixelCPEClusterRepair should always be called with track angles. This is a bad error !!! ";
536 float xerr = 0.0f, yerr = 0.0f;
545 <<
"A non-pixel detector type in here?";
549 xerr = 55.0f * micronsToCm;
550 yerr = 36.0f * micronsToCm;
553 xerr = 42.0f * micronsToCm;
554 yerr = 39.0f * micronsToCm;
588 <<
" ErrX = " << xerr <<
" ErrY = " << yerr;
592 if ( !(xerr > 0.0
f) )
594 <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
596 if ( !(yerr > 0.0
f) )
598 <<
"\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_
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
ClusterParam * createClusterParam(const SiPixelCluster &cl) const override
int PixelTempReco2D(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)
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_
void callTempReco3D(DetParam const &theDetParam, ClusterParamTemplate &theClusterParam, SiPixelTemplateReco2D::ClusMatrix &clusterPayload, int ID, LocalPoint &lp) const
float clsleny()
y-size of smaller interpolated template in pixels
int PixelTempReco3D(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)
const SiPixelTemplateDBObject * templateDBobject_
virtual float localX(float mpX) const =0
DetId geographicalId() const
The label of this GeomDet.
~PixelCPEClusterRepair() override
void callTempReco2D(DetParam const &theDetParam, ClusterParamTemplate &theClusterParam, SiPixelTemplateReco::ClusMatrix &clusterPayload, int ID, LocalPoint &lp) const
std::vector< SiPixelTemplateStore2D > thePixelTemp2D_
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
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