79 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
95 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
100 #define LOGERROR(x) LogError(x)
101 #define LOGINFO(x) LogInfo(x)
102 #define LOGWARNING(x) LogWarning(x)
109 #define LOGERROR(x) std::cout << x << ": "
110 #define LOGINFO(x) std::cout << x << ": "
111 #define ENDL std::endl
115 const float fbin0=1.50f, fbin1=1.00f, fbin2=0.85f;
131 const char *tempfile;
134 const int code_version={17};
140 std::ostringstream tout;
144 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
145 tout <<
"CalibTracker/SiPixelESProducers/data/template_summary_zp"
146 << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
149 tempfile = (
file.fullPath()).c_str();
151 tout <<
"template_summary_zp" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
153 tempfile = tempf.c_str();
160 if(in_file.is_open()) {
168 for (i=0; (c=in_file.get()) !=
'\n'; ++
i) {
173 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
181 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0A, no template load" <<
ENDL;
return false;}
188 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0B, no template load"
189 <<
ENDL;
return false;}
194 theCurrentTemp.
head.
fbin[0] = fbin0;
195 theCurrentTemp.
head.
fbin[1] = fbin1;
196 theCurrentTemp.
head.
fbin[2] = fbin2;
200 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
201 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
203 <<
", 1/2 multi dcol threshold " << theCurrentTemp.
head.
s50 <<
", 1/2 single dcol threshold " << theCurrentTemp.
head.
ss50
206 <<
", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.
head.
fbin[0] <<
", " << theCurrentTemp.
head.
fbin[1]
207 <<
", " << theCurrentTemp.
head.
fbin[2]
213 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
217 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
225 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
230 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
245 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
250 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
253 if(theCurrentTemp.
enty[i].
qmin <= 0.) {
LOGERROR(
"SiPixelTemplate") <<
"Error in template ID " << theCurrentTemp.
head.
ID <<
" qmin = " << theCurrentTemp.
enty[
i].
qmin <<
", run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
256 for (j=0; j<2; ++
j) {
261 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
265 for (j=0; j<9; ++
j) {
269 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
272 for (j=0; j<2; ++
j) {
277 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
282 for (j=0; j<9; ++
j) {
286 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
290 for (j=0; j<4; ++
j) {
294 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
297 for (j=0; j<4; ++
j) {
302 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
305 for (j=0; j<4; ++
j) {
309 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
312 for (j=0; j<4; ++
j) {
317 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
320 for (j=0; j<4; ++
j) {
324 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
327 for (j=0; j<4; ++
j) {
331 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
334 for (j=0; j<4; ++
j) {
338 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
341 for (j=0; j<4; ++
j) {
345 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
348 for (j=0; j<4; ++
j) {
352 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
358 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
364 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
370 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
372 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
377 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
385 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
392 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
398 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
400 for (j=0; j<2; ++
j) {
405 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
408 for (j=0; j<9; ++
j) {
412 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
415 for (j=0; j<2; ++
j) {
421 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
425 for (j=0; j<9; ++
j) {
429 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
433 for (j=0; j<4; ++
j) {
437 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
440 for (j=0; j<4; ++
j) {
445 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
448 for (j=0; j<4; ++
j) {
452 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
455 for (j=0; j<4; ++
j) {
460 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
463 for (j=0; j<4; ++
j) {
467 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
470 for (j=0; j<4; ++
j) {
474 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
477 for (j=0; j<4; ++
j) {
481 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
484 for (j=0; j<4; ++
j) {
488 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
491 for (j=0; j<4; ++
j) {
495 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
501 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
507 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
517 thePixelTemp_.push_back(theCurrentTemp);
519 postInit(thePixelTemp_);
526 LOGERROR(
"SiPixelTemplate") <<
"Error opening File" << tempfile <<
ENDL;
534 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
550 const int code_version={17};
559 for(
int m=0;
m<
db.numOfTempl(); ++
m) {
564 for (i=0; i<20; ++
i) {
565 temp.
f =
db.sVector()[
db.index()];
566 theCurrentTemp.head.title[4*
i] = temp.
c[0];
567 theCurrentTemp.head.title[4*i+1] = temp.
c[1];
568 theCurrentTemp.head.title[4*i+2] = temp.
c[2];
569 theCurrentTemp.head.title[4*i+3] = temp.
c[3];
570 db.incrementIndex(1);
572 theCurrentTemp.head.title[79] =
'\0';
573 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.head.title <<
ENDL;
577 db >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx
578 >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale
579 >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize;
581 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0A, no template load" <<
ENDL;
return false;}
583 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.head.title
584 <<
" code version = "<<code_version
585 <<
" object version "<<theCurrentTemp.head.templ_version
588 if(theCurrentTemp.head.templ_version > 17) {
589 db >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2];
591 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0B, no template load"
592 <<
ENDL;
return false;}
594 theCurrentTemp.head.ss50 = theCurrentTemp.head.s50;
595 theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth/2.f;
596 theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth/2.f;
597 theCurrentTemp.head.fbin[0] = fbin0;
598 theCurrentTemp.head.fbin[1] = fbin1;
599 theCurrentTemp.head.fbin[2] = fbin2;
605 <<
"Template ID = " << theCurrentTemp.head.ID <<
", Template Version "
606 << theCurrentTemp.head.templ_version <<
", Bfield = "
607 << theCurrentTemp.head.Bfield<<
", NTy = " << theCurrentTemp.head.NTy <<
", NTyx = "
608 << theCurrentTemp.head.NTyx<<
", NTxx = " << theCurrentTemp.head.NTxx <<
", Dtype = "
609 << theCurrentTemp.head.Dtype<<
", Bias voltage " << theCurrentTemp.head.Vbias <<
", temperature "
610 << theCurrentTemp.head.temperature <<
", fluence " << theCurrentTemp.head.fluence
611 <<
", Q-scaling factor " << theCurrentTemp.head.qscale
612 <<
", 1/2 multi dcol threshold " << theCurrentTemp.head.s50 <<
", 1/2 single dcol threshold "
613 << theCurrentTemp.head.ss50<<
", y Lorentz Width " << theCurrentTemp.head.lorywidth
614 <<
", y Lorentz Bias " << theCurrentTemp.head.lorybias
615 <<
", x Lorentz width " << theCurrentTemp.head.lorxwidth
616 <<
", x Lorentz Bias " << theCurrentTemp.head.lorxbias
617 <<
", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0]
618 <<
", " << theCurrentTemp.head.fbin[1]
619 <<
", " << theCurrentTemp.head.fbin[2]
620 <<
", pixel x-size " << theCurrentTemp.head.xsize
621 <<
", y-size " << theCurrentTemp.head.ysize <<
", zsize " << theCurrentTemp.head.zsize <<
ENDL;
623 if(theCurrentTemp.head.templ_version < code_version) {
624 LOGINFO(
"SiPixelTemplate") <<
"code expects version "<< code_version <<
" finds "
625 << theCurrentTemp.head.templ_version <<
", load anyway " <<
ENDL;
630 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
633 theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]);
634 theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
640 for (i=0; i < theCurrentTemp.head.NTy; ++
i) {
642 db >> theCurrentTemp.enty[
i].runnum >> theCurrentTemp.enty[
i].costrk[0]
643 >> theCurrentTemp.enty[
i].costrk[1] >> theCurrentTemp.enty[
i].costrk[2];
645 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
649 theCurrentTemp.enty[
i].alpha =
static_cast<float>(atan2((
double)theCurrentTemp.enty[i].costrk[2], (
double)theCurrentTemp.enty[i].costrk[0]));
651 theCurrentTemp.enty[
i].cotalpha = theCurrentTemp.enty[
i].costrk[0]/theCurrentTemp.enty[
i].costrk[2];
653 theCurrentTemp.enty[
i].beta =
static_cast<float>(atan2((
double)theCurrentTemp.enty[i].costrk[2], (
double)theCurrentTemp.enty[i].costrk[1]));
655 theCurrentTemp.enty[
i].cotbeta = theCurrentTemp.enty[
i].costrk[1]/theCurrentTemp.enty[
i].costrk[2];
657 db >> theCurrentTemp.enty[
i].qavg >> theCurrentTemp.enty[
i].pixmax >> theCurrentTemp.enty[
i].symax >> theCurrentTemp.enty[
i].dyone
658 >> theCurrentTemp.enty[
i].syone >> theCurrentTemp.enty[
i].sxmax >> theCurrentTemp.enty[
i].dxone >> theCurrentTemp.enty[
i].sxone;
660 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
662 db >> theCurrentTemp.enty[
i].dytwo >> theCurrentTemp.enty[
i].sytwo >> theCurrentTemp.enty[
i].dxtwo
663 >> theCurrentTemp.enty[
i].sxtwo >> theCurrentTemp.enty[
i].qmin >> theCurrentTemp.enty[
i].clsleny >> theCurrentTemp.enty[
i].clslenx;
666 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
668 if(theCurrentTemp.enty[i].qmin <= 0.) {
LOGERROR(
"SiPixelTemplate") <<
"Error in template ID " << theCurrentTemp.head.ID <<
" qmin = " << theCurrentTemp.enty[
i].qmin <<
", run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
670 for (j=0; j<2; ++
j) {
672 db >> theCurrentTemp.enty[
i].ypar[
j][0] >> theCurrentTemp.enty[
i].ypar[
j][1]
673 >> theCurrentTemp.enty[
i].ypar[
j][2] >> theCurrentTemp.enty[
i].ypar[
j][3] >> theCurrentTemp.enty[
i].ypar[
j][4];
675 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
679 for (j=0; j<9; ++
j) {
681 for (k=0; k<
TYSIZE; ++
k) {
db >> theCurrentTemp.enty[
i].ytemp[
j][
k];}
683 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
686 for (j=0; j<2; ++
j) {
688 db >> theCurrentTemp.enty[
i].xpar[
j][0] >> theCurrentTemp.enty[
i].xpar[
j][1]
689 >> theCurrentTemp.enty[
i].xpar[
j][2] >> theCurrentTemp.enty[
i].xpar[
j][3] >> theCurrentTemp.enty[
i].xpar[
j][4];
691 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
696 for (j=0; j<9; ++
j) {
698 for (k=0; k<
TXSIZE; ++
k) {
db >> theCurrentTemp.enty[
i].xtemp[
j][
k]; qavg_avg += theCurrentTemp.enty[
i].xtemp[
j][
k];}
700 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
702 theCurrentTemp.enty[
i].qavg_avg = qavg_avg/9.;
704 for (j=0; j<4; ++
j) {
706 db >> theCurrentTemp.enty[
i].yavg[
j] >> theCurrentTemp.enty[
i].yrms[
j] >> theCurrentTemp.enty[
i].ygx0[
j] >> theCurrentTemp.enty[
i].ygsig[
j];
708 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
711 for (j=0; j<4; ++
j) {
713 db >> theCurrentTemp.enty[
i].yflpar[
j][0] >> theCurrentTemp.enty[
i].yflpar[
j][1] >> theCurrentTemp.enty[
i].yflpar[
j][2]
714 >> theCurrentTemp.enty[
i].yflpar[
j][3] >> theCurrentTemp.enty[
i].yflpar[
j][4] >> theCurrentTemp.enty[
i].yflpar[
j][5];
716 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
719 for (j=0; j<4; ++
j) {
721 db >> theCurrentTemp.enty[
i].xavg[
j] >> theCurrentTemp.enty[
i].xrms[
j] >> theCurrentTemp.enty[
i].xgx0[
j] >> theCurrentTemp.enty[
i].xgsig[
j];
723 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
726 for (j=0; j<4; ++
j) {
728 db >> theCurrentTemp.enty[
i].xflpar[
j][0] >> theCurrentTemp.enty[
i].xflpar[
j][1] >> theCurrentTemp.enty[
i].xflpar[
j][2]
729 >> theCurrentTemp.enty[
i].xflpar[
j][3] >> theCurrentTemp.enty[
i].xflpar[
j][4] >> theCurrentTemp.enty[
i].xflpar[
j][5];
731 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
734 for (j=0; j<4; ++
j) {
736 db >> theCurrentTemp.enty[
i].chi2yavg[
j] >> theCurrentTemp.enty[
i].chi2ymin[
j] >> theCurrentTemp.enty[
i].chi2xavg[
j] >> theCurrentTemp.enty[
i].chi2xmin[
j];
738 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
741 for (j=0; j<4; ++
j) {
743 db >> theCurrentTemp.enty[
i].yavgc2m[
j] >> theCurrentTemp.enty[
i].yrmsc2m[
j] >> theCurrentTemp.enty[
i].chi2yavgc2m[
j] >> theCurrentTemp.enty[
i].chi2yminc2m[
j];
745 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
748 for (j=0; j<4; ++
j) {
750 db >> theCurrentTemp.enty[
i].xavgc2m[
j] >> theCurrentTemp.enty[
i].xrmsc2m[
j] >> theCurrentTemp.enty[
i].chi2xavgc2m[
j] >> theCurrentTemp.enty[
i].chi2xminc2m[
j];
752 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
755 for (j=0; j<4; ++
j) {
757 db >> theCurrentTemp.enty[
i].yavggen[
j] >> theCurrentTemp.enty[
i].yrmsgen[
j] >> theCurrentTemp.enty[
i].ygx0gen[
j] >> theCurrentTemp.enty[
i].ygsiggen[
j];
759 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
762 for (j=0; j<4; ++
j) {
764 db >> theCurrentTemp.enty[
i].xavggen[
j] >> theCurrentTemp.enty[
i].xrmsgen[
j] >> theCurrentTemp.enty[
i].xgx0gen[
j] >> theCurrentTemp.enty[
i].xgsiggen[
j];
766 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
770 db >> theCurrentTemp.enty[
i].chi2yavgone >> theCurrentTemp.enty[
i].chi2yminone >> theCurrentTemp.enty[
i].chi2xavgone >> theCurrentTemp.enty[
i].chi2xminone >> theCurrentTemp.enty[
i].qmin2
771 >> theCurrentTemp.enty[
i].mpvvav >> theCurrentTemp.enty[
i].sigmavav >> theCurrentTemp.enty[
i].kappavav >> theCurrentTemp.enty[
i].r_qMeas_qTrue >> theCurrentTemp.enty[
i].spare[0];
773 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
775 db >> theCurrentTemp.enty[
i].mpvvav2 >> theCurrentTemp.enty[
i].sigmavav2 >> theCurrentTemp.enty[
i].kappavav2 >> theCurrentTemp.enty[
i].qbfrac[0] >> theCurrentTemp.enty[
i].qbfrac[1]
776 >> theCurrentTemp.enty[
i].qbfrac[2] >> theCurrentTemp.enty[
i].fracyone >> theCurrentTemp.enty[
i].fracxone >> theCurrentTemp.enty[
i].fracytwo >> theCurrentTemp.enty[
i].fracxtwo;
779 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
785 for (k=0; k < theCurrentTemp.head.NTyx; ++
k) {
787 for (i=0; i < theCurrentTemp.head.NTxx; ++
i) {
789 db >> theCurrentTemp.entx[
k][
i].runnum >> theCurrentTemp.entx[
k][
i].costrk[0]
790 >> theCurrentTemp.entx[
k][
i].costrk[1] >> theCurrentTemp.entx[
k][
i].costrk[2];
792 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
796 theCurrentTemp.entx[
k][
i].alpha =
static_cast<float>(atan2((
double)theCurrentTemp.entx[k][i].costrk[2], (
double)theCurrentTemp.entx[k][i].costrk[0]));
798 theCurrentTemp.entx[
k][
i].cotalpha = theCurrentTemp.entx[
k][
i].costrk[0]/theCurrentTemp.entx[
k][
i].costrk[2];
800 theCurrentTemp.entx[
k][
i].beta =
static_cast<float>(atan2((
double)theCurrentTemp.entx[k][i].costrk[2], (
double)theCurrentTemp.entx[k][i].costrk[1]));
802 theCurrentTemp.entx[
k][
i].cotbeta = theCurrentTemp.entx[
k][
i].costrk[1]/theCurrentTemp.entx[
k][
i].costrk[2];
804 db >> theCurrentTemp.entx[
k][
i].qavg >> theCurrentTemp.entx[
k][
i].pixmax >> theCurrentTemp.entx[
k][
i].symax >> theCurrentTemp.entx[
k][
i].dyone
805 >> theCurrentTemp.entx[
k][
i].syone >> theCurrentTemp.entx[
k][
i].sxmax >> theCurrentTemp.entx[
k][
i].dxone >> theCurrentTemp.entx[
k][
i].sxone;
807 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
809 db >> theCurrentTemp.entx[
k][
i].dytwo >> theCurrentTemp.entx[
k][
i].sytwo >> theCurrentTemp.entx[
k][
i].dxtwo
810 >> theCurrentTemp.entx[
k][
i].sxtwo >> theCurrentTemp.entx[
k][
i].qmin >> theCurrentTemp.entx[
k][
i].clsleny >> theCurrentTemp.entx[
k][
i].clslenx;
813 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
815 for (j=0; j<2; ++
j) {
817 db >> theCurrentTemp.entx[
k][
i].ypar[
j][0] >> theCurrentTemp.entx[
k][
i].ypar[
j][1]
818 >> theCurrentTemp.entx[
k][
i].ypar[
j][2] >> theCurrentTemp.entx[
k][
i].ypar[
j][3] >> theCurrentTemp.entx[
k][
i].ypar[
j][4];
820 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
823 for (j=0; j<9; ++
j) {
825 for (l=0; l<
TYSIZE; ++
l) {
db >> theCurrentTemp.entx[
k][
i].ytemp[
j][
l];}
827 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
832 for (j=0; j<2; ++
j) {
834 db >> theCurrentTemp.entx[
k][
i].xpar[
j][0] >> theCurrentTemp.entx[
k][
i].xpar[
j][1]
835 >> theCurrentTemp.entx[
k][
i].xpar[
j][2] >> theCurrentTemp.entx[
k][
i].xpar[
j][3] >> theCurrentTemp.entx[
k][
i].xpar[
j][4];
838 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
842 for (j=0; j<9; ++
j) {
844 for (l=0; l<
TXSIZE; ++
l) {
db >> theCurrentTemp.entx[
k][
i].xtemp[
j][
l]; qavg_avg += theCurrentTemp.entx[
k][
i].xtemp[
j][
l];}
846 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
848 theCurrentTemp.entx[
k][
i].qavg_avg = qavg_avg/9.;
850 for (j=0; j<4; ++
j) {
852 db >> theCurrentTemp.entx[
k][
i].yavg[
j] >> theCurrentTemp.entx[
k][
i].yrms[
j] >> theCurrentTemp.entx[
k][
i].ygx0[
j] >> theCurrentTemp.entx[
k][
i].ygsig[
j];
854 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
857 for (j=0; j<4; ++
j) {
859 db >> theCurrentTemp.entx[
k][
i].yflpar[
j][0] >> theCurrentTemp.entx[
k][
i].yflpar[
j][1] >> theCurrentTemp.entx[
k][
i].yflpar[
j][2]
860 >> theCurrentTemp.entx[
k][
i].yflpar[
j][3] >> theCurrentTemp.entx[
k][
i].yflpar[
j][4] >> theCurrentTemp.entx[
k][
i].yflpar[
j][5];
862 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
865 for (j=0; j<4; ++
j) {
867 db >> theCurrentTemp.entx[
k][
i].xavg[
j] >> theCurrentTemp.entx[
k][
i].xrms[
j] >> theCurrentTemp.entx[
k][
i].xgx0[
j] >> theCurrentTemp.entx[
k][
i].xgsig[
j];
869 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
872 for (j=0; j<4; ++
j) {
874 db >> theCurrentTemp.entx[
k][
i].xflpar[
j][0] >> theCurrentTemp.entx[
k][
i].xflpar[
j][1] >> theCurrentTemp.entx[
k][
i].xflpar[
j][2]
875 >> theCurrentTemp.entx[
k][
i].xflpar[
j][3] >> theCurrentTemp.entx[
k][
i].xflpar[
j][4] >> theCurrentTemp.entx[
k][
i].xflpar[
j][5];
877 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
880 for (j=0; j<4; ++
j) {
882 db >> theCurrentTemp.entx[
k][
i].chi2yavg[
j] >> theCurrentTemp.entx[
k][
i].chi2ymin[
j] >> theCurrentTemp.entx[
k][
i].chi2xavg[
j] >> theCurrentTemp.entx[
k][
i].chi2xmin[
j];
884 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
887 for (j=0; j<4; ++
j) {
889 db >> theCurrentTemp.entx[
k][
i].yavgc2m[
j] >> theCurrentTemp.entx[
k][
i].yrmsc2m[
j] >> theCurrentTemp.entx[
k][
i].chi2yavgc2m[
j] >> theCurrentTemp.entx[
k][
i].chi2yminc2m[
j];
891 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
894 for (j=0; j<4; ++
j) {
896 db >> theCurrentTemp.entx[
k][
i].xavgc2m[
j] >> theCurrentTemp.entx[
k][
i].xrmsc2m[
j] >> theCurrentTemp.entx[
k][
i].chi2xavgc2m[
j] >> theCurrentTemp.entx[
k][
i].chi2xminc2m[
j];
898 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
901 for (j=0; j<4; ++
j) {
903 db >> theCurrentTemp.entx[
k][
i].yavggen[
j] >> theCurrentTemp.entx[
k][
i].yrmsgen[
j] >> theCurrentTemp.entx[
k][
i].ygx0gen[
j] >> theCurrentTemp.entx[
k][
i].ygsiggen[
j];
905 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
908 for (j=0; j<4; ++
j) {
910 db >> theCurrentTemp.entx[
k][
i].xavggen[
j] >> theCurrentTemp.entx[
k][
i].xrmsgen[
j] >> theCurrentTemp.entx[
k][
i].xgx0gen[
j] >> theCurrentTemp.entx[
k][
i].xgsiggen[
j];
912 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
916 db >> theCurrentTemp.entx[
k][
i].chi2yavgone >> theCurrentTemp.entx[
k][
i].chi2yminone >> theCurrentTemp.entx[
k][
i].chi2xavgone >> theCurrentTemp.entx[
k][
i].chi2xminone >> theCurrentTemp.entx[
k][
i].qmin2
917 >> theCurrentTemp.entx[
k][
i].mpvvav >> theCurrentTemp.entx[
k][
i].sigmavav >> theCurrentTemp.entx[
k][
i].kappavav >> theCurrentTemp.entx[
k][
i].r_qMeas_qTrue >> theCurrentTemp.entx[
k][
i].spare[0];
919 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
921 db >> theCurrentTemp.entx[
k][
i].mpvvav2 >> theCurrentTemp.entx[
k][
i].sigmavav2 >> theCurrentTemp.entx[
k][
i].kappavav2 >> theCurrentTemp.entx[
k][
i].qbfrac[0] >> theCurrentTemp.entx[
k][
i].qbfrac[1]
922 >> theCurrentTemp.entx[
k][
i].qbfrac[2] >> theCurrentTemp.entx[
k][
i].fracyone >> theCurrentTemp.entx[
k][
i].fracxone >> theCurrentTemp.entx[
k][
i].fracytwo >> theCurrentTemp.entx[
k][
i].fracxtwo;
925 if(
db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
933 thePixelTemp_.push_back(theCurrentTemp);
936 postInit(thePixelTemp_);
962 for (
auto & templ : thePixelTemp_) {
963 for (
auto iy=0; iy<templ.head.NTy; ++iy ) templ.cotbetaY[iy]=templ.enty[iy].cotbeta;
964 for (
auto iy=0; iy<templ.head.NTyx; ++iy ) templ.cotbetaX[iy]= templ.entx[iy][0].cotbeta;
965 for (
auto ix=0; ix<templ.head.NTxx; ++ix ) templ.cotalphaX[ix]=templ.entx[0][ix].cotalpha;
986 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx;
987 float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, symax, chi2xavgone, chi2xminone, cotb, cotalpha0, cotbeta0;
990 float chi2xavg[4], chi2xmin[4], chi2xavgc2m[4], chi2xminc2m[4];
994 if(
id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
996 cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ =
true;
998 if(
id != id_current_) {
1003 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
1007 if(
id == thePixelTemp_[i].head.ID) {
1014 qscale_ = thePixelTemp_[index_id_].head.qscale;
1018 s50_ = thePixelTemp_[index_id_].head.s50;
1022 for(j=0; j<3; ++
j) {fbin_[
j] = thePixelTemp_[index_id_].head.fbin[
j];}
1027 xsize_ = thePixelTemp_[index_id_].head.xsize;
1028 ysize_ = thePixelTemp_[index_id_].head.ysize;
1029 zsize_ = thePixelTemp_[index_id_].head.zsize;
1036 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1037 if(index_id_ < 0 || index_id_ >= (
int)thePixelTemp_.size()) {
1038 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::interpolate can't find needed template ID = " <<
id << std::endl;
1041 assert(index_id_ >= 0 && index_id_ < (
int)thePixelTemp_.size());
1050 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
1051 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
1054 if(thePixelTemp_[index_id_].head.Dtype == 0) {
1057 if(cotbeta < 0.
f) {flip_y =
true;}
1068 Ny = thePixelTemp_[index_id_].head.NTy;
1069 Nyx = thePixelTemp_[index_id_].head.NTyx;
1070 Nxx = thePixelTemp_[index_id_].head.NTxx;
1072 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1073 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
1074 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
1077 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
1087 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
1095 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
1097 for (i=0; i<Ny-1; ++
i) {
1099 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
1102 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
1106 }
else { success_ =
false; }
1114 qavg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg;
1116 symax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].symax + yratio*thePixelTemp_[index_id_].enty[ihigh].symax;
1118 sxmax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sxmax + yratio*thePixelTemp_[index_id_].enty[ihigh].sxmax;
1119 dyone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dyone + yratio*thePixelTemp_[index_id_].enty[ihigh].dyone;
1120 if(flip_y) {dyone_ = -dyone_;}
1121 syone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].syone + yratio*thePixelTemp_[index_id_].enty[ihigh].syone;
1122 dytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].dytwo;
1123 if(flip_y) {dytwo_ = -dytwo_;}
1124 sytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].sytwo;
1125 qmin_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin;
1127 qmin2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin2 + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin2;
1129 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
1130 mpvvav_ *= qcorrect;
1131 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
1132 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
1133 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
1134 mpvvav2_ *= qcorrect;
1135 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
1136 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
1137 clsleny_ = fminf(thePixelTemp_[index_id_].enty[ilow].clsleny, thePixelTemp_[index_id_].enty[ihigh].clsleny);
1138 qavg_avg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg_avg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg_avg;
1139 qavg_avg_ *= qcorrect;
1140 for(i=0; i<2 ; ++
i) {
1141 for(j=0; j<5 ; ++
j) {
1144 yparl_[1-
i][
j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][
j];
1145 yparh_[1-
i][
j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][
j];
1147 yparl_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][
j];
1148 yparh_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][
j];
1150 xparly0_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].xpar[
i][
j];
1151 xparhy0_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].xpar[
i][
j];
1154 for(i=0; i<4; ++
i) {
1155 yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavg[i];
1156 if(flip_y) {yavg_[
i] = -yavg_[
i];}
1157 yrms_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrms[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrms[i];
1163 chi2yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavg[i];
1164 chi2ymin_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2ymin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2ymin[i];
1165 chi2xavg[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavg[i];
1166 chi2xmin[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xmin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xmin[i];
1167 yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavgc2m[i];
1168 if(flip_y) {yavgc2m_[
i] = -yavgc2m_[
i];}
1169 yrmsc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrmsc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrmsc2m[i];
1170 chi2yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgc2m[i];
1172 chi2yminc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminc2m[i];
1174 chi2xavgc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgc2m[i];
1175 chi2xminc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminc2m[i];
1176 for(j=0; j<6 ; ++
j) {
1177 yflparl_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].yflpar[
i][
j];
1178 yflparh_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].yflpar[
i][
j];
1182 if(flip_y && (j == 0 || j == 2 || j == 4)) {
1183 yflparl_[
i][
j] = - yflparl_[
i][
j];
1184 yflparh_[
i][
j] = - yflparh_[
i][
j];
1191 chi2yavgone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgone;
1192 chi2yminone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminone;
1193 chi2xavgone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgone;
1194 chi2xminone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminone;
1201 for(i=0; i<9; ++
i) {
1204 ytemp_[
i][
BYM2] = 0.f;
1205 ytemp_[
i][
BYM1] = 0.f;
1211 ytemp_[8-
i][
BYM3-
j]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].ytemp[i][j] + yratio*thePixelTemp_[index_id_].enty[ihigh].ytemp[i][j];
1213 ytemp_[
i][j+2]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].ytemp[i][j] + yratio*thePixelTemp_[index_id_].enty[ihigh].ytemp[i][j];
1223 if(abs_cotb_ >= thePixelTemp_[index_id_].entx[Nyx-1][0].cotbeta) {
1228 }
else if(abs_cotb_ >= thePixelTemp_[index_id_].entx[0][0].cotbeta) {
1230 for (i=0; i<Nyx-1; ++
i) {
1232 if( thePixelTemp_[index_id_].entx[i][0].cotbeta <= abs_cotb_ && abs_cotb_ < thePixelTemp_[index_id_].entx[i+1][0].cotbeta) {
1235 yxratio = (abs_cotb_ - thePixelTemp_[index_id_].entx[
i][0].cotbeta)/(thePixelTemp_[index_id_].entx[i+1][0].cotbeta - thePixelTemp_[index_id_].entx[i][0].cotbeta);
1246 if(cotalpha >= thePixelTemp_[index_id_].entx[0][Nxx-1].cotalpha) {
1254 if(cotalpha >= thePixelTemp_[index_id_].entx[0][0].cotalpha) {
1256 for (i=0; i<Nxx-1; ++
i) {
1258 if( thePixelTemp_[index_id_].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index_id_].entx[0][i+1].cotalpha) {
1261 xxratio = (cotalpha - thePixelTemp_[index_id_].entx[0][
i].cotalpha)/(thePixelTemp_[index_id_].entx[0][i+1].cotalpha - thePixelTemp_[index_id_].entx[0][i].cotalpha);
1265 }
else { success_ =
false; }
1277 sxparmax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].sxmax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].sxmax;
1279 if(thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax != 0.
f) {sxmax_=sxmax_/thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax*sxmax;}
1280 symax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].symax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].symax;
1281 if(thePixelTemp_[index_id_].entx[imaxx][imidy].symax != 0.
f) {symax_=symax_/thePixelTemp_[index_id_].entx[imaxx][imidy].symax*symax;}
1282 dxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxone;
1283 sxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxone;
1284 dxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxtwo;
1285 sxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxtwo;
1286 clslenx_ = fminf(thePixelTemp_[index_id_].entx[0][ilow].clslenx, thePixelTemp_[index_id_].entx[0][ihigh].clslenx);
1287 for(i=0; i<2 ; ++
i) {
1288 for(j=0; j<5 ; ++
j) {
1289 xpar0_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
1290 xparl_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
1291 xparh_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
1297 pixmax_=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].pixmax)
1298 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].pixmax);
1301 r_qMeas_qTrue_=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].r_qMeas_qTrue + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].r_qMeas_qTrue)
1302 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].r_qMeas_qTrue + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].r_qMeas_qTrue);
1305 for(i=0; i<4; ++
i) {
1306 xavg_[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].xavg[
i] + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].xavg[
i])
1307 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavg[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavg[
i]);
1309 xrms_[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].xrms[
i] + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].xrms[
i])
1310 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrms[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrms[
i]);
1318 xavgc2m_[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].xavgc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].xavgc2m[
i])
1319 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavgc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavgc2m[
i]);
1321 xrmsc2m_[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].xrmsc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].xrmsc2m[
i])
1322 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrmsc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrmsc2m[
i]);
1338 chi2xavg_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavg[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavg[i]);
1339 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavg[i] != 0.
f) {chi2xavg_[
i]=chi2xavg_[
i]/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavg[
i]*chi2xavg[
i];}
1341 chi2xmin_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xmin[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xmin[i]);
1342 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xmin[i] != 0.
f) {chi2xmin_[
i]=chi2xmin_[
i]/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xmin[
i]*chi2xmin[
i];}
1344 chi2xavgc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgc2m[i]);
1345 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgc2m[i] != 0.
f) {chi2xavgc2m_[
i]=chi2xavgc2m_[
i]/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgc2m[
i]*chi2xavgc2m[
i];}
1347 chi2xminc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminc2m[i]);
1348 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminc2m[i] != 0.
f) {chi2xminc2m_[
i]=chi2xminc2m_[
i]/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminc2m[
i]*chi2xminc2m[
i];}
1350 for(j=0; j<6 ; ++
j) {
1351 xflparll_[
i][
j] = thePixelTemp_[index_id_].entx[iylow][ilow].xflpar[
i][
j];
1352 xflparlh_[
i][
j] = thePixelTemp_[index_id_].entx[iylow][ihigh].xflpar[
i][
j];
1353 xflparhl_[
i][
j] = thePixelTemp_[index_id_].entx[iyhigh][ilow].xflpar[
i][
j];
1354 xflparhh_[
i][
j] = thePixelTemp_[index_id_].entx[iyhigh][ihigh].xflpar[
i][
j];
1360 chi2xavgone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgone);
1361 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone != 0.
f) {chi2xavgone_=chi2xavgone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone*chi2xavgone;}
1363 chi2xminone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminone);
1364 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone != 0.
f) {chi2xminone_=chi2xminone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone*chi2xminone;}
1374 cotbeta0 = thePixelTemp_[index_id_].entx[iyhigh][0].cotbeta;
1375 qxtempcor=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta0*cotbeta0+cotalpha*cotalpha));
1377 for(i=0; i<9; ++
i) {
1380 xtemp_[
i][
BXM2] = 0.f;
1381 xtemp_[
i][
BXM1] = 0.f;
1386 xtemp_[
i][j+2]=qxtempcor*((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xtemp[i][j] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xtemp[i][j]);
1390 lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
1391 lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
1392 lorybias_ = thePixelTemp_[index_id_].head.lorybias;
1393 lorxbias_ = thePixelTemp_[index_id_].head.lorxbias;
1394 if(locBz > 0.
f) {lorywidth_ = -lorywidth_; lorybias_ = -lorybias_;}
1419 if(cotbeta < 0.
f) {locBz = -locBz;}
1442 float sigi, sigi2, sigi3, sigi4, symax, qscale;
1446 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1447 if(fypix < 2 || fypix >=
BYM2) {
1448 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with fypix = " << fypix << std::endl;
1451 assert(fypix > 1 && fypix <
BYM2);
1453 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1454 if(lypix < fypix || lypix >=
BYM2) {
1455 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with lypix/fypix = " << lypix <<
"/" << fypix << std::endl;
1458 assert(lypix >= fypix && lypix <
BYM2);
1464 if(symax_ > syparmax_) {symax = syparmax_;}
1468 for(i=fypix-2; i<=lypix+2; ++
i) {
1469 if(i < fypix || i > lypix) {
1473 ysig2[
i] = s50_*s50_;
1475 if(ysum[i] < symax) {
1480 qscale = ysum[
i]/symax;
1482 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1484 ysig2[
i] = (1.f-yratio_)*
1485 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1487 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1489 ysig2[
i] = (1.f-yratio_)*
1490 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1492 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1495 if(ysum[i] > sythr) {ysig2[
i] = 1.e8;}
1496 if(ysig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1497 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1519 float sigi, sigi2, sigi3, sigi4, symax, qscale, err2;
1523 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1524 if(index < 2 || index >=
BYM2) {
1525 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with index = " << index << std::endl;
1528 assert(index > 1 && index <
BYM2);
1534 if(symax_ > syparmax_) {symax = syparmax_;}
1538 if(qpixel < symax) {
1543 qscale = qpixel/symax;
1545 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1547 err2 = (1.f-yratio_)*
1548 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1550 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1552 err2 = (1.f-yratio_)*
1553 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1555 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1558 if(ysig2 <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1559 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1585 float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale;
1589 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1590 if(fxpix < 2 || fxpix >=
BXM2) {
1591 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with fxpix = " << fxpix << std::endl;
1594 assert(fxpix > 1 && fxpix <
BXM2);
1596 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1597 if(lxpix < fxpix || lxpix >=
BXM2) {
1598 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with lxpix/fxpix = " << lxpix <<
"/" << fxpix << std::endl;
1601 assert(lxpix >= fxpix && lxpix <
BXM2);
1607 if(sxmax_ > sxparmax_) {sxmax = sxparmax_;}
1611 for(i=fxpix-2; i<=lxpix+2; ++
i) {
1612 if(i < fxpix || i > lxpix) {
1616 xsig2[
i] = s50_*s50_;
1618 if(xsum[i] < sxmax) {
1623 qscale = xsum[
i]/sxmax;
1625 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1630 yint = (1.f-yratio_)*
1631 (xparly0_[0][0]+xparly0_[0][1]*sigi+xparly0_[0][2]*sigi2+xparly0_[0][3]*sigi3+xparly0_[0][4]*sigi4)
1633 (xparhy0_[0][0]+xparhy0_[0][1]*sigi+xparhy0_[0][2]*sigi2+xparhy0_[0][3]*sigi3+xparhy0_[0][4]*sigi4);
1635 yint = (1.f-yratio_)*
1636 (xparly0_[1][0]+xparly0_[1][1]*sigi+xparly0_[1][2]*sigi2+xparly0_[1][3]*sigi3+xparly0_[1][4]*sigi4)
1638 (xparhy0_[1][0]+xparhy0_[1][1]*sigi+xparhy0_[1][2]*sigi2+xparhy0_[1][3]*sigi3+xparhy0_[1][4]*sigi4);
1644 xsig2[
i] = (1.f-xxratio_)*
1645 (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4)
1647 (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4);
1649 xsig2[
i] = (1.f-xxratio_)*
1650 (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4)
1652 (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4);
1658 x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4;
1660 x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4;
1665 if(x0 != 0.
f) {xsig2[
i] = xsig2[
i]/x0 * yint;}
1667 if(xsum[i] > sxthr) {xsig2[
i] = 1.e8;}
1668 if(xsig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg x-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1669 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1693 float qfl, qfl2, qfl3, qfl4, qfl5, dy;
1697 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1698 if(binq < 0 || binq > 3) {
1699 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with binq = " << binq << std::endl;
1702 assert(binq >= 0 && binq < 4);
1704 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1705 if(fabs((
double)qfly) > 1.) {
1706 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with qfly = " << qfly << std::endl;
1709 assert(fabs((
double)qfly) <= 1.);
1716 if(qfl < -0.9
f) {qfl = -0.9f;}
1717 if(qfl > 0.9
f) {qfl = 0.9f;}
1721 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1722 dy = (1.f-yratio_)*(yflparl_[binq][0]+yflparl_[binq][1]*qfl+yflparl_[binq][2]*qfl2+yflparl_[binq][3]*qfl3+yflparl_[binq][4]*qfl4+yflparl_[binq][5]*qfl5)
1723 + yratio_*(yflparh_[binq][0]+yflparh_[binq][1]*qfl+yflparh_[binq][2]*qfl2+yflparh_[binq][3]*qfl3+yflparh_[binq][4]*qfl4+yflparh_[binq][5]*qfl5);
1745 float qfl, qfl2, qfl3, qfl4, qfl5, dx;
1749 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1750 if(binq < 0 || binq > 3) {
1751 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with binq = " << binq << std::endl;
1754 assert(binq >= 0 && binq < 4);
1756 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1757 if(fabs((
double)qflx) > 1.) {
1758 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with qflx = " << qflx << std::endl;
1761 assert(fabs((
double)qflx) <= 1.);
1768 if(qfl < -0.9
f) {qfl = -0.9f;}
1769 if(qfl > 0.9
f) {qfl = 0.9f;}
1773 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1774 dx = (1.f - yxratio_)*((1.
f-xxratio_)*(xflparll_[binq][0]+xflparll_[binq][1]*qfl+xflparll_[binq][2]*qfl2+xflparll_[binq][3]*qfl3+xflparll_[binq][4]*qfl4+xflparll_[binq][5]*qfl5)
1775 + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5))
1776 + yxratio_*((1.
f-xxratio_)*(xflparhl_[binq][0]+xflparhl_[binq][1]*qfl+xflparhl_[binq][2]*qfl2+xflparhl_[binq][3]*qfl3+xflparhl_[binq][4]*qfl4+xflparhl_[binq][5]*qfl5)
1777 + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5));
1801 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1802 if(fybin < 0 || fybin > 40) {
1803 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with fybin = " << fybin << std::endl;
1806 assert(fybin >= 0 && fybin < 41);
1808 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1809 if(lybin < 0 || lybin > 40) {
1810 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with lybin = " << lybin << std::endl;
1813 assert(lybin >= 0 && lybin < 41);
1818 for(i=0; i<9; ++
i) {
1820 ytemplate[i+16][
j]=ytemp_[
i][
j];
1823 for(i=0; i<8; ++
i) {
1824 ytemplate[i+8][
BYM1] = 0.f;
1825 for(j=0; j<
BYM1; ++
j) {
1826 ytemplate[i+8][
j]=ytemp_[
i][j+1];
1829 for(i=1; i<9; ++
i) {
1830 ytemplate[i+24][0] = 0.f;
1831 for(j=0; j<
BYM1; ++
j) {
1832 ytemplate[i+24][j+1]=ytemp_[
i][
j];
1839 for(i=0; i<8; ++
i) {
1840 ytemplate[
i][
BYM2] = 0.f;
1841 ytemplate[
i][
BYM1] = 0.f;
1842 for(j=0; j<
BYM2; ++
j) {
1843 ytemplate[
i][
j]=ytemp_[
i][j+2];
1848 for(i=1; i<9; ++
i) {
1849 ytemplate[i+32][0] = 0.f;
1850 ytemplate[i+32][1] = 0.f;
1851 for(j=0; j<
BYM2; ++
j) {
1852 ytemplate[i+32][j+2]=ytemp_[
i][
j];
1879 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1880 if(fxbin < 0 || fxbin > 40) {
1881 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with fxbin = " << fxbin << std::endl;
1884 assert(fxbin >= 0 && fxbin < 41);
1886 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1887 if(lxbin < 0 || lxbin > 40) {
1888 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with lxbin = " << lxbin << std::endl;
1891 assert(lxbin >= 0 && lxbin < 41);
1896 for(i=0; i<9; ++
i) {
1898 xtemplate[i+16][
j]=xtemp_[
i][
j];
1901 for(i=0; i<8; ++
i) {
1902 xtemplate[i+8][
BXM1] = 0.f;
1903 for(j=0; j<
BXM1; ++
j) {
1904 xtemplate[i+8][
j]=xtemp_[
i][j+1];
1907 for(i=1; i<9; ++
i) {
1908 xtemplate[i+24][0] = 0.f;
1909 for(j=0; j<
BXM1; ++
j) {
1910 xtemplate[i+24][j+1]=xtemp_[
i][
j];
1917 for(i=0; i<8; ++
i) {
1918 xtemplate[
i][
BXM2] = 0.f;
1919 xtemplate[
i][
BXM1] = 0.f;
1920 for(j=0; j<
BXM2; ++
j) {
1921 xtemplate[
i][
j]=xtemp_[
i][j+2];
1926 for(i=1; i<9; ++
i) {
1927 xtemplate[i+32][0] = 0.f;
1928 xtemplate[i+32][1] = 0.f;
1929 for(j=0; j<
BXM2; ++
j) {
1930 xtemplate[i+32][j+2]=xtemp_[
i][
j];
1955 float qedge = 2.*s50_;
1959 if(ytemp_[4][j] > sigmax) {
1960 sigmax = ytemp_[4][
j];
1964 if(sigmax < qedge) {qedge = s50_;}
1965 if(sigmax < qedge || jmax<1 || jmax>
BYM2) {
return -1;}
1971 for(j=jmax+1; j<
BYM1; ++
j) {
1972 if(ytemp_[4][j] < qedge)
break;
1978 for(j=jmax-1; j>0; --
j) {
1979 if(ytemp_[4][j] < qedge)
break;
1983 return (jbeg+jend)/2;
2004 float qedge = 2.*s50_;
2008 if(xtemp_[4][j] > sigmax) {
2009 sigmax = xtemp_[4][
j];
2013 if(sigmax < qedge) {qedge = s50_;}
2014 if(sigmax < qedge || jmax<1 || jmax>
BXM2) {
return -1;}
2020 for(j=jmax+1; j<
BXM1; ++
j) {
2021 if(xtemp_[4][j] < qedge)
break;
2027 for(j=jmax-1; j>0; --
j) {
2028 if(xtemp_[4][j] < qedge)
break;
2032 return (jbeg+jend)/2;
2050 int ioff0, ioffp, ioffm;
2054 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2055 if(nypix < 1 || nypix >=
BYM3) {
2056 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp3d called with nypix = " << nypix << std::endl;
2059 assert(nypix > 0 && nypix <
BYM3);
2064 float diff = fabsf(nypix - clsleny_)/2. + 1.f;
2065 int nshift = (int)diff;
2066 if((diff - nshift) > 0.5f) {++nshift;}
2070 nybins_ = 9 + 16*nshift;
2074 temp2dy_.resize(boost::extents[nybins_][
BYSIZE]);
2080 for(i=0; i<9; ++
i) {
2082 temp2dy_[i+ioff0][
j]=ytemp_[
i][
j];
2088 for(k=1; k<=nshift; ++
k) {
2090 for(i=0; i<8; ++
i) {
2091 for(j=0; j<
k; ++
j) {
2092 temp2dy_[i+ioffm][
BYM1-
j] = 0.f;
2094 for(j=0; j<BYSIZE-
k; ++
j) {
2095 temp2dy_[i+ioffm][
j]=ytemp_[
i][j+
k];
2099 for(i=1; i<9; ++
i) {
2100 for(j=0; j<
k; ++
j) {
2101 temp2dy_[i+ioffp][
j] = 0.f;
2103 for(j=0; j<BYSIZE-
k; ++
j) {
2104 temp2dy_[i+ioffp][j+
k]=ytemp_[
i][
j];
2124 if(i >= 0 && i < nybins_ && j <= i) {
2126 ytemplate[
k]=temp2dy_[
i][
k]+temp2dy_[
j][
k];
2151 int ioff0, ioffp, ioffm;
2155 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2156 if(nxpix < 1 || nxpix >=
BXM3) {
2157 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl;
2160 assert(nxpix > 0 && nxpix <
BXM3);
2165 float diff = fabsf(nxpix - clslenx_)/2.f + 1.f;
2166 int nshift = (int)diff;
2167 if((diff - nshift) > 0.5f) {++nshift;}
2171 nxbins_ = 9 + 16*nshift;
2175 temp2dx_.resize(boost::extents[nxbins_][
BXSIZE]);
2181 for(i=0; i<9; ++
i) {
2183 temp2dx_[i+ioff0][
j]=xtemp_[
i][
j];
2189 for(k=1; k<=nshift; ++
k) {
2191 for(i=0; i<8; ++
i) {
2192 for(j=0; j<
k; ++
j) {
2193 temp2dx_[i+ioffm][
BXM1-
j] = 0.f;
2195 for(j=0; j<BXSIZE-
k; ++
j) {
2196 temp2dx_[i+ioffm][
j]=xtemp_[
i][j+
k];
2200 for(i=1; i<9; ++
i) {
2201 for(j=0; j<
k; ++
j) {
2202 temp2dx_[i+ioffp][
j] = 0.f;
2204 for(j=0; j<BXSIZE-
k; ++
j) {
2205 temp2dx_[i+ioffp][j+
k]=xtemp_[
i][
j];
2227 if(i >= 0 && i < nxbins_ && j <= i) {
2229 xtemplate[
k]=temp2dx_[
i][
k]+temp2dx_[
j][
k];
2268 float& sigmay,
float& deltay,
float& sigmax,
float& deltax,
float& sy1,
float& dy1,
float& sy2,
2269 float& dy2,
float& sx1,
float& dx1,
float& sx2,
float& dx2)
2277 for(
int i=0; i<(int)thePixelTemp_.size(); ++
i) {
2278 if(
id == thePixelTemp_[i].head.ID) {
2284 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2285 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2286 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin can't find needed template ID = " <<
id << std::endl;
2289 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2295 auto const & templ = thePixelTemp_[
index];
2303 auto cotalpha0 = thePixelTemp_[
index].enty[0].cotalpha;
2304 auto qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
2308 float cotb;
bool flip_y;
2309 if(thePixelTemp_[index].head.Dtype == 0) {
2312 if(cotbeta < 0.
f) {flip_y =
true;}
2325 auto qscale = thePixelTemp_[
index].head.qscale;
2335 auto Ny = thePixelTemp_[
index].head.NTy;
2336 auto Nyx = thePixelTemp_[
index].head.NTyx;
2337 auto Nxx = thePixelTemp_[
index].head.NTxx;
2339 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2340 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2341 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2344 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2354 auto j = std::lower_bound(templ.cotbetaY,templ.cotbetaY+Ny,cotb);
2355 if (
j==templ.cotbetaY+Ny) { --
j; yratio = 1.f; }
2356 else if (
j==templ.cotbetaY) { ++
j; yratio = 0.f;}
2357 else { yratio = (cotb - (*(
j-1)) )/( (*
j) - (*(
j-1)) ) ; }
2359 ihigh =
j-templ.cotbetaY;
2367 dy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dyone + yratio*thePixelTemp_[index].enty[ihigh].dyone;
2368 if(flip_y) {dy1 = -dy1;}
2369 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2370 dy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dytwo + yratio*thePixelTemp_[index].enty[ihigh].dytwo;
2371 if(flip_y) {dy2 = -dy2;}
2372 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2374 auto qavg = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qavg + yratio*thePixelTemp_[index].enty[ihigh].qavg;
2376 auto qmin = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin + yratio*thePixelTemp_[index].enty[ihigh].qmin;
2378 auto qmin2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin2 + yratio*thePixelTemp_[index].enty[ihigh].qmin2;
2382 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2383 if(qavg <= 0.
f || qmin <= 0.
f) {
2384 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin, qavg or qmin <= 0,"
2385 <<
" Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
2388 assert(qavg > 0.
f && qmin > 0.
f);
2393 auto qtotal = qscale*qclus;
2396 auto fq = qtotal/qavg;
2399 fbin_[0]=fbin0; fbin_[1]=fbin1; fbin_[2]=fbin2;
2417 auto yavggen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yavggen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yavggen[binq];
2418 if(flip_y) {yavggen = -yavggen;}
2419 auto yrmsgen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrmsgen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yrmsgen[binq];
2430 auto j = std::lower_bound(templ.cotbetaX,templ.cotbetaX+Nyx,acotb);
2431 if (
j==templ.cotbetaX+Nyx) { --
j; yxratio = 1.f; }
2432 else if (
j==templ.cotbetaX) { ++
j; yxratio = 0.f;}
2433 else { yxratio = (acotb - (*(
j-1)) )/( (*
j) - (*(
j-1)) ) ; }
2435 iyhigh =
j-templ.cotbetaX;
2445 auto j = std::lower_bound(templ.cotalphaX,templ.cotalphaX+Nxx,cotalpha);
2446 if (
j==templ.cotalphaX+Nxx) { --
j; xxratio = 1.f; }
2447 else if (
j==templ.cotalphaX) { ++
j; xxratio = 0.f;}
2448 else { xxratio = (cotalpha - (*(
j-1)) )/( (*
j) - (*(
j-1)) ) ; }
2450 ihigh =
j-templ.cotalphaX;
2456 dx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxone + xxratio*thePixelTemp_[index].entx[0][ihigh].dxone;
2457 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2458 dx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].dxtwo;
2459 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2463 pixmx=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].pixmax)
2464 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].pixmax);
2466 auto xavggen = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xavggen[binq] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xavggen[binq])
2467 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xavggen[binq] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xavggen[binq]);
2469 auto xrmsgen = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrmsgen[binq] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrmsgen[binq])
2470 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrmsgen[binq] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrmsgen[binq]);
2476 sigmay = yrmsgen; deltay = yavggen;
2478 sigmax = xrmsgen; deltax = xavggen;
2482 if(qtotal < 0.95
f*qmin) {binq = 5;}
else {
if(qtotal < 0.95
f*qmin2) {binq = 4;}}
2536 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz;
2538 if(cotbeta < 0.
f) {locBz = -locBz;}
2539 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2540 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2556 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz;
2557 const float cotalpha = 0.f;
2559 if(cotbeta < 0.
f) {locBz = -locBz;}
2560 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2561 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2580 void SiPixelTemplate::temperrors(
int id,
float cotalpha,
float cotbeta,
int qBin,
float& sigmay,
float& sigmax,
float& sy1,
float& sy2,
float& sx1,
float& sx2)
2587 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2588 float yratio, yxratio, xxratio;
2597 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2599 if(
id == thePixelTemp_[i].head.ID) {
2606 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2607 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2608 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2611 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2615 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2616 if(qBin < 0 || qBin > 5) {
2617 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors called with illegal qBin = " << qBin << std::endl;
2620 assert(qBin >= 0 && qBin < 6);
2625 if(qBin > 3) {qBin = 3;}
2630 acotb = fabs((
double)cotbeta);
2651 Ny = thePixelTemp_[
index].head.NTy;
2652 Nyx = thePixelTemp_[
index].head.NTyx;
2653 Nxx = thePixelTemp_[
index].head.NTxx;
2655 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2656 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2657 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2660 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2668 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2675 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2677 for (i=0; i<Ny-1; ++
i) {
2679 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2682 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2693 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2694 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2695 yrms=(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrms[qBin] + yratio*thePixelTemp_[index].enty[ihigh].yrms[qBin];
2703 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2708 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2710 for (i=0; i<Nyx-1; ++
i) {
2712 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2715 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2726 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2733 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2735 for (i=0; i<Nxx-1; ++
i) {
2737 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2740 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2749 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2750 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2752 xrms=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrms[qBin] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrms[qBin])
2753 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrms[qBin] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrms[qBin]);
2779 void SiPixelTemplate::qbin_dist(
int id,
float cotalpha,
float cotbeta,
float qbin_frac[4],
float& ny1_frac,
float& ny2_frac,
float& nx1_frac,
float& nx2_frac)
2786 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2787 float yratio, yxratio, xxratio;
2795 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2797 if(
id == thePixelTemp_[i].head.ID) {
2805 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2806 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2807 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2810 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2817 acotb = fabs((
double)cotbeta);
2839 Ny = thePixelTemp_[
index].head.NTy;
2840 Nyx = thePixelTemp_[
index].head.NTyx;
2841 Nxx = thePixelTemp_[
index].head.NTxx;
2843 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2844 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2845 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2848 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2856 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2863 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2865 for (i=0; i<Ny-1; ++
i) {
2867 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2870 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2880 ny1_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracyone + yratio*thePixelTemp_[index].enty[ihigh].fracyone;
2881 ny2_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracytwo + yratio*thePixelTemp_[index].enty[ihigh].fracytwo;
2888 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2893 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2895 for (i=0; i<Nyx-1; ++
i) {
2897 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2900 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2911 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2918 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2920 for (i=0; i<Nxx-1; ++
i) {
2922 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2925 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2934 for(i=0; i<3; ++
i) {
2935 qfrac[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].qbfrac[
i])
2936 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].qbfrac[
i]);
2938 nx1_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxone)
2939 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxone);
2940 nx2_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxtwo)
2941 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxtwo);
2945 qbin_frac[0] = qfrac[0];
2946 qbin_frac[1] = qbin_frac[0] + qfrac[1];
2947 qbin_frac[2] = qbin_frac[1] + qfrac[2];
2968 float x0, y0, xf, yf, xi, yi, sf, si, s0, qpix, slopey, slopex, ds;
2969 int i,
j, jpix0, ipix0, jpixf, ipixf, jpix, ipix, nx, ny, anx,
any, jmax, imax;
2972 std::list<SimplePixel>
list;
2973 std::list<SimplePixel>::iterator listIter, listEnd;
2977 x0 = xhit - 0.5*zsize_*cota_current_;
2978 y0 = yhit - 0.5*zsize_*cotb_current_;
2980 jpix0 = floor(x0/xsize_)+1;
2981 ipix0 = floor(y0/ysize_)+1;
2983 if(jpix0 < 0 || jpix0 >
BXM3) {
return false;}
2984 if(ipix0 < 0 || ipix0 >
BYM3) {
return false;}
2986 xf = xhit + 0.5*zsize_*cota_current_ + lorxwidth_;
2987 yf = yhit + 0.5*zsize_*cotb_current_ + lorywidth_;
2989 jpixf = floor(xf/xsize_)+1;
2990 ipixf = floor(yf/ysize_)+1;
2992 if(jpixf < 0 || jpixf > BXM3) {
return false;}
2993 if(ipixf < 0 || ipixf > BYM3) {
return false;}
2997 sf =
std::sqrt((xf-x0)*(xf-x0) + (yf-y0)*(yf-y0));
2998 if((xf-x0) != 0.
f) {slopey = (yf-y0)/(xf-x0);}
else { slopey = 1.e10;}
2999 if((yf-y0) != 0.f) {slopex = (xf-x0)/(yf-y0);}
else { slopex = 1.e10;}
3012 list.push_back(element);
3020 for(j=jpix0; j<jpixf; ++
j) {
3022 yi = slopey*(xi-x0) + y0;
3023 ipix = (int)(yi/ysize_)+1;
3024 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3031 list.push_back(element);
3034 for(j=jpix0; j>jpixf; --
j) {
3036 yi = slopey*(xi-x0) + y0;
3037 ipix = (int)(yi/ysize_)+1;
3038 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3045 list.push_back(element);
3054 for(i=ipix0; i<ipixf; ++
i) {
3056 xi = slopex*(yi-y0) + x0;
3057 jpix = (int)(xi/xsize_)+1;
3058 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3065 list.push_back(element);
3068 for(i=ipix0; i>ipixf; --
i) {
3070 xi = slopex*(yi-y0) + x0;
3071 jpix = (int)(xi/xsize_)+1;
3072 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3079 list.push_back(element);
3093 for(i=1; i<imax; ++
i) {
3095 listIter = list.begin();
3097 while(listIter != list.end()) {
3098 if(listIter->i == i && listIter->btype == 2) {
3099 listIter = list.erase(listIter);
3102 if(listIter->i > i) {
3108 while(listIter != list.end()) {
3109 if(listIter->i == i+1 && listIter->btype == 2) {
3110 listIter = list.erase(listIter);
3113 if(listIter->i > i+1) {
3122 for(j=1; j<jmax; ++
j) {
3124 listIter = list.begin();
3126 while(listIter != list.end()) {
3127 if(listIter->j == j && listIter->btype == 1) {
3128 listIter = list.erase(listIter);
3131 if(listIter->j > j) {
3137 while(listIter != list.end()) {
3138 if(listIter->j == j+1 && listIter->btype == 1) {
3139 listIter = list.erase(listIter);
3142 if(listIter->j > j+1) {
3154 listIter = list.begin();
3155 listEnd = list.end();
3156 for( ;listIter != listEnd; ++listIter) {
3162 if(sf > 0.
f) { qpix = qtotal*ds/sf;}
else {qpix = qtotal;}
3163 template2d[
j][
i] += qpix;
3182 int ilow, ihigh, Ny;
3183 float yratio, cotb, cotalpha0,
arg;
3187 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3188 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3189 if(arg < 0.
f) arg = 0.f;
3194 Ny = thePixelTemp_[index_id_].head.NTy;
3196 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3198 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3209 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3216 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3218 for (i=0; i<Ny-1; ++
i) {
3220 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3223 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3234 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
3235 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
3236 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
3241 mpv = (double)mpvvav_;
3242 sigma = (double)sigmavav_;
3243 kappa = (double)kappavav_;
3260 int ilow, ihigh, Ny;
3261 float yratio, cotb, cotalpha0,
arg;
3265 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3266 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3267 if(arg < 0.
f) arg = 0.f;
3272 Ny = thePixelTemp_[index_id_].head.NTy;
3274 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3276 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3287 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3294 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3296 for (i=0; i<Ny-1; ++
i) {
3298 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3301 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3312 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
3313 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
3314 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
3318 mpv = (double)mpvvav2_;
3319 sigma = (double)sigmavav2_;
3320 kappa = (double)kappavav2_;
float qavg_avg
average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) ...
int runnum
< Basic template entry corresponding to a single set of track angles
float xflpar[4][6]
Aqfl-parameterized x-correction in 4 charge bins.
float xrms[4]
average x-rms of reconstruction binned in 4 charge bins
void vavilov2_pars(double &mpv, double &sigma, double &kappa)
float clslenx
cluster x-length in pixels at signal height sxmax/2
float qavg
average cluster charge for this set of track angles (now includes threshold effects) ...
float syone
rms for one pixel y-clusters
float chi2yavgone
average y chi^2 for 1 pixel clusters
int cytemp()
Return central pixel of y template pixels above readout threshold.
float dyone
mean offset/correction for one pixel y-clusters
float sigmavav
"sigma" scale fctor for Vavilov distribution
float fracxtwo
fraction of double pixel sample with xsize = 1
float yavggen[4]
generic algorithm: average y-bias of reconstruction binned in 4 charge bins
float sxmax
average pixel signal for x-projection of cluster
int qbin(int id, float cotalpha, float cotbeta, float locBz, float qclus, float &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
int btype
type of boundary (0=end, 1 = x-boundary, 2 = y-boundary)
void xsigma2(int fxpix, int lxpix, float sxthr, float xsum[13+4], float xsig2[13+4])
float chi2yminc2m[4]
1st pass chi2 min search: minimum of y chi^2 in 4 charge bins (merged clusters)
float xavgc2m[4]
1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins ...
bool any(const std::vector< T > &v, const T &what)
float chi2xavgone
average x chi^2 for 1 pixel clusters
float fracytwo
fraction of double pixel sample with ysize = 1
float yrms[4]
average y-rms of reconstruction binned in 4 charge bins
float mpvvav2
most probable charge in Vavilov distribution for 2 merged clusters (not actually for larger kappa) ...
float ygx0gen[4]
generic algorithm: average y0 from Gaussian fit binned in 4 charge bins
float xavg[4]
average x-bias of reconstruction binned in 4 charge bins
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &thePixelTemp_)
bool simpletemplate2D(float xhitp, float yhitp, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[13+2][21+2])
Make simple 2-D templates from track angles set in interpolate and hit position.
float y
y coordinate of boundary intersection
float dytwo
mean offset/correction for one double-pixel y-clusters
float dxone
mean offset/correction for one pixel x-clusters
float pixmax
maximum charge for individual pixels in cluster
float chi2yavgc2m[4]
1st pass chi2 min search: average y chi^2 in 4 charge bins (merged clusters)
float qmin
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)
float chi2xavgc2m[4]
1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters)
float xflcorr(int binq, float qflx)
float xgsiggen[4]
generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins
float chi2xminc2m[4]
1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters)
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float ytemp[9][21]
templates for y-reconstruction (binned over 1 central pixel)
bool interpolate(int id, float cotalpha, float cotbeta, float locBz)
float yrmsc2m[4]
1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins ...
void ytemp(int fybin, int lybin, float ytemplate[41][21+4])
int cxtemp()
Return central pixel of x-template pixels above readout threshold.
float xpar[2][5]
projected x-pixel uncertainty parameterization
float ygx0[4]
average y0 from Gaussian fit binned in 4 charge bins
float xgx0gen[4]
generic algorithm: average x0 from Gaussian fit binned in 4 charge bins
float symax
average pixel signal for y-projection of cluster
float kappavav2
kappa parameter for Vavilov distribution for 2 merged clusters
float xgsig[4]
average sigma_x from Gaussian fit binned in 4 charge bins
float cotbeta
cot(beta) is proportional to cluster length in y and is basis of interpolation
float beta
beta track angle (defined in CMS CMS IN 2004/014)
void vavilov_pars(double &mpv, double &sigma, double &kappa)
float yflcorr(int binq, float qfly)
float s
distance from track entry
float xrmsc2m[4]
1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins ...
void ytemp3d(int j, int k, std::vector< float > &ytemplate)
void temperrors(int id, float cotalpha, float cotbeta, int qBin, float &sigmay, float &sigmax, float &sy1, float &sy2, float &sx1, float &sx2)
float xgx0[4]
average x0 from Gaussian fit binned in 4 charge bins
Abs< T >::type abs(const T &t)
void ysigma2(int fypix, int lypix, float sythr, float ysum[21+4], float ysig2[21+4])
int j
y index of traversed pixel
float ygsiggen[4]
generic algorithm: average sigma_y from Gaussian fit binned in 4 charge bins
float fracxone
fraction of sample with xsize = 1
float mpvvav
most probable charge in Vavilov distribution (not actually for larger kappa)
float sxtwo
rms for one double-pixel x-clusters
float r_qMeas_qTrue
ratio of measured to true cluster charge
float chi2yavg[4]
average y chi^2 in 4 charge bins
float alpha
alpha track angle (defined in CMS CMS IN 2004/014)
float xtemp[9][13]
templates for x-reconstruction (binned over 1 central pixel)
SiPixelTemplateHeader head
< template storage structure
float chi2xminone
minimum of x chi^2 for 1 pixel clusters
float ypar[2][5]
projected y-pixel uncertainty parameterization
void xtemp3d(int j, int k, std::vector< float > &xtemplate)
void xtemp(int fxbin, int lxbin, float xtemplate[41][13+4])
void qbin_dist(int id, float cotalpha, float cotbeta, float qbin_frac[4], float &ny1_frac, float &ny2_frac, float &nx1_frac, float &nx2_frac)
float qbfrac[3]
fraction of sample in qbin = 0-2 (>=3 is the complement)
void ytemp3d_int(int nypix, int &nybins)
float fracyone
fraction of sample with ysize = 1
float qmin2
tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits)
float yavg[4]
average y-bias of reconstruction binned in 4 charge bins
void xtemp3d_int(int nxpix, int &nxbins)
float chi2ymin[4]
minimum of y chi^2 in 4 charge bins
float yavgc2m[4]
1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins ...
float x
x coordinate of boundary intersection
float dxtwo
mean offset/correction for one double-pixel x-clusters
int i
x index of traversed pixel
float yflpar[4][6]
Aqfl-parameterized y-correction in 4 charge bins.
float sxone
rms for one pixel x-clusters
float chi2xmin[4]
minimum of x chi^2 in 4 charge bins
static const G4double kappa
float chi2yminone
minimum of y chi^2 for 1 pixel clusters
float costrk[3]
direction cosines of tracks used to generate this entry
static void postInit(std::vector< SiPixelTemplateStore > &thePixelTemp_)
SiPixelTemplateEntry entx[5][29]
29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5...
float ygsig[4]
average sigma_y from Gaussian fit binned in 4 charge bins
SiPixelTemplateEntry enty[60]
60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fpix] ...
float sigmavav2
"sigma" scale fctor for Vavilov distribution for 2 merged clusters
float sytwo
rms for one double-pixel y-clusters
for(const auto &isodef:isoDefs)
float xrmsgen[4]
generic algorithm: average x-rms of reconstruction binned in 4 charge bins
float chi2xavg[4]
average x chi^2 in 4 charge bins
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
float kappavav
kappa parameter for Vavilov distribution
float xavggen[4]
generic algorithm: average x-bias of reconstruction binned in 4 charge bins
float yrmsgen[4]
generic algorithm: average y-rms of reconstruction binned in 4 charge bins
float clsleny
cluster y-length in pixels at signal height symax/2