CMS 3D CMS Logo

PixelCPETemplateReco.cc
Go to the documentation of this file.
1 // Include our own header first
3 
4 // Geometry services
6 
7 //#define DEBUG
8 
9 // MessageLogger
11 
12 // Magnetic field
14 
15 // The template header files
17 
18 // Commented for now (3/10/17) until we figure out how to resuscitate 2D template splitter
20 
22 
23 #include <vector>
24 #include "boost/multi_array.hpp"
25 
26 #include <iostream>
27 
28 using namespace SiPixelTemplateReco;
29 //using namespace SiPixelTemplateSplit;
30 using namespace std;
31 
32 namespace {
33  constexpr float micronsToCm = 1.0e-4;
34  constexpr int cluster_matrix_size_x = 13;
35  constexpr int cluster_matrix_size_y = 21;
36 } // namespace
37 
38 //-----------------------------------------------------------------------------
39 // Constructor.
40 //
41 //-----------------------------------------------------------------------------
43  const MagneticField* mag,
44  const TrackerGeometry& geom,
45  const TrackerTopology& ttopo,
46  const SiPixelLorentzAngle* lorentzAngle,
47  const std::vector<SiPixelTemplateStore>* templateStore,
48  const SiPixelTemplateDBObject* templateDBobject)
49  : PixelCPEBase(conf, mag, geom, ttopo, lorentzAngle, nullptr, templateDBobject, nullptr, 1) {
50  //cout << endl;
51  //cout << "Constructing PixelCPETemplateReco::PixelCPETemplateReco(...)................................................." << endl;
52  //cout << endl;
53 
54  // Configurable parameters
55  //DoCosmics_ = conf.getParameter<bool>("DoCosmics"); // Not used in templates
56  //LoadTemplatesFromDB_ = conf.getParameter<bool>("LoadTemplatesFromDB"); // Moved to Base
57 
58  //cout << " PixelCPETemplateReco : (int)LoadTemplatesFromDB_ = " << (int)LoadTemplatesFromDB_ << endl;
59  //cout << "field_magnitude = " << field_magnitude << endl;
60 
61  // configuration parameter to decide between DB or text file template access
62 
64  //cout << "PixelCPETemplateReco: Loading templates from database (DB) --------- " << endl;
65  thePixelTemp_ = templateStore;
66  } else {
67  //cout << "PixelCPETemplateReco : Loading templates for barrel and forward from ASCII files ----------" << endl;
68  barrelTemplateID_ = conf.getParameter<int>("barrelTemplateID");
69  forwardTemplateID_ = conf.getParameter<int>("forwardTemplateID");
70  templateDir_ = conf.getParameter<int>("directoryWithTemplates");
71 
74  throw cms::Exception("PixelCPETemplateReco")
75  << "\nERROR: Template ID " << barrelTemplateID_
76  << " not loaded correctly from text file. Reconstruction will fail.\n\n";
77 
79  throw cms::Exception("PixelCPETemplateReco")
80  << "\nERROR: Template ID " << forwardTemplateID_
81  << " not loaded correctly from text file. Reconstruction will fail.\n\n";
82  }
83 
84  speed_ = conf.getParameter<int>("speed");
85  LogDebug("PixelCPETemplateReco::PixelCPETemplateReco:") << "Template speed = " << speed_ << "\n";
86 
87  UseClusterSplitter_ = conf.getParameter<bool>("UseClusterSplitter");
88 }
89 
90 //-----------------------------------------------------------------------------
91 // Clean up.
92 //-----------------------------------------------------------------------------
94 
95 std::unique_ptr<PixelCPEBase::ClusterParam> PixelCPETemplateReco::createClusterParam(const SiPixelCluster& cl) const {
96  return std::make_unique<ClusterParamTemplate>(cl);
97 }
98 
99 //------------------------------------------------------------------
100 // Public methods mandated by the base class.
101 //------------------------------------------------------------------
102 
103 //------------------------------------------------------------------
104 // The main call to the template code.
105 //------------------------------------------------------------------
106 LocalPoint PixelCPETemplateReco::localPosition(DetParam const& theDetParam, ClusterParam& theClusterParamBase) const {
107  ClusterParamTemplate& theClusterParam = static_cast<ClusterParamTemplate&>(theClusterParamBase);
108 
110  throw cms::Exception("PixelCPETemplateReco::localPosition :") << "A non-pixel detector type in here?";
111  // barrel(false) or forward(true)
112  const bool fpix = GeomDetEnumerators::isEndcap(theDetParam.thePart);
113 
114  int ID = -9999;
115  if (LoadTemplatesFromDB_) {
116  int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre
117  ID = theDetParam.detTemplateId;
118  if (ID0 != ID)
119  edm::LogError("PixelCPETemplateReco") << " different id" << ID << " " << ID0 << endl;
120  } else { // from asci file
121  if (!fpix)
122  ID = barrelTemplateID_; // barrel
123  else
124  ID = forwardTemplateID_; // forward
125  }
126  //cout << "PixelCPETemplateReco : ID = " << ID << endl;
127 
129 
130  // Preparing to retrieve ADC counts from the SiPixeltheClusterParam.theCluster-> In the cluster,
131  // we have the following:
132  // int minPixelRow(); // Minimum pixel index in the x direction (low edge).
133  // int maxPixelRow(); // Maximum pixel index in the x direction (top edge).
134  // int minPixelCol(); // Minimum pixel index in the y direction (left edge).
135  // int maxPixelCol(); // Maximum pixel index in the y direction (right edge).
136  // So the pixels from minPixelRow() will go into clust_array_2d[0][*],
137  // and the pixels from minPixelCol() will go into clust_array_2d[*][0].
138 
139  int row_offset = theClusterParam.theCluster->minPixelRow();
140  int col_offset = theClusterParam.theCluster->minPixelCol();
141 
142  // Store the coordinates of the center of the (0,0) pixel of the array that
143  // gets passed to PixelTempReco1D
144  // Will add these values to the output of PixelTempReco1D
145  float tmp_x = float(row_offset) + 0.5f;
146  float tmp_y = float(col_offset) + 0.5f;
147 
148  // Store these offsets (to be added later) in a LocalPoint after tranforming
149  // them from measurement units (pixel units) to local coordinates (cm)
150  //
151  //
152 
153  // In case of template reco failure, these are the lorentz drift corrections
154  // to be applied
155  float lorentzshiftX = 0.5f * theDetParam.lorentzShiftInCmX;
156  float lorentzshiftY = 0.5f * theDetParam.lorentzShiftInCmY;
157 
158  // ggiurgiu@jhu.edu 12/09/2010 : update call with trk angles needed for bow/kink corrections
159  LocalPoint lp;
160 
161  if (theClusterParam.with_track_angle)
162  lp = theDetParam.theTopol->localPosition(MeasurementPoint(tmp_x, tmp_y), theClusterParam.loc_trk_pred);
163  else {
164  edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition"
165  << "Should never be here. PixelCPETemplateReco should always be called with "
166  "track angles. This is a bad error !!! ";
167 
168  lp = theDetParam.theTopol->localPosition(MeasurementPoint(tmp_x, tmp_y));
169  }
170 
171  // first compute matrix size
172  int mrow = 0, mcol = 0;
173  for (int i = 0; i != theClusterParam.theCluster->size(); ++i) {
174  auto pix = theClusterParam.theCluster->pixel(i);
175  int irow = int(pix.x);
176  int icol = int(pix.y);
177  mrow = std::max(mrow, irow);
178  mcol = std::max(mcol, icol);
179  }
180  mrow -= row_offset;
181  mrow += 1;
182  mrow = std::min(mrow, cluster_matrix_size_x);
183  mcol -= col_offset;
184  mcol += 1;
185  mcol = std::min(mcol, cluster_matrix_size_y);
186  assert(mrow > 0);
187  assert(mcol > 0);
188 
189  float clustMatrix[mrow][mcol];
190  memset(clustMatrix, 0, sizeof(float) * mrow * mcol);
191 
192  // Copy clust's pixels (calibrated in electrons) into clusMatrix;
193  for (int i = 0; i != theClusterParam.theCluster->size(); ++i) {
194  auto pix = theClusterParam.theCluster->pixel(i);
195  int irow = int(pix.x) - row_offset;
196  int icol = int(pix.y) - col_offset;
197 
198  // Gavril : what do we do here if the row/column is larger than cluster_matrix_size_x/cluster_matrix_size_y ?
199  // Ignore them for the moment...
200  if ((irow < mrow) & (icol < mcol))
201  clustMatrix[irow][icol] = float(pix.adc);
202  }
203 
204  // Make and fill the bool arrays flagging double pixels
205  bool xdouble[mrow], ydouble[mcol];
206  // x directions (shorter), rows
207  for (int irow = 0; irow < mrow; ++irow)
208  xdouble[irow] = theDetParam.theTopol->isItBigPixelInX(irow + row_offset);
209 
210  // y directions (longer), columns
211  for (int icol = 0; icol < mcol; ++icol)
212  ydouble[icol] = theDetParam.theTopol->isItBigPixelInY(icol + col_offset);
213 
214  SiPixelTemplateReco::ClusMatrix clusterPayload{&clustMatrix[0][0], xdouble, ydouble, mrow, mcol};
215 
216  // Output:
217  float nonsense = -99999.9f; // nonsense init value
218  theClusterParam.templXrec_ = theClusterParam.templYrec_ = theClusterParam.templSigmaX_ =
219  theClusterParam.templSigmaY_ = nonsense;
220  // If the template recontruction fails, we want to return 1.0 for now
221  theClusterParam.templProbY_ = theClusterParam.templProbX_ = theClusterParam.templProbQ_ = 1.0f;
222  theClusterParam.templQbin_ = 0;
223  // We have a boolean denoting whether the reco failed or not
224  theClusterParam.hasFilledProb_ = false;
225 
226  float templYrec1_ = nonsense;
227  float templXrec1_ = nonsense;
228  float templYrec2_ = nonsense;
229  float templXrec2_ = nonsense;
230 
231  // ******************************************************************
232  // Do it! Use cotalpha_ and cotbeta_ calculated in PixelCPEBase
233 
234  float locBz = theDetParam.bz;
235  float locBx = theDetParam.bx;
236 
237  theClusterParam.ierr = PixelTempReco1D(ID,
238  theClusterParam.cotalpha,
239  theClusterParam.cotbeta,
240  locBz,
241  locBx,
242  clusterPayload,
243  templ,
244  theClusterParam.templYrec_,
245  theClusterParam.templSigmaY_,
246  theClusterParam.templProbY_,
247  theClusterParam.templXrec_,
248  theClusterParam.templSigmaX_,
249  theClusterParam.templProbX_,
250  theClusterParam.templQbin_,
251  speed_,
252  theClusterParam.templProbQ_);
253 
254  // ******************************************************************
255 
256  // Check exit status
257  if UNLIKELY (theClusterParam.ierr != 0) {
258  LogDebug("PixelCPETemplateReco::localPosition")
259  << "reconstruction failed with error " << theClusterParam.ierr << "\n";
260 
261  // Template reco has failed, compute position estimates based on cluster center of gravity + Lorentz drift
262  // Future improvement would be to call generic reco instead
263 
264  // ggiurgiu@jhu.edu, 21/09/2010 : trk angles needed to correct for bows/kinks
265  if (theClusterParam.with_track_angle) {
266  theClusterParam.templXrec_ =
267  theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX;
268  theClusterParam.templYrec_ =
269  theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY;
270  } else {
271  edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition"
272  << "Should never be here. PixelCPETemplateReco should always be called "
273  "with track angles. This is a bad error !!! ";
274 
275  theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) + lorentzshiftX;
276  theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()) + lorentzshiftY;
277  }
278  } else if UNLIKELY (UseClusterSplitter_ && theClusterParam.templQbin_ == 0) {
279  edm::LogError("PixelCPETemplateReco") << " PixelCPETemplateReco: Qbin = 0 but using cluster splitter, we should "
280  "never be here !!!!!!!!!!!!!!!!!!!!!! \n"
281  << "(int)UseClusterSplitter_ = " << (int)UseClusterSplitter_ << endl;
282 
283  //ierr =
284  //PixelTempSplit( ID, fpix, cotalpha_, cotbeta_,
285  // clust_array_2d, ydouble, xdouble,
286  // templ,
287  // templYrec1_, templYrec2_, templSigmaY_, templProbY_,
288  // templXrec1_, templXrec2_, templSigmaX_, templProbX_,
289  // templQbin_ );
290 
291  // Commented for now (3/10/17) until we figure out how to resuscitate 2D template splitter
295 
296  theClusterParam.ierr = -123;
297  /*
298  float dchisq;
299  float templProbQ_;
300  SiPixelTemplateSplit::PixelTempSplit( ID, theClusterParam.cotalpha, theClusterParam.cotbeta,
301  clust_array_2d,
302  ydouble, xdouble,
303  templ,
304  templYrec1_, templYrec2_, theClusterParam.templSigmaY_, theClusterParam.templProbY_,
305  templXrec1_, templXrec2_, theClusterParam.templSigmaX_, theClusterParam.templProbX_,
306  theClusterParam.templQbin_,
307  templProbQ_,
308  true,
309  dchisq,
310  templ2D_ );
311 
312  */
313  if (theClusterParam.ierr != 0) {
314  // Template reco has failed, compute position estimates based on cluster center of gravity + Lorentz drift
315  // Future improvement would be to call generic reco instead
316 
317  // ggiurgiu@jhu.edu, 12/09/2010 : trk angles needed to correct for bows/kinks
318  if (theClusterParam.with_track_angle) {
319  theClusterParam.templXrec_ =
320  theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) + lorentzshiftX;
321  theClusterParam.templYrec_ =
322  theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred) + lorentzshiftY;
323  } else {
324  edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition"
325  << "Should never be here. PixelCPETemplateReco should always be called "
326  "with track angles. This is a bad error !!! ";
327  theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) + lorentzshiftX;
328  theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y()) + lorentzshiftY;
329  }
330  } else {
331  // go from micrometer to centimeter
332  templXrec1_ *= micronsToCm;
333  templYrec1_ *= micronsToCm;
334  templXrec2_ *= micronsToCm;
335  templYrec2_ *= micronsToCm;
336 
337  // go back to the module coordinate system
338  templXrec1_ += lp.x();
339  templYrec1_ += lp.y();
340  templXrec2_ += lp.x();
341  templYrec2_ += lp.y();
342 
343  // calculate distance from each hit to the track and choose the hit closest to the track
344  float distX1 = std::abs(templXrec1_ - theClusterParam.trk_lp_x);
345  float distX2 = std::abs(templXrec2_ - theClusterParam.trk_lp_x);
346  float distY1 = std::abs(templYrec1_ - theClusterParam.trk_lp_y);
347  float distY2 = std::abs(templYrec2_ - theClusterParam.trk_lp_y);
348  theClusterParam.templXrec_ = (distX1 < distX2 ? templXrec1_ : templXrec2_);
349  theClusterParam.templYrec_ = (distY1 < distY2 ? templYrec1_ : templYrec2_);
350  }
351  } // else if ( UseClusterSplitter_ && templQbin_ == 0 )
352 
353  else // apparenly this is the good one!
354  {
355  // go from micrometer to centimeter
356  theClusterParam.templXrec_ *= micronsToCm;
357  theClusterParam.templYrec_ *= micronsToCm;
358 
359  // go back to the module coordinate system
360  theClusterParam.templXrec_ += lp.x();
361  theClusterParam.templYrec_ += lp.y();
362 
363  // Compute the Alignment Group Corrections [template ID should already be selected from call to reco procedure]
365  // Do only if the lotentzshift has meaningfull numbers
366  if (theDetParam.lorentzShiftInCmX != 0.0 || theDetParam.lorentzShiftInCmY != 0.0) {
367  // the LA width/shift returned by templates use (+)
368  // the LA width/shift produced by PixelCPEBase for positive LA is (-)
369  // correct this by iserting (-)
370  //float temp1 = -micronsToCm*templ.lorxwidth(); // old
371  //float temp2 = -micronsToCm*templ.lorywidth(); // does not incl 1/2
372  float templateLorbiasCmX = -micronsToCm * templ.lorxbias(); // new
373  float templateLorbiasCmY = -micronsToCm * templ.lorybias(); //incl. 1/2
374  // now, correctly, we can use the difference of shifts
375  //theClusterParam.templXrec_ += 0.5*(theDetParam.lorentzShiftInCmX - templateLorbiasCmX);
376  //theClusterParam.templYrec_ += 0.5*(theDetParam.lorentzShiftInCmY - templateLorbiasCmY);
377  theClusterParam.templXrec_ += (0.5 * (theDetParam.lorentzShiftInCmX) - templateLorbiasCmX);
378  theClusterParam.templYrec_ += (0.5 * (theDetParam.lorentzShiftInCmY) - templateLorbiasCmY);
379  //cout << "Templates: la lorentz offset = "
380  // <<(0.5*(theDetParam.lorentzShiftInCmX)-templateLorbiasCmX)
381  // <<" "<<templateLorbiasCmX<<" "<<templateLorbiasCmY
382  // <<" "<<temp1<<" "<<temp2
383  // <<" "<<theDetParam.lorentzShiftInCmX
384  // <<" "<<theDetParam.lorentzShiftInCmY
385  // << endl; //dk
386  } //else {cout<<" LA is 0, disable offset corrections "<<endl;} //dk
387  } //else {cout<<" Do not do LA offset correction "<<endl;} //dk
388  }
389 
390  // Save probabilities and qBin in the quantities given to us by the base class
391  // (for which there are also inline getters). &&& templProbX_ etc. should be retired...
392  theClusterParam.probabilityX_ = theClusterParam.templProbX_;
393  theClusterParam.probabilityY_ = theClusterParam.templProbY_;
394  theClusterParam.probabilityQ_ = theClusterParam.templProbQ_;
395  theClusterParam.qBin_ = theClusterParam.templQbin_;
396 
397  if (theClusterParam.ierr == 0) // always true here
398  theClusterParam.hasFilledProb_ = true;
399 
400  return LocalPoint(theClusterParam.templXrec_, theClusterParam.templYrec_);
401 }
402 
403 //------------------------------------------------------------------
404 // localError() relies on localPosition() being called FIRST!!!
405 //------------------------------------------------------------------
406 LocalError PixelCPETemplateReco::localError(DetParam const& theDetParam, ClusterParam& theClusterParamBase) const {
407  ClusterParamTemplate& theClusterParam = static_cast<ClusterParamTemplate&>(theClusterParamBase);
408 
409  //cout << endl;
410  //cout << "Set PixelCPETemplate errors .............................................." << endl;
411 
412  //cout << "CPETemplate : " << endl;
413 
414  //--- Default is the maximum error used for edge clusters.
415  //--- (never used, in fact: let comment it out, shut up the complains of the static analyzer, and save a few CPU cycles)
416  // const float sig12 = 1./sqrt(12.0);
417  // float xerr = theDetParam.thePitchX *sig12;
418  // float yerr = theDetParam.thePitchY *sig12;
419  float xerr, yerr;
420 
421  // Check if the errors were already set at the clusters splitting level
422  if (theClusterParam.theCluster->getSplitClusterErrorX() > 0.0f &&
423  theClusterParam.theCluster->getSplitClusterErrorX() < clusterSplitMaxError_ &&
424  theClusterParam.theCluster->getSplitClusterErrorY() > 0.0f &&
425  theClusterParam.theCluster->getSplitClusterErrorY() < clusterSplitMaxError_) {
426  xerr = theClusterParam.theCluster->getSplitClusterErrorX() * micronsToCm;
427  yerr = theClusterParam.theCluster->getSplitClusterErrorY() * micronsToCm;
428 
429  //cout << "Errors set at cluster splitting level : " << endl;
430  //cout << "xerr = " << xerr << endl;
431  //cout << "yerr = " << yerr << endl;
432  } else {
433  // If errors are not split at the cluster splitting level, set the errors here
434 
435  //cout << "Errors are not split at the cluster splitting level, set the errors here : " << endl;
436 
437  int maxPixelCol = theClusterParam.theCluster->maxPixelCol();
438  int maxPixelRow = theClusterParam.theCluster->maxPixelRow();
439  int minPixelCol = theClusterParam.theCluster->minPixelCol();
440  int minPixelRow = theClusterParam.theCluster->minPixelRow();
441 
442  //--- Are we near either of the edges?
443  bool edgex =
444  (theDetParam.theTopol->isItEdgePixelInX(minPixelRow) || theDetParam.theTopol->isItEdgePixelInX(maxPixelRow));
445  bool edgey =
446  (theDetParam.theTopol->isItEdgePixelInY(minPixelCol) || theDetParam.theTopol->isItEdgePixelInY(maxPixelCol));
447 
448  if (theClusterParam.ierr != 0) {
449  // If reconstruction fails the hit position is calculated from cluster center of gravity
450  // corrected in x by average Lorentz drift. Assign huge errors.
451  //xerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * xerr;
452  //yerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * yerr;
453 
455  throw cms::Exception("PixelCPETemplateReco::localPosition :") << "A non-pixel detector type in here?";
456 
457  // Assign better errors based on the residuals for failed template cases
458  if (GeomDetEnumerators::isBarrel(theDetParam.thePart)) {
459  xerr = 55.0f * micronsToCm;
460  yerr = 36.0f * micronsToCm;
461  } else {
462  xerr = 42.0f * micronsToCm;
463  yerr = 39.0f * micronsToCm;
464  }
465 
466  //cout << "xerr = " << xerr << endl;
467  //cout << "yerr = " << yerr << endl;
468 
469  //return LocalError(xerr*xerr, 0, yerr*yerr);
470  } else if (edgex || edgey) {
471  // for edge pixels assign errors according to observed residual RMS
472  if (edgex && !edgey) {
473  xerr = xEdgeXError_ * micronsToCm;
474  yerr = xEdgeYError_ * micronsToCm;
475  } else if (!edgex && edgey) {
476  xerr = yEdgeXError_ * micronsToCm;
477  yerr = yEdgeYError_ * micronsToCm;
478  } else if (edgex && edgey) {
479  xerr = bothEdgeXError_ * micronsToCm;
480  yerr = bothEdgeYError_ * micronsToCm;
481  } else {
482  throw cms::Exception(" PixelCPETemplateReco::localError: Something wrong with pixel edge flag !!!");
483  }
484 
485  //cout << "xerr = " << xerr << endl;
486  //cout << "yerr = " << yerr << endl;
487  } else {
488  // &&& need a class const
489  //const float micronsToCm = 1.0e-4;
490 
491  xerr = theClusterParam.templSigmaX_ * micronsToCm;
492  yerr = theClusterParam.templSigmaY_ * micronsToCm;
493 
494  //cout << "xerr = " << xerr << endl;
495  //cout << "yerr = " << yerr << endl;
496 
497  // &&& should also check ierr (saved as class variable) and return
498  // &&& nonsense (another class static) if the template fit failed.
499  }
500 
501  if (theVerboseLevel > 9) {
502  LogDebug("PixelCPETemplateReco") << " Sizex = " << theClusterParam.theCluster->sizeX()
503  << " Sizey = " << theClusterParam.theCluster->sizeY() << " Edgex = " << edgex
504  << " Edgey = " << edgey << " ErrX = " << xerr << " ErrY = " << yerr;
505  }
506 
507  } // else
508 
509  if (!(xerr > 0.0f))
510  throw cms::Exception("PixelCPETemplateReco::localError")
511  << "\nERROR: Negative pixel error xerr = " << xerr << "\n\n";
512 
513  if (!(yerr > 0.0f))
514  throw cms::Exception("PixelCPETemplateReco::localError")
515  << "\nERROR: Negative pixel error yerr = " << yerr << "\n\n";
516 
517  //cout << "Final errors set to: " << endl;
518  //cout << "xerr = " << xerr << endl;
519  //cout << "yerr = " << yerr << endl;
520  //cout << "Out of PixelCPETemplateREco..........................................................................." << endl;
521  //cout << endl;
522 
523  return LocalError(xerr * xerr, 0, yerr * yerr);
524 }
525 
527  desc.add<int>("barrelTemplateID", 0);
528  desc.add<int>("forwardTemplateID", 0);
529  desc.add<int>("directoryWithTemplates", 0);
530  desc.add<int>("speed", -2);
531  desc.add<bool>("UseClusterSplitter", false);
532 }
std::unique_ptr< ClusterParam > createClusterParam(const SiPixelCluster &cl) const override
static constexpr float xEdgeYError_
Definition: PixelCPEBase.h:246
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
virtual LocalPoint localPosition(const MeasurementPoint &) const =0
const std::vector< SiPixelTemplateStore > * thePixelTemp_
uint32_t ID
Definition: Definitions.h:24
bool isBarrel(GeomDetEnumerators::SubDetector m)
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)
bool doLorentzFromAlignment_
Definition: PixelCPEBase.h:240
Log< level::Error, false > LogError
assert(be >=bs)
static constexpr float bothEdgeYError_
Definition: PixelCPEBase.h:252
const PixelGeomDetUnit * theDet
Definition: PixelCPEBase.h:46
GeomDetType::SubDetector thePart
Definition: PixelCPEBase.h:51
static constexpr float yEdgeYError_
Definition: PixelCPEBase.h:249
virtual float localX(float mpX) const =0
constexpr float micronsToCm
PixelCPETemplateReco(edm::ParameterSet const &conf, const MagneticField *, const TrackerGeometry &, const TrackerTopology &, const SiPixelLorentzAngle *, const std::vector< SiPixelTemplateStore > *, const SiPixelTemplateDBObject *)
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
virtual bool isItEdgePixelInX(int ixbin) const =0
const PixelTopology * theTopol
Definition: PixelCPEBase.h:48
bool LoadTemplatesFromDB_
Definition: PixelCPEBase.h:241
virtual bool isItBigPixelInX(int ixbin) const =0
virtual bool isItBigPixelInY(int iybin) const =0
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:235
double f[11][100]
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
bool isEndcap(GeomDetEnumerators::SubDetector m)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
static constexpr float xEdgeXError_
Definition: PixelCPEBase.h:245
float lorybias()
signed lorentz y-width (microns)
virtual float localY(float mpY) const =0
static constexpr float clusterSplitMaxError_
Definition: PixelCPEBase.h:254
short getTemplateID(const uint32_t &detid) const
LocalError localError(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
Pixel cluster – collection of neighboring pixels above threshold.
virtual bool isItEdgePixelInY(int iybin) const =0
float lorxbias()
signed lorentz x-width (microns)
std::vector< SiPixelTemplateStore > thePixelTempCache_
static constexpr float bothEdgeXError_
Definition: PixelCPEBase.h:251
#define UNLIKELY(x)
Definition: Likely.h:21
static constexpr float yEdgeXError_
Definition: PixelCPEBase.h:248
static void fillPSetDescription(edm::ParameterSetDescription &desc)
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
LocalPoint localPosition(DetParam const &theDetParam, ClusterParam &theClusterParam) const override
#define LogDebug(id)