CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PixelCPETemplateReco Class Reference

#include <PixelCPETemplateReco.h>

Inheritance diagram for PixelCPETemplateReco:
PixelCPEBase PixelClusterParameterEstimator

Classes

struct  ClusterParamTemplate
 

Public Member Functions

 PixelCPETemplateReco (edm::ParameterSet const &conf, const MagneticField *, const TrackerGeometry &, const TrackerTopology &, const SiPixelLorentzAngle *, const SiPixelTemplateDBObject *)
 
 ~PixelCPETemplateReco () override
 
- Public Member Functions inherited from PixelCPEBase
ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det) const override
 
ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det, const LocalTrajectoryParameters &ltp) const override
 
 PixelCPEBase (edm::ParameterSet const &conf, const MagneticField *mag, const TrackerGeometry &geom, const TrackerTopology &ttopo, const SiPixelLorentzAngle *lorentzAngle, const SiPixelGenErrorDBObject *genErrorDBObject, const SiPixelTemplateDBObject *templateDBobject, const SiPixelLorentzAngle *lorentzAngleWidth, int flag=0)
 
- Public Member Functions inherited from PixelClusterParameterEstimator
unsigned int clusterProbComputationFlag () const
 
virtual ReturnType getParameters (const SiPixelCluster &cl, const GeomDetUnit &det, const TrajectoryStateOnSurface &tsos) const
 
virtual VLocalValues localParametersV (const SiPixelCluster &cluster, const GeomDetUnit &gd) const
 
virtual VLocalValues localParametersV (const SiPixelCluster &cluster, const GeomDetUnit &gd, TrajectoryStateOnSurface &tsos) const
 
 PixelClusterParameterEstimator ()
 
virtual ~PixelClusterParameterEstimator ()
 

Static Public Member Functions

static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
- Static Public Member Functions inherited from PixelCPEBase
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 

Private Member Functions

std::unique_ptr< ClusterParamcreateClusterParam (const SiPixelCluster &cl) const override
 
LocalError localError (DetParam const &theDetParam, ClusterParam &theClusterParam) const override
 
LocalPoint localPosition (DetParam const &theDetParam, ClusterParam &theClusterParam) const override
 

Private Attributes

int barrelTemplateID_
 
int forwardTemplateID_
 
int speed_
 
std::string templateDir_
 
std::vector< SiPixelTemplateStorethePixelTemp_
 
bool UseClusterSplitter_
 

Additional Inherited Members

- Public Types inherited from PixelClusterParameterEstimator
typedef std::pair< LocalPoint, LocalErrorLocalValues
 
using ReturnType = std::tuple< LocalPoint, LocalError, SiPixelRecHitQuality::QualWordType >
 
typedef std::vector< LocalValuesVLocalValues
 
- Protected Types inherited from PixelCPEBase
using DetParams = std::vector< DetParam >
 
typedef GloballyPositioned< double > Frame
 
- Protected Member Functions inherited from PixelCPEBase
void computeAnglesFromDetPosition (DetParam const &theDetParam, ClusterParam &theClusterParam) const
 
void computeAnglesFromTrajectory (DetParam const &theDetParam, ClusterParam &theClusterParam, const LocalTrajectoryParameters &ltp) const
 
void computeLorentzShifts (DetParam &) const
 
DetParam const & detParam (const GeomDetUnit &det) const
 
LocalVector driftDirection (DetParam &theDetParam, GlobalVector bfield) const
 
LocalVector driftDirection (DetParam &theDetParam, LocalVector bfield) const
 
void setTheClu (DetParam const &, ClusterParam &theClusterParam) const
 
- Protected Attributes inherited from PixelCPEBase
bool alpha2Order
 
bool DoLorentz_
 
const SiPixelGenErrorDBObjectgenErrorDBObject_
 
const TrackerGeometrygeom_
 
float lAOffset_
 
float lAWidthBPix_
 
float lAWidthFPix_
 
bool LoadTemplatesFromDB_
 
const SiPixelLorentzAnglelorentzAngle_
 
const SiPixelLorentzAnglelorentzAngleWidth_
 
DetParams m_DetParams = DetParams(1440)
 
const MagneticFieldmagfield_
 
const SiPixelTemplateDBObjecttemplateDBobject_
 
int theFlag_
 
int theVerboseLevel
 
const TrackerTopologyttopo_
 
bool useLAOffsetFromConfig_
 
bool useLAWidthFromConfig_
 
bool useLAWidthFromDB_
 
- Protected Attributes inherited from PixelClusterParameterEstimator
unsigned int clusterProbComputationFlag_
 

Detailed Description

Definition at line 32 of file PixelCPETemplateReco.h.

Constructor & Destructor Documentation

◆ PixelCPETemplateReco()

PixelCPETemplateReco::PixelCPETemplateReco ( edm::ParameterSet const &  conf,
const MagneticField mag,
const TrackerGeometry geom,
const TrackerTopology ttopo,
const SiPixelLorentzAngle lorentzAngle,
const SiPixelTemplateDBObject templateDBobject 
)

Definition at line 43 of file PixelCPETemplateReco.cc.

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 
66  // Initialize template store to the selected ID [Morris, 6/25/08]
68  throw cms::Exception("PixelCPETemplateReco")
69  << "\nERROR: Templates not filled correctly. Check the sqlite file. Using SiPixelTemplateDBObject version "
70  << (*templateDBobject_).version() << "\n\n";
71  } else {
72  //cout << "PixelCPETemplateReco : Loading templates for barrel and forward from ASCII files ----------" << endl;
73  barrelTemplateID_ = conf.getParameter<int>("barrelTemplateID");
74  forwardTemplateID_ = conf.getParameter<int>("forwardTemplateID");
75  templateDir_ = conf.getParameter<int>("directoryWithTemplates");
76 
78  throw cms::Exception("PixelCPETemplateReco")
79  << "\nERROR: Template ID " << barrelTemplateID_
80  << " not loaded correctly from text file. Reconstruction will fail.\n\n";
81 
83  throw cms::Exception("PixelCPETemplateReco")
84  << "\nERROR: Template ID " << forwardTemplateID_
85  << " not loaded correctly from text file. Reconstruction will fail.\n\n";
86  }
87 
88  speed_ = conf.getParameter<int>("speed");
89  LogDebug("PixelCPETemplateReco::PixelCPETemplateReco:") << "Template speed = " << speed_ << "\n";
90 
91  UseClusterSplitter_ = conf.getParameter<bool>("UseClusterSplitter");
92 }

References barrelTemplateID_, Exception, forwardTemplateID_, edm::ParameterSet::getParameter(), PixelCPEBase::LoadTemplatesFromDB_, LogDebug, SiPixelTemplate::pushfile(), speed_, PixelCPEBase::templateDBobject_, templateDir_, thePixelTemp_, and UseClusterSplitter_.

◆ ~PixelCPETemplateReco()

PixelCPETemplateReco::~PixelCPETemplateReco ( )
override

Definition at line 97 of file PixelCPETemplateReco.cc.

97  {
98  for (auto x : thePixelTemp_)
99  x.destroy();
100 }

References thePixelTemp_, and x.

Member Function Documentation

◆ createClusterParam()

std::unique_ptr< PixelCPEBase::ClusterParam > PixelCPETemplateReco::createClusterParam ( const SiPixelCluster cl) const
overrideprivatevirtual

Implements PixelCPEBase.

Definition at line 102 of file PixelCPETemplateReco.cc.

102  {
103  return std::make_unique<ClusterParamTemplate>(cl);
104 }

References GetRecoTauVFromDQM_MC_cff::cl.

◆ fillPSetDescription()

void PixelCPETemplateReco::fillPSetDescription ( edm::ParameterSetDescription desc)
static

Definition at line 547 of file PixelCPETemplateReco.cc.

547  {
548  desc.add<int>("barrelTemplateID", 0);
549  desc.add<int>("forwardTemplateID", 0);
550  desc.add<int>("directoryWithTemplates", 0);
551  desc.add<int>("speed", -2);
552  desc.add<bool>("UseClusterSplitter", false);
553 }

References edm::ParameterSetDescription::add().

Referenced by PixelCPETemplateRecoESProducer::fillDescriptions().

◆ localError()

LocalError PixelCPETemplateReco::localError ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
overrideprivatevirtual

Implements PixelCPEBase.

Definition at line 427 of file PixelCPETemplateReco.cc.

427  {
428  ClusterParamTemplate& theClusterParam = static_cast<ClusterParamTemplate&>(theClusterParamBase);
429 
430  //cout << endl;
431  //cout << "Set PixelCPETemplate errors .............................................." << endl;
432 
433  //cout << "CPETemplate : " << endl;
434 
435  //--- Default is the maximum error used for edge clusters.
436  //--- (never used, in fact: let comment it out, shut up the complains of the static analyzer, and save a few CPU cycles)
437  // const float sig12 = 1./sqrt(12.0);
438  // float xerr = theDetParam.thePitchX *sig12;
439  // float yerr = theDetParam.thePitchY *sig12;
440  float xerr, yerr;
441 
442  // Check if the errors were already set at the clusters splitting level
443  if (theClusterParam.theCluster->getSplitClusterErrorX() > 0.0f &&
444  theClusterParam.theCluster->getSplitClusterErrorX() < 7777.7f &&
445  theClusterParam.theCluster->getSplitClusterErrorY() > 0.0f &&
446  theClusterParam.theCluster->getSplitClusterErrorY() < 7777.7f) {
447  xerr = theClusterParam.theCluster->getSplitClusterErrorX() * micronsToCm;
448  yerr = theClusterParam.theCluster->getSplitClusterErrorY() * micronsToCm;
449 
450  //cout << "Errors set at cluster splitting level : " << endl;
451  //cout << "xerr = " << xerr << endl;
452  //cout << "yerr = " << yerr << endl;
453  } else {
454  // If errors are not split at the cluster splitting level, set the errors here
455 
456  //cout << "Errors are not split at the cluster splitting level, set the errors here : " << endl;
457 
458  int maxPixelCol = theClusterParam.theCluster->maxPixelCol();
459  int maxPixelRow = theClusterParam.theCluster->maxPixelRow();
460  int minPixelCol = theClusterParam.theCluster->minPixelCol();
461  int minPixelRow = theClusterParam.theCluster->minPixelRow();
462 
463  //--- Are we near either of the edges?
464  bool edgex = (theDetParam.theRecTopol->isItEdgePixelInX(minPixelRow) ||
465  theDetParam.theRecTopol->isItEdgePixelInX(maxPixelRow));
466  bool edgey = (theDetParam.theRecTopol->isItEdgePixelInY(minPixelCol) ||
467  theDetParam.theRecTopol->isItEdgePixelInY(maxPixelCol));
468 
469  if (theClusterParam.ierr != 0) {
470  // If reconstruction fails the hit position is calculated from cluster center of gravity
471  // corrected in x by average Lorentz drift. Assign huge errors.
472  //xerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * xerr;
473  //yerr = 10.0 * (float)theClusterParam.theCluster->sizeX() * yerr;
474 
475  if (!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart))
476  throw cms::Exception("PixelCPETemplateReco::localPosition :") << "A non-pixel detector type in here?";
477 
478  // Assign better errors based on the residuals for failed template cases
479  if (GeomDetEnumerators::isBarrel(theDetParam.thePart)) {
480  xerr = 55.0f * micronsToCm;
481  yerr = 36.0f * micronsToCm;
482  } else {
483  xerr = 42.0f * micronsToCm;
484  yerr = 39.0f * micronsToCm;
485  }
486 
487  //cout << "xerr = " << xerr << endl;
488  //cout << "yerr = " << yerr << endl;
489 
490  //return LocalError(xerr*xerr, 0, yerr*yerr);
491  } else if (edgex || edgey) {
492  // for edge pixels assign errors according to observed residual RMS
493  if (edgex && !edgey) {
494  xerr = 23.0f * micronsToCm;
495  yerr = 39.0f * micronsToCm;
496  } else if (!edgex && edgey) {
497  xerr = 24.0f * micronsToCm;
498  yerr = 96.0f * micronsToCm;
499  } else if (edgex && edgey) {
500  xerr = 31.0f * micronsToCm;
501  yerr = 90.0f * micronsToCm;
502  } else {
503  throw cms::Exception(" PixelCPETemplateReco::localError: Something wrong with pixel edge flag !!!");
504  }
505 
506  //cout << "xerr = " << xerr << endl;
507  //cout << "yerr = " << yerr << endl;
508  } else {
509  // &&& need a class const
510  //const float micronsToCm = 1.0e-4;
511 
512  xerr = theClusterParam.templSigmaX_ * micronsToCm;
513  yerr = theClusterParam.templSigmaY_ * micronsToCm;
514 
515  //cout << "xerr = " << xerr << endl;
516  //cout << "yerr = " << yerr << endl;
517 
518  // &&& should also check ierr (saved as class variable) and return
519  // &&& nonsense (another class static) if the template fit failed.
520  }
521 
522  if (theVerboseLevel > 9) {
523  LogDebug("PixelCPETemplateReco") << " Sizex = " << theClusterParam.theCluster->sizeX()
524  << " Sizey = " << theClusterParam.theCluster->sizeY() << " Edgex = " << edgex
525  << " Edgey = " << edgey << " ErrX = " << xerr << " ErrY = " << yerr;
526  }
527 
528  } // else
529 
530  if (!(xerr > 0.0f))
531  throw cms::Exception("PixelCPETemplateReco::localError")
532  << "\nERROR: Negative pixel error xerr = " << xerr << "\n\n";
533 
534  if (!(yerr > 0.0f))
535  throw cms::Exception("PixelCPETemplateReco::localError")
536  << "\nERROR: Negative pixel error yerr = " << yerr << "\n\n";
537 
538  //cout << "Final errors set to: " << endl;
539  //cout << "xerr = " << xerr << endl;
540  //cout << "yerr = " << yerr << endl;
541  //cout << "Out of PixelCPETemplateREco..........................................................................." << endl;
542  //cout << endl;
543 
544  return LocalError(xerr * xerr, 0, yerr * yerr);
545 }

References Exception, f, PixelCPETemplateReco::ClusterParamTemplate::ierr, GeomDetEnumerators::isBarrel(), RectangularPixelTopology::isItEdgePixelInX(), RectangularPixelTopology::isItEdgePixelInY(), GeomDetEnumerators::isTrackerPixel(), LogDebug, PixelCPETemplateReco::ClusterParamTemplate::templSigmaX_, PixelCPETemplateReco::ClusterParamTemplate::templSigmaY_, PixelCPEBase::DetParam::thePart, PixelCPEBase::DetParam::theRecTopol, and PixelCPEBase::theVerboseLevel.

◆ localPosition()

LocalPoint PixelCPETemplateReco::localPosition ( DetParam const &  theDetParam,
ClusterParam theClusterParam 
) const
overrideprivatevirtual

std::vector< SiPixelTemplateStore2D > thePixelTemp2D_; SiPixelTemplate2D::pushfile(ID, thePixelTemp2D_); SiPixelTemplate2D templ2D_(thePixelTemp2D_);

Implements PixelCPEBase.

Definition at line 113 of file PixelCPETemplateReco.cc.

113  {
114  ClusterParamTemplate& theClusterParam = static_cast<ClusterParamTemplate&>(theClusterParamBase);
115 
116  if (!GeomDetEnumerators::isTrackerPixel(theDetParam.thePart))
117  throw cms::Exception("PixelCPETemplateReco::localPosition :") << "A non-pixel detector type in here?";
118  // barrel(false) or forward(true)
119  const bool fpix = GeomDetEnumerators::isEndcap(theDetParam.thePart);
120 
121  int ID = -9999;
122  if (LoadTemplatesFromDB_) {
123  int ID0 = templateDBobject_->getTemplateID(theDetParam.theDet->geographicalId()); // just to comapre
124  ID = theDetParam.detTemplateId;
125  if (ID0 != ID)
126  edm::LogError("PixelCPETemplateReco") << " different id" << ID << " " << ID0 << endl;
127  } else { // from asci file
128  if (!fpix)
129  ID = barrelTemplateID_; // barrel
130  else
131  ID = forwardTemplateID_; // forward
132  }
133  //cout << "PixelCPETemplateReco : ID = " << ID << endl;
134 
136 
137  // Preparing to retrieve ADC counts from the SiPixeltheClusterParam.theCluster-> In the cluster,
138  // we have the following:
139  // int minPixelRow(); // Minimum pixel index in the x direction (low edge).
140  // int maxPixelRow(); // Maximum pixel index in the x direction (top edge).
141  // int minPixelCol(); // Minimum pixel index in the y direction (left edge).
142  // int maxPixelCol(); // Maximum pixel index in the y direction (right edge).
143  // So the pixels from minPixelRow() will go into clust_array_2d[0][*],
144  // and the pixels from minPixelCol() will go into clust_array_2d[*][0].
145 
146  int row_offset = theClusterParam.theCluster->minPixelRow();
147  int col_offset = theClusterParam.theCluster->minPixelCol();
148 
149  // Store the coordinates of the center of the (0,0) pixel of the array that
150  // gets passed to PixelTempReco1D
151  // Will add these values to the output of PixelTempReco1D
152  float tmp_x = float(row_offset) + 0.5f;
153  float tmp_y = float(col_offset) + 0.5f;
154 
155  // Store these offsets (to be added later) in a LocalPoint after tranforming
156  // them from measurement units (pixel units) to local coordinates (cm)
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.theRecTopol->isItBigPixelInX(irow + row_offset);
209 
210  // y directions (longer), columns
211  for (int icol = 0; icol < mcol; ++icol)
212  ydouble[icol] = theDetParam.theRecTopol->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
258  UNLIKELY(theClusterParam.ierr != 0) {
259  LogDebug("PixelCPETemplateReco::localPosition")
260  << "reconstruction failed with error " << theClusterParam.ierr << "\n";
261 
262  // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns
263  // In the x case, apply a rough Lorentz drift average correction
264  // To do: call PixelCPEGeneric whenever PixelTempReco1D fails
265  float lorentz_drift = -999.9;
266  if (!fpix)
267  lorentz_drift = 60.0f; // in microns
268  else
269  lorentz_drift = 10.0f; // in microns
270  // ggiurgiu@jhu.edu, 21/09/2010 : trk angles needed to correct for bows/kinks
271  if (theClusterParam.with_track_angle) {
272  theClusterParam.templXrec_ =
273  theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) -
274  lorentz_drift * micronsToCm; // rough Lorentz drift correction
275  theClusterParam.templYrec_ =
276  theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred);
277  } else {
278  edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition"
279  << "Should never be here. PixelCPETemplateReco should always be called "
280  "with track angles. This is a bad error !!! ";
281 
282  theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) -
283  lorentz_drift * micronsToCm; // rough Lorentz drift correction
284  theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y());
285  }
286  }
287  else if
288  UNLIKELY(UseClusterSplitter_ && theClusterParam.templQbin_ == 0) {
289  cout << " PixelCPETemplateReco : We should never be here !!!!!!!!!!!!!!!!!!!!!!" << endl;
290  cout << " (int)UseClusterSplitter_ = " << (int)UseClusterSplitter_ << endl;
291 
292  //ierr =
293  //PixelTempSplit( ID, fpix, cotalpha_, cotbeta_,
294  // clust_array_2d, ydouble, xdouble,
295  // templ,
296  // templYrec1_, templYrec2_, templSigmaY_, templProbY_,
297  // templXrec1_, templXrec2_, templSigmaX_, templProbX_,
298  // templQbin_ );
299 
300  // Commented for now (3/10/17) until we figure out how to resuscitate 2D template splitter
304 
305  theClusterParam.ierr = -123;
306  /*
307  float dchisq;
308  float templProbQ_;
309  SiPixelTemplateSplit::PixelTempSplit( ID, theClusterParam.cotalpha, theClusterParam.cotbeta,
310  clust_array_2d,
311  ydouble, xdouble,
312  templ,
313  templYrec1_, templYrec2_, theClusterParam.templSigmaY_, theClusterParam.templProbY_,
314  templXrec1_, templXrec2_, theClusterParam.templSigmaX_, theClusterParam.templProbX_,
315  theClusterParam.templQbin_,
316  templProbQ_,
317  true,
318  dchisq,
319  templ2D_ );
320 
321  */
322  if (theClusterParam.ierr != 0) {
323  LogDebug("PixelCPETemplateReco::localPosition")
324  << "reconstruction failed with error " << theClusterParam.ierr << "\n";
325 
326  // Gavril: what do we do in this case ? For now, just return the cluster center of gravity in microns
327  // In the x case, apply a rough Lorentz drift average correction
328  // To do: call PixelCPEGeneric whenever PixelTempReco1D fails
329  float lorentz_drift = -999.9f;
330  if (!fpix)
331  lorentz_drift = 60.0f; // in microns
332  else
333  lorentz_drift = 10.0f; // in microns
334 
335  // ggiurgiu@jhu.edu, 12/09/2010 : trk angles needed to correct for bows/kinks
336  if (theClusterParam.with_track_angle) {
337  theClusterParam.templXrec_ =
338  theDetParam.theTopol->localX(theClusterParam.theCluster->x(), theClusterParam.loc_trk_pred) -
339  lorentz_drift * micronsToCm; // rough Lorentz drift correction
340  theClusterParam.templYrec_ =
341  theDetParam.theTopol->localY(theClusterParam.theCluster->y(), theClusterParam.loc_trk_pred);
342  } else {
343  edm::LogError("PixelCPETemplateReco") << "@SUB = PixelCPETemplateReco::localPosition"
344  << "Should never be here. PixelCPETemplateReco should always be called "
345  "with track angles. This is a bad error !!! ";
346 
347  theClusterParam.templXrec_ = theDetParam.theTopol->localX(theClusterParam.theCluster->x()) -
348  lorentz_drift * micronsToCm; // very rough Lorentz drift correction
349  theClusterParam.templYrec_ = theDetParam.theTopol->localY(theClusterParam.theCluster->y());
350  }
351  } else {
352  // go from micrometer to centimeter
353  templXrec1_ *= micronsToCm;
354  templYrec1_ *= micronsToCm;
355  templXrec2_ *= micronsToCm;
356  templYrec2_ *= micronsToCm;
357 
358  // go back to the module coordinate system
359  templXrec1_ += lp.x();
360  templYrec1_ += lp.y();
361  templXrec2_ += lp.x();
362  templYrec2_ += lp.y();
363 
364  // calculate distance from each hit to the track and choose the hit closest to the track
365  float distX1 = std::abs(templXrec1_ - theClusterParam.trk_lp_x);
366  float distX2 = std::abs(templXrec2_ - theClusterParam.trk_lp_x);
367  float distY1 = std::abs(templYrec1_ - theClusterParam.trk_lp_y);
368  float distY2 = std::abs(templYrec2_ - theClusterParam.trk_lp_y);
369  theClusterParam.templXrec_ = (distX1 < distX2 ? templXrec1_ : templXrec2_);
370  theClusterParam.templYrec_ = (distY1 < distY2 ? templYrec1_ : templYrec2_);
371  }
372  } // else if ( UseClusterSplitter_ && templQbin_ == 0 )
373 
374  else // apparenly this is the good one!
375  {
376  // go from micrometer to centimeter
377  theClusterParam.templXrec_ *= micronsToCm;
378  theClusterParam.templYrec_ *= micronsToCm;
379 
380  // go back to the module coordinate system
381  theClusterParam.templXrec_ += lp.x();
382  theClusterParam.templYrec_ += lp.y();
383 
384  // Compute the Alignment Group Corrections [template ID should already be selected from call to reco procedure]
385  if (DoLorentz_) {
386  // Do only if the lotentzshift has meaningfull numbers
387  if (theDetParam.lorentzShiftInCmX != 0.0 || theDetParam.lorentzShiftInCmY != 0.0) {
388  // the LA width/shift returned by templates use (+)
389  // the LA width/shift produced by PixelCPEBase for positive LA is (-)
390  // correct this by iserting (-)
391  //float temp1 = -micronsToCm*templ.lorxwidth(); // old
392  //float temp2 = -micronsToCm*templ.lorywidth(); // does not incl 1/2
393  float templateLorbiasCmX = -micronsToCm * templ.lorxbias(); // new
394  float templateLorbiasCmY = -micronsToCm * templ.lorybias(); //incl. 1/2
395  // now, correctly, we can use the difference of shifts
396  //theClusterParam.templXrec_ += 0.5*(theDetParam.lorentzShiftInCmX - templateLorbiasCmX);
397  //theClusterParam.templYrec_ += 0.5*(theDetParam.lorentzShiftInCmY - templateLorbiasCmY);
398  theClusterParam.templXrec_ += (0.5 * (theDetParam.lorentzShiftInCmX) - templateLorbiasCmX);
399  theClusterParam.templYrec_ += (0.5 * (theDetParam.lorentzShiftInCmY) - templateLorbiasCmY);
400  //cout << "Templates: la lorentz offset = "
401  // <<(0.5*(theDetParam.lorentzShiftInCmX)-templateLorbiasCmX)
402  // <<" "<<templateLorbiasCmX<<" "<<templateLorbiasCmY
403  // <<" "<<temp1<<" "<<temp2
404  // <<" "<<theDetParam.lorentzShiftInCmX
405  // <<" "<<theDetParam.lorentzShiftInCmY
406  // << endl; //dk
407  } //else {cout<<" LA is 0, disable offset corrections "<<endl;} //dk
408  } //else {cout<<" Do not do LA offset correction "<<endl;} //dk
409  }
410 
411  // Save probabilities and qBin in the quantities given to us by the base class
412  // (for which there are also inline getters). &&& templProbX_ etc. should be retired...
413  theClusterParam.probabilityX_ = theClusterParam.templProbX_;
414  theClusterParam.probabilityY_ = theClusterParam.templProbY_;
415  theClusterParam.probabilityQ_ = theClusterParam.templProbQ_;
416  theClusterParam.qBin_ = theClusterParam.templQbin_;
417 
418  if (theClusterParam.ierr == 0) // always true here
419  theClusterParam.hasFilledProb_ = true;
420 
421  return LocalPoint(theClusterParam.templXrec_, theClusterParam.templYrec_);
422 }

References funct::abs(), cms::cuda::assert(), barrelTemplateID_, PixelCPEBase::DetParam::bx, PixelCPEBase::DetParam::bz, gather_cfg::cout, PixelCPEBase::DetParam::detTemplateId, PixelCPEBase::DoLorentz_, Exception, dqmMemoryStats::float, forwardTemplateID_, GeomDet::geographicalId(), SiPixelTemplateDBObject::getTemplateID(), mps_fire::i, PixelCPETemplateReco::ClusterParamTemplate::ierr, createfilelist::int, GeomDetEnumerators::isEndcap(), RectangularPixelTopology::isItBigPixelInX(), RectangularPixelTopology::isItBigPixelInY(), GeomDetEnumerators::isTrackerPixel(), PixelCPEBase::LoadTemplatesFromDB_, Topology::localPosition(), PixelTopology::localX(), PixelTopology::localY(), LogDebug, PixelCPEBase::DetParam::lorentzShiftInCmX, PixelCPEBase::DetParam::lorentzShiftInCmY, SiPixelTemplate::lorxbias(), SiPixelTemplate::lorybias(), SiStripPI::max, min(), SiPixelTemplateReco::PixelTempReco1D(), speed_, PixelCPEBase::templateDBobject_, PixelCPETemplateReco::ClusterParamTemplate::templProbQ_, PixelCPETemplateReco::ClusterParamTemplate::templProbX_, PixelCPETemplateReco::ClusterParamTemplate::templProbY_, PixelCPETemplateReco::ClusterParamTemplate::templQbin_, PixelCPETemplateReco::ClusterParamTemplate::templSigmaX_, PixelCPETemplateReco::ClusterParamTemplate::templSigmaY_, PixelCPETemplateReco::ClusterParamTemplate::templXrec_, PixelCPETemplateReco::ClusterParamTemplate::templYrec_, PixelCPEBase::DetParam::theDet, PixelCPEBase::DetParam::thePart, thePixelTemp_, PixelCPEBase::DetParam::theRecTopol, PixelCPEBase::DetParam::theTopol, UNLIKELY, UseClusterSplitter_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Member Data Documentation

◆ barrelTemplateID_

int PixelCPETemplateReco::barrelTemplateID_
private

Definition at line 84 of file PixelCPETemplateReco.h.

Referenced by localPosition(), and PixelCPETemplateReco().

◆ forwardTemplateID_

int PixelCPETemplateReco::forwardTemplateID_
private

Definition at line 85 of file PixelCPETemplateReco.h.

Referenced by localPosition(), and PixelCPETemplateReco().

◆ speed_

int PixelCPETemplateReco::speed_
private

Definition at line 79 of file PixelCPETemplateReco.h.

Referenced by localPosition(), and PixelCPETemplateReco().

◆ templateDir_

std::string PixelCPETemplateReco::templateDir_
private

Definition at line 86 of file PixelCPETemplateReco.h.

Referenced by PixelCPETemplateReco().

◆ thePixelTemp_

std::vector<SiPixelTemplateStore> PixelCPETemplateReco::thePixelTemp_
private

◆ UseClusterSplitter_

bool PixelCPETemplateReco::UseClusterSplitter_
private

Definition at line 81 of file PixelCPETemplateReco.h.

Referenced by localPosition(), and PixelCPETemplateReco().

PixelCPEBase::templateDBobject_
const SiPixelTemplateDBObject * templateDBobject_
Definition: PixelCPEBase.h:248
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
SiPixelTemplate::pushfile
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
Definition: SiPixelTemplate.cc:129
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
PixelCPETemplateReco::thePixelTemp_
std::vector< SiPixelTemplateStore > thePixelTemp_
Definition: PixelCPETemplateReco.h:77
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
min
T min(T a, T b)
Definition: MathUtil.h:58
SiPixelTemplate
Definition: SiPixelTemplate.h:255
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
SiPixelTemplateReco::PixelTempReco1D
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)
Definition: SiPixelTemplateReco.cc:134
DDAxes::x
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
PixelCPETemplateReco::barrelTemplateID_
int barrelTemplateID_
Definition: PixelCPETemplateReco.h:84
PixelCPETemplateReco::speed_
int speed_
Definition: PixelCPETemplateReco.h:79
GetRecoTauVFromDQM_MC_cff.cl
cl
Definition: GetRecoTauVFromDQM_MC_cff.py:38
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
PixelCPETemplateReco::templateDir_
std::string templateDir_
Definition: PixelCPETemplateReco.h:86
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, LocalTag >
PixelCPETemplateReco::forwardTemplateID_
int forwardTemplateID_
Definition: PixelCPETemplateReco.h:85
MeasurementPoint
Measurement2DPoint MeasurementPoint
Measurement points are two-dimensional by default.
Definition: MeasurementPoint.h:12
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:670
edm::LogError
Definition: MessageLogger.h:183
align::ID
uint32_t ID
Definition: Definitions.h:24
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
LocalError
Definition: LocalError.h:12
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
createfilelist.int
int
Definition: createfilelist.py:10
GeomDetEnumerators::isTrackerPixel
bool isTrackerPixel(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:68
PixelCPEBase::theVerboseLevel
int theVerboseLevel
Definition: PixelCPEBase.h:235
GeomDetEnumerators::isBarrel
bool isBarrel(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:57
PixelCPEBase::DoLorentz_
bool DoLorentz_
Definition: PixelCPEBase.h:251
PixelCPEBase::PixelCPEBase
PixelCPEBase(edm::ParameterSet const &conf, const MagneticField *mag, const TrackerGeometry &geom, const TrackerTopology &ttopo, const SiPixelLorentzAngle *lorentzAngle, const SiPixelGenErrorDBObject *genErrorDBObject, const SiPixelTemplateDBObject *templateDBobject, const SiPixelLorentzAngle *lorentzAngleWidth, int flag=0)
Definition: PixelCPEBase.cc:30
PixelCPEBase::LoadTemplatesFromDB_
bool LoadTemplatesFromDB_
Definition: PixelCPEBase.h:252
SiPixelTemplateDBObject::getTemplateID
short getTemplateID(const uint32_t &detid) const
Definition: SiPixelTemplateDBObject.h:131
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
Exception
Definition: hltDiff.cc:246
SiPixelTemplateReco::ClusMatrix
Definition: SiPixelTemplateReco.h:73
PixelCPETemplateReco::UseClusterSplitter_
bool UseClusterSplitter_
Definition: PixelCPETemplateReco.h:81
cms::Exception
Definition: Exception.h:70
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GeomDetEnumerators::isEndcap
bool isEndcap(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:62