CMS 3D CMS Logo

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

#include <SiPixelTemplate2D.h>

Public Member Functions

float chi2avgone ()
 average y chi^2 for 1 pixel clusters More...
 
float chi2minone ()
 minimum of y chi^2 for 1 pixel clusters More...
 
float chi2ppix ()
 average chi^2 per struck pixel More...
 
float chi2scale ()
 scale factor for chi^2 distribution More...
 
float clslenx ()
 cluster x-size More...
 
float clsleny ()
 cluster y-size More...
 
float delyavg ()
 average difference between clsleny_ and cluster length [with threshold effects] More...
 
float delysig ()
 rms difference between clsleny_ and cluster length [with threshold effects] More...
 
float fbin (int i)
 Return lower bound of Qbin definition. More...
 
bool getid (int id)
 
bool interpolate (int id, float cotalpha, float cotbeta, float locBz, float locBx)
 
float kappavav ()
 kappa parameter in Vavilov distribution More...
 
void landau_par (float lanpar[2][5])
 Return the Landau probability parameters for this set of cot(alpha, cot(beta) More...
 
float lorxdrift ()
 signed lorentz x-width (microns) More...
 
float lorydrift ()
 signed lorentz y-width (microns) More...
 
float mpvvav ()
 most probable Q in Vavilov distribution More...
 
float offsetx (int i)
 x-offset in 4 charge bins More...
 
float offsety (int i)
 y-offset in 4 charge bins More...
 
float pixmax ()
 maximum pixel charge More...
 
float qavg ()
 average cluster charge for this set of track angles More...
 
float qscale ()
 charge scaling factor More...
 
float s50 ()
 1/2 of the pixel threshold signal in adc units More...
 
float scalex (int i)
 x-error scale factor in 4 charge bins More...
 
float scalexavg ()
 x-reco error scaling factor More...
 
float scaley (int i)
 y-error scale factor in 4 charge bins More...
 
float scaleyavg ()
 y-reco error scaling factor More...
 
float sigmavav ()
 scale factor in Vavilov distribution More...
 
 SiPixelTemplate2D (const std::vector< SiPixelTemplateStore2D > &thePixelTemp)
 Default constructor. More...
 
float sizex ()
 return x size of template cluster More...
 
float sizey ()
 return y size of template cluster More...
 
int storesize ()
 return the size of the template store (the number of stored IDs More...
 
float sxymax ()
 max pixel signal for pixel error calculation More...
 
float xsize ()
 pixel x-size (microns) More...
 
void xysigma2 (float qpixel, int index, float &xysig2)
 
bool xytemp (float xhit, float yhit, bool ydouble[21+2], bool xdouble[13+2], float template2d[13+2][21+2], bool dervatives, float dpdx2d[2][13+2][21+2], float &QTemplate)
 
bool xytemp (float xhit, float yhit, bool ydouble[21+2], bool xdouble[13+2], float template2d[13+2][21+2])
 
bool xytemp (int id, float cotalpha, float cotbeta, float xhit, float yhit, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[13+2][21+2])
 
float ysize ()
 pixel y-size (microns) More...
 
float zsize ()
 pixel z-size or thickness (microns) More...
 

Static Public Member Functions

static bool pushfile (int filenum, std::vector< SiPixelTemplateStore2D > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
 
static bool pushfile (const SiPixel2DTemplateDBObject &dbobject, std::vector< SiPixelTemplateStore2D > &pixelTemp)
 

Private Member Functions

bool checkIllegalIndex (const std::string whichMethod, int indMax, int i)
 

Private Attributes

float adcota_
 fractional pixel distance of cot(alpha) from jx0_ More...
 
float adcotb_
 fractional pixel distance of cot(beta) from iy0_ More...
 
float chi2avgone_
 average chi^2 for 1 pixel clusters More...
 
float chi2minone_
 minimum of chi^2 for 1 pixel clusters More...
 
float chi2ppix_
 average chi^2 per struck pixel More...
 
float chi2scale_
 scale factor for chi2 distribution More...
 
float clslenx_
 projected x-length of cluster More...
 
float clsleny_
 projected y-length of cluster More...
 
float cota_current_
 current cot alpha More...
 
float cotalpha0_
 minimum cot(alpha) covered More...
 
float cotalpha1_
 maximum cot(alpha) covered More...
 
float cotb_current_
 current cot beta More...
 
float cotbeta0_
 minimum cot(beta) covered More...
 
float cotbeta1_
 maximum cot(beta) covered More...
 
float deltacota_
 cot(alpha) bin size More...
 
float deltacotb_
 cot(beta) bin size More...
 
float delyavg_
 average difference between clsleny_ and cluster length [with threshold effects] More...
 
float delysig_
 rms of difference between clsleny_ and cluster length [with threshold effects] More...
 
int Dtype_
 flags BPix (=0) or FPix (=1) More...
 
const SiPixelTemplateEntry2Dentry00_
 
const SiPixelTemplateEntry2Dentry01_
 
const SiPixelTemplateEntry2Dentry10_
 
float fbin_ [3]
 The QBin definitions in Q_clus/Q_avg. More...
 
bool flip_x_
 flip x sign-sensitive quantities More...
 
bool flip_y_
 flip y sign-sensitive quantities More...
 
int id_current_
 current id More...
 
int imax_
 max y index of templated cluster More...
 
int imin_
 min y index of templated cluster More...
 
int index_id_
 current index More...
 
int iy0_
 index of nearest cot(beta) bin More...
 
int iy1_
 index of next-nearest cot(beta) bin More...
 
int jmax_
 max x index of templated cluster More...
 
int jmin_
 min x index of templated cluster More...
 
int jx0_
 index of nearest cot(alpha) bin More...
 
int jx1_
 index of next-nearest cot(alpha) bin More...
 
float kappavav_
 kappa parameter in Vavilov distribution More...
 
float lanpar_ [2][5]
 Interpolated Landau parameters. More...
 
float lorxdrift_
 Lorentz x-drift. More...
 
float lorxwidth_
 Lorentz x-width. More...
 
float lorydrift_
 Lorentz y-drift. More...
 
float lorywidth_
 Lorentz y-width (sign corrected for fpix frame) More...
 
float mpvvav_
 most probable Q in Vavilov distribution More...
 
int Nxx_
 number of cot(alpha)-entries (rows) in template More...
 
int Nyx_
 number of cot(beta)-entries (columns) in template More...
 
float offsetx_ [4]
 x-offset in charge bins More...
 
float offsety_ [4]
 y-offset in charge bins More...
 
float pixmax_
 maximum pixel charge More...
 
float qavg_
 average cluster charge for this set of track angles More...
 
float qscale_
 charge scaling factor More...
 
float s50_
 1/2 of the pixel threshold signal in adc units More...
 
float scalex_ [4]
 x-error scale factor in charge bins More...
 
float scalexavg_
 average x-error scale factor More...
 
float scaley_ [4]
 y-error scale factor in charge bins More...
 
float scaleyavg_
 average y-error scale factor More...
 
float sigmavav_
 scale factor in Vavilov distribution More...
 
bool success_
 true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded) More...
 
float sxymax_
 average pixel signal for y-projection of cluster More...
 
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
 
float xsize_
 Pixel x-size. More...
 
float xypary0x0_ [2][5]
 Polynomial error parameterization at ix0,iy0. More...
 
float xypary0x1_ [2][5]
 Polynomial error parameterization at ix1,iy0. More...
 
float xypary1x0_ [2][5]
 Polynomial error parameterization at ix0,iy1. More...
 
float xytemp_ [13+2][21+2]
 template for xy-reconstruction More...
 
float ysize_
 Pixel y-size. More...
 
float zsize_
 Pixel z-size (thickness) More...
 

Detailed Description

A template management class. SiPixelTemplate contains thePixelTemp (a std::vector of SiPixelTemplateStore, each of which is a collection of many SiPixelTemplateEntries). Each SiPixelTemplateStore corresponds to a given detector condition, and is valid for a range of runs. We allow more than one Store since the may change over time.

This class reads templates from files via pushfile() method.

The main functionality of SiPixelTemplate is xytemp(), which produces a template on the fly, given a specific track's alpha and beta. The results are kept in data members and accessed via inline getters.

The resulting template is then used by PixelTempReco2D() (a global function) which get the reference for SiPixelTemplate & templ and uses the current template to reconstruct the SiPixelRecHit.

Definition at line 128 of file SiPixelTemplate2D.h.

Constructor & Destructor Documentation

◆ SiPixelTemplate2D()

SiPixelTemplate2D::SiPixelTemplate2D ( const std::vector< SiPixelTemplateStore2D > &  thePixelTemp)
inline

Default constructor.

Definition at line 130 of file SiPixelTemplate2D.h.

References cota_current_, cotb_current_, id_current_, and index_id_.

Member Function Documentation

◆ checkIllegalIndex()

bool SiPixelTemplate2D::checkIllegalIndex ( const std::string  whichMethod,
int  indMax,
int  i 
)
inlineprivate

Definition at line 270 of file SiPixelTemplate2D.h.

References cms::cuda::assert(), Exception, and mps_fire::i.

Referenced by fbin(), offsetx(), offsety(), scalex(), and scaley().

270  {
271 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
272  if (i < 0 || i > indMax) {
273  throw cms::Exception("DataCorrupt")
274  << "SiPixelTemplate2D::" << whichMethod << " called with illegal index = " << i << std::endl;
275  }
276 #else
277  assert(i >= 0 && i < indMax + 1);
278 
279 #endif
280  return true;
281  }
assert(be >=bs)

◆ chi2avgone()

float SiPixelTemplate2D::chi2avgone ( )
inline

average y chi^2 for 1 pixel clusters

Definition at line 247 of file SiPixelTemplate2D.h.

References chi2avgone_.

◆ chi2minone()

float SiPixelTemplate2D::chi2minone ( )
inline

minimum of y chi^2 for 1 pixel clusters

Definition at line 248 of file SiPixelTemplate2D.h.

References chi2minone_.

◆ chi2ppix()

float SiPixelTemplate2D::chi2ppix ( )
inline

average chi^2 per struck pixel

Definition at line 245 of file SiPixelTemplate2D.h.

References chi2ppix_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ chi2scale()

float SiPixelTemplate2D::chi2scale ( )
inline

scale factor for chi^2 distribution

Definition at line 246 of file SiPixelTemplate2D.h.

References chi2scale_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ clslenx()

float SiPixelTemplate2D::clslenx ( )
inline

cluster x-size

Definition at line 255 of file SiPixelTemplate2D.h.

References clslenx_.

◆ clsleny()

float SiPixelTemplate2D::clsleny ( )
inline

cluster y-size

Definition at line 254 of file SiPixelTemplate2D.h.

References clsleny_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ delyavg()

float SiPixelTemplate2D::delyavg ( )
inline

average difference between clsleny_ and cluster length [with threshold effects]

Definition at line 258 of file SiPixelTemplate2D.h.

References delyavg_.

◆ delysig()

float SiPixelTemplate2D::delysig ( )
inline

rms difference between clsleny_ and cluster length [with threshold effects]

Definition at line 261 of file SiPixelTemplate2D.h.

References delysig_.

◆ fbin()

float SiPixelTemplate2D::fbin ( int  i)
inline

Return lower bound of Qbin definition.

Definition at line 236 of file SiPixelTemplate2D.h.

References checkIllegalIndex(), fbin_, and mps_fire::i.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ getid()

bool SiPixelTemplate2D::getid ( int  id)

Definition at line 536 of file SiPixelTemplate2D.cc.

References cms::cuda::assert(), Exception, mps_fire::i, triggerObjects_cff::id, createfilelist::int, and dqmiolumiharvest::j.

Referenced by SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D().

536  {
537  if (id != id_current_) {
538  // Find the index corresponding to id
539 
540  index_id_ = -1;
541  for (int i = 0; i < (int)thePixelTemp_.size(); ++i) {
542  if (id == thePixelTemp_[i].head.ID) {
543  index_id_ = i;
544  id_current_ = id;
545 
546  // Copy the detector type to the private variable
547 
548  Dtype_ = thePixelTemp_[index_id_].head.Dtype;
549 
550  // Copy the charge scaling factor to the private variable
551 
552  qscale_ = thePixelTemp_[index_id_].head.qscale;
553 
554  // Copy the pseudopixel signal size to the private variable
555 
556  s50_ = thePixelTemp_[index_id_].head.s50;
557 
558  // Copy Qbinning info to private variables
559 
560  for (int j = 0; j < 3; ++j) {
561  fbin_[j] = thePixelTemp_[index_id_].head.fbin[j];
562  }
563 
564  // Copy the Lorentz widths to private variables
565 
566  lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
567  lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
568 
569  // Copy the pixel sizes private variables
570 
571  xsize_ = thePixelTemp_[index_id_].head.xsize;
572  ysize_ = thePixelTemp_[index_id_].head.ysize;
573  zsize_ = thePixelTemp_[index_id_].head.zsize;
574 
575  // Determine the size of this template
576 
577  Nyx_ = thePixelTemp_[index_id_].head.NTyx;
578  Nxx_ = thePixelTemp_[index_id_].head.NTxx;
579 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
580  if (Nyx_ < 2 || Nxx_ < 2) {
581  throw cms::Exception("DataCorrupt") << "template ID = " << id_current_
582  << "has too few entries: Nyx/Nxx = " << Nyx_ << "/" << Nxx_ << std::endl;
583  }
584 #else
585  assert(Nyx_ > 1 && Nxx_ > 1);
586 #endif
587  int imidx = Nxx_ / 2;
588 
589  cotalpha0_ = thePixelTemp_[index_id_].entry[0][0].cotalpha;
590  cotalpha1_ = thePixelTemp_[index_id_].entry[0][Nxx_ - 1].cotalpha;
591  deltacota_ = (cotalpha1_ - cotalpha0_) / (float)(Nxx_ - 1);
592 
593  cotbeta0_ = thePixelTemp_[index_id_].entry[0][imidx].cotbeta;
594  cotbeta1_ = thePixelTemp_[index_id_].entry[Nyx_ - 1][imidx].cotbeta;
595  deltacotb_ = (cotbeta1_ - cotbeta0_) / (float)(Nyx_ - 1);
596 
597  break;
598  }
599  }
600  }
601 
602 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
603  if (index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) {
604  throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id
605  << ", Are you using the correct global tag?" << std::endl;
606  }
607 #else
608  assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size());
609 #endif
610  return true;
611 }
float deltacota_
cot(alpha) bin size
float deltacotb_
cot(beta) bin size
float cotalpha1_
maximum cot(alpha) covered
float xsize_
Pixel x-size.
int Dtype_
flags BPix (=0) or FPix (=1)
float fbin_[3]
The QBin definitions in Q_clus/Q_avg.
int Nxx_
number of cot(alpha)-entries (rows) in template
int index_id_
current index
assert(be >=bs)
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
float s50_
1/2 of the pixel threshold signal in adc units
float cotbeta0_
minimum cot(beta) covered
float cotalpha0_
minimum cot(alpha) covered
float zsize_
Pixel z-size (thickness)
int Nyx_
number of cot(beta)-entries (columns) in template
float lorxwidth_
Lorentz x-width.
float cotbeta1_
maximum cot(beta) covered
float ysize_
Pixel y-size.
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
float qscale_
charge scaling factor
int id_current_
current id

◆ interpolate()

bool SiPixelTemplate2D::interpolate ( int  id,
float  cotalpha,
float  cotbeta,
float  locBz,
float  locBx 
)

Interpolate stored 2-D information for input angles

Parameters
id- (input) the id of the template
cotalpha- (input) the cotangent of the alpha track angle (see CMS IN 2004/014)
cotbeta- (input) the cotangent of the beta track angle (see CMS IN 2004/014)
locBz- (input) the sign of this quantity is used to determine whether to flip cot(beta)<0 quantities from cot(beta)>0 (FPix only) for Phase 0 FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0 for Phase 1 FPix IP-related tracks, see next comment
locBx- (input) the sign of this quantity is used to determine whether to flip cot(alpha/beta)<0 quantities from cot(alpha/beta)>0 (FPix only) for Phase 1 FPix IP-related tracks, locBx/locBz > 0 for cot(alpha) > 0 and locBx/locBz < 0 for cot(alpha) < 0 for Phase 1 FPix IP-related tracks, locBx > 0 for cot(beta) > 0 and locBx < 0 for cot(beta) < 0

Definition at line 626 of file SiPixelTemplate2D.cc.

References funct::abs(), cms::cuda::assert(), gather_cfg::cout, Exception, f, dqmMemoryStats::float, mps_fire::i, createfilelist::int, edm::isFinite(), and dqmiolumiharvest::j.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D(), and xytemp().

626  {
627  // Interpolate for a new set of track angles
628 
629  //check for nan's
630  if (!edm::isFinite(cotalpha) || !edm::isFinite(cotbeta)) {
631  success_ = false;
632  return success_;
633  }
634 
635  // Local variables
636 
637  float acotb, dcota, dcotb;
638 
639  // Check to see if interpolation is valid
640 
641  if (id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
642  cota_current_ = cotalpha;
643  cotb_current_ = cotbeta;
644  // Try to find the correct template. Fill the class variable index_id_ .
645  success_ = getid(id);
646  }
647 
648 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
649  if (index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) {
650  throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id
651  << ", Are you using the correct global tag?" << std::endl;
652  }
653 #else
654  assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size());
655 #endif
656 
657  // Check angle limits and et up interpolation parameters
658 
659  float cota = cotalpha;
660  flip_x_ = false;
661  flip_y_ = false;
662  switch (Dtype_) {
663  case 0:
664  if (cotbeta < 0.f) {
665  flip_y_ = true;
666  }
667  break;
668  case 1:
669  if (locBz > 0.f) {
670  flip_y_ = true;
671  }
672  break;
673  case 2:
674  case 3:
675  case 4:
676  case 5:
677  if (locBx * locBz < 0.f) {
678  cota = std::abs(cotalpha);
679  flip_x_ = true;
680  }
681  if (locBx < 0.f) {
682  flip_y_ = true;
683  }
684  break;
685  default:
686 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
687  throw cms::Exception("DataCorrupt")
688  << "SiPixelTemplate2D::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
689 #else
690  std::cout << "SiPixelTemplate:2D:illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
691 #endif
692  }
693 
694  if (cota < cotalpha0_) {
695  success_ = false;
696  jx0_ = 0;
697  jx1_ = 1;
698  adcota_ = 0.f;
699  } else if (cota > cotalpha1_) {
700  success_ = false;
701  jx0_ = Nxx_ - 1;
702  jx1_ = jx0_ - 1;
703  adcota_ = 0.f;
704  } else {
705  jx0_ = (int)((cota - cotalpha0_) / deltacota_ + 0.5f);
706  dcota = (cota - (cotalpha0_ + jx0_ * deltacota_)) / deltacota_;
707  adcota_ = fabs(dcota);
708  if (dcota > 0.f) {
709  jx1_ = jx0_ + 1;
710  if (jx1_ > Nxx_ - 1)
711  jx1_ = jx0_ - 1;
712  } else {
713  jx1_ = jx0_ - 1;
714  if (jx1_ < 0)
715  jx1_ = jx0_ + 1;
716  }
717  }
718 
719  // Interpolate the absolute value of cot(beta)
720 
721  acotb = std::abs(cotbeta);
722 
723  if (acotb < cotbeta0_) {
724  success_ = false;
725  iy0_ = 0;
726  iy1_ = 1;
727  adcotb_ = 0.f;
728  } else if (acotb > cotbeta1_) {
729  success_ = false;
730  iy0_ = Nyx_ - 1;
731  iy1_ = iy0_ - 1;
732  adcotb_ = 0.f;
733  } else {
734  iy0_ = (int)((acotb - cotbeta0_) / deltacotb_ + 0.5f);
735  dcotb = (acotb - (cotbeta0_ + iy0_ * deltacotb_)) / deltacotb_;
736  adcotb_ = fabs(dcotb);
737  if (dcotb > 0.f) {
738  iy1_ = iy0_ + 1;
739  if (iy1_ > Nyx_ - 1)
740  iy1_ = iy0_ - 1;
741  } else {
742  iy1_ = iy0_ - 1;
743  if (iy1_ < 0)
744  iy1_ = iy0_ + 1;
745  }
746  }
747 
748  // Calculate signed quantities
749 
750  lorydrift_ = lorywidth_ / 2.;
751  if (flip_y_)
753  lorxdrift_ = lorxwidth_ / 2.;
754  if (flip_x_)
756 
757  // Use pointers to the three angle pairs used in the interpolation
758 
762 
763  // Interpolate things in cot(alpha)-cot(beta)
764 
766 
769 
772 
775 
778 
781 
784 
787 
790 
793 
796 
799 
802 
805 
808 
811 
812  for (int i = 0; i < 4; ++i) {
815 
818 
821  if (flip_x_)
822  offsetx_[i] = -offsetx_[i];
823 
826  if (flip_y_)
827  offsety_[i] = -offsety_[i];
828  }
829 
830  for (int i = 0; i < 2; ++i) {
831  for (int j = 0; j < 5; ++j) {
832  // Charge loss switches sides when cot(beta) changes sign
833  if (flip_y_) {
834  xypary0x0_[1 - i][j] = (float)entry00_->xypar[i][j];
835  xypary1x0_[1 - i][j] = (float)entry10_->xypar[i][j];
836  xypary0x1_[1 - i][j] = (float)entry01_->xypar[i][j];
837  lanpar_[1 - i][j] = entry00_->lanpar[i][j] + adcota_ * (entry01_->lanpar[i][j] - entry00_->lanpar[i][j]) +
838  adcotb_ * (entry10_->lanpar[i][j] - entry00_->lanpar[i][j]);
839  } else {
840  xypary0x0_[i][j] = (float)entry00_->xypar[i][j];
841  xypary1x0_[i][j] = (float)entry10_->xypar[i][j];
842  xypary0x1_[i][j] = (float)entry01_->xypar[i][j];
843  lanpar_[i][j] = entry00_->lanpar[i][j] + adcota_ * (entry01_->lanpar[i][j] - entry00_->lanpar[i][j]) +
844  adcotb_ * (entry10_->lanpar[i][j] - entry00_->lanpar[i][j]);
845  }
846  }
847  }
848 
849  return success_;
850 } // interpolate
float pixmax
maximum charge for individual pixels in cluster
float adcotb_
fractional pixel distance of cot(beta) from iy0_
float kappavav_
kappa parameter in Vavilov distribution
float deltacota_
cot(alpha) bin size
float chi2ppix_
average chi^2 per struck pixel
float scaley_[4]
y-error scale factor in charge bins
int jx1_
index of next-nearest cot(alpha) bin
float chi2avgone
average y chi^2 for 1 pixel clusters
float qavg
average cluster charge for this set of track angles
int jx0_
index of nearest cot(alpha) bin
float deltacotb_
cot(beta) bin size
float qavg_
average cluster charge for this set of track angles
float cotalpha1_
maximum cot(alpha) covered
int Dtype_
flags BPix (=0) or FPix (=1)
bool flip_y_
flip y sign-sensitive quantities
float clslenx_
projected x-length of cluster
float clsleny
cluster y-length in pixels at signal height symax/2
float sxymax
average pixel signal for use of the error parameterization
float xypar[2][5]
pixel uncertainty parameterization
float chi2avgone_
average chi^2 for 1 pixel clusters
float scaleyavg
average y-error scale factor
float chi2minone
minimum of y chi^2 for 1 pixel clusters
float delyavg_
average difference between clsleny_ and cluster length [with threshold effects]
float xypary0x1_[2][5]
Polynomial error parameterization at ix1,iy0.
float sxymax_
average pixel signal for y-projection of cluster
int Nxx_
number of cot(alpha)-entries (rows) in template
int index_id_
current index
float delyavg
average length difference between template and cluster
float delysig
rms of length difference between template and cluster
float scalexavg_
average x-error scale factor
assert(be >=bs)
constexpr bool isFinite(T x)
float chi2scale_
scale factor for chi2 distribution
float lorydrift_
Lorentz y-drift.
const SiPixelTemplateEntry2D * entry01_
float offsetx_[4]
x-offset in charge bins
float adcota_
fractional pixel distance of cot(alpha) from jx0_
float sigmavav_
scale factor in Vavilov distribution
const SiPixelTemplateEntry2D * entry00_
float mpvvav
most probable charge in Vavilov distribution (not actually for larger kappa)
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
float cotbeta0_
minimum cot(beta) covered
float scalex[4]
x-error scale factor in 4 charge bins
float lanpar[2][5]
pixel landau distribution parameters
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float offsetx[4]
x-offset in 4 charge bins
float chi2minone_
minimum of chi^2 for 1 pixel clusters
double f[11][100]
float lorxdrift_
Lorentz x-drift.
float cotalpha0_
minimum cot(alpha) covered
float sigmavav
"sigma" scale fctor for Vavilov distribution
const SiPixelTemplateEntry2D * entry10_
int iy1_
index of next-nearest cot(beta) bin
float clsleny_
projected y-length of cluster
bool flip_x_
flip x sign-sensitive quantities
float offsety[4]
y-offset in 4 charge bins
int Nyx_
number of cot(beta)-entries (columns) in template
float chi2scale
scale factor for the chi2 distribution
float lanpar_[2][5]
Interpolated Landau parameters.
float clslenx
cluster x-length in pixels at signal height sxmax/2
float cota_current_
current cot alpha
float offsety_[4]
y-offset in charge bins
float lorxwidth_
Lorentz x-width.
float pixmax_
maximum pixel charge
float cotbeta1_
maximum cot(beta) covered
float scalexavg
average x-error scale factor
float mpvvav_
most probable Q in Vavilov distribution
float xypary1x0_[2][5]
Polynomial error parameterization at ix0,iy1.
float scaley[4]
y-error scale factor in 4 charge bins
bool success_
true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded)
float scaleyavg_
average y-error scale factor
float xypary0x0_[2][5]
Polynomial error parameterization at ix0,iy0.
float cotb_current_
current cot beta
float chi2ppix
average chi^2 per pixel
float scalex_[4]
x-error scale factor in charge bins
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
int iy0_
index of nearest cot(beta) bin
float kappavav
kappa parameter for Vavilov distribution
int id_current_
current id
float delysig_
rms of difference between clsleny_ and cluster length [with threshold effects]

◆ kappavav()

float SiPixelTemplate2D::kappavav ( )
inline

kappa parameter in Vavilov distribution

Definition at line 251 of file SiPixelTemplate2D.h.

References kappavav_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ landau_par()

void SiPixelTemplate2D::landau_par ( float  lanpar[2][5])

Return the Landau probability parameters for this set of cot(alpha, cot(beta)

Definition at line 1758 of file SiPixelTemplate2D.cc.

References mps_fire::i, and dqmiolumiharvest::j.

Referenced by SiPixelTemplateSplit::PixelTempSplit().

1760 {
1761  // Interpolate using quantities already stored in the private variables
1762 
1763  for (int i = 0; i < 2; ++i) {
1764  for (int j = 0; j < 5; ++j) {
1765  lanpar[i][j] = lanpar_[i][j];
1766  }
1767  }
1768  return;
1769 
1770 } // End lan_par
float lanpar_[2][5]
Interpolated Landau parameters.

◆ lorxdrift()

float SiPixelTemplate2D::lorxdrift ( )
inline

signed lorentz x-width (microns)

Definition at line 253 of file SiPixelTemplate2D.h.

References lorxdrift_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ lorydrift()

float SiPixelTemplate2D::lorydrift ( )
inline

signed lorentz y-width (microns)

Definition at line 252 of file SiPixelTemplate2D.h.

References lorydrift_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ mpvvav()

float SiPixelTemplate2D::mpvvav ( )
inline

most probable Q in Vavilov distribution

Definition at line 249 of file SiPixelTemplate2D.h.

References mpvvav_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ offsetx()

float SiPixelTemplate2D::offsetx ( int  i)
inline

x-offset in 4 charge bins

Definition at line 222 of file SiPixelTemplate2D.h.

References checkIllegalIndex(), mps_fire::i, and offsetx_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ offsety()

float SiPixelTemplate2D::offsety ( int  i)
inline

y-offset in 4 charge bins

Definition at line 229 of file SiPixelTemplate2D.h.

References checkIllegalIndex(), mps_fire::i, and offsety_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ pixmax()

float SiPixelTemplate2D::pixmax ( )
inline

maximum pixel charge

Definition at line 204 of file SiPixelTemplate2D.h.

References pixmax_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ pushfile() [1/2]

bool SiPixelTemplate2D::pushfile ( int  filenum,
std::vector< SiPixelTemplateStore2D > &  pixelTemp,
std::string  dir = "CalibTracker/SiPixelESProducers/data/" 
)
static

This routine initializes the global template structures from an external file template_summary_zpNNNN where NNNN are four digits of filenum.

Parameters
filenum- an integer NNNN used in the filename template_summary_zpNNNN

Alt implementation: for (unsigned cnt=4-tempfile.length(); cnt > 0; cnt– ){ tempfile = "0" + tempfile; }

Definition at line 62 of file SiPixelTemplate2D.cc.

References SiPixelTemplateHeader2D::Bfield, c, DeadROC_duringRun::dir, SiPixelTemplateHeader2D::Dtype, ENDL, SiPixelTemplateStore2D::entry, SiPixelTemplateHeader2D::fbin, geometryDiff::file, SiPixelTemplateHeader2D::fluence, SiPixelTemplateStore2D::head, mps_fire::i, SiPixelTemplateHeader2D::ID, runGCPTkAlMap::in_file, createfilelist::int, B2GTnPMonitor_cfi::item, dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, LOGERROR, LOGINFO, SiPixelTemplateHeader2D::lorxbias, SiPixelTemplateHeader2D::lorxwidth, SiPixelTemplateHeader2D::lorybias, SiPixelTemplateHeader2D::lorywidth, SiPixelTemplateHeader2D::NTxx, SiPixelTemplateHeader2D::NTy, SiPixelTemplateHeader2D::NTyx, SiPixelTemplateHeader2D::qscale, SiPixelTemplateHeader2D::s50, SiPixelTemplateHeader2D::ss50, AlCaHLTBitMon_QueryRunRegistry::string, T2XSIZE, T2YSIZE, SiPixelTemplateHeader2D::temperature, SiPixelTemplateHeader2D::templ_version, SiPixelTemplateHeader2D::title, cond::impl::to_string(), SiPixelTemplateHeader2D::Vbias, SiPixelTemplateHeader2D::xsize, SiPixelTemplateHeader2D::ysize, and SiPixelTemplateHeader2D::zsize.

Referenced by SiPixelChargeReweightingAlgorithm::init(), and PixelCPEClusterRepair::PixelCPEClusterRepair().

62  {
63  // Add template stored in external file numbered filenum to theTemplateStore
64 
65  // Local variables
66  const int code_version = {21};
67 
68  // Create a filename for this run
69  std::string tempfile = std::to_string(filenum);
70 
71  // Create different path in CMSSW than standalone
72 
73 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
74  // If integer filenum has less than 4 digits, prepend 0's until we have four numerical characters, e.g. "0292"
75  int nzeros = 4 - tempfile.length();
76  if (nzeros > 0)
77  tempfile = std::string(nzeros, '0') + tempfile;
79 
80  tempfile = dir + "template_summary2D_zp" + tempfile + ".out";
81  edm::FileInPath file(tempfile); // Find the file in CMSSW
82  tempfile = file.fullPath(); // Put it back with the whole path.
83 
84 #else
85  // This is the same as above, but more elegant.
86  std::ostringstream tout;
87  tout << "template_summary2D_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends;
88  tempfile = tout.str();
89 
90 #endif
91 
92  // Open the template file
93  //
94  std::ifstream in_file(tempfile);
95  if (in_file.is_open() && in_file.good()) {
96  // Create a local template storage entry
97  SiPixelTemplateStore2D theCurrentTemp;
98 
99  // Read-in a header string first and print it
100  char c;
101  for (int i = 0; (c = in_file.get()) != '\n'; ++i) {
102  if (i < 79) {
103  theCurrentTemp.head.title[i] = c;
104  } else {
105  theCurrentTemp.head.title[79] = '\0';
106  }
107  }
108  LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL;
109 
110  // next, the header information
111  in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >>
112  theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx >> theCurrentTemp.head.Dtype >>
113  theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >>
114  theCurrentTemp.head.qscale >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >>
115  theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >>
116  theCurrentTemp.head.zsize;
117 
118  if (in_file.fail()) {
119  LOGERROR("SiPixelTemplate2D") << "Error reading file 0A, no template load" << ENDL;
120  return false;
121  }
122 
123  if (theCurrentTemp.head.templ_version > 17) {
124  in_file >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >>
125  theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2];
126 
127  if (in_file.fail()) {
128  LOGERROR("SiPixelTemplate2D") << "Error reading file 0B, no template load" << ENDL;
129  return false;
130  }
131  } else {
132  // This is for older [legacy] payloads
133  theCurrentTemp.head.ss50 = theCurrentTemp.head.s50;
134  theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth / 2.f;
135  theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth / 2.f;
136  theCurrentTemp.head.fbin[0] = 1.5f;
137  theCurrentTemp.head.fbin[1] = 1.00f;
138  theCurrentTemp.head.fbin[2] = 0.85f;
139  }
140 
141  LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version "
142  << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield
143  << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx
144  << ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype
145  << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature "
146  << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence
147  << ", Q-scaling factor " << theCurrentTemp.head.qscale << ", 1/2 multi dcol threshold "
148  << theCurrentTemp.head.s50 << ", 1/2 single dcol threshold "
149  << theCurrentTemp.head.ss50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth
150  << ", y Lorentz Bias " << theCurrentTemp.head.lorybias << ", x Lorentz width "
151  << theCurrentTemp.head.lorxwidth << ", x Lorentz Bias " << theCurrentTemp.head.lorxbias
152  << ", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] << ", "
153  << theCurrentTemp.head.fbin[1] << ", " << theCurrentTemp.head.fbin[2]
154  << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size "
155  << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL;
156 
157  if (theCurrentTemp.head.templ_version < code_version) {
158  LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL;
159  return false;
160  }
161 
162  if (theCurrentTemp.head.NTy != 0) {
163  LOGERROR("SiPixelTemplate2D")
164  << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL;
165  return false;
166  }
167 
168  // next, layout the 2-d structure needed to store template
169 
170  theCurrentTemp.entry.resize(theCurrentTemp.head.NTyx);
171  for (auto& item : theCurrentTemp.entry)
172  item.resize(theCurrentTemp.head.NTxx);
173 
174  // Read in the file info
175 
176  for (int iy = 0; iy < theCurrentTemp.head.NTyx; ++iy) {
177  for (int jx = 0; jx < theCurrentTemp.head.NTxx; ++jx) {
178  in_file >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] >>
179  theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2];
180 
181  if (in_file.fail()) {
182  LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # "
183  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
184  return false;
185  }
186 
187  // Calculate cot(alpha) and cot(beta) for this entry
188 
189  theCurrentTemp.entry[iy][jx].cotalpha =
190  theCurrentTemp.entry[iy][jx].costrk[0] / theCurrentTemp.entry[iy][jx].costrk[2];
191 
192  theCurrentTemp.entry[iy][jx].cotbeta =
193  theCurrentTemp.entry[iy][jx].costrk[1] / theCurrentTemp.entry[iy][jx].costrk[2];
194 
195  in_file >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >>
196  theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin >>
197  theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >>
198  theCurrentTemp.entry[iy][jx].jxmax;
199 
200  if (in_file.fail()) {
201  LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # "
202  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
203  return false;
204  }
205 
206  for (int k = 0; k < 2; ++k) {
207  in_file >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] >>
208  theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >>
209  theCurrentTemp.entry[iy][jx].xypar[k][4];
210 
211  if (in_file.fail()) {
212  LOGERROR("SiPixelTemplate2D")
213  << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL;
214  return false;
215  }
216  }
217 
218  for (int k = 0; k < 2; ++k) {
219  in_file >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] >>
220  theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >>
221  theCurrentTemp.entry[iy][jx].lanpar[k][4];
222 
223  if (in_file.fail()) {
224  LOGERROR("SiPixelTemplate2D")
225  << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL;
226  return false;
227  }
228  }
229 
230  // Read the 2D template entries as floats [they are formatted that way] and cast to short ints
231 
232  float dummy[T2YSIZE];
233  for (int l = 0; l < 7; ++l) {
234  for (int k = 0; k < 7; ++k) {
235  for (int j = 0; j < T2XSIZE; ++j) {
236  for (int i = 0; i < T2YSIZE; ++i) {
237  in_file >> dummy[i];
238  }
239  if (in_file.fail()) {
240  LOGERROR("SiPixelTemplate2D")
241  << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL;
242  return false;
243  }
244  for (int i = 0; i < T2YSIZE; ++i) {
245  theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j] = (short int)dummy[i];
246  }
247  }
248  }
249  }
250 
251  in_file >> theCurrentTemp.entry[iy][jx].chi2ppix >> theCurrentTemp.entry[iy][jx].chi2scale >>
252  theCurrentTemp.entry[iy][jx].offsetx[0] >> theCurrentTemp.entry[iy][jx].offsetx[1] >>
253  theCurrentTemp.entry[iy][jx].offsetx[2] >> theCurrentTemp.entry[iy][jx].offsetx[3] >>
254  theCurrentTemp.entry[iy][jx].offsety[0] >> theCurrentTemp.entry[iy][jx].offsety[1] >>
255  theCurrentTemp.entry[iy][jx].offsety[2] >> theCurrentTemp.entry[iy][jx].offsety[3];
256 
257  if (in_file.fail()) {
258  LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # "
259  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
260  return false;
261  }
262 
263  in_file >> theCurrentTemp.entry[iy][jx].clsleny >> theCurrentTemp.entry[iy][jx].clslenx >>
264  theCurrentTemp.entry[iy][jx].mpvvav >> theCurrentTemp.entry[iy][jx].sigmavav >>
265  theCurrentTemp.entry[iy][jx].kappavav >> theCurrentTemp.entry[iy][jx].scalexavg >>
266  theCurrentTemp.entry[iy][jx].scaleyavg >> theCurrentTemp.entry[iy][jx].delyavg >>
267  theCurrentTemp.entry[iy][jx].delysig >> theCurrentTemp.entry[iy][jx].spare[0];
268 
269  if (in_file.fail()) {
270  LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # "
271  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
272  return false;
273  }
274 
275  in_file >> theCurrentTemp.entry[iy][jx].scalex[0] >> theCurrentTemp.entry[iy][jx].scalex[1] >>
276  theCurrentTemp.entry[iy][jx].scalex[2] >> theCurrentTemp.entry[iy][jx].scalex[3] >>
277  theCurrentTemp.entry[iy][jx].scaley[0] >> theCurrentTemp.entry[iy][jx].scaley[1] >>
278  theCurrentTemp.entry[iy][jx].scaley[2] >> theCurrentTemp.entry[iy][jx].scaley[3] >>
279  theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2];
280 
281  if (in_file.fail()) {
282  LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # "
283  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
284  return false;
285  }
286  }
287  }
288 
289  in_file.close();
290 
291  // Add this template to the store
292 
293  pixelTemp.push_back(theCurrentTemp);
294 
295  return true;
296 
297  } else {
298  // If file didn't open, report this
299 
300  LOGERROR("SiPixelTemplate2D") << "Error opening File" << tempfile << ENDL;
301  return false;
302  }
303 
304 } // TempInit
float qscale
Charge scaling to match cmssw and pixelav.
float Vbias
detector bias potential in Volts
float lorxwidth
estimate of x-lorentz width for optimal resolution
float ysize
pixel size (for future use in upgraded geometry)
SiPixelTemplateHeader2D head
< template storage structure
#define ENDL
std::string to_string(const V &value)
Definition: OMSAccess.h:71
float lorxbias
estimate of x-lorentz bias
float fbin[3]
The QBin definitions in Q_clus/Q_avg.
#define T2XSIZE
float ss50
1/2 of the single hit dcol threshold in electrons
int ID
< template header structure
#define LOGERROR(x)
int NTxx
number of Template x-entries in each slice
#define LOGINFO(x)
float xsize
pixel size (for future use in upgraded geometry)
char title[80]
template title
std::vector< std::vector< SiPixelTemplateEntry2D > > entry
float zsize
pixel size (for future use in upgraded geometry)
float lorywidth
estimate of y-lorentz width for optimal resolution
int NTy
number of Template y entries
int Dtype
detector type (0=BPix, 1=FPix)
int templ_version
Version number of the template to ensure code compatibility.
float s50
1/2 of the multihit dcol threshold in electrons
float temperature
detector temperature in deg K
float Bfield
Bfield in Tesla.
#define T2YSIZE
float fluence
radiation fluence in n_eq/cm^2
float lorybias
estimate of y-lorentz bias
int NTyx
number of Template y-slices of x entries

◆ pushfile() [2/2]

bool SiPixelTemplate2D::pushfile ( const SiPixel2DTemplateDBObject dbobject,
std::vector< SiPixelTemplateStore2D > &  pixelTemp 
)
static

This routine initializes the global template structures from an external file template_summary_zpNNNN where NNNN are four digits

Parameters
dbobject- db storing multiple template calibrations

Definition at line 313 of file SiPixelTemplate2D.cc.

References SiPixelTemplateHeader2D::Bfield, dqmiodatasetharvest::db, SiPixelTemplateHeader2D::Dtype, ENDL, SiPixelTemplateStore2D::entry, SiPixelTemplateHeader2D::fbin, SiPixelTemplateHeader2D::fluence, SiPixelTemplateStore2D::head, mps_fire::i, SiPixelTemplateHeader2D::ID, createfilelist::int, B2GTnPMonitor_cfi::item, dqmiolumiharvest::j, dqmdumpme::k, MainPageGenerator::l, LOGERROR, LOGINFO, SiPixelTemplateHeader2D::lorxbias, SiPixelTemplateHeader2D::lorxwidth, SiPixelTemplateHeader2D::lorybias, SiPixelTemplateHeader2D::lorywidth, visualization-live-secondInstance_cfg::m, SiPixelTemplateHeader2D::NTxx, SiPixelTemplateHeader2D::NTy, SiPixelTemplateHeader2D::NTyx, SiPixelTemplateHeader2D::qscale, SiPixelTemplateHeader2D::s50, SiPixelTemplateHeader2D::ss50, T2XSIZE, T2YSIZE, groupFilesInBlocks::temp, SiPixelTemplateHeader2D::temperature, SiPixelTemplateHeader2D::templ_version, SiPixelTemplateHeader2D::title, SiPixelTemplateHeader2D::Vbias, SiPixelTemplateHeader2D::xsize, SiPixelTemplateHeader2D::ysize, and SiPixelTemplateHeader2D::zsize.

314  {
315  // Add template stored in external dbobject to theTemplateStore
316 
317  const int code_version = {21};
318 
319  // We must create a new object because dbobject must be a const and our stream must not be
320  SiPixel2DTemplateDBObject db = dbobject;
321 
322  // Create a local template storage entry
323  SiPixelTemplateStore2D theCurrentTemp;
324 
325  // Fill the template storage for each template calibration stored in the db
326  for (int m = 0; m < db.numOfTempl(); ++m) {
327  // Read-in a header string first and print it
328 
330  for (int i = 0; i < 20; ++i) {
331  temp.f = db.sVector()[db.index()];
332  theCurrentTemp.head.title[4 * i] = temp.c[0];
333  theCurrentTemp.head.title[4 * i + 1] = temp.c[1];
334  theCurrentTemp.head.title[4 * i + 2] = temp.c[2];
335  theCurrentTemp.head.title[4 * i + 3] = temp.c[3];
336  db.incrementIndex(1);
337  }
338  theCurrentTemp.head.title[79] = '\0';
339  LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL;
340 
341  // next, the header information
342 
343  db >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >>
344  theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx >> theCurrentTemp.head.Dtype >>
345  theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >>
346  theCurrentTemp.head.qscale >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >>
347  theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >>
348  theCurrentTemp.head.zsize;
349 
350  if (db.fail()) {
351  LOGERROR("SiPixelTemplate2D") << "Error reading file 0A, no template load" << ENDL;
352  return false;
353  }
354 
355  LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title
356  << " code version = " << code_version << " object version "
357  << theCurrentTemp.head.templ_version << ENDL;
358 
359  if (theCurrentTemp.head.templ_version > 17) {
360  db >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >>
361  theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2];
362 
363  if (db.fail()) {
364  LOGERROR("SiPixelTemplate2D") << "Error reading file 0B, no template load" << ENDL;
365  return false;
366  }
367  } else {
368  // This is for older [legacy] payloads and the numbers are indeed magic [they are part of the payload for v>17]
369  theCurrentTemp.head.ss50 = theCurrentTemp.head.s50;
370  theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth / 2.f;
371  theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth / 2.f;
372  theCurrentTemp.head.fbin[0] = 1.50f;
373  theCurrentTemp.head.fbin[1] = 1.00f;
374  theCurrentTemp.head.fbin[2] = 0.85f;
375  }
376 
377  LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version "
378  << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield
379  << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx
380  << ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype
381  << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature "
382  << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence
383  << ", Q-scaling factor " << theCurrentTemp.head.qscale << ", 1/2 multi dcol threshold "
384  << theCurrentTemp.head.s50 << ", 1/2 single dcol threshold "
385  << theCurrentTemp.head.ss50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth
386  << ", y Lorentz Bias " << theCurrentTemp.head.lorybias << ", x Lorentz width "
387  << theCurrentTemp.head.lorxwidth << ", x Lorentz Bias " << theCurrentTemp.head.lorxbias
388  << ", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] << ", "
389  << theCurrentTemp.head.fbin[1] << ", " << theCurrentTemp.head.fbin[2]
390  << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size "
391  << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL;
392 
393  if (theCurrentTemp.head.templ_version < code_version) {
394  LOGINFO("SiPixelTemplate2D") << "code expects version " << code_version << " finds "
395  << theCurrentTemp.head.templ_version << ", load anyway " << ENDL;
396  }
397 
398  if (theCurrentTemp.head.NTy != 0) {
399  LOGERROR("SiPixelTemplate2D")
400  << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL;
401  return false;
402  }
403 
404  // next, layout the 2-d structure needed to store template
405 
406  theCurrentTemp.entry.resize(theCurrentTemp.head.NTyx);
407  for (auto& item : theCurrentTemp.entry)
408  item.resize(theCurrentTemp.head.NTxx);
409 
410  // Read in the file info
411 
412  for (int iy = 0; iy < theCurrentTemp.head.NTyx; ++iy) {
413  for (int jx = 0; jx < theCurrentTemp.head.NTxx; ++jx) {
414  db >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0] >>
415  theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2];
416 
417  if (db.fail()) {
418  LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # "
419  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
420  return false;
421  }
422 
423  // Calculate cot(alpha) and cot(beta) for this entry
424 
425  theCurrentTemp.entry[iy][jx].cotalpha =
426  theCurrentTemp.entry[iy][jx].costrk[0] / theCurrentTemp.entry[iy][jx].costrk[2];
427 
428  theCurrentTemp.entry[iy][jx].cotbeta =
429  theCurrentTemp.entry[iy][jx].costrk[1] / theCurrentTemp.entry[iy][jx].costrk[2];
430 
431  db >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >>
432  theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin >>
433  theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >>
434  theCurrentTemp.entry[iy][jx].jxmax;
435 
436  if (db.fail()) {
437  LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # "
438  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
439  return false;
440  }
441 
442  for (int k = 0; k < 2; ++k) {
443  db >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1] >>
444  theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >>
445  theCurrentTemp.entry[iy][jx].xypar[k][4];
446 
447  if (db.fail()) {
448  LOGERROR("SiPixelTemplate2D")
449  << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL;
450  return false;
451  }
452  }
453 
454  for (int k = 0; k < 2; ++k) {
455  db >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1] >>
456  theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >>
457  theCurrentTemp.entry[iy][jx].lanpar[k][4];
458 
459  if (db.fail()) {
460  LOGERROR("SiPixelTemplate2D")
461  << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL;
462  return false;
463  }
464  }
465 
466  // Read the 2D template entries as floats [they are formatted that way] and cast to short ints
467 
468  float dummy[T2YSIZE];
469  for (int l = 0; l < 7; ++l) {
470  for (int k = 0; k < 7; ++k) {
471  for (int j = 0; j < T2XSIZE; ++j) {
472  for (int i = 0; i < T2YSIZE; ++i) {
473  db >> dummy[i];
474  }
475  if (db.fail()) {
476  LOGERROR("SiPixelTemplate2D")
477  << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL;
478  return false;
479  }
480  for (int i = 0; i < T2YSIZE; ++i) {
481  theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j] = (short int)dummy[i];
482  }
483  }
484  }
485  }
486 
487  db >> theCurrentTemp.entry[iy][jx].chi2ppix >> theCurrentTemp.entry[iy][jx].chi2scale >>
488  theCurrentTemp.entry[iy][jx].offsetx[0] >> theCurrentTemp.entry[iy][jx].offsetx[1] >>
489  theCurrentTemp.entry[iy][jx].offsetx[2] >> theCurrentTemp.entry[iy][jx].offsetx[3] >>
490  theCurrentTemp.entry[iy][jx].offsety[0] >> theCurrentTemp.entry[iy][jx].offsety[1] >>
491  theCurrentTemp.entry[iy][jx].offsety[2] >> theCurrentTemp.entry[iy][jx].offsety[3];
492 
493  if (db.fail()) {
494  LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # "
495  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
496  return false;
497  }
498 
499  db >> theCurrentTemp.entry[iy][jx].clsleny >> theCurrentTemp.entry[iy][jx].clslenx >>
500  theCurrentTemp.entry[iy][jx].mpvvav >> theCurrentTemp.entry[iy][jx].sigmavav >>
501  theCurrentTemp.entry[iy][jx].kappavav >> theCurrentTemp.entry[iy][jx].scalexavg >>
502  theCurrentTemp.entry[iy][jx].scaleyavg >> theCurrentTemp.entry[iy][jx].delyavg >>
503  theCurrentTemp.entry[iy][jx].delysig >> theCurrentTemp.entry[iy][jx].spare[0];
504 
505  if (db.fail()) {
506  LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # "
507  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
508  return false;
509  }
510 
511  db >> theCurrentTemp.entry[iy][jx].scalex[0] >> theCurrentTemp.entry[iy][jx].scalex[1] >>
512  theCurrentTemp.entry[iy][jx].scalex[2] >> theCurrentTemp.entry[iy][jx].scalex[3] >>
513  theCurrentTemp.entry[iy][jx].scaley[0] >> theCurrentTemp.entry[iy][jx].scaley[1] >>
514  theCurrentTemp.entry[iy][jx].scaley[2] >> theCurrentTemp.entry[iy][jx].scaley[3] >>
515  theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2];
516 
517  if (db.fail()) {
518  LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # "
519  << theCurrentTemp.entry[iy][jx].runnum << ENDL;
520  return false;
521  }
522  }
523  }
524 
525  // Add this template to the store
526 
527  pixelTemp.push_back(theCurrentTemp);
528  }
529 
530  return true;
531 
532 } // TempInit
float qscale
Charge scaling to match cmssw and pixelav.
float Vbias
detector bias potential in Volts
float lorxwidth
estimate of x-lorentz width for optimal resolution
float ysize
pixel size (for future use in upgraded geometry)
SiPixelTemplateHeader2D head
< template storage structure
#define ENDL
float lorxbias
estimate of x-lorentz bias
float fbin[3]
The QBin definitions in Q_clus/Q_avg.
#define T2XSIZE
float ss50
1/2 of the single hit dcol threshold in electrons
int ID
< template header structure
#define LOGERROR(x)
int NTxx
number of Template x-entries in each slice
#define LOGINFO(x)
float xsize
pixel size (for future use in upgraded geometry)
char title[80]
template title
std::vector< std::vector< SiPixelTemplateEntry2D > > entry
float zsize
pixel size (for future use in upgraded geometry)
float lorywidth
estimate of y-lorentz width for optimal resolution
int NTy
number of Template y entries
int Dtype
detector type (0=BPix, 1=FPix)
int templ_version
Version number of the template to ensure code compatibility.
float s50
1/2 of the multihit dcol threshold in electrons
float temperature
detector temperature in deg K
float Bfield
Bfield in Tesla.
#define T2YSIZE
float fluence
radiation fluence in n_eq/cm^2
float lorybias
estimate of y-lorentz bias
int NTyx
number of Template y-slices of x entries

◆ qavg()

float SiPixelTemplate2D::qavg ( )
inline

average cluster charge for this set of track angles

Definition at line 203 of file SiPixelTemplate2D.h.

References qavg_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ qscale()

float SiPixelTemplate2D::qscale ( )
inline

charge scaling factor

Definition at line 205 of file SiPixelTemplate2D.h.

References qscale_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ s50()

float SiPixelTemplate2D::s50 ( )
inline

1/2 of the pixel threshold signal in adc units

Definition at line 206 of file SiPixelTemplate2D.h.

References s50_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D(), and SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D().

◆ scalex()

float SiPixelTemplate2D::scalex ( int  i)
inline

x-error scale factor in 4 charge bins

Definition at line 208 of file SiPixelTemplate2D.h.

References checkIllegalIndex(), mps_fire::i, and scalex_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ scalexavg()

float SiPixelTemplate2D::scalexavg ( )
inline

x-reco error scaling factor

Definition at line 257 of file SiPixelTemplate2D.h.

References scalexavg_.

◆ scaley()

float SiPixelTemplate2D::scaley ( int  i)
inline

y-error scale factor in 4 charge bins

Definition at line 215 of file SiPixelTemplate2D.h.

References checkIllegalIndex(), mps_fire::i, and scaley_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ scaleyavg()

float SiPixelTemplate2D::scaleyavg ( )
inline

y-reco error scaling factor

Definition at line 256 of file SiPixelTemplate2D.h.

References scaleyavg_.

◆ sigmavav()

float SiPixelTemplate2D::sigmavav ( )
inline

scale factor in Vavilov distribution

Definition at line 250 of file SiPixelTemplate2D.h.

References sigmavav_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ sizex()

float SiPixelTemplate2D::sizex ( )
inline

return x size of template cluster

Definition at line 243 of file SiPixelTemplate2D.h.

References clslenx_.

◆ sizey()

float SiPixelTemplate2D::sizey ( )
inline

return y size of template cluster

Definition at line 244 of file SiPixelTemplate2D.h.

References clsleny_.

◆ storesize()

int SiPixelTemplate2D::storesize ( )
inline

return the size of the template store (the number of stored IDs

Definition at line 265 of file SiPixelTemplate2D.h.

References thePixelTemp_.

◆ sxymax()

float SiPixelTemplate2D::sxymax ( )
inline

max pixel signal for pixel error calculation

Definition at line 207 of file SiPixelTemplate2D.h.

References sxymax_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

◆ xsize()

float SiPixelTemplate2D::xsize ( )
inline

pixel x-size (microns)

Definition at line 262 of file SiPixelTemplate2D.h.

References xsize_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D(), and SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D().

◆ xysigma2()

void SiPixelTemplate2D::xysigma2 ( float  qpixel,
int  index,
float &  xysig2 
)

Return y error (squared) for an input signal and yindex Add large Q scaling for use in cluster splitting.

Parameters
qpixel- (input) pixel charge
index- (input) y-index index of pixel
xysig2- (output) square error

Definition at line 1697 of file SiPixelTemplate2D.cc.

References cms::cuda::assert(), BYM2, Exception, f, and T2HYP1.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D().

1699 {
1700  // Interpolate using quantities already stored in the private variables
1701 
1702  // Local variables
1703  float sigi, sigi2, sigi3, sigi4, qscale, err2, err00;
1704 
1705  // Make sure that input is OK
1706 
1707 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1708  if (index < 1 || index >= BYM2) {
1709  throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::ysigma2 called with index = " << index << std::endl;
1710  }
1711 #else
1712  assert(index > 0 && index < BYM2);
1713 #endif
1714 
1715  // Define the maximum signal to use in the parameterization
1716 
1717  // Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis
1718 
1719  if (qpixel < sxymax_) {
1720  sigi = qpixel;
1721  qscale = 1.f;
1722  } else {
1723  sigi = sxymax_;
1724  qscale = qpixel / sxymax_;
1725  }
1726  sigi2 = sigi * sigi;
1727  sigi3 = sigi2 * sigi;
1728  sigi4 = sigi3 * sigi;
1729  if (index <= T2HYP1) {
1730  err00 = xypary0x0_[0][0] + xypary0x0_[0][1] * sigi + xypary0x0_[0][2] * sigi2 + xypary0x0_[0][3] * sigi3 +
1731  xypary0x0_[0][4] * sigi4;
1732  err2 = err00 +
1733  adcota_ * (xypary0x1_[0][0] + xypary0x1_[0][1] * sigi + xypary0x1_[0][2] * sigi2 + xypary0x1_[0][3] * sigi3 +
1734  xypary0x1_[0][4] * sigi4 - err00) +
1735  adcotb_ * (xypary1x0_[0][0] + xypary1x0_[0][1] * sigi + xypary1x0_[0][2] * sigi2 + xypary1x0_[0][3] * sigi3 +
1736  xypary1x0_[0][4] * sigi4 - err00);
1737  } else {
1738  err00 = xypary0x0_[1][0] + xypary0x0_[1][1] * sigi + xypary0x0_[1][2] * sigi2 + xypary0x0_[1][3] * sigi3 +
1739  xypary0x0_[1][4] * sigi4;
1740  err2 = err00 +
1741  adcota_ * (xypary0x1_[1][0] + xypary0x1_[1][1] * sigi + xypary0x1_[1][2] * sigi2 + xypary0x1_[1][3] * sigi3 +
1742  xypary0x1_[1][4] * sigi4 - err00) +
1743  adcotb_ * (xypary1x0_[1][0] + xypary1x0_[1][1] * sigi + xypary1x0_[1][2] * sigi2 + xypary1x0_[1][3] * sigi3 +
1744  xypary1x0_[1][4] * sigi4 - err00);
1745  }
1746  xysig2 = qscale * err2;
1747  if (xysig2 <= 0.f) {
1748  xysig2 = s50_ * s50_;
1749  }
1750 
1751  return;
1752 
1753 } // End xysigma2
float adcotb_
fractional pixel distance of cot(beta) from iy0_
#define T2HYP1
float xypary0x1_[2][5]
Polynomial error parameterization at ix1,iy0.
float sxymax_
average pixel signal for y-projection of cluster
assert(be >=bs)
float adcota_
fractional pixel distance of cot(alpha) from jx0_
float s50_
1/2 of the pixel threshold signal in adc units
#define BYM2
double f[11][100]
float qscale()
charge scaling factor
float xypary1x0_[2][5]
Polynomial error parameterization at ix0,iy1.
float xypary0x0_[2][5]
Polynomial error parameterization at ix0,iy0.

◆ xytemp() [1/3]

bool SiPixelTemplate2D::xytemp ( float  xhit,
float  yhit,
bool  ydouble[21+2],
bool  xdouble[13+2],
float  template2d[13+2][21+2],
bool  derivatives,
float  dpdx2d[2][13+2][21+2],
float &  QTemplate 
)

Load template info for single angle point to invoke template reco for template generation

Parameters
entry- (input) pointer to template entry
sizex- (input) pixel x-size
sizey- (input) pixel y-size
sizez- (input) pixel z-size
xhit- (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter)
yhit- (input) y-position of hit relative to the lower left corner of pixel[1][1]
ydouble- (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1]
xdouble- (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1]
template2d- (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only.

Definition at line 989 of file SiPixelTemplate2D.cc.

References BXM2, BXM3, BYM2, BYM3, PVValHelper::dx, PVValHelper::dy, f, dqmMemoryStats::float, mps_fire::i, createfilelist::int, dqmiolumiharvest::j, dqmdumpme::k, reco::ParticleMasses::k0, visualization-live-secondInstance_cfg::m, SiStripPI::max, SiStripPI::min, dqmiodumpmetadata::n, T2HX, T2HY, T2XSIZE, and T2YSIZE.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D(), SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D(), SiPixelTemplateSplit::PixelTempSplit(), and xytemp().

996  {
997  // Interpolate for a new set of track angles
998 
999  // Local variables
1000  int pixx, pixy, k0, k1, l0, l1, deltax, deltay, iflipy, jflipx, imin, imax, jmin, jmax;
1001  int m, n;
1002  float dx, dy, ddx, ddy, adx, ady;
1003  // const float deltaxy[2] = {8.33f, 12.5f};
1004  const float deltaxy[2] = {16.67f, 25.0f};
1005 
1006  // Check to see if interpolation is valid
1007 
1008  // next, determine the indices of the closest point in k (y-displacement), l (x-displacement)
1009  // pixy and pixx are the indices of the struck pixel in the (Ty,Tx) system
1010  // k0,k1 are the k-indices of the closest and next closest point
1011  // l0,l1 are the l-indices of the closest and next closest point
1012 
1013  pixy = (int)floorf(yhit / ysize_);
1014  dy = yhit - (pixy + 0.5f) * ysize_;
1015  if (flip_y_) {
1016  dy = -dy;
1017  }
1018  k0 = (int)(dy / ysize_ * 6.f + 3.5f);
1019  if (k0 < 0)
1020  k0 = 0;
1021  if (k0 > 6)
1022  k0 = 6;
1023  ddy = 6.f * dy / ysize_ - (k0 - 3);
1024  ady = fabs(ddy);
1025  if (ddy > 0.f) {
1026  k1 = k0 + 1;
1027  if (k1 > 6)
1028  k1 = k0 - 1;
1029  } else {
1030  k1 = k0 - 1;
1031  if (k1 < 0)
1032  k1 = k0 + 1;
1033  }
1034  pixx = (int)floorf(xhit / xsize_);
1035  dx = xhit - (pixx + 0.5f) * xsize_;
1036  if (flip_x_) {
1037  dx = -dx;
1038  }
1039  l0 = (int)(dx / xsize_ * 6.f + 3.5f);
1040  if (l0 < 0)
1041  l0 = 0;
1042  if (l0 > 6)
1043  l0 = 6;
1044  ddx = 6.f * dx / xsize_ - (l0 - 3);
1045  adx = fabs(ddx);
1046  if (ddx > 0.f) {
1047  l1 = l0 + 1;
1048  if (l1 > 6)
1049  l1 = l0 - 1;
1050  } else {
1051  l1 = l0 - 1;
1052  if (l1 < 0)
1053  l1 = l0 + 1;
1054  }
1055 
1056  // OK, lets do the template interpolation.
1057 
1058  // First find the limits of the indices for non-zero pixels
1059 
1060  imin = std::min(entry00_->iymin, entry10_->iymin);
1061  imin_ = std::min(imin, entry01_->iymin);
1062 
1063  jmin = std::min(entry00_->jxmin, entry10_->jxmin);
1064  jmin_ = std::min(jmin, entry01_->jxmin);
1065 
1066  imax = std::max(entry00_->iymax, entry10_->iymax);
1067  imax_ = std::max(imax, entry01_->iymax);
1068 
1069  jmax = std::max(entry00_->jxmax, entry10_->jxmax);
1070  jmax_ = std::max(jmax, entry01_->jxmax);
1071 
1072  // Calculate the x and y offsets to make the new template
1073 
1074  // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system
1075 
1076  ++pixy;
1077  ++pixx;
1078 
1079  // In the template store, the struck pixel is always (THy,THx)
1080 
1081  deltax = pixx - T2HX;
1082  deltay = pixy - T2HY;
1083 
1084  // First zero the local 2-d template
1085 
1086  for (int j = 0; j < BXM2; ++j) {
1087  for (int i = 0; i < BYM2; ++i) {
1088  xytemp_[j][i] = 0.f;
1089  }
1090  }
1091 
1092  // Loop over the non-zero part of the template index space and interpolate
1093 
1094  for (int j = jmin_; j <= jmax_; ++j) {
1095  // Flip indices as needed
1096  if (flip_x_) {
1097  jflipx = T2XSIZE - 1 - j;
1098  m = deltax + jflipx;
1099  } else {
1100  m = deltax + j;
1101  }
1102  for (int i = imin_; i <= imax_; ++i) {
1103  if (flip_y_) {
1104  iflipy = T2YSIZE - 1 - i;
1105  n = deltay + iflipy;
1106  } else {
1107  n = deltay + i;
1108  }
1109  if (m >= 0 && m <= BXM3 && n >= 0 && n <= BYM3) {
1110  xytemp_[m][n] = (float)entry00_->xytemp[k0][l0][i][j] +
1111  adx * (float)(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1112  ady * (float)(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1113  adcota_ * (float)(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1114  adcotb_ * (float)(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]);
1115  }
1116  }
1117  }
1118 
1119  //combine rows and columns to simulate double pixels
1120 
1121  for (int n = 1; n < BYM3; ++n) {
1122  if (ydouble[n]) {
1123  // Combine the y-columns
1124  for (int m = 1; m < BXM3; ++m) {
1125  xytemp_[m][n] += xytemp_[m][n + 1];
1126  }
1127  // Now shift the remaining pixels over by one column
1128  for (int i = n + 1; i < BYM3; ++i) {
1129  for (int m = 1; m < BXM3; ++m) {
1130  xytemp_[m][i] = xytemp_[m][i + 1];
1131  }
1132  }
1133  }
1134  }
1135 
1136  //combine rows and columns to simulate double pixels
1137 
1138  for (int m = 1; m < BXM3; ++m) {
1139  if (xdouble[m]) {
1140  // Combine the x-rows
1141  for (int n = 1; n < BYM3; ++n) {
1142  xytemp_[m][n] += xytemp_[m + 1][n];
1143  }
1144  // Now shift the remaining pixels over by one row
1145  for (int j = m + 1; j < BXM3; ++j) {
1146  for (n = 1; n < BYM3; ++n) {
1147  xytemp_[j][n] = xytemp_[j + 1][n];
1148  }
1149  }
1150  }
1151  }
1152 
1153  // Finally, loop through and increment the external template
1154 
1155  float qtemptot = 0.f;
1156 
1157  for (int n = 1; n < BYM3; ++n) {
1158  for (int m = 1; m < BXM3; ++m) {
1159  if (xytemp_[m][n] != 0.f) {
1160  template2d[m][n] += xytemp_[m][n];
1161  qtemptot += xytemp_[m][n];
1162  }
1163  }
1164  }
1165 
1166  QTemplate = qtemptot;
1167 
1168  if (derivatives) {
1169  float dxytempdx[2][BXM2][BYM2], dxytempdy[2][BXM2][BYM2];
1170 
1171  for (int k = 0; k < 2; ++k) {
1172  for (int i = 0; i < BXM2; ++i) {
1173  for (int j = 0; j < BYM2; ++j) {
1174  dxytempdx[k][i][j] = 0.f;
1175  dxytempdy[k][i][j] = 0.f;
1176  dpdx2d[k][i][j] = 0.f;
1177  }
1178  }
1179  }
1180 
1181  // First do shifted +x template
1182 
1183  pixx = (int)floorf((xhit + deltaxy[0]) / xsize_);
1184  dx = (xhit + deltaxy[0]) - (pixx + 0.5f) * xsize_;
1185  if (flip_x_) {
1186  dx = -dx;
1187  }
1188  l0 = (int)(dx / xsize_ * 6.f + 3.5f);
1189  if (l0 < 0)
1190  l0 = 0;
1191  if (l0 > 6)
1192  l0 = 6;
1193  ddx = 6.f * dx / xsize_ - (l0 - 3);
1194  adx = fabs(ddx);
1195  if (ddx > 0.f) {
1196  l1 = l0 + 1;
1197  if (l1 > 6)
1198  l1 = l0 - 1;
1199  } else {
1200  l1 = l0 - 1;
1201  if (l1 < 0)
1202  l1 = l0 + 1;
1203  }
1204 
1205  // OK, lets do the template interpolation.
1206 
1207  // Calculate the x and y offsets to make the new template
1208 
1209  // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system
1210 
1211  ++pixx;
1212 
1213  // In the template store, the struck pixel is always (THy,THx)
1214 
1215  deltax = pixx - T2HX;
1216 
1217  // Loop over the non-zero part of the template index space and interpolate
1218 
1219  for (int j = jmin_; j <= jmax_; ++j) {
1220  // Flip indices as needed
1221  if (flip_x_) {
1222  jflipx = T2XSIZE - 1 - j;
1223  m = deltax + jflipx;
1224  } else {
1225  m = deltax + j;
1226  }
1227  for (int i = imin_; i <= imax_; ++i) {
1228  if (flip_y_) {
1229  iflipy = T2YSIZE - 1 - i;
1230  n = deltay + iflipy;
1231  } else {
1232  n = deltay + i;
1233  }
1234  if (m >= 0 && m <= BXM3 && n >= 0 && n <= BYM3) {
1235  dxytempdx[1][m][n] = (float)entry00_->xytemp[k0][l0][i][j] +
1236  adx * (float)(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1237  ady * (float)(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1238  adcota_ * (float)(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1239  adcotb_ * (float)(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]);
1240  }
1241  }
1242  }
1243 
1244  //combine rows and columns to simulate double pixels
1245 
1246  for (int n = 1; n < BYM3; ++n) {
1247  if (ydouble[n]) {
1248  // Combine the y-columns
1249  for (int m = 1; m < BXM3; ++m) {
1250  dxytempdx[1][m][n] += dxytempdx[1][m][n + 1];
1251  }
1252  // Now shift the remaining pixels over by one column
1253  for (int i = n + 1; i < BYM3; ++i) {
1254  for (int m = 1; m < BXM3; ++m) {
1255  dxytempdx[1][m][i] = dxytempdx[1][m][i + 1];
1256  }
1257  }
1258  }
1259  }
1260 
1261  //combine rows and columns to simulate double pixels
1262 
1263  for (int m = 1; m < BXM3; ++m) {
1264  if (xdouble[m]) {
1265  // Combine the x-rows
1266  for (int n = 1; n < BYM3; ++n) {
1267  dxytempdx[1][m][n] += dxytempdx[1][m + 1][n];
1268  }
1269  // Now shift the remaining pixels over by one row
1270  for (int j = m + 1; j < BXM3; ++j) {
1271  for (int n = 1; n < BYM3; ++n) {
1272  dxytempdx[1][j][n] = dxytempdx[1][j + 1][n];
1273  }
1274  }
1275  }
1276  }
1277 
1278  // Next do shifted -x template
1279 
1280  pixx = (int)floorf((xhit - deltaxy[0]) / xsize_);
1281  dx = (xhit - deltaxy[0]) - (pixx + 0.5f) * xsize_;
1282  if (flip_x_) {
1283  dx = -dx;
1284  }
1285  l0 = (int)(dx / xsize_ * 6.f + 3.5f);
1286  if (l0 < 0)
1287  l0 = 0;
1288  if (l0 > 6)
1289  l0 = 6;
1290  ddx = 6.f * dx / xsize_ - (l0 - 3);
1291  adx = fabs(ddx);
1292  if (ddx > 0.f) {
1293  l1 = l0 + 1;
1294  if (l1 > 6)
1295  l1 = l0 - 1;
1296  } else {
1297  l1 = l0 - 1;
1298  if (l1 < 0)
1299  l1 = l0 + 1;
1300  }
1301 
1302  // OK, lets do the template interpolation.
1303 
1304  // Calculate the x and y offsets to make the new template
1305 
1306  // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system
1307 
1308  ++pixx;
1309 
1310  // In the template store, the struck pixel is always (THy,THx)
1311 
1312  deltax = pixx - T2HX;
1313 
1314  // Loop over the non-zero part of the template index space and interpolate
1315 
1316  for (int j = jmin_; j <= jmax_; ++j) {
1317  // Flip indices as needed
1318  if (flip_x_) {
1319  jflipx = T2XSIZE - 1 - j;
1320  m = deltax + jflipx;
1321  } else {
1322  m = deltax + j;
1323  }
1324  for (int i = imin_; i <= imax_; ++i) {
1325  if (flip_y_) {
1326  iflipy = T2YSIZE - 1 - i;
1327  n = deltay + iflipy;
1328  } else {
1329  n = deltay + i;
1330  }
1331  if (m >= 0 && m <= BXM3 && n >= 0 && n <= BYM3) {
1332  dxytempdx[0][m][n] = (float)entry00_->xytemp[k0][l0][i][j] +
1333  adx * (float)(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1334  ady * (float)(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1335  adcota_ * (float)(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1336  adcotb_ * (float)(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]);
1337  }
1338  }
1339  }
1340 
1341  //combine rows and columns to simulate double pixels
1342 
1343  for (int n = 1; n < BYM3; ++n) {
1344  if (ydouble[n]) {
1345  // Combine the y-columns
1346  for (int m = 1; m < BXM3; ++m) {
1347  dxytempdx[0][m][n] += dxytempdx[0][m][n + 1];
1348  }
1349  // Now shift the remaining pixels over by one column
1350  for (int i = n + 1; i < BYM3; ++i) {
1351  for (int m = 1; m < BXM3; ++m) {
1352  dxytempdx[0][m][i] = dxytempdx[0][m][i + 1];
1353  }
1354  }
1355  }
1356  }
1357 
1358  //combine rows and columns to simulate double pixels
1359 
1360  for (int m = 1; m < BXM3; ++m) {
1361  if (xdouble[m]) {
1362  // Combine the x-rows
1363  for (int n = 1; n < BYM3; ++n) {
1364  dxytempdx[0][m][n] += dxytempdx[0][m + 1][n];
1365  }
1366  // Now shift the remaining pixels over by one row
1367  for (int j = m + 1; j < BXM3; ++j) {
1368  for (int n = 1; n < BYM3; ++n) {
1369  dxytempdx[0][j][n] = dxytempdx[0][j + 1][n];
1370  }
1371  }
1372  }
1373  }
1374 
1375  // Finally, normalize the derivatives and copy the results to the output array
1376 
1377  for (int n = 1; n < BYM3; ++n) {
1378  for (int m = 1; m < BXM3; ++m) {
1379  dpdx2d[0][m][n] = (dxytempdx[1][m][n] - dxytempdx[0][m][n]) / (2. * deltaxy[0]);
1380  }
1381  }
1382 
1383  // Next, do shifted y template
1384 
1385  pixy = (int)floorf((yhit + deltaxy[1]) / ysize_);
1386  dy = (yhit + deltaxy[1]) - (pixy + 0.5f) * ysize_;
1387  if (flip_y_) {
1388  dy = -dy;
1389  }
1390  k0 = (int)(dy / ysize_ * 6.f + 3.5f);
1391  if (k0 < 0)
1392  k0 = 0;
1393  if (k0 > 6)
1394  k0 = 6;
1395  ddy = 6.f * dy / ysize_ - (k0 - 3);
1396  ady = fabs(ddy);
1397  if (ddy > 0.f) {
1398  k1 = k0 + 1;
1399  if (k1 > 6)
1400  k1 = k0 - 1;
1401  } else {
1402  k1 = k0 - 1;
1403  if (k1 < 0)
1404  k1 = k0 + 1;
1405  }
1406  pixx = (int)floorf(xhit / xsize_);
1407  dx = xhit - (pixx + 0.5f) * xsize_;
1408  if (flip_x_) {
1409  dx = -dx;
1410  }
1411  l0 = (int)(dx / xsize_ * 6.f + 3.5f);
1412  if (l0 < 0)
1413  l0 = 0;
1414  if (l0 > 6)
1415  l0 = 6;
1416  ddx = 6.f * dx / xsize_ - (l0 - 3);
1417  adx = fabs(ddx);
1418  if (ddx > 0.f) {
1419  l1 = l0 + 1;
1420  if (l1 > 6)
1421  l1 = l0 - 1;
1422  } else {
1423  l1 = l0 - 1;
1424  if (l1 < 0)
1425  l1 = l0 + 1;
1426  }
1427 
1428  // OK, lets do the template interpolation.
1429 
1430  // Calculate the x and y offsets to make the new template
1431 
1432  // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system
1433 
1434  ++pixy;
1435  ++pixx;
1436 
1437  // In the template store, the struck pixel is always (THy,THx)
1438 
1439  deltax = pixx - T2HX;
1440  deltay = pixy - T2HY;
1441 
1442  // Loop over the non-zero part of the template index space and interpolate
1443 
1444  for (int j = jmin_; j <= jmax_; ++j) {
1445  // Flip indices as needed
1446  if (flip_x_) {
1447  jflipx = T2XSIZE - 1 - j;
1448  m = deltax + jflipx;
1449  } else {
1450  m = deltax + j;
1451  }
1452  for (int i = imin_; i <= imax_; ++i) {
1453  if (flip_y_) {
1454  iflipy = T2YSIZE - 1 - i;
1455  n = deltay + iflipy;
1456  } else {
1457  n = deltay + i;
1458  }
1459  if (m >= 0 && m <= BXM3 && n >= 0 && n <= BYM3) {
1460  dxytempdy[1][m][n] = (float)entry00_->xytemp[k0][l0][i][j] +
1461  adx * (float)(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1462  ady * (float)(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1463  adcota_ * (float)(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1464  adcotb_ * (float)(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]);
1465  }
1466  }
1467  }
1468 
1469  //combine rows and columns to simulate double pixels
1470 
1471  for (int n = 1; n < BYM3; ++n) {
1472  if (ydouble[n]) {
1473  // Combine the y-columns
1474  for (int m = 1; m < BXM3; ++m) {
1475  dxytempdy[1][m][n] += dxytempdy[1][m][n + 1];
1476  }
1477  // Now shift the remaining pixels over by one column
1478  for (int i = n + 1; i < BYM3; ++i) {
1479  for (int m = 1; m < BXM3; ++m) {
1480  dxytempdy[1][m][i] = dxytempdy[1][m][i + 1];
1481  }
1482  }
1483  }
1484  }
1485 
1486  //combine rows and columns to simulate double pixels
1487 
1488  for (int m = 1; m < BXM3; ++m) {
1489  if (xdouble[m]) {
1490  // Combine the x-rows
1491  for (int n = 1; n < BYM3; ++n) {
1492  dxytempdy[1][m][n] += dxytempdy[1][m + 1][n];
1493  }
1494  // Now shift the remaining pixels over by one row
1495  for (int j = m + 1; j < BXM3; ++j) {
1496  for (int n = 1; n < BYM3; ++n) {
1497  dxytempdy[1][j][n] = dxytempdy[1][j + 1][n];
1498  }
1499  }
1500  }
1501  }
1502 
1503  // Next, do shifted -y template
1504 
1505  pixy = (int)floorf((yhit - deltaxy[1]) / ysize_);
1506  dy = (yhit - deltaxy[1]) - (pixy + 0.5f) * ysize_;
1507  if (flip_y_) {
1508  dy = -dy;
1509  }
1510  k0 = (int)(dy / ysize_ * 6.f + 3.5f);
1511  if (k0 < 0)
1512  k0 = 0;
1513  if (k0 > 6)
1514  k0 = 6;
1515  ddy = 6.f * dy / ysize_ - (k0 - 3);
1516  ady = fabs(ddy);
1517  if (ddy > 0.f) {
1518  k1 = k0 + 1;
1519  if (k1 > 6)
1520  k1 = k0 - 1;
1521  } else {
1522  k1 = k0 - 1;
1523  if (k1 < 0)
1524  k1 = k0 + 1;
1525  }
1526 
1527  // OK, lets do the template interpolation.
1528 
1529  // Calculate the x and y offsets to make the new template
1530 
1531  // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system
1532 
1533  ++pixy;
1534 
1535  // In the template store, the struck pixel is always (THy,THx)
1536 
1537  deltay = pixy - T2HY;
1538 
1539  // Loop over the non-zero part of the template index space and interpolate
1540 
1541  for (int j = jmin_; j <= jmax_; ++j) {
1542  // Flip indices as needed
1543  if (flip_x_) {
1544  jflipx = T2XSIZE - 1 - j;
1545  m = deltax + jflipx;
1546  } else {
1547  m = deltax + j;
1548  }
1549  for (int i = imin_; i <= imax_; ++i) {
1550  if (flip_y_) {
1551  iflipy = T2YSIZE - 1 - i;
1552  n = deltay + iflipy;
1553  } else {
1554  n = deltay + i;
1555  }
1556  if (m >= 0 && m <= BXM3 && n >= 0 && n <= BYM3) {
1557  dxytempdy[0][m][n] = (float)entry00_->xytemp[k0][l0][i][j] +
1558  adx * (float)(entry00_->xytemp[k0][l1][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1559  ady * (float)(entry00_->xytemp[k1][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1560  adcota_ * (float)(entry01_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]) +
1561  adcotb_ * (float)(entry10_->xytemp[k0][l0][i][j] - entry00_->xytemp[k0][l0][i][j]);
1562  }
1563  }
1564  }
1565 
1566  //combine rows and columns to simulate double pixels
1567 
1568  for (int n = 1; n < BYM3; ++n) {
1569  if (ydouble[n]) {
1570  // Combine the y-columns
1571  for (int m = 1; m < BXM3; ++m) {
1572  dxytempdy[0][m][n] += dxytempdy[0][m][n + 1];
1573  }
1574  // Now shift the remaining pixels over by one column
1575  for (int i = n + 1; i < BYM3; ++i) {
1576  for (int m = 1; m < BXM3; ++m) {
1577  dxytempdy[0][m][i] = dxytempdy[0][m][i + 1];
1578  }
1579  }
1580  }
1581  }
1582 
1583  //combine rows and columns to simulate double pixels
1584 
1585  for (int m = 1; m < BXM3; ++m) {
1586  if (xdouble[m]) {
1587  // Combine the x-rows
1588  for (int n = 1; n < BYM3; ++n) {
1589  dxytempdy[0][m][n] += dxytempdy[0][m + 1][n];
1590  }
1591  // Now shift the remaining pixels over by one row
1592  for (int j = m + 1; j < BXM3; ++j) {
1593  for (int n = 1; n < BYM3; ++n) {
1594  dxytempdy[0][j][n] = dxytempdy[0][j + 1][n];
1595  }
1596  }
1597  }
1598  }
1599 
1600  // Finally, normalize the derivatives and copy the results to the output array
1601 
1602  for (int n = 1; n < BYM3; ++n) {
1603  for (int m = 1; m < BXM3; ++m) {
1604  dpdx2d[1][m][n] = (dxytempdy[1][m][n] - dxytempdy[0][m][n]) / (2. * deltaxy[1]);
1605  }
1606  }
1607  }
1608 
1609  return success_;
1610 } // xytemp
float adcotb_
fractional pixel distance of cot(beta) from iy0_
float xsize_
Pixel x-size.
bool flip_y_
flip y sign-sensitive quantities
#define T2HY
#define BXM3
#define T2HX
float xytemp_[13+2][21+2]
template for xy-reconstruction
const SiPixelTemplateEntry2D * entry01_
#define BXM2
int iymax
the maximum nonzero pixel yindex in template (saves time during interpolation)
float adcota_
fractional pixel distance of cot(alpha) from jx0_
#define T2XSIZE
int imin_
min y index of templated cluster
int iymin
the minimum nonzero pixel yindex in template (saves time during interpolation)
short int xytemp[7][7][21][7]
templates for y-reconstruction (binned over 1 central pixel)
const SiPixelTemplateEntry2D * entry00_
int jxmax
the maximum nonzero pixel xindex in template (saves time during interpolation)
int imax_
max y index of templated cluster
#define BYM2
double f[11][100]
int jxmin
the minimum nonzero pixel xindex in template (saves time during interpolation)
#define BYM3
const SiPixelTemplateEntry2D * entry10_
bool flip_x_
flip x sign-sensitive quantities
int jmax_
max x index of templated cluster
bool success_
true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded)
float ysize_
Pixel y-size.
#define T2YSIZE
int jmin_
min x index of templated cluster

◆ xytemp() [2/3]

bool SiPixelTemplate2D::xytemp ( float  xhit,
float  yhit,
bool  ydouble[21+2],
bool  xdouble[13+2],
float  template2d[13+2][21+2] 
)

Interpolate stored 2-D information for input angles and hit position to make a 2-D template

Parameters
xhit- (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter)
yhit- (input) y-position of hit relative to the lower left corner of pixel[1][1]
ydouble- (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1]
xdouble- (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1]
template2d- (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only.

Definition at line 1621 of file SiPixelTemplate2D.cc.

References BXM2, BYM2, and xytemp().

1622  {
1623  // Interpolate for a new set of track angles
1624 
1625  bool derivatives = false;
1626  float dpdx2d[2][BXM2][BYM2];
1627  float QTemplate;
1628 
1629  return SiPixelTemplate2D::xytemp(xhit, yhit, ydouble, xdouble, template2d, derivatives, dpdx2d, QTemplate);
1630 
1631 } // xytemp
bool xytemp(float xhit, float yhit, bool ydouble[21+2], bool xdouble[13+2], float template2d[13+2][21+2], bool dervatives, float dpdx2d[2][13+2][21+2], float &QTemplate)
#define BXM2
#define BYM2

◆ xytemp() [3/3]

bool SiPixelTemplate2D::xytemp ( int  id,
float  cotalpha,
float  cotbeta,
float  xhit,
float  yhit,
std::vector< bool > &  ydouble,
std::vector< bool > &  xdouble,
float  template2d[13+2][21+2] 
)

Interpolate stored 2-D information for input angles and hit position to make a 2-D template

Parameters
id- (input) the id of the template
cotalpha- (input) the cotangent of the alpha track angle (see CMS IN 2004/014)
cotbeta- (input) the cotangent of the beta track angle (see CMS IN 2004/014)
xhit- (input) x-position of hit relative to the lower left corner of pixel[1][1] (to allow for the "padding" of the two-d clusters in the splitter)
yhit- (input) y-position of hit relative to the lower left corner of pixel[1][1]
ydouble- (input) STL vector of 21 element array to flag a double-pixel starting at cluster[1][1]
xdouble- (input) STL vector of 11 element array to flag a double-pixel starting at cluster[1][1]
template2d- (output) 2d template of size matched to the cluster. Input must be zeroed since charge is added only.

Definition at line 1645 of file SiPixelTemplate2D.cc.

References BXM2, BYM2, f, mps_fire::i, interpolate(), dqmiolumiharvest::j, TXSIZE, TYSIZE, and xytemp().

1652  {
1653  // Local variables
1654 
1655  bool derivatives = false;
1656  float dpdx2d[2][BXM2][BYM2];
1657  float QTemplate;
1658  float locBx = 1.f;
1659  if (cotbeta < 0.f) {
1660  locBx = -1.f;
1661  }
1662  float locBz = locBx;
1663  if (cotalpha < 0.f) {
1664  locBz = -locBx;
1665  }
1666 
1667  bool yd[BYM2], xd[BXM2];
1668 
1669  yd[0] = false;
1670  yd[BYM2 - 1] = false;
1671  for (int i = 0; i < TYSIZE; ++i) {
1672  yd[i + 1] = ydouble[i];
1673  }
1674  xd[0] = false;
1675  xd[BXM2 - 1] = false;
1676  for (int j = 0; j < TXSIZE; ++j) {
1677  xd[j + 1] = xdouble[j];
1678  }
1679 
1680  // Interpolate for a new set of track angles
1681 
1682  if (SiPixelTemplate2D::interpolate(id, cotalpha, cotbeta, locBz, locBx)) {
1683  return SiPixelTemplate2D::xytemp(xhit, yhit, yd, xd, template2d, derivatives, dpdx2d, QTemplate);
1684  } else {
1685  return false;
1686  }
1687 
1688 } // xytemp
bool xytemp(float xhit, float yhit, bool ydouble[21+2], bool xdouble[13+2], float template2d[13+2][21+2], bool dervatives, float dpdx2d[2][13+2][21+2], float &QTemplate)
#define TXSIZE
#define BXM2
#define BYM2
double f[11][100]
bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx)
#define TYSIZE

◆ ysize()

float SiPixelTemplate2D::ysize ( )
inline

pixel y-size (microns)

Definition at line 263 of file SiPixelTemplate2D.h.

References ysize_.

Referenced by SiPixelTemplateReco2D::PixelTempReco2D(), and SiPixelChargeReweightingAlgorithm::PixelTempRewgt2D().

◆ zsize()

float SiPixelTemplate2D::zsize ( )
inline

pixel z-size or thickness (microns)

Definition at line 264 of file SiPixelTemplate2D.h.

References zsize_.

Member Data Documentation

◆ adcota_

float SiPixelTemplate2D::adcota_
private

fractional pixel distance of cot(alpha) from jx0_

Definition at line 303 of file SiPixelTemplate2D.h.

◆ adcotb_

float SiPixelTemplate2D::adcotb_
private

fractional pixel distance of cot(beta) from iy0_

Definition at line 300 of file SiPixelTemplate2D.h.

◆ chi2avgone_

float SiPixelTemplate2D::chi2avgone_
private

average chi^2 for 1 pixel clusters

Definition at line 326 of file SiPixelTemplate2D.h.

Referenced by chi2avgone().

◆ chi2minone_

float SiPixelTemplate2D::chi2minone_
private

minimum of chi^2 for 1 pixel clusters

Definition at line 327 of file SiPixelTemplate2D.h.

Referenced by chi2minone().

◆ chi2ppix_

float SiPixelTemplate2D::chi2ppix_
private

average chi^2 per struck pixel

Definition at line 324 of file SiPixelTemplate2D.h.

Referenced by chi2ppix().

◆ chi2scale_

float SiPixelTemplate2D::chi2scale_
private

scale factor for chi2 distribution

Definition at line 325 of file SiPixelTemplate2D.h.

Referenced by chi2scale().

◆ clslenx_

float SiPixelTemplate2D::clslenx_
private

projected x-length of cluster

Definition at line 329 of file SiPixelTemplate2D.h.

Referenced by clslenx(), and sizex().

◆ clsleny_

float SiPixelTemplate2D::clsleny_
private

projected y-length of cluster

Definition at line 328 of file SiPixelTemplate2D.h.

Referenced by clsleny(), and sizey().

◆ cota_current_

float SiPixelTemplate2D::cota_current_
private

current cot alpha

Definition at line 287 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

◆ cotalpha0_

float SiPixelTemplate2D::cotalpha0_
private

minimum cot(alpha) covered

Definition at line 295 of file SiPixelTemplate2D.h.

◆ cotalpha1_

float SiPixelTemplate2D::cotalpha1_
private

maximum cot(alpha) covered

Definition at line 296 of file SiPixelTemplate2D.h.

◆ cotb_current_

float SiPixelTemplate2D::cotb_current_
private

current cot beta

Definition at line 288 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

◆ cotbeta0_

float SiPixelTemplate2D::cotbeta0_
private

minimum cot(beta) covered

Definition at line 292 of file SiPixelTemplate2D.h.

◆ cotbeta1_

float SiPixelTemplate2D::cotbeta1_
private

maximum cot(beta) covered

Definition at line 293 of file SiPixelTemplate2D.h.

◆ deltacota_

float SiPixelTemplate2D::deltacota_
private

cot(alpha) bin size

Definition at line 297 of file SiPixelTemplate2D.h.

◆ deltacotb_

float SiPixelTemplate2D::deltacotb_
private

cot(beta) bin size

Definition at line 294 of file SiPixelTemplate2D.h.

◆ delyavg_

float SiPixelTemplate2D::delyavg_
private

average difference between clsleny_ and cluster length [with threshold effects]

Definition at line 332 of file SiPixelTemplate2D.h.

Referenced by delyavg().

◆ delysig_

float SiPixelTemplate2D::delysig_
private

rms of difference between clsleny_ and cluster length [with threshold effects]

Definition at line 333 of file SiPixelTemplate2D.h.

Referenced by delysig().

◆ Dtype_

int SiPixelTemplate2D::Dtype_
private

flags BPix (=0) or FPix (=1)

Definition at line 291 of file SiPixelTemplate2D.h.

◆ entry00_

const SiPixelTemplateEntry2D* SiPixelTemplate2D::entry00_
private

Definition at line 349 of file SiPixelTemplate2D.h.

◆ entry01_

const SiPixelTemplateEntry2D* SiPixelTemplate2D::entry01_
private

Definition at line 351 of file SiPixelTemplate2D.h.

◆ entry10_

const SiPixelTemplateEntry2D* SiPixelTemplate2D::entry10_
private

Definition at line 350 of file SiPixelTemplate2D.h.

◆ fbin_

float SiPixelTemplate2D::fbin_[3]
private

The QBin definitions in Q_clus/Q_avg.

Definition at line 348 of file SiPixelTemplate2D.h.

Referenced by fbin().

◆ flip_x_

bool SiPixelTemplate2D::flip_x_
private

flip x sign-sensitive quantities

Definition at line 309 of file SiPixelTemplate2D.h.

◆ flip_y_

bool SiPixelTemplate2D::flip_y_
private

flip y sign-sensitive quantities

Definition at line 308 of file SiPixelTemplate2D.h.

◆ id_current_

int SiPixelTemplate2D::id_current_
private

current id

Definition at line 285 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

◆ imax_

int SiPixelTemplate2D::imax_
private

max y index of templated cluster

Definition at line 305 of file SiPixelTemplate2D.h.

◆ imin_

int SiPixelTemplate2D::imin_
private

min y index of templated cluster

Definition at line 304 of file SiPixelTemplate2D.h.

◆ index_id_

int SiPixelTemplate2D::index_id_
private

current index

Definition at line 286 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

◆ iy0_

int SiPixelTemplate2D::iy0_
private

index of nearest cot(beta) bin

Definition at line 298 of file SiPixelTemplate2D.h.

◆ iy1_

int SiPixelTemplate2D::iy1_
private

index of next-nearest cot(beta) bin

Definition at line 299 of file SiPixelTemplate2D.h.

◆ jmax_

int SiPixelTemplate2D::jmax_
private

max x index of templated cluster

Definition at line 307 of file SiPixelTemplate2D.h.

◆ jmin_

int SiPixelTemplate2D::jmin_
private

min x index of templated cluster

Definition at line 306 of file SiPixelTemplate2D.h.

◆ jx0_

int SiPixelTemplate2D::jx0_
private

index of nearest cot(alpha) bin

Definition at line 301 of file SiPixelTemplate2D.h.

◆ jx1_

int SiPixelTemplate2D::jx1_
private

index of next-nearest cot(alpha) bin

Definition at line 302 of file SiPixelTemplate2D.h.

◆ kappavav_

float SiPixelTemplate2D::kappavav_
private

kappa parameter in Vavilov distribution

Definition at line 340 of file SiPixelTemplate2D.h.

Referenced by kappavav().

◆ lanpar_

float SiPixelTemplate2D::lanpar_[2][5]
private

Interpolated Landau parameters.

Definition at line 323 of file SiPixelTemplate2D.h.

◆ lorxdrift_

float SiPixelTemplate2D::lorxdrift_
private

Lorentz x-drift.

Definition at line 344 of file SiPixelTemplate2D.h.

Referenced by lorxdrift().

◆ lorxwidth_

float SiPixelTemplate2D::lorxwidth_
private

Lorentz x-width.

Definition at line 342 of file SiPixelTemplate2D.h.

◆ lorydrift_

float SiPixelTemplate2D::lorydrift_
private

Lorentz y-drift.

Definition at line 343 of file SiPixelTemplate2D.h.

Referenced by lorydrift().

◆ lorywidth_

float SiPixelTemplate2D::lorywidth_
private

Lorentz y-width (sign corrected for fpix frame)

Definition at line 341 of file SiPixelTemplate2D.h.

◆ mpvvav_

float SiPixelTemplate2D::mpvvav_
private

most probable Q in Vavilov distribution

Definition at line 338 of file SiPixelTemplate2D.h.

Referenced by mpvvav().

◆ Nxx_

int SiPixelTemplate2D::Nxx_
private

number of cot(alpha)-entries (rows) in template

Definition at line 290 of file SiPixelTemplate2D.h.

◆ Nyx_

int SiPixelTemplate2D::Nyx_
private

number of cot(beta)-entries (columns) in template

Definition at line 289 of file SiPixelTemplate2D.h.

◆ offsetx_

float SiPixelTemplate2D::offsetx_[4]
private

x-offset in charge bins

Definition at line 336 of file SiPixelTemplate2D.h.

Referenced by offsetx().

◆ offsety_

float SiPixelTemplate2D::offsety_[4]
private

y-offset in charge bins

Definition at line 337 of file SiPixelTemplate2D.h.

Referenced by offsety().

◆ pixmax_

float SiPixelTemplate2D::pixmax_
private

maximum pixel charge

Definition at line 315 of file SiPixelTemplate2D.h.

Referenced by pixmax().

◆ qavg_

float SiPixelTemplate2D::qavg_
private

average cluster charge for this set of track angles

Definition at line 314 of file SiPixelTemplate2D.h.

Referenced by qavg().

◆ qscale_

float SiPixelTemplate2D::qscale_
private

charge scaling factor

Definition at line 316 of file SiPixelTemplate2D.h.

Referenced by qscale().

◆ s50_

float SiPixelTemplate2D::s50_
private

1/2 of the pixel threshold signal in adc units

Definition at line 317 of file SiPixelTemplate2D.h.

Referenced by s50().

◆ scalex_

float SiPixelTemplate2D::scalex_[4]
private

x-error scale factor in charge bins

Definition at line 334 of file SiPixelTemplate2D.h.

Referenced by scalex().

◆ scalexavg_

float SiPixelTemplate2D::scalexavg_
private

average x-error scale factor

Definition at line 330 of file SiPixelTemplate2D.h.

Referenced by scalexavg().

◆ scaley_

float SiPixelTemplate2D::scaley_[4]
private

y-error scale factor in charge bins

Definition at line 335 of file SiPixelTemplate2D.h.

Referenced by scaley().

◆ scaleyavg_

float SiPixelTemplate2D::scaleyavg_
private

average y-error scale factor

Definition at line 331 of file SiPixelTemplate2D.h.

Referenced by scaleyavg().

◆ sigmavav_

float SiPixelTemplate2D::sigmavav_
private

scale factor in Vavilov distribution

Definition at line 339 of file SiPixelTemplate2D.h.

Referenced by sigmavav().

◆ success_

bool SiPixelTemplate2D::success_
private

true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded)

Definition at line 310 of file SiPixelTemplate2D.h.

◆ sxymax_

float SiPixelTemplate2D::sxymax_
private

average pixel signal for y-projection of cluster

Definition at line 318 of file SiPixelTemplate2D.h.

Referenced by sxymax().

◆ thePixelTemp_

const std::vector<SiPixelTemplateStore2D>& SiPixelTemplate2D::thePixelTemp_
private

Definition at line 354 of file SiPixelTemplate2D.h.

Referenced by storesize().

◆ xsize_

float SiPixelTemplate2D::xsize_
private

Pixel x-size.

Definition at line 345 of file SiPixelTemplate2D.h.

Referenced by xsize().

◆ xypary0x0_

float SiPixelTemplate2D::xypary0x0_[2][5]
private

Polynomial error parameterization at ix0,iy0.

Definition at line 320 of file SiPixelTemplate2D.h.

◆ xypary0x1_

float SiPixelTemplate2D::xypary0x1_[2][5]
private

Polynomial error parameterization at ix1,iy0.

Definition at line 322 of file SiPixelTemplate2D.h.

◆ xypary1x0_

float SiPixelTemplate2D::xypary1x0_[2][5]
private

Polynomial error parameterization at ix0,iy1.

Definition at line 321 of file SiPixelTemplate2D.h.

◆ xytemp_

float SiPixelTemplate2D::xytemp_[ 13+2][ 21+2]
private

template for xy-reconstruction

Definition at line 319 of file SiPixelTemplate2D.h.

◆ ysize_

float SiPixelTemplate2D::ysize_
private

Pixel y-size.

Definition at line 346 of file SiPixelTemplate2D.h.

Referenced by ysize().

◆ zsize_

float SiPixelTemplate2D::zsize_
private

Pixel z-size (thickness)

Definition at line 347 of file SiPixelTemplate2D.h.

Referenced by zsize().