24 #include "boost/multi_array.hpp"
28 using namespace SiPixelTemplateReco;
32 const float PI = 3.141593;
49 :
PixelCPEBase(conf, mag, lorentzAngle, 0, templateDBobject)
65 if ( LoadTemplatesFromDB_ )
72 <<
"\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
73 << (*templateDBobject_).version() <<
"\n\n";
81 <<
"\nERROR: Templates 40 not loaded correctly from text file. Reconstruction will fail.\n\n";
85 <<
"\nERROR: Templates 41 not loaded correctly from text file. Reconstruction will fail.\n\n";
89 LogDebug(
"PixelCPETemplateReco::PixelCPETemplateReco:") <<
90 "Template speed = " <<
speed_ <<
"\n";
117 <<
"@SUB = PixelCPETemplateReco::measurementPosition"
118 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
193 <<
"@SUB = PixelCPETemplateReco::localPosition"
194 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
199 const std::vector<SiPixelCluster::Pixel> & pixVec = cluster.
pixels();
200 std::vector<SiPixelCluster::Pixel>::const_iterator
201 pixIter = pixVec.begin(), pixEnd = pixVec.end();
236 for ( ; pixIter != pixEnd; ++pixIter )
242 int irow = int(pixIter->x) - row_offset;
243 int icol = int(pixIter->y) - col_offset;
249 clust_array_2d[irow][icol] = (float)pixIter->adc;
267 float nonsense = -99999.9;
275 float templYrec1_ = nonsense;
276 float templXrec1_ = nonsense;
277 float templYrec2_ = nonsense;
278 float templXrec2_ = nonsense;
287 float locBz = Bfield.
z();
292 clust_array_2d, ydouble, xdouble,
306 LogDebug(
"PixelCPETemplateReco::localPosition") <<
307 "reconstruction failed with error " <<
ierr <<
"\n";
312 double lorentz_drift = -999.9;
314 lorentz_drift = 60.0;
316 lorentz_drift = 10.0;
319 <<
"A non-pixel detector type in here?" <<
"\n";
329 <<
"@SUB = PixelCPETemplateReco::localPosition"
330 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
338 cout <<
" PixelCPETemplateReco : We should never be here !!!!!!!!!!!!!!!!!!!!!!" << endl;
371 LogDebug(
"PixelCPETemplateReco::localPosition") <<
372 "reconstruction failed with error " <<
ierr <<
"\n";
377 double lorentz_drift = -999.9;
379 lorentz_drift = 60.0;
381 lorentz_drift = 10.0;
384 <<
"A non-pixel detector type in here?" <<
"\n";
395 <<
"@SUB = PixelCPETemplateReco::localPosition"
396 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
412 templXrec1_ += lp.x();
413 templYrec1_ += lp.y();
414 templXrec2_ += lp.x();
415 templYrec2_ += lp.y();
431 float min_templXrec_ = -999.9;
432 float min_templYrec_ = -999.9;
433 float distance_min = 9999999999.9;
434 if ( distance11 < distance_min )
436 distance_min = distance11;
437 min_templXrec_ = templXrec1_;
438 min_templYrec_ = templYrec1_;
440 if ( distance12 < distance_min )
442 distance_min = distance12;
443 min_templXrec_ = templXrec1_;
444 min_templYrec_ = templYrec2_;
446 if ( distance21 < distance_min )
448 distance_min = distance21;
449 min_templXrec_ = templXrec2_;
450 min_templYrec_ = templYrec1_;
452 if ( distance22 < distance_min )
454 distance_min = distance22;
455 min_templXrec_ = templXrec2_;
456 min_templYrec_ = templYrec2_;
554 throw cms::Exception(
"PixelCPETemplateReco::localError :") <<
"A non-pixel detector type in here?" ;
561 else if ( edgex || edgey )
564 if ( edgex && !edgey )
569 else if ( !edgex && edgey )
574 else if ( edgex && edgey )
581 throw cms::Exception(
" PixelCPETemplateReco::localError: Something wrong with pixel edge flag !!!");
605 " Sizex = " << cluster.
sizeX() <<
" Sizey = " << cluster.
sizeY() <<
" Edgex = " << edgex <<
" Edgey = " << edgey <<
606 " ErrX = " << xerr <<
" ErrY = " << yerr;
613 <<
"\nERROR: Negative pixel error xerr = " << xerr <<
"\n\n";
617 <<
"\nERROR: Negative pixel error yerr = " << yerr <<
"\n\n";
T getParameter(std::string const &) const
Topology::LocalTrackPred loc_trk_pred_
bool LoadTemplatesFromDB_
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
short getTemplateID(const uint32_t &detid) const
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
LocalError localError(const SiPixelCluster &cl, const GeomDetUnit &det) const
GeomDetType::SubDetector thePart
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItEdgePixelInX(int ixbin) const =0
MeasurementPoint measurementPosition(const SiPixelCluster &, const GeomDetUnit &det) const
int PixelTempSplit(int id, float cotalpha, float cotbeta, array_2d &cluster, std::vector< bool > &ydouble, std::vector< bool > &xdouble, SiPixelTemplate &templ, float &yrec1, float &yrec2, float &sigmay, float &prob2y, float &xrec1, float &xrec2, float &sigmax, float &prob2x, int &q2bin, float &prob2Q, bool resolve, int speed, float &dchisq, bool deadpix, std::vector< std::pair< int, int > > &zeropix, SiPixelTemplate2D &templ2D)
const SiPixelTemplateDBObject * templateDBobject_
LocalPoint localPosition(const SiPixelCluster &cluster, const GeomDetUnit &det) const
DetId geographicalId() const
The label of this GeomDet.
const MagneticField * magfield_
virtual MeasurementPoint measurementPosition(const LocalPoint &) const =0
int PixelTempReco2D(int id, float cotalpha, float cotbeta, float locBz, array_2d &cluster, std::vector< bool > &ydouble, std::vector< bool > &xdouble, 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)
virtual bool isItBigPixelInX(const int ixbin) const =0
virtual float localX(const float mpX) const =0
bool pushfile(int filenum)
float getSplitClusterErrorY() const
LocalTrajectoryParameters loc_traj_param_
const PixelTopology * theTopol
const int cluster_matrix_size_y
PixelCPETemplateReco(edm::ParameterSet const &conf, const MagneticField *, const SiPixelLorentzAngle *, const SiPixelTemplateDBObject *)
void setTheDet(const GeomDetUnit &det, const SiPixelCluster &cluster) const
Pixel cluster – collection of neighboring pixels above threshold.
virtual bool isItEdgePixelInY(int iybin) const =0
const BoundPlane & surface() const
The nominal surface of the GeomDet.
float getSplitClusterErrorX() const
const RotationType & rotation() const
bool pushfile(int filenum)
const int cluster_matrix_size_x
const PixelGeomDetUnit * theDet
const PositionType & position() const
const std::vector< Pixel > pixels() const
virtual float localY(const float mpY) const =0
virtual bool isItBigPixelInY(const int iybin) const =0