24 #include "boost/multi_array.hpp"
28 using namespace SiPixelTemplateReco;
31 const float PI = 3.141593;
48 :
PixelCPEBase(conf, mag, lorentzAngle, 0, templateDBobject)
62 if ( LoadTemplatesFromDB_ )
67 <<
"\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
68 << (*templateDBobject_).version() <<
"\n\n";
74 <<
"\nERROR: Templates not loaded correctly from text file. Reconstruction will fail.\n\n";
78 LogDebug(
"PixelCPETemplateReco::PixelCPETemplateReco:") <<
79 "Template speed = " <<
speed_ <<
"\n";
106 <<
"@SUB = PixelCPETemplateReco::measurementPosition"
107 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
169 <<
"@SUB = PixelCPETemplateReco::localPosition"
170 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
175 const std::vector<SiPixelCluster::Pixel> & pixVec = cluster.
pixels();
176 std::vector<SiPixelCluster::Pixel>::const_iterator
177 pixIter = pixVec.begin(), pixEnd = pixVec.end();
212 for ( ; pixIter != pixEnd; ++pixIter )
218 int irow = int(pixIter->x) - row_offset;
219 int icol = int(pixIter->y) - col_offset;
225 clust_array_2d[irow][icol] = (float)pixIter->adc;
243 float nonsense = -99999.9;
251 float templYrec1_ = nonsense;
252 float templXrec1_ = nonsense;
253 float templYrec2_ = nonsense;
254 float templXrec2_ = nonsense;
263 float locBz = Bfield.
z();
268 clust_array_2d, ydouble, xdouble,
282 LogDebug(
"PixelCPETemplateReco::localPosition") <<
283 "reconstruction failed with error " <<
ierr <<
"\n";
288 double lorentz_drift = -999.9;
290 lorentz_drift = 60.0;
292 lorentz_drift = 10.0;
295 <<
"A non-pixel detector type in here?" <<
"\n";
306 <<
"@SUB = PixelCPETemplateReco::localPosition"
307 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
318 clust_array_2d, ydouble, xdouble,
326 LogDebug(
"PixelCPETemplateReco::localPosition") <<
327 "reconstruction failed with error " <<
ierr <<
"\n";
332 double lorentz_drift = -999.9;
334 lorentz_drift = 60.0;
336 lorentz_drift = 10.0;
339 <<
"A non-pixel detector type in here?" <<
"\n";
350 <<
"@SUB = PixelCPETemplateReco::localPosition"
351 <<
"Should never be here. PixelCPETemplateReco should always be called with track angles. This is a bad error !!! ";
367 templXrec1_ += lp.x();
368 templYrec1_ += lp.y();
369 templXrec2_ += lp.x();
370 templYrec2_ += lp.y();
386 int index_dist = -999;
387 float min_templXrec_ = -999.9;
388 float min_templYrec_ = -999.9;
389 float distance_min = 9999999999.9;
390 if ( distance11 < distance_min )
392 distance_min = distance11;
393 min_templXrec_ = templXrec1_;
394 min_templYrec_ = templYrec1_;
397 if ( distance12 < distance_min )
399 distance_min = distance12;
400 min_templXrec_ = templXrec1_;
401 min_templYrec_ = templYrec2_;
404 if ( distance21 < distance_min )
406 distance_min = distance21;
407 min_templXrec_ = templXrec2_;
408 min_templYrec_ = templYrec1_;
411 if ( distance22 < distance_min )
413 distance_min = distance22;
414 min_templXrec_ = templXrec2_;
415 min_templYrec_ = templYrec2_;
490 throw cms::Exception(
"PixelCPETemplateReco::localError :") <<
"A non-pixel detector type in here?" ;
495 else if ( edgex || edgey )
498 if ( edgex && !edgey )
503 else if ( !edgex && edgey )
508 else if ( edgex && edgey )
515 throw cms::Exception(
" PixelCPETemplateReco::localError: Something wrong with pixel edge flag !!!");
533 " Sizex = " << cluster.
sizeX() <<
" Sizey = " << cluster.
sizeY() <<
" Edgex = " << edgex <<
" Edgey = " << edgey <<
534 " ErrX = " << xerr <<
" ErrY = " << yerr;
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.
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
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
MeasurementPoint measurementPosition(const SiPixelCluster &, const GeomDetUnit &det) const
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)
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 RotationType & rotation() const
const int cluster_matrix_size_x
const PixelGeomDetUnit * theDet
int PixelTempSplit(int id, bool fpix, float cotalpha, float cotbeta, array_2d cluster, std::vector< bool > ydouble, std::vector< bool > xdouble, SiPixelTemplate &templ, float &yrec1, float &yrec2, float &sigmay, float &proby, float &xrec1, float &xrec2, float &sigmax, float &probx, int &qbin, bool deadpix, std::vector< std::pair< int, int > > zeropix)
const PositionType & position() const
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
const std::vector< Pixel > pixels() const
virtual float localY(const float mpY) const =0
virtual bool isItBigPixelInY(const int iybin) const =0