CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
SiPixelTemplate2D Class Reference

#include <SiPixelTemplate2D.h>

Public Member Functions

float chi2avg (int i)
 average chi^2 in 4 charge bins More...
 
float chi2avgone ()
 //!< average y chi^2 for 1 pixel clusters More...
 
float chi2min (int i)
 minimum chi^2 in 4 charge bins More...
 
float chi2minone ()
 //!< minimum of y chi^2 for 1 pixel clusters More...
 
void landau_par (float lanpar[2][5])
 Return the Landau probability parameters for this set of cot(alpha, cot(beta) More...
 
float lorxwidth ()
 signed lorentz x-width (microns) More...
 
float lorywidth ()
 signed lorentz y-width (microns) 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...
 
 SiPixelTemplate2D (const std::vector< SiPixelTemplateStore2D > &thePixelTemp)
 Default constructor. 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 (int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector< bool > &ydouble, std::vector< bool > &xdouble, 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 xytemp (int j, int i)
 current 2-d template More...
 
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 > &thePixelTemp_)
 
static bool pushfile (const SiPixelTemplateDBObject &dbobject, std::vector< SiPixelTemplateStore2D > &thePixelTemp_)
 

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 chi2avg_ [4]
 average chi^2 in 4 charge bins More...
 
float chi2avgone_
 average chi^2 for 1 pixel clusters More...
 
float chi2min_ [4]
 minimum of chi^2 in 4 charge bins More...
 
float chi2minone_
 minimum of chi^2 for 1 pixel clusters 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...
 
int Dtype_
 flags BPix (=0) or FPix (=1) More...
 
int id_current_
 current id 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 jx0_
 index of nearest cot(alpha) bin More...
 
int jx1_
 index of next-nearest cot(alpha) bin More...
 
float lanpar_ [2][5]
 Interpolated Landau parameters. More...
 
float lorxwidth_
 Lorentz x-width. More...
 
float lorywidth_
 Lorentz y-width (sign corrected for fpix frame) More...
 
int Nxx_
 number of cot(alpha)-entries (rows) in template More...
 
int Nyx_
 number of cot(beta)-entries (columns) in template 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...
 
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]
 templates for y-reconstruction (binned over 5 central pixels) 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 105 of file SiPixelTemplate2D.h.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 107 of file SiPixelTemplate2D.h.

References cota_current_, cotb_current_, id_current_, and index_id_.

Member Function Documentation

float SiPixelTemplate2D::chi2avg ( int  i)
inline

average chi^2 in 4 charge bins

Definition at line 144 of file SiPixelTemplate2D.h.

References assert(), chi2avg_, edm::hlt::Exception, and i.

float SiPixelTemplate2D::chi2avgone ( )
inline

//!< average y chi^2 for 1 pixel clusters

Definition at line 158 of file SiPixelTemplate2D.h.

References chi2avgone_.

float SiPixelTemplate2D::chi2min ( int  i)
inline

minimum chi^2 in 4 charge bins

Definition at line 151 of file SiPixelTemplate2D.h.

References assert(), chi2min_, edm::hlt::Exception, and i.

float SiPixelTemplate2D::chi2minone ( )
inline

//!< minimum of y chi^2 for 1 pixel clusters

Definition at line 159 of file SiPixelTemplate2D.h.

References chi2minone_.

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

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

Definition at line 784 of file SiPixelTemplate2D.cc.

References i, and j.

Referenced by SiPixelTemplateSplit::PixelTempSplit().

786 {
787  // Interpolate using quantities already stored in the private variables
788 
789  // Local variables
790  int i,j;
791  for(i=0; i<2; ++i) {
792  for(j=0; j<5; ++j) {
793  lanpar[i][j] = lanpar_[i][j];
794  }
795  }
796  return;
797 
798 } // End lan_par
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
float lanpar_[2][5]
Interpolated Landau parameters.
float SiPixelTemplate2D::lorxwidth ( )
inline

signed lorentz x-width (microns)

Definition at line 161 of file SiPixelTemplate2D.h.

References lorxwidth_.

float SiPixelTemplate2D::lorywidth ( )
inline

signed lorentz y-width (microns)

Definition at line 160 of file SiPixelTemplate2D.h.

References lorywidth_.

float SiPixelTemplate2D::pixmax ( )
inline

maximum pixel charge

Definition at line 133 of file SiPixelTemplate2D.h.

References pixmax_.

bool SiPixelTemplate2D::pushfile ( int  filenum,
std::vector< SiPixelTemplateStore2D > &  thePixelTemp_ 
)
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

Definition at line 52 of file SiPixelTemplate2D.cc.

References SiPixelTemplateHeader2D::Bfield, EnergyCorrector::c, SiPixelTemplateHeader2D::Dtype, ENDL, SiPixelTemplateStore2D::entry, mergeVDriftHistosByStation::file, SiPixelTemplateHeader2D::fluence, SiPixelTemplateStore2D::head, i, SiPixelTemplateHeader2D::ID, recoMuon::in, create_public_lumi_plots::in_file, j, relval_steps::k, prof2calltree::l, LOGERROR, LOGINFO, SiPixelTemplateHeader2D::lorxwidth, SiPixelTemplateHeader2D::lorywidth, SiPixelTemplateHeader2D::NTxx, SiPixelTemplateHeader2D::NTy, SiPixelTemplateHeader2D::NTyx, SiPixelTemplateHeader2D::qscale, SiPixelTemplateHeader2D::s50, AlCaHLTBitMon_QueryRunRegistry::string, T2XSIZE, T2YSIZE, SiPixelTemplateHeader2D::temperature, SiPixelTemplateHeader2D::templ_version, SiPixelTemplateHeader2D::title, SiPixelTemplateHeader2D::Vbias, SiPixelTemplateHeader2D::xsize, SiPixelTemplateHeader2D::ysize, and SiPixelTemplateHeader2D::zsize.

Referenced by PixelCPETemplateReco::localPosition(), and TrackClusterSplitter::TrackClusterSplitter().

53 {
54  // Add template stored in external file numbered filenum to theTemplateStore
55 
56  // Local variables
57  int i, j, k, l, iy, jx;
58  const char *tempfile;
59  // char title[80]; remove this
60  char c;
61  const int code_version={16};
62 
63 
64 
65  // Create a filename for this run
66 
67  std::ostringstream tout;
68 
69  // Create different path in CMSSW than standalone
70 
71 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
72  tout << "CalibTracker/SiPixelESProducers/data/template_summary2D_zp"
73  << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends;
74  std::string tempf = tout.str();
75  edm::FileInPath file( tempf.c_str() );
76  tempfile = (file.fullPath()).c_str();
77 #else
78  tout << "template_summary2D_zp" << std::setw(4) << std::setfill('0') << std::right << filenum << ".out" << std::ends;
79  std::string tempf = tout.str();
80  tempfile = tempf.c_str();
81 #endif
82 
83  // open the template file
84 
85  std::ifstream in_file(tempfile, std::ios::in);
86 
87  if(in_file.is_open()) {
88 
89  // Create a local template storage entry
90 
91  SiPixelTemplateStore2D theCurrentTemp;
92 
93  // Read-in a header string first and print it
94 
95  for (i=0; (c=in_file.get()) != '\n'; ++i) {
96  if(i < 79) {theCurrentTemp.head.title[i] = c;}
97  }
98  if(i > 78) {i=78;}
99  theCurrentTemp.head.title[i+1] ='\0';
100  LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL;
101 
102  // next, the header information
103 
104  in_file >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx
105  >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale
106  >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize;
107 
108  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file, no template load" << ENDL; return false;}
109 
110  LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield
111  << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype
112  << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature "
113  << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale
114  << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth
115  << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL;
116 
117  if(theCurrentTemp.head.templ_version != code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;}
118 
119  if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;}
120 
121  // next, layout the 2-d structure needed to store template
122 
123  theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
124 
125  // Read in the file info
126 
127  for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) {
128  for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) {
129 
130  in_file >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0]
131  >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2];
132 
133  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
134 
135  // Calculate cot(alpha) and cot(beta) for this entry
136 
137  theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2];
138 
139  theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2];
140 
141  in_file >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin
142  >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax;
143 
144  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
145 
146  for (k=0; k<2; ++k) {
147 
148  in_file >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1]
149  >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4];
150 
151  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
152 
153  }
154 
155  for (k=0; k<2; ++k) {
156 
157  in_file >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1]
158  >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4];
159 
160  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
161 
162  }
163 
164  for (l=0; l<7; ++l) {
165  for (k=0; k<7; ++k) {
166  for (j=0; j<T2XSIZE; ++j) {
167 
168  for (i=0; i<T2YSIZE; ++i) {in_file >> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];}
169 
170  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
171  }
172  }
173  }
174 
175 
176  in_file >> theCurrentTemp.entry[iy][jx].chi2minone >> theCurrentTemp.entry[iy][jx].chi2avgone >> theCurrentTemp.entry[iy][jx].chi2min[0] >> theCurrentTemp.entry[iy][jx].chi2avg[0]
177  >> theCurrentTemp.entry[iy][jx].chi2min[1] >> theCurrentTemp.entry[iy][jx].chi2avg[1]>> theCurrentTemp.entry[iy][jx].chi2min[2] >> theCurrentTemp.entry[iy][jx].chi2avg[2]
178  >> theCurrentTemp.entry[iy][jx].chi2min[3] >> theCurrentTemp.entry[iy][jx].chi2avg[3];
179 
180  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
181 
182  in_file >> theCurrentTemp.entry[iy][jx].spare[0] >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2] >> theCurrentTemp.entry[iy][jx].spare[3]
183  >> theCurrentTemp.entry[iy][jx].spare[4] >> theCurrentTemp.entry[iy][jx].spare[5] >> theCurrentTemp.entry[iy][jx].spare[6] >> theCurrentTemp.entry[iy][jx].spare[7]
184  >> theCurrentTemp.entry[iy][jx].spare[8] >> theCurrentTemp.entry[iy][jx].spare[9];
185 
186  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
187 
188  in_file >> theCurrentTemp.entry[iy][jx].spare[10] >> theCurrentTemp.entry[iy][jx].spare[11] >> theCurrentTemp.entry[iy][jx].spare[12] >> theCurrentTemp.entry[iy][jx].spare[13]
189  >> theCurrentTemp.entry[iy][jx].spare[14] >> theCurrentTemp.entry[iy][jx].spare[15] >> theCurrentTemp.entry[iy][jx].spare[16] >> theCurrentTemp.entry[iy][jx].spare[17]
190  >> theCurrentTemp.entry[iy][jx].spare[18] >> theCurrentTemp.entry[iy][jx].spare[19];
191 
192  if(in_file.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
193  }
194 
195  }
196 
197 
198  in_file.close();
199 
200  // Add this template to the store
201 
202  thePixelTemp_.push_back(theCurrentTemp);
203 
204  return true;
205 
206  } else {
207 
208  // If file didn't open, report this
209 
210  LOGERROR("SiPixelTemplate2D") << "Error opening File" << tempfile << ENDL;
211  return false;
212 
213  }
214 
215 } // TempInit
float qscale
Charge scaling to match cmssw and pixelav.
int i
Definition: DBlmapReader.cc:9
float Vbias
detector bias potential in Volts
float lorxwidth
estimate of x-lorentz width from single pixel offset
float ysize
pixel size (for future use in upgraded geometry)
SiPixelTemplateHeader2D head
&lt; template storage structure
#define ENDL
boost::multi_array< SiPixelTemplateEntry2D, 2 > entry
use 2d entry to store [47][5] barrel entries or [5][9] fpix entries
#define T2XSIZE
int ID
template ID number
#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)
int j
Definition: DBlmapReader.cc:9
char title[80]
&lt; template header structure
float zsize
pixel size (for future use in upgraded geometry)
float lorywidth
estimate of y-lorentz width from single pixel offset
int NTy
number of Template y entries (= 0 for 2-D templates)
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 readout threshold in ADC units
float temperature
detector temperature in deg K
float Bfield
Bfield in Tesla.
#define T2YSIZE
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
float fluence
radiation fluence in n_eq/cm^2
int NTyx
number of Template y-slices of x entries
bool SiPixelTemplate2D::pushfile ( const SiPixelTemplateDBObject dbobject,
std::vector< SiPixelTemplateStore2D > &  thePixelTemp_ 
)
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 225 of file SiPixelTemplate2D.cc.

References SiPixelTemplateHeader2D::Bfield, SiPixelTemplateDBObject::char2float::c, EcalCondDB::db, SiPixelTemplateHeader2D::Dtype, ENDL, SiPixelTemplateStore2D::entry, SiPixelTemplateDBObject::char2float::f, SiPixelTemplateDBObject::fail(), SiPixelTemplateHeader2D::fluence, SiPixelTemplateStore2D::head, i, SiPixelTemplateHeader2D::ID, SiPixelTemplateDBObject::incrementIndex(), SiPixelTemplateDBObject::index(), j, relval_steps::k, prof2calltree::l, LOGERROR, LOGINFO, SiPixelTemplateHeader2D::lorxwidth, SiPixelTemplateHeader2D::lorywidth, visualization-live-secondInstance_cfg::m, SiPixelTemplateHeader2D::NTxx, SiPixelTemplateHeader2D::NTy, SiPixelTemplateHeader2D::NTyx, SiPixelTemplateDBObject::numOfTempl(), SiPixelTemplateHeader2D::qscale, SiPixelTemplateHeader2D::s50, SiPixelTemplateDBObject::sVector(), T2XSIZE, T2YSIZE, groupFilesInBlocks::temp, SiPixelTemplateHeader2D::temperature, SiPixelTemplateHeader2D::templ_version, SiPixelTemplateHeader2D::title, SiPixelTemplateHeader2D::Vbias, SiPixelTemplateHeader2D::xsize, SiPixelTemplateHeader2D::ysize, and SiPixelTemplateHeader2D::zsize.

226 {
227  // Add template stored in external dbobject to theTemplateStore
228 
229  // Local variables
230  int i, j, k, l, iy, jx;
231  // const char *tempfile;
232  const int code_version={16};
233 
234  // We must create a new object because dbobject must be a const and our stream must not be
235  SiPixelTemplateDBObject db = dbobject;
236 
237  // Create a local template storage entry
238  SiPixelTemplateStore2D theCurrentTemp;
239 
240  // Fill the template storage for each template calibration stored in the db
241  for(int m=0; m<db.numOfTempl(); ++m)
242  {
243 
244  // Read-in a header string first and print it
245 
247  for (i=0; i<20; ++i) {
248  temp.f = db.sVector()[db.index()];
249  theCurrentTemp.head.title[4*i] = temp.c[0];
250  theCurrentTemp.head.title[4*i+1] = temp.c[1];
251  theCurrentTemp.head.title[4*i+2] = temp.c[2];
252  theCurrentTemp.head.title[4*i+3] = temp.c[3];
253  db.incrementIndex(1);
254  }
255  theCurrentTemp.head.title[79] = '\0';
256  LOGINFO("SiPixelTemplate2D") << "Loading Pixel Template File - " << theCurrentTemp.head.title << ENDL;
257 
258  // next, the header information
259 
260  db >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx
261  >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale
262  >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize;
263 
264  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file, no template load" << ENDL; return false;}
265 
266  LOGINFO("SiPixelTemplate2D") << "Template ID = " << theCurrentTemp.head.ID << ", Template Version " << theCurrentTemp.head.templ_version << ", Bfield = " << theCurrentTemp.head.Bfield
267  << ", NTy = " << theCurrentTemp.head.NTy << ", NTyx = " << theCurrentTemp.head.NTyx<< ", NTxx = " << theCurrentTemp.head.NTxx << ", Dtype = " << theCurrentTemp.head.Dtype
268  << ", Bias voltage " << theCurrentTemp.head.Vbias << ", temperature "
269  << theCurrentTemp.head.temperature << ", fluence " << theCurrentTemp.head.fluence << ", Q-scaling factor " << theCurrentTemp.head.qscale
270  << ", 1/2 threshold " << theCurrentTemp.head.s50 << ", y Lorentz Width " << theCurrentTemp.head.lorywidth << ", x Lorentz width " << theCurrentTemp.head.lorxwidth
271  << ", pixel x-size " << theCurrentTemp.head.xsize << ", y-size " << theCurrentTemp.head.ysize << ", zsize " << theCurrentTemp.head.zsize << ENDL;
272 
273  if(theCurrentTemp.head.templ_version != code_version) {LOGERROR("SiPixelTemplate2D") << "code expects version " << code_version << ", no template load" << ENDL; return false;}
274 
275  if(theCurrentTemp.head.NTy != 0) {LOGERROR("SiPixelTemplate2D") << "Trying to load 1-d template info into the 2-d template object, check your DB/global tag!" << ENDL; return false;}
276 
277  // next, layout the 2-d structure needed to store template
278 
279  theCurrentTemp.entry.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
280 
281  // Read in the file info
282 
283  for (iy=0; iy < theCurrentTemp.head.NTyx; ++iy) {
284  for(jx=0; jx < theCurrentTemp.head.NTxx; ++jx) {
285 
286  db >> theCurrentTemp.entry[iy][jx].runnum >> theCurrentTemp.entry[iy][jx].costrk[0]
287  >> theCurrentTemp.entry[iy][jx].costrk[1] >> theCurrentTemp.entry[iy][jx].costrk[2];
288 
289  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 1, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
290 
291  // Calculate cot(alpha) and cot(beta) for this entry
292 
293  theCurrentTemp.entry[iy][jx].cotalpha = theCurrentTemp.entry[iy][jx].costrk[0]/theCurrentTemp.entry[iy][jx].costrk[2];
294 
295  theCurrentTemp.entry[iy][jx].cotbeta = theCurrentTemp.entry[iy][jx].costrk[1]/theCurrentTemp.entry[iy][jx].costrk[2];
296 
297  db >> theCurrentTemp.entry[iy][jx].qavg >> theCurrentTemp.entry[iy][jx].pixmax >> theCurrentTemp.entry[iy][jx].sxymax >> theCurrentTemp.entry[iy][jx].iymin
298  >> theCurrentTemp.entry[iy][jx].iymax >> theCurrentTemp.entry[iy][jx].jxmin >> theCurrentTemp.entry[iy][jx].jxmax;
299 
300  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 2, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
301 
302  for (k=0; k<2; ++k) {
303 
304  db >> theCurrentTemp.entry[iy][jx].xypar[k][0] >> theCurrentTemp.entry[iy][jx].xypar[k][1]
305  >> theCurrentTemp.entry[iy][jx].xypar[k][2] >> theCurrentTemp.entry[iy][jx].xypar[k][3] >> theCurrentTemp.entry[iy][jx].xypar[k][4];
306 
307  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 3, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
308 
309  }
310 
311  for (k=0; k<2; ++k) {
312 
313  db >> theCurrentTemp.entry[iy][jx].lanpar[k][0] >> theCurrentTemp.entry[iy][jx].lanpar[k][1]
314  >> theCurrentTemp.entry[iy][jx].lanpar[k][2] >> theCurrentTemp.entry[iy][jx].lanpar[k][3] >> theCurrentTemp.entry[iy][jx].lanpar[k][4];
315 
316  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 4, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
317 
318  }
319 
320  for (l=0; l<7; ++l) {
321  for (k=0; k<7; ++k) {
322  for (j=0; j<T2XSIZE; ++j) {
323 
324  for (i=0; i<T2YSIZE; ++i) {db >> theCurrentTemp.entry[iy][jx].xytemp[k][l][i][j];}
325 
326  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 5, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
327  }
328  }
329  }
330 
331 
332  db >> theCurrentTemp.entry[iy][jx].chi2minone >> theCurrentTemp.entry[iy][jx].chi2avgone >> theCurrentTemp.entry[iy][jx].chi2min[0] >> theCurrentTemp.entry[iy][jx].chi2avg[0]
333  >> theCurrentTemp.entry[iy][jx].chi2min[1] >> theCurrentTemp.entry[iy][jx].chi2avg[1]>> theCurrentTemp.entry[iy][jx].chi2min[2] >> theCurrentTemp.entry[iy][jx].chi2avg[2]
334  >> theCurrentTemp.entry[iy][jx].chi2min[3] >> theCurrentTemp.entry[iy][jx].chi2avg[3];
335 
336  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 6, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
337 
338  db >> theCurrentTemp.entry[iy][jx].spare[0] >> theCurrentTemp.entry[iy][jx].spare[1] >> theCurrentTemp.entry[iy][jx].spare[2] >> theCurrentTemp.entry[iy][jx].spare[3]
339  >> theCurrentTemp.entry[iy][jx].spare[4] >> theCurrentTemp.entry[iy][jx].spare[5] >> theCurrentTemp.entry[iy][jx].spare[6] >> theCurrentTemp.entry[iy][jx].spare[7]
340  >> theCurrentTemp.entry[iy][jx].spare[8] >> theCurrentTemp.entry[iy][jx].spare[9];
341 
342  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 7, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
343 
344  db >> theCurrentTemp.entry[iy][jx].spare[10] >> theCurrentTemp.entry[iy][jx].spare[11] >> theCurrentTemp.entry[iy][jx].spare[12] >> theCurrentTemp.entry[iy][jx].spare[13]
345  >> theCurrentTemp.entry[iy][jx].spare[14] >> theCurrentTemp.entry[iy][jx].spare[15] >> theCurrentTemp.entry[iy][jx].spare[16] >> theCurrentTemp.entry[iy][jx].spare[17]
346  >> theCurrentTemp.entry[iy][jx].spare[18] >> theCurrentTemp.entry[iy][jx].spare[19];
347 
348  if(db.fail()) {LOGERROR("SiPixelTemplate2D") << "Error reading file 8, no template load, run # " << theCurrentTemp.entry[iy][jx].runnum << ENDL; return false;}
349 
350  }
351  }
352 
353  }
354 
355 
356 // Add this template to the store
357 
358  thePixelTemp_.push_back(theCurrentTemp);
359 
360  return true;
361 
362 } // TempInit
float qscale
Charge scaling to match cmssw and pixelav.
int i
Definition: DBlmapReader.cc:9
float Vbias
detector bias potential in Volts
float lorxwidth
estimate of x-lorentz width from single pixel offset
float ysize
pixel size (for future use in upgraded geometry)
SiPixelTemplateHeader2D head
&lt; template storage structure
tuple db
Definition: EcalCondDB.py:151
#define ENDL
boost::multi_array< SiPixelTemplateEntry2D, 2 > entry
use 2d entry to store [47][5] barrel entries or [5][9] fpix entries
#define T2XSIZE
int ID
template ID number
#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)
int j
Definition: DBlmapReader.cc:9
char title[80]
&lt; template header structure
float zsize
pixel size (for future use in upgraded geometry)
float lorywidth
estimate of y-lorentz width from single pixel offset
int NTy
number of Template y entries (= 0 for 2-D templates)
int Dtype
detector type (0=BPix, 1=FPix)
std::vector< float > const & sVector() const
int templ_version
Version number of the template to ensure code compatibility.
float s50
1/2 of the readout threshold in ADC units
float temperature
detector temperature in deg K
float Bfield
Bfield in Tesla.
#define T2YSIZE
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
float fluence
radiation fluence in n_eq/cm^2
int NTyx
number of Template y-slices of x entries
float SiPixelTemplate2D::qavg ( )
inline

average cluster charge for this set of track angles

Definition at line 132 of file SiPixelTemplate2D.h.

References qavg_.

float SiPixelTemplate2D::qscale ( )
inline

charge scaling factor

Definition at line 134 of file SiPixelTemplate2D.h.

References qscale_.

float SiPixelTemplate2D::s50 ( )
inline

1/2 of the pixel threshold signal in adc units

Definition at line 135 of file SiPixelTemplate2D.h.

References s50_.

int SiPixelTemplate2D::storesize ( )
inline

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

Definition at line 165 of file SiPixelTemplate2D.h.

References thePixelTemp_.

float SiPixelTemplate2D::sxymax ( )
inline

max pixel signal for pixel error calculation

Definition at line 136 of file SiPixelTemplate2D.h.

References sxymax_.

float SiPixelTemplate2D::xsize ( )
inline

pixel x-size (microns)

Definition at line 162 of file SiPixelTemplate2D.h.

References xsize_.

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 731 of file SiPixelTemplate2D.cc.

References assert(), BYM2, ENDL, edm::hlt::Exception, f, LOGERROR, and THXP1.

733 {
734  // Interpolate using quantities already stored in the private variables
735 
736  // Local variables
737  float sigi, sigi2, sigi3, sigi4, qscale, err2, err00;
738 
739  // Make sure that input is OK
740 
741 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
742  if(index < 2 || index >= BYM2) {
743  throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::ysigma2 called with index = " << index << std::endl;
744  }
745 #else
746  assert(index > 1 && index < BYM2);
747 #endif
748 
749  // Define the maximum signal to use in the parameterization
750 
751  // Evaluate pixel-by-pixel uncertainties (weights) for the templ analysis
752 
753  if(qpixel < sxymax_) {
754  sigi = qpixel;
755  qscale = 1.f;
756  } else {
757  sigi = sxymax_;
758  qscale = qpixel/sxymax_;
759  }
760  sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
761  if(index <= THXP1) {
762  err00 = xypary0x0_[0][0]+xypary0x0_[0][1]*sigi+xypary0x0_[0][2]*sigi2+xypary0x0_[0][3]*sigi3+xypary0x0_[0][4]*sigi4;
763  err2 = err00
764  +adcota_*(xypary0x1_[0][0]+xypary0x1_[0][1]*sigi+xypary0x1_[0][2]*sigi2+xypary0x1_[0][3]*sigi3+xypary0x1_[0][4]*sigi4 - err00)
765  +adcotb_*(xypary1x0_[0][0]+xypary1x0_[0][1]*sigi+xypary1x0_[0][2]*sigi2+xypary1x0_[0][3]*sigi3+xypary1x0_[0][4]*sigi4 - err00);
766  } else {
767  err00 = xypary0x0_[1][0]+xypary0x0_[1][1]*sigi+xypary0x0_[1][2]*sigi2+xypary0x0_[1][3]*sigi3+xypary0x0_[1][4]*sigi4;
768  err2 = err00
769  +adcota_*(xypary0x1_[1][0]+xypary0x1_[1][1]*sigi+xypary0x1_[1][2]*sigi2+xypary0x1_[1][3]*sigi3+xypary0x1_[1][4]*sigi4 - err00)
770  +adcotb_*(xypary1x0_[1][0]+xypary1x0_[1][1]*sigi+xypary1x0_[1][2]*sigi2+xypary1x0_[1][3]*sigi3+xypary1x0_[1][4]*sigi4 - err00);
771  }
772  xysig2 =qscale*err2;
773  if(xysig2 <= 0.f) {LOGERROR("SiPixelTemplate2D") << "neg y-error-squared, id = " << id_current_ << ", index = " << index_id_ <<
774  ", cot(alpha) = " << cota_current_ << ", cot(beta) = " << cotb_current_ << ", sigi = " << sigi << ENDL;}
775 
776  return;
777 
778 } // End xysigma2
float adcotb_
fractional pixel distance of cot(beta) from iy0_
assert(m_qm.get())
#define ENDL
float xypary0x1_[2][5]
Polynomial error parameterization at ix1,iy0.
float sxymax_
average pixel signal for y-projection of cluster
int index_id_
current index
float adcota_
fractional pixel distance of cot(alpha) from jx0_
#define LOGERROR(x)
#define BYM2
double f[11][100]
float cota_current_
current cot alpha
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.
float cotb_current_
current cot beta
int id_current_
current id
#define THXP1
bool SiPixelTemplate2D::xytemp ( int  id,
float  cotalpha,
float  cotbeta,
float  locBz,
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)
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 FPix IP-related tracks, locBz < 0 for cot(beta) > 0 and locBz > 0 for cot(beta) < 0
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 382 of file SiPixelTemplate2D.cc.

References funct::abs(), assert(), BXM2, BXM3, BYM2, BYM3, edm::hlt::Exception, f, i, j, reco::ParticleMasses::k0, visualization-live-secondInstance_cfg::m, bookConverter::max, min(), gen::n, T2HX, T2HY, and T2YSIZE.

Referenced by SiPixelTemplateSplit::PixelTempSplit(), TrackClusterSplitter::splitCluster(), and xytemp().

383 {
384  // Interpolate for a new set of track angles
385 
386  // Local variables
387  int i, j;
388  int pixx, pixy, k0, k1, l0, l1, imidx, deltax, deltay, iflipy, imin, imax, jmin, jmax;
389  int m, n;
390  float acotb, dcota, dcotb, dx, dy, ddx, ddy, adx, ady, tmpxy;
391  bool flip_y;
392 // std::vector <float> xrms(4), xgsig(4), xrmsc2m(4), xgsigc2m(4);
393  std::vector <float> chi2xavg(4), chi2xmin(4);
394 
395 
396 // Check to see if interpolation is valid
397 
398  if(id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
399 
400  cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ = true;
401 
402  if(id != id_current_) {
403 
404  // Find the index corresponding to id
405 
406  index_id_ = -1;
407  for(i=0; i<(int)thePixelTemp_.size(); ++i) {
408 
409  if(id == thePixelTemp_[i].head.ID) {
410 
411  index_id_ = i;
412  id_current_ = id;
413 
414 // Copy the charge scaling factor to the private variable
415 
416  Dtype_ = thePixelTemp_[index_id_].head.Dtype;
417 
418 // Copy the charge scaling factor to the private variable
419 
420  qscale_ = thePixelTemp_[index_id_].head.qscale;
421 
422 // Copy the pseudopixel signal size to the private variable
423 
424  s50_ = thePixelTemp_[index_id_].head.s50;
425 
426 // Copy the Lorentz widths to private variables
427 
428  lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
429  lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
430 
431 // Copy the pixel sizes private variables
432 
433  xsize_ = thePixelTemp_[index_id_].head.xsize;
434  ysize_ = thePixelTemp_[index_id_].head.ysize;
435  zsize_ = thePixelTemp_[index_id_].head.zsize;
436 
437 // Determine the size of this template
438 
439  Nyx_ = thePixelTemp_[index_id_].head.NTyx;
440  Nxx_ = thePixelTemp_[index_id_].head.NTxx;
441 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
442  if(Nyx_ < 2 || Nxx_ < 2) {
443  throw cms::Exception("DataCorrupt") << "template ID = " << id_current_ << "has too few entries: Nyx/Nxx = " << Nyx_ << "/" << Nxx_ << std::endl;
444  }
445 #else
446  assert(Nyx_ > 1 && Nxx_ > 1);
447 #endif
448  imidx = Nxx_/2;
449 
450  cotalpha0_ = thePixelTemp_[index_id_].entry[0][0].cotalpha;
451  cotalpha1_ = thePixelTemp_[index_id_].entry[0][Nxx_-1].cotalpha;
452  deltacota_ = (cotalpha1_-cotalpha0_)/(float)(Nxx_-1);
453 
454  cotbeta0_ = thePixelTemp_[index_id_].entry[0][imidx].cotbeta;
455  cotbeta1_ = thePixelTemp_[index_id_].entry[Nyx_-1][imidx].cotbeta;
456  deltacotb_ = (cotbeta1_-cotbeta0_)/(float)(Nyx_-1);
457 
458  break;
459  }
460  }
461  }
462  }
463 
464 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
465  if(index_id_ < 0 || index_id_ >= (int)thePixelTemp_.size()) {
466  throw cms::Exception("DataCorrupt") << "SiPixelTemplate2D::interpolate can't find needed template ID = " << id
467  << ", Are you using the correct global tag?" << std::endl;
468  }
469 #else
470  assert(index_id_ >= 0 && index_id_ < (int)thePixelTemp_.size());
471 #endif
472 
473 // Check angle limits and et up interpolation parameters
474 
475  if(cotalpha < cotalpha0_) {
476  success_ = false;
477  jx0_ = 0;
478  jx1_ = 1;
479  adcota_ = 0.f;
480  } else if(cotalpha > cotalpha1_) {
481  success_ = false;
482  jx0_ = Nxx_ - 1;
483  jx1_ = jx0_ - 1;
484  adcota_ = 0.f;
485  } else {
486  jx0_ = (int)((cotalpha-cotalpha0_)/deltacota_+0.5f);
487  dcota = (cotalpha - (cotalpha0_ + jx0_*deltacota_))/deltacota_;
488  adcota_ = fabs(dcota);
489  if(dcota > 0.f) {jx1_ = jx0_ + 1;if(jx1_ > Nxx_-1) jx1_ = jx0_-1;} else {jx1_ = jx0_ - 1; if(jx1_ < 0) jx1_ = jx0_+1;}
490  }
491 
492 // Interpolate the absolute value of cot(beta)
493 
494  acotb = std::abs(cotbeta);
495 
496  if(acotb < cotbeta0_) {
497  success_ = false;
498  iy0_ = 0;
499  iy1_ = 1;
500  adcotb_ = 0.f;
501  } else if(acotb > cotbeta1_) {
502  success_ = false;
503  iy0_ = Nyx_ - 1;
504  iy1_ = iy0_ - 1;
505  adcotb_ = 0.f;
506  } else {
507  iy0_ = (int)((acotb-cotbeta0_)/deltacotb_+0.5f);
508  dcotb = (acotb - (cotbeta0_ + iy0_*deltacotb_))/deltacotb_;
509  adcotb_ = fabs(dcotb);
510  if(dcotb > 0.f) {iy1_ = iy0_ + 1; if(iy1_ > Nyx_-1) iy1_ = iy0_-1;} else {iy1_ = iy0_ - 1; if(iy1_ < 0) iy1_ = iy0_+1;}
511  }
512 
513 // This works only for IP-related tracks
514 
515  flip_y = false;
516  if(cotbeta < 0.f) {flip_y = true;}
517 
518 // If Fpix-related track has wrong cotbeta-field correlation, return false to trigger simple template instead
519 
520  if(Dtype_ == 1) {
521  if(cotbeta*locBz > 0.f) success_ = false;
522  }
523 
524 // Interpolate things in cot(alpha)-cot(beta)
525 
526  qavg_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg
527  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].qavg - thePixelTemp_[index_id_].entry[iy0_][jx0_].qavg)
529 
530  pixmax_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax
531  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].pixmax - thePixelTemp_[index_id_].entry[iy0_][jx0_].pixmax)
533 
534  sxymax_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax
535  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].sxymax - thePixelTemp_[index_id_].entry[iy0_][jx0_].sxymax)
537 
538  chi2avgone_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone
539  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2avgone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avgone)
541 
542  chi2minone_ = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone
543  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2minone - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2minone)
545 
546  for(i=0; i<4 ; ++i) {
547  chi2avg_[i] = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i]
548  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2avg[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2avg[i])
550 
551  chi2min_[i] = thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i]
552  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].chi2min[i] - thePixelTemp_[index_id_].entry[iy0_][jx0_].chi2min[i])
554  }
555 
556  for(i=0; i<2 ; ++i) {
557  for(j=0; j<5 ; ++j) {
558  // Charge loss switches sides when cot(beta) changes sign
559  if(flip_y) {
560  xypary0x0_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].xypar[i][j];
561  xypary1x0_[1-i][j] = thePixelTemp_[index_id_].entry[iy1_][jx0_].xypar[i][j];
562  xypary0x1_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx1_].xypar[i][j];
563  lanpar_[1-i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]
564  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j])
565  +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]);
566  } else {
567  xypary0x0_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].xypar[i][j];
568  xypary1x0_[i][j] = thePixelTemp_[index_id_].entry[iy1_][jx0_].xypar[i][j];
569  xypary0x1_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx1_].xypar[i][j];
570  lanpar_[i][j] = thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]
571  +adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j])
572  +adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].lanpar[i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].lanpar[i][j]);
573  }
574  }
575  }
576 
577 // next, determine the indices of the closest point in k (y-displacement), l (x-displacement)
578 // pixy and pixx are the indices of the struck pixel in the (Ty,Tx) system
579 // k0,k1 are the k-indices of the closest and next closest point
580 // l0,l1 are the l-indices of the closest and next closest point
581 
582  pixy = (int)floorf(yhit/ysize_);
583  dy = yhit-(pixy+0.5f)*ysize_;
584  if(flip_y) {dy = -dy;}
585  k0 = (int)(dy/ysize_*6.f+3.5f);
586  if(k0 < 0) k0 = 0;
587  if(k0 > 6) k0 = 6;
588  ddy = 6.f*dy/ysize_ - (k0-3);
589  ady = fabs(ddy);
590  if(ddy > 0.f) {k1 = k0 + 1; if(k1 > 6) k1 = k0-1;} else {k1 = k0 - 1; if(k1 < 0) k1 = k0+1;}
591  pixx = (int)floorf(xhit/xsize_);
592  dx = xhit-(pixx+0.5f)*xsize_;
593  l0 = (int)(dx/xsize_*6.f+3.5f);
594  if(l0 < 0) l0 = 0;
595  if(l0 > 6) l0 = 6;
596  ddx = 6.f*dx/xsize_ - (l0-3);
597  adx = fabs(ddx);
598  if(ddx > 0.f) {l1 = l0 + 1; if(l1 > 6) l1 = l0-1;} else {l1 = l0 - 1; if(l1 < 0) l1 = l0+1;}
599 
600 // OK, lets do the template interpolation.
601 
602 // First find the limits of the indices for non-zero pixels
603 
604  imin = std::min(thePixelTemp_[index_id_].entry[iy0_][jx0_].iymin,thePixelTemp_[index_id_].entry[iy1_][jx0_].iymin);
605  imin = std::min(imin,thePixelTemp_[index_id_].entry[iy0_][jx1_].iymin);
606 
607  jmin = std::min(thePixelTemp_[index_id_].entry[iy0_][jx0_].jxmin,thePixelTemp_[index_id_].entry[iy1_][jx0_].jxmin);
608  jmin = std::min(jmin,thePixelTemp_[index_id_].entry[iy0_][jx1_].jxmin);
609 
610  imax = std::max(thePixelTemp_[index_id_].entry[iy0_][jx0_].iymax,thePixelTemp_[index_id_].entry[iy1_][jx0_].iymax);
611  imax = std::max(imax,thePixelTemp_[index_id_].entry[iy0_][jx1_].iymax);
612 
613  jmax = std::max(thePixelTemp_[index_id_].entry[iy0_][jx0_].jxmax,thePixelTemp_[index_id_].entry[iy1_][jx0_].jxmax);
614  jmax = std::max(jmax,thePixelTemp_[index_id_].entry[iy0_][jx1_].jxmax);
615 
616 // Calculate the x and y offsets to make the new template
617 
618 // First, shift the struck pixel coordinates to the (Ty+2, Tx+2) system
619 
620  ++pixy; ++pixx;
621 
622 // In the template store, the struck pixel is always (THy,THx)
623 
624  deltax = pixx - T2HX;
625  deltay = pixy - T2HY;
626 
627 // First zero the local 2-d template
628 
629  for(j=0; j<BXM2; ++j) {for(i=0; i<BYM2; ++i) {xytemp_[j][i] = 0.f;}}
630 
631 // Loop over the non-zero part of the template index space and interpolate
632 
633  for(j=jmin; j<=jmax; ++j) {
634  for(i=imin; i<=imax; ++i) {
635  m = deltax+j;
636 
637 // If cot(beta) < 0, we must flip the cluster, iflipy is the flipped y-index
638 
639  if(flip_y) {iflipy=T2YSIZE-1-i; n = deltay+iflipy;} else {n = deltay+i;}
640  if(m>=0 && m<=BXM3 && n>=0 && n<=BYM3) {
641  tmpxy = thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]
642  + adx*(thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l1][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j])
643  + ady*(thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k1][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j])
644  + adcota_*(thePixelTemp_[index_id_].entry[iy0_][jx1_].xytemp[k0][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j])
645  + adcotb_*(thePixelTemp_[index_id_].entry[iy1_][jx0_].xytemp[k0][l0][i][j] - thePixelTemp_[index_id_].entry[iy0_][jx0_].xytemp[k0][l0][i][j]);
646  if(tmpxy > 0.f) {xytemp_[m][n] = tmpxy;} else {xytemp_[m][n] = 0.f;}
647  }
648  }
649  }
650 
651 //combine rows and columns to simulate double pixels
652 
653  for(n=1; n<BYM3; ++n) {
654  if(ydouble[n-1]) {
655 // Combine the y-columns
656  for(m=1; m<BXM3; ++m) {
657  xytemp_[m][n] += xytemp_[m][n+1];
658  }
659 // Now shift the remaining pixels over by one column
660  for(i=n+1; i<BYM3; ++i) {
661  for(m=1; m<BXM3; ++m) {
662  xytemp_[m][i] = xytemp_[m][i+1];
663  }
664  }
665  }
666  }
667 
668 //combine rows and columns to simulate double pixels
669 
670  for(m=1; m<BXM3; ++m) {
671  if(xdouble[m-1]) {
672 // Combine the x-rows
673  for(n=1; n<BYM3; ++n) {
674  xytemp_[m][n] += xytemp_[m+1][n];
675  }
676 // Now shift the remaining pixels over by one row
677  for(j=m+1; j<BXM3; ++j) {
678  for(n=1; n<BYM3; ++n) {
679  xytemp_[j][n] = xytemp_[j+1][n];
680  }
681  }
682  }
683  }
684 
685 // Finally, loop through and increment the external template
686 
687  for(n=1; n<BYM3; ++n) {
688  for(m=1; m<BXM3; ++m) {
689  if(xytemp_[m][n] > 0.f) {template2d[m][n] += xytemp_[m][n];}
690  }
691  }
692 
693  return success_;
694 } // xytemp
float adcotb_
fractional pixel distance of cot(beta) from iy0_
float deltacota_
cot(alpha) bin size
int i
Definition: DBlmapReader.cc:9
int jx1_
index of next-nearest cot(alpha) bin
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
float xsize_
Pixel x-size.
int Dtype_
flags BPix (=0) or FPix (=1)
#define T2HY
#define BXM3
#define T2HX
assert(m_qm.get())
float chi2avgone_
average chi^2 for 1 pixel clusters
float chi2min_[4]
minimum of chi^2 in 4 charge bins
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
#define BXM2
float adcota_
fractional pixel distance of cot(alpha) from jx0_
float xytemp_[13+2][21+2]
templates for y-reconstruction (binned over 5 central pixels)
float chi2min(int i)
minimum chi^2 in 4 charge bins
float chi2avgone()
//!&lt; average y chi^2 for 1 pixel clusters
float s50_
1/2 of the pixel threshold signal in adc units
float cotbeta0_
minimum cot(beta) covered
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
float chi2minone_
minimum of chi^2 for 1 pixel clusters
#define BYM2
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
float chi2minone()
//!&lt; minimum of y chi^2 for 1 pixel clusters
float cotalpha0_
minimum cot(alpha) covered
#define BYM3
bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[13+2][21+2])
int iy1_
index of next-nearest cot(beta) bin
float zsize_
Pixel z-size (thickness)
int Nyx_
number of cot(beta)-entries (columns) in template
float lanpar_[2][5]
Interpolated Landau parameters.
float chi2avg_[4]
average chi^2 in 4 charge bins
float cota_current_
current cot alpha
float pixmax()
maximum pixel charge
float lorxwidth_
Lorentz x-width.
float chi2avg(int i)
average chi^2 in 4 charge bins
float sxymax()
max pixel signal for pixel error calculation
float pixmax_
maximum pixel charge
float cotbeta1_
maximum cot(beta) covered
float xypary1x0_[2][5]
Polynomial error parameterization at ix0,iy1.
float qavg()
average cluster charge for this set of track angles
bool success_
true if cotalpha, cotbeta are inside of the acceptance (dynamically loaded)
float ysize_
Pixel y-size.
float xypary0x0_[2][5]
Polynomial error parameterization at ix0,iy0.
float cotb_current_
current cot beta
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
float qscale_
charge scaling factor
#define T2YSIZE
int iy0_
index of nearest cot(beta) bin
const std::vector< SiPixelTemplateStore2D > & thePixelTemp_
int id_current_
current id
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 710 of file SiPixelTemplate2D.cc.

References f, and xytemp().

711 {
712  // Interpolate for a new set of track angles
713 
714  // Local variables
715  float locBz = -1;
716  if(cotbeta < 0.f) {locBz = -locBz;}
717 
718  return SiPixelTemplate2D::xytemp(id, cotalpha, cotbeta, locBz, xhit, yhit, ydouble, xdouble, template2d);
719 
720 } // xytemp
double f[11][100]
bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[13+2][21+2])
float SiPixelTemplate2D::xytemp ( int  j,
int  i 
)
inline

current 2-d template

< get the 2-d template for pixel j (x), i (y) in BXM2 x BYM2 array (x,y)=(0,0) in lower LH corner of pixel[1][1]

Definition at line 137 of file SiPixelTemplate2D.h.

References assert(), BXM3, BYM2, BYM3, edm::hlt::Exception, i, j, and xytemp_.

float SiPixelTemplate2D::ysize ( )
inline

pixel y-size (microns)

Definition at line 163 of file SiPixelTemplate2D.h.

References ysize_.

float SiPixelTemplate2D::zsize ( )
inline

pixel z-size or thickness (microns)

Definition at line 164 of file SiPixelTemplate2D.h.

References zsize_.

Member Data Documentation

float SiPixelTemplate2D::adcota_
private

fractional pixel distance of cot(alpha) from jx0_

Definition at line 189 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::adcotb_
private

fractional pixel distance of cot(beta) from iy0_

Definition at line 186 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::chi2avg_[4]
private

average chi^2 in 4 charge bins

Definition at line 205 of file SiPixelTemplate2D.h.

Referenced by chi2avg().

float SiPixelTemplate2D::chi2avgone_
private

average chi^2 for 1 pixel clusters

Definition at line 207 of file SiPixelTemplate2D.h.

Referenced by chi2avgone().

float SiPixelTemplate2D::chi2min_[4]
private

minimum of chi^2 in 4 charge bins

Definition at line 206 of file SiPixelTemplate2D.h.

Referenced by chi2min().

float SiPixelTemplate2D::chi2minone_
private

minimum of chi^2 for 1 pixel clusters

Definition at line 208 of file SiPixelTemplate2D.h.

Referenced by chi2minone().

float SiPixelTemplate2D::cota_current_
private

current cot alpha

Definition at line 173 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

float SiPixelTemplate2D::cotalpha0_
private

minimum cot(alpha) covered

Definition at line 181 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::cotalpha1_
private

maximum cot(alpha) covered

Definition at line 182 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::cotb_current_
private

current cot beta

Definition at line 174 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

float SiPixelTemplate2D::cotbeta0_
private

minimum cot(beta) covered

Definition at line 178 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::cotbeta1_
private

maximum cot(beta) covered

Definition at line 179 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::deltacota_
private

cot(alpha) bin size

Definition at line 183 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::deltacotb_
private

cot(beta) bin size

Definition at line 180 of file SiPixelTemplate2D.h.

int SiPixelTemplate2D::Dtype_
private

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

Definition at line 177 of file SiPixelTemplate2D.h.

int SiPixelTemplate2D::id_current_
private

current id

Definition at line 171 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

int SiPixelTemplate2D::index_id_
private

current index

Definition at line 172 of file SiPixelTemplate2D.h.

Referenced by SiPixelTemplate2D().

int SiPixelTemplate2D::iy0_
private

index of nearest cot(beta) bin

Definition at line 184 of file SiPixelTemplate2D.h.

int SiPixelTemplate2D::iy1_
private

index of next-nearest cot(beta) bin

Definition at line 185 of file SiPixelTemplate2D.h.

int SiPixelTemplate2D::jx0_
private

index of nearest cot(alpha) bin

Definition at line 187 of file SiPixelTemplate2D.h.

int SiPixelTemplate2D::jx1_
private

index of next-nearest cot(alpha) bin

Definition at line 188 of file SiPixelTemplate2D.h.

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

Interpolated Landau parameters.

Definition at line 204 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::lorxwidth_
private

Lorentz x-width.

Definition at line 210 of file SiPixelTemplate2D.h.

Referenced by lorxwidth().

float SiPixelTemplate2D::lorywidth_
private

Lorentz y-width (sign corrected for fpix frame)

Definition at line 209 of file SiPixelTemplate2D.h.

Referenced by lorywidth().

int SiPixelTemplate2D::Nxx_
private

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

Definition at line 176 of file SiPixelTemplate2D.h.

int SiPixelTemplate2D::Nyx_
private

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

Definition at line 175 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::pixmax_
private

maximum pixel charge

Definition at line 196 of file SiPixelTemplate2D.h.

Referenced by pixmax().

float SiPixelTemplate2D::qavg_
private

average cluster charge for this set of track angles

Definition at line 195 of file SiPixelTemplate2D.h.

Referenced by qavg().

float SiPixelTemplate2D::qscale_
private

charge scaling factor

Definition at line 197 of file SiPixelTemplate2D.h.

Referenced by qscale().

float SiPixelTemplate2D::s50_
private

1/2 of the pixel threshold signal in adc units

Definition at line 198 of file SiPixelTemplate2D.h.

Referenced by s50().

bool SiPixelTemplate2D::success_
private

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

Definition at line 190 of file SiPixelTemplate2D.h.

float SiPixelTemplate2D::sxymax_
private

average pixel signal for y-projection of cluster

Definition at line 199 of file SiPixelTemplate2D.h.

Referenced by sxymax().

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

Definition at line 217 of file SiPixelTemplate2D.h.

Referenced by storesize().

float SiPixelTemplate2D::xsize_
private

Pixel x-size.

Definition at line 211 of file SiPixelTemplate2D.h.

Referenced by xsize().

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

Polynomial error parameterization at ix0,iy0.

Definition at line 201 of file SiPixelTemplate2D.h.

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

Polynomial error parameterization at ix1,iy0.

Definition at line 203 of file SiPixelTemplate2D.h.

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

Polynomial error parameterization at ix0,iy1.

Definition at line 202 of file SiPixelTemplate2D.h.

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

templates for y-reconstruction (binned over 5 central pixels)

Definition at line 200 of file SiPixelTemplate2D.h.

Referenced by xytemp().

float SiPixelTemplate2D::ysize_
private

Pixel y-size.

Definition at line 212 of file SiPixelTemplate2D.h.

Referenced by ysize().

float SiPixelTemplate2D::zsize_
private

Pixel z-size (thickness)

Definition at line 213 of file SiPixelTemplate2D.h.

Referenced by zsize().