CMS 3D CMS Logo

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