88 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 95 #include "boost/multi_array.hpp" 104 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 109 #define LOGERROR(x) LogError(x) 110 #define LOGINFO(x) LogInfo(x) 111 #define LOGWARNING(x) LogWarning(x) 118 #define LOGERROR(x) std::cout << x << ": " 119 #define LOGINFO(x) std::cout << x << ": " 120 #define ENDL std::endl 136 const char *tempfile;
139 const int code_version={17};
145 std::ostringstream tout;
149 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 150 tout <<
"CalibTracker/SiPixelESProducers/data/template_summary_zp" 151 << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
154 tempfile = (
file.fullPath()).c_str();
156 tout <<
"template_summary_zp" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
158 tempfile = tempf.c_str();
165 if(in_file.is_open()) {
173 for (i=0; (c=in_file.get()) !=
'\n'; ++
i) {
178 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
186 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0A, no template load" <<
ENDL;
return false;}
193 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0B, no template load" 194 <<
ENDL;
return false;}
200 theCurrentTemp.
head.
fbin[1] = 1.00f;
201 theCurrentTemp.
head.
fbin[2] = 0.85f;
205 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype 206 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature " 208 <<
", 1/2 multi dcol threshold " << theCurrentTemp.
head.
s50 <<
", 1/2 single dcol threshold " << theCurrentTemp.
head.
ss50 211 <<
", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.
head.
fbin[0] <<
", " << theCurrentTemp.
head.
fbin[1]
212 <<
", " << theCurrentTemp.
head.
fbin[2]
218 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST 226 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
234 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
239 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
254 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
259 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
262 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;}
265 for (j=0; j<2; ++j) {
270 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
274 for (j=0; j<9; ++j) {
278 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
281 for (j=0; j<2; ++j) {
286 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
291 for (j=0; j<9; ++j) {
295 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
299 for (j=0; j<4; ++j) {
303 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
306 for (j=0; j<4; ++j) {
311 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
314 for (j=0; j<4; ++j) {
318 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
321 for (j=0; j<4; ++j) {
326 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
329 for (j=0; j<4; ++j) {
333 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
336 for (j=0; j<4; ++j) {
340 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
343 for (j=0; j<4; ++j) {
347 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
350 for (j=0; j<4; ++j) {
354 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
357 for (j=0; j<4; ++j) {
361 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
367 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
373 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
379 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
381 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
386 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
394 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
401 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
407 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
409 for (j=0; j<2; ++j) {
414 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
417 for (j=0; j<9; ++j) {
421 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
424 for (j=0; j<2; ++j) {
430 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
434 for (j=0; j<9; ++j) {
438 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
442 for (j=0; j<4; ++j) {
446 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
449 for (j=0; j<4; ++j) {
454 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
457 for (j=0; j<4; ++j) {
461 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
464 for (j=0; j<4; ++j) {
469 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
472 for (j=0; j<4; ++j) {
476 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
479 for (j=0; j<4; ++j) {
483 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
486 for (j=0; j<4; ++j) {
490 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
493 for (j=0; j<4; ++j) {
497 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
500 for (j=0; j<4; ++j) {
504 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
510 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
516 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
526 thePixelTemp_.push_back(theCurrentTemp);
528 postInit(thePixelTemp_);
535 LOGERROR(
"SiPixelTemplate") <<
"Error opening File" << tempfile <<
ENDL;
543 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 559 const int code_version={17};
562 auto db(dbobject.
reader());
568 for(
int m=0;
m<db.numOfTempl(); ++
m) {
573 for (i=0; i<20; ++
i) {
574 temp.
f = db.sVector()[db.index()];
575 theCurrentTemp.head.title[4*
i] = temp.
c[0];
576 theCurrentTemp.head.title[4*i+1] = temp.
c[1];
577 theCurrentTemp.head.title[4*i+2] = temp.
c[2];
578 theCurrentTemp.head.title[4*i+3] = temp.
c[3];
579 db.incrementIndex(1);
581 theCurrentTemp.head.title[79] =
'\0';
582 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.head.title <<
ENDL;
586 db >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >> theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx
587 >> theCurrentTemp.head.Dtype >> theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >> theCurrentTemp.head.qscale
588 >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >> theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >> theCurrentTemp.head.zsize;
590 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0A, no template load" <<
ENDL;
return false;}
592 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.head.title
593 <<
" code version = "<<code_version
594 <<
" object version "<<theCurrentTemp.head.templ_version
597 if(theCurrentTemp.head.templ_version > 17) {
598 db >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >> theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2];
600 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0B, no template load" 601 <<
ENDL;
return false;}
603 theCurrentTemp.head.ss50 = theCurrentTemp.head.s50;
604 theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth/2.f;
605 theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth/2.f;
606 theCurrentTemp.head.fbin[0] = 1.50f;
607 theCurrentTemp.head.fbin[1] = 1.00f;
608 theCurrentTemp.head.fbin[2] = 0.85f;
614 <<
"Template ID = " << theCurrentTemp.head.ID <<
", Template Version " 615 << theCurrentTemp.head.templ_version <<
", Bfield = " 616 << theCurrentTemp.head.Bfield<<
", NTy = " << theCurrentTemp.head.NTy <<
", NTyx = " 617 << theCurrentTemp.head.NTyx<<
", NTxx = " << theCurrentTemp.head.NTxx <<
", Dtype = " 618 << theCurrentTemp.head.Dtype<<
", Bias voltage " << theCurrentTemp.head.Vbias <<
", temperature " 619 << theCurrentTemp.head.temperature <<
", fluence " << theCurrentTemp.head.fluence
620 <<
", Q-scaling factor " << theCurrentTemp.head.qscale
621 <<
", 1/2 multi dcol threshold " << theCurrentTemp.head.s50 <<
", 1/2 single dcol threshold " 622 << theCurrentTemp.head.ss50<<
", y Lorentz Width " << theCurrentTemp.head.lorywidth
623 <<
", y Lorentz Bias " << theCurrentTemp.head.lorybias
624 <<
", x Lorentz width " << theCurrentTemp.head.lorxwidth
625 <<
", x Lorentz Bias " << theCurrentTemp.head.lorxbias
626 <<
", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0]
627 <<
", " << theCurrentTemp.head.fbin[1]
628 <<
", " << theCurrentTemp.head.fbin[2]
629 <<
", pixel x-size " << theCurrentTemp.head.xsize
630 <<
", y-size " << theCurrentTemp.head.ysize <<
", zsize " << theCurrentTemp.head.zsize <<
ENDL;
632 if(theCurrentTemp.head.templ_version < code_version) {
633 LOGINFO(
"SiPixelTemplate") <<
"code expects version "<< code_version <<
" finds " 634 << theCurrentTemp.head.templ_version <<
", load anyway " <<
ENDL;
639 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST 642 theCurrentTemp.cotbetaY =
new float[theCurrentTemp.head.NTy];
643 theCurrentTemp.cotbetaX =
new float[theCurrentTemp.head.NTyx];
644 theCurrentTemp.cotalphaX =
new float[theCurrentTemp.head.NTxx];
645 theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]);
646 theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
652 for (i=0; i < theCurrentTemp.head.NTy; ++
i) {
654 db >> theCurrentTemp.enty[
i].runnum >> theCurrentTemp.enty[
i].costrk[0]
655 >> theCurrentTemp.enty[
i].costrk[1] >> theCurrentTemp.enty[
i].costrk[2];
657 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
661 theCurrentTemp.enty[
i].alpha =
static_cast<float>(atan2((
double)theCurrentTemp.enty[i].costrk[2], (
double)theCurrentTemp.enty[i].costrk[0]));
663 theCurrentTemp.enty[
i].cotalpha = theCurrentTemp.enty[
i].costrk[0]/theCurrentTemp.enty[
i].costrk[2];
665 theCurrentTemp.enty[
i].beta =
static_cast<float>(atan2((
double)theCurrentTemp.enty[i].costrk[2], (
double)theCurrentTemp.enty[i].costrk[1]));
667 theCurrentTemp.enty[
i].cotbeta = theCurrentTemp.enty[
i].costrk[1]/theCurrentTemp.enty[
i].costrk[2];
669 db >> theCurrentTemp.enty[
i].qavg >> theCurrentTemp.enty[
i].pixmax >> theCurrentTemp.enty[
i].symax >> theCurrentTemp.enty[
i].dyone
670 >> theCurrentTemp.enty[
i].syone >> theCurrentTemp.enty[
i].sxmax >> theCurrentTemp.enty[
i].dxone >> theCurrentTemp.enty[
i].sxone;
672 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
674 db >> theCurrentTemp.enty[
i].dytwo >> theCurrentTemp.enty[
i].sytwo >> theCurrentTemp.enty[
i].dxtwo
675 >> theCurrentTemp.enty[
i].sxtwo >> theCurrentTemp.enty[
i].qmin >> theCurrentTemp.enty[
i].clsleny >> theCurrentTemp.enty[
i].clslenx;
678 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
680 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;}
682 for (j=0; j<2; ++j) {
684 db >> theCurrentTemp.enty[
i].ypar[j][0] >> theCurrentTemp.enty[
i].ypar[j][1]
685 >> theCurrentTemp.enty[
i].ypar[j][2] >> theCurrentTemp.enty[
i].ypar[j][3] >> theCurrentTemp.enty[
i].ypar[j][4];
687 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
691 for (j=0; j<9; ++j) {
693 for (k=0; k<
TYSIZE; ++
k) {db >> theCurrentTemp.enty[
i].ytemp[j][
k];}
695 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
698 for (j=0; j<2; ++j) {
700 db >> theCurrentTemp.enty[
i].xpar[j][0] >> theCurrentTemp.enty[
i].xpar[j][1]
701 >> theCurrentTemp.enty[
i].xpar[j][2] >> theCurrentTemp.enty[
i].xpar[j][3] >> theCurrentTemp.enty[
i].xpar[j][4];
703 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
708 for (j=0; j<9; ++j) {
710 for (k=0; k<
TXSIZE; ++
k) {db >> theCurrentTemp.enty[
i].xtemp[j][
k]; qavg_avg += theCurrentTemp.enty[
i].xtemp[j][
k];}
712 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
714 theCurrentTemp.enty[
i].qavg_avg = qavg_avg/9.;
716 for (j=0; j<4; ++j) {
718 db >> theCurrentTemp.enty[
i].yavg[j] >> theCurrentTemp.enty[
i].yrms[j] >> theCurrentTemp.enty[
i].ygx0[j] >> theCurrentTemp.enty[
i].ygsig[j];
720 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
723 for (j=0; j<4; ++j) {
725 db >> theCurrentTemp.enty[
i].yflpar[j][0] >> theCurrentTemp.enty[
i].yflpar[j][1] >> theCurrentTemp.enty[
i].yflpar[j][2]
726 >> theCurrentTemp.enty[
i].yflpar[j][3] >> theCurrentTemp.enty[
i].yflpar[j][4] >> theCurrentTemp.enty[
i].yflpar[j][5];
728 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
731 for (j=0; j<4; ++j) {
733 db >> theCurrentTemp.enty[
i].xavg[j] >> theCurrentTemp.enty[
i].xrms[j] >> theCurrentTemp.enty[
i].xgx0[j] >> theCurrentTemp.enty[
i].xgsig[j];
735 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
738 for (j=0; j<4; ++j) {
740 db >> theCurrentTemp.enty[
i].xflpar[j][0] >> theCurrentTemp.enty[
i].xflpar[j][1] >> theCurrentTemp.enty[
i].xflpar[j][2]
741 >> theCurrentTemp.enty[
i].xflpar[j][3] >> theCurrentTemp.enty[
i].xflpar[j][4] >> theCurrentTemp.enty[
i].xflpar[j][5];
743 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
746 for (j=0; j<4; ++j) {
748 db >> theCurrentTemp.enty[
i].chi2yavg[j] >> theCurrentTemp.enty[
i].chi2ymin[j] >> theCurrentTemp.enty[
i].chi2xavg[j] >> theCurrentTemp.enty[
i].chi2xmin[j];
750 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
753 for (j=0; j<4; ++j) {
755 db >> theCurrentTemp.enty[
i].yavgc2m[j] >> theCurrentTemp.enty[
i].yrmsc2m[j] >> theCurrentTemp.enty[
i].chi2yavgc2m[j] >> theCurrentTemp.enty[
i].chi2yminc2m[j];
757 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
760 for (j=0; j<4; ++j) {
762 db >> theCurrentTemp.enty[
i].xavgc2m[j] >> theCurrentTemp.enty[
i].xrmsc2m[j] >> theCurrentTemp.enty[
i].chi2xavgc2m[j] >> theCurrentTemp.enty[
i].chi2xminc2m[j];
764 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
767 for (j=0; j<4; ++j) {
769 db >> theCurrentTemp.enty[
i].yavggen[j] >> theCurrentTemp.enty[
i].yrmsgen[j] >> theCurrentTemp.enty[
i].ygx0gen[j] >> theCurrentTemp.enty[
i].ygsiggen[j];
771 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
774 for (j=0; j<4; ++j) {
776 db >> theCurrentTemp.enty[
i].xavggen[j] >> theCurrentTemp.enty[
i].xrmsgen[j] >> theCurrentTemp.enty[
i].xgx0gen[j] >> theCurrentTemp.enty[
i].xgsiggen[j];
778 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
782 db >> theCurrentTemp.enty[
i].chi2yavgone >> theCurrentTemp.enty[
i].chi2yminone >> theCurrentTemp.enty[
i].chi2xavgone >> theCurrentTemp.enty[
i].chi2xminone >> theCurrentTemp.enty[
i].qmin2
783 >> theCurrentTemp.enty[
i].mpvvav >> theCurrentTemp.enty[
i].sigmavav >> theCurrentTemp.enty[
i].kappavav >> theCurrentTemp.enty[
i].r_qMeas_qTrue >> theCurrentTemp.enty[
i].spare[0];
785 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
787 db >> theCurrentTemp.enty[
i].mpvvav2 >> theCurrentTemp.enty[
i].sigmavav2 >> theCurrentTemp.enty[
i].kappavav2 >> theCurrentTemp.enty[
i].qbfrac[0] >> theCurrentTemp.enty[
i].qbfrac[1]
788 >> theCurrentTemp.enty[
i].qbfrac[2] >> theCurrentTemp.enty[
i].fracyone >> theCurrentTemp.enty[
i].fracxone >> theCurrentTemp.enty[
i].fracytwo >> theCurrentTemp.enty[
i].fracxtwo;
791 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.enty[
i].runnum <<
ENDL;
return false;}
797 for (k=0; k < theCurrentTemp.head.NTyx; ++
k) {
799 for (i=0; i < theCurrentTemp.head.NTxx; ++
i) {
801 db >> theCurrentTemp.entx[
k][
i].runnum >> theCurrentTemp.entx[
k][
i].costrk[0]
802 >> theCurrentTemp.entx[
k][
i].costrk[1] >> theCurrentTemp.entx[
k][
i].costrk[2];
804 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
808 theCurrentTemp.entx[
k][
i].alpha =
static_cast<float>(atan2((
double)theCurrentTemp.entx[k][i].costrk[2], (
double)theCurrentTemp.entx[k][i].costrk[0]));
810 theCurrentTemp.entx[
k][
i].cotalpha = theCurrentTemp.entx[
k][
i].costrk[0]/theCurrentTemp.entx[
k][
i].costrk[2];
812 theCurrentTemp.entx[
k][
i].beta =
static_cast<float>(atan2((
double)theCurrentTemp.entx[k][i].costrk[2], (
double)theCurrentTemp.entx[k][i].costrk[1]));
814 theCurrentTemp.entx[
k][
i].cotbeta = theCurrentTemp.entx[
k][
i].costrk[1]/theCurrentTemp.entx[
k][
i].costrk[2];
816 db >> theCurrentTemp.entx[
k][
i].qavg >> theCurrentTemp.entx[
k][
i].pixmax >> theCurrentTemp.entx[
k][
i].symax >> theCurrentTemp.entx[
k][
i].dyone
817 >> theCurrentTemp.entx[
k][
i].syone >> theCurrentTemp.entx[
k][
i].sxmax >> theCurrentTemp.entx[
k][
i].dxone >> theCurrentTemp.entx[
k][
i].sxone;
819 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
821 db >> theCurrentTemp.entx[
k][
i].dytwo >> theCurrentTemp.entx[
k][
i].sytwo >> theCurrentTemp.entx[
k][
i].dxtwo
822 >> theCurrentTemp.entx[
k][
i].sxtwo >> theCurrentTemp.entx[
k][
i].qmin >> theCurrentTemp.entx[
k][
i].clsleny >> theCurrentTemp.entx[
k][
i].clslenx;
825 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
827 for (j=0; j<2; ++j) {
829 db >> theCurrentTemp.entx[
k][
i].ypar[j][0] >> theCurrentTemp.entx[
k][
i].ypar[j][1]
830 >> theCurrentTemp.entx[
k][
i].ypar[j][2] >> theCurrentTemp.entx[
k][
i].ypar[j][3] >> theCurrentTemp.entx[
k][
i].ypar[j][4];
832 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
835 for (j=0; j<9; ++j) {
837 for (l=0; l<
TYSIZE; ++
l) {db >> theCurrentTemp.entx[
k][
i].ytemp[j][
l];}
839 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
844 for (j=0; j<2; ++j) {
846 db >> theCurrentTemp.entx[
k][
i].xpar[j][0] >> theCurrentTemp.entx[
k][
i].xpar[j][1]
847 >> theCurrentTemp.entx[
k][
i].xpar[j][2] >> theCurrentTemp.entx[
k][
i].xpar[j][3] >> theCurrentTemp.entx[
k][
i].xpar[j][4];
850 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
854 for (j=0; j<9; ++j) {
856 for (l=0; l<
TXSIZE; ++
l) {db >> theCurrentTemp.entx[
k][
i].xtemp[j][
l]; qavg_avg += theCurrentTemp.entx[
k][
i].xtemp[j][
l];}
858 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
860 theCurrentTemp.entx[
k][
i].qavg_avg = qavg_avg/9.;
862 for (j=0; j<4; ++j) {
864 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];
866 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
869 for (j=0; j<4; ++j) {
871 db >> theCurrentTemp.entx[
k][
i].yflpar[j][0] >> theCurrentTemp.entx[
k][
i].yflpar[j][1] >> theCurrentTemp.entx[
k][
i].yflpar[j][2]
872 >> theCurrentTemp.entx[
k][
i].yflpar[j][3] >> theCurrentTemp.entx[
k][
i].yflpar[j][4] >> theCurrentTemp.entx[
k][
i].yflpar[j][5];
874 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
877 for (j=0; j<4; ++j) {
879 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];
881 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
884 for (j=0; j<4; ++j) {
886 db >> theCurrentTemp.entx[
k][
i].xflpar[j][0] >> theCurrentTemp.entx[
k][
i].xflpar[j][1] >> theCurrentTemp.entx[
k][
i].xflpar[j][2]
887 >> theCurrentTemp.entx[
k][
i].xflpar[j][3] >> theCurrentTemp.entx[
k][
i].xflpar[j][4] >> theCurrentTemp.entx[
k][
i].xflpar[j][5];
889 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
892 for (j=0; j<4; ++j) {
894 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];
896 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
899 for (j=0; j<4; ++j) {
901 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];
903 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
906 for (j=0; j<4; ++j) {
908 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];
910 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
913 for (j=0; j<4; ++j) {
915 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];
917 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
920 for (j=0; j<4; ++j) {
922 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];
924 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
928 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
929 >> 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];
931 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
933 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]
934 >> 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;
937 if(db.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
return false;}
945 thePixelTemp_.push_back(theCurrentTemp);
948 postInit(thePixelTemp_);
974 for (
auto & templ : thePixelTemp_) {
975 for (
auto iy=0; iy<templ.head.NTy; ++iy ) templ.cotbetaY[iy]=templ.enty[iy].cotbeta;
976 for (
auto iy=0; iy<templ.head.NTyx; ++iy ) templ.cotbetaX[iy]= templ.entx[iy][0].cotbeta;
977 for (
auto ix=0; ix<templ.head.NTxx; ++ix ) templ.cotalphaX[ix]=templ.entx[0][ix].cotalpha;
1002 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx;
1003 float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, symax, chi2xavgone, chi2xminone, cota, cotb, cotalpha0, cotbeta0;
1004 bool flip_x, flip_y;
1006 float chi2xavg[4], chi2xmin[4], chi2xavgc2m[4], chi2xminc2m[4];
1010 if(
id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
1012 cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ =
true;
1014 if(
id != id_current_) {
1019 for(i=0; i<(
int)thePixelTemp_.size(); ++
i) {
1023 if(
id == thePixelTemp_[i].head.ID) {
1030 qscale_ = thePixelTemp_[index_id_].head.qscale;
1034 s50_ = thePixelTemp_[index_id_].head.s50;
1038 for(j=0; j<3; ++j) {fbin_[j] = thePixelTemp_[index_id_].head.fbin[j];}
1043 xsize_ = thePixelTemp_[index_id_].head.xsize;
1044 ysize_ = thePixelTemp_[index_id_].head.ysize;
1045 zsize_ = thePixelTemp_[index_id_].head.zsize;
1052 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1053 if(index_id_ < 0 || index_id_ >= (
int)thePixelTemp_.size()) {
1054 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::interpolate can't find needed template ID = " <<
id << std::endl;
1057 assert(index_id_ >= 0 && index_id_ < (
int)thePixelTemp_.size());
1066 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
1067 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
1074 switch(thePixelTemp_[index_id_].head.Dtype) {
1076 if(cotbeta < 0.
f) {flip_y =
true;}
1090 if(locBx*locBz < 0.
f) {
1102 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1103 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
1105 std::cout <<
"SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
1109 Ny = thePixelTemp_[index_id_].head.NTy;
1110 Nyx = thePixelTemp_[index_id_].head.NTyx;
1111 Nxx = thePixelTemp_[index_id_].head.NTxx;
1113 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1114 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
1115 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
1118 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
1128 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
1136 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
1138 for (i=0; i<Ny-1; ++
i) {
1140 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
1143 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
1147 }
else { success_ =
false; }
1155 qavg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg;
1157 symax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].symax + yratio*thePixelTemp_[index_id_].enty[ihigh].symax;
1159 sxmax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sxmax + yratio*thePixelTemp_[index_id_].enty[ihigh].sxmax;
1160 dyone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dyone + yratio*thePixelTemp_[index_id_].enty[ihigh].dyone;
1161 if(flip_y) {dyone_ = -dyone_;}
1162 syone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].syone + yratio*thePixelTemp_[index_id_].enty[ihigh].syone;
1163 dytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].dytwo;
1164 if(flip_y) {dytwo_ = -dytwo_;}
1165 sytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].sytwo;
1166 qmin_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin;
1168 qmin2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin2 + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin2;
1170 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
1171 mpvvav_ *= qcorrect;
1172 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
1173 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
1174 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
1175 mpvvav2_ *= qcorrect;
1176 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
1177 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
1178 clsleny_ = fminf(thePixelTemp_[index_id_].enty[ilow].clsleny, thePixelTemp_[index_id_].enty[ihigh].clsleny);
1179 qavg_avg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg_avg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg_avg;
1180 qavg_avg_ *= qcorrect;
1181 for(i=0; i<2 ; ++
i) {
1182 for(j=0; j<5 ; ++j) {
1185 yparl_[1-
i][j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][j];
1186 yparh_[1-
i][j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][j];
1188 yparl_[
i][j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][j];
1189 yparh_[
i][j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][j];
1192 xparly0_[1-
i][j] = thePixelTemp_[index_id_].enty[ilow].xpar[
i][j];
1193 xparhy0_[1-
i][j] = thePixelTemp_[index_id_].enty[ihigh].xpar[
i][j];
1195 xparly0_[
i][j] = thePixelTemp_[index_id_].enty[ilow].xpar[
i][j];
1196 xparhy0_[
i][j] = thePixelTemp_[index_id_].enty[ihigh].xpar[
i][j];
1201 for(i=0; i<4; ++
i) {
1202 yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavg[i];
1203 if(flip_y) {yavg_[
i] = -yavg_[
i];}
1204 yrms_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrms[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrms[i];
1210 chi2yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavg[i];
1211 chi2ymin_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2ymin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2ymin[i];
1212 chi2xavg[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavg[i];
1213 chi2xmin[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xmin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xmin[i];
1214 yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavgc2m[i];
1215 if(flip_y) {yavgc2m_[
i] = -yavgc2m_[
i];}
1216 yrmsc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrmsc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrmsc2m[i];
1217 chi2yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgc2m[i];
1219 chi2yminc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminc2m[i];
1221 chi2xavgc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgc2m[i];
1222 chi2xminc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminc2m[i];
1223 for(j=0; j<6 ; ++j) {
1224 yflparl_[
i][j] = thePixelTemp_[index_id_].enty[ilow].yflpar[
i][j];
1225 yflparh_[
i][j] = thePixelTemp_[index_id_].enty[ihigh].yflpar[
i][j];
1229 if(flip_y && (j == 0 || j == 2 || j == 4)) {
1230 yflparl_[
i][j] = - yflparl_[
i][j];
1231 yflparh_[
i][j] = - yflparh_[
i][j];
1238 chi2yavgone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgone;
1239 chi2yminone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminone;
1240 chi2xavgone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgone;
1241 chi2xminone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminone;
1243 fracyone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].fracyone + yratio*thePixelTemp_[index_id_].enty[ihigh].fracyone;
1244 fracytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].fracytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].fracytwo;
1251 for(i=0; i<9; ++
i) {
1254 ytemp_[
i][
BYM2] = 0.f;
1255 ytemp_[
i][
BYM1] = 0.f;
1256 for(j=0; j<
TYSIZE; ++j) {
1261 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];
1263 ytemp_[
i][j+2]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].ytemp[i][j] + yratio*thePixelTemp_[index_id_].enty[ihigh].ytemp[i][j];
1273 if(abs_cotb_ >= thePixelTemp_[index_id_].entx[Nyx-1][0].cotbeta) {
1278 }
else if(abs_cotb_ >= thePixelTemp_[index_id_].entx[0][0].cotbeta) {
1280 for (i=0; i<Nyx-1; ++
i) {
1282 if( thePixelTemp_[index_id_].entx[i][0].cotbeta <= abs_cotb_ && abs_cotb_ < thePixelTemp_[index_id_].entx[i+1][0].cotbeta) {
1285 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);
1296 if(cota >= thePixelTemp_[index_id_].entx[0][Nxx-1].cotalpha) {
1304 if(cota >= thePixelTemp_[index_id_].entx[0][0].cotalpha) {
1306 for (i=0; i<Nxx-1; ++
i) {
1308 if( thePixelTemp_[index_id_].entx[0][i].cotalpha <= cota && cota < thePixelTemp_[index_id_].entx[0][i+1].cotalpha) {
1311 xxratio = (cota - thePixelTemp_[index_id_].entx[0][
i].cotalpha)/(thePixelTemp_[index_id_].entx[0][i+1].cotalpha - thePixelTemp_[index_id_].entx[0][i].cotalpha);
1315 }
else { success_ =
false; }
1327 sxparmax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].sxmax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].sxmax;
1329 if(thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax != 0.
f) {sxmax_=sxmax_/thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax*sxmax;}
1330 symax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].symax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].symax;
1331 if(thePixelTemp_[index_id_].entx[imaxx][imidy].symax != 0.
f) {symax_=symax_/thePixelTemp_[index_id_].entx[imaxx][imidy].symax*symax;}
1332 dxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxone;
1333 if(flip_x) {dxone_ = -dxone_;}
1334 sxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxone;
1335 dxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxtwo;
1336 if(flip_x) {dxtwo_ = -dxtwo_;}
1337 sxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxtwo;
1338 clslenx_ = fminf(thePixelTemp_[index_id_].entx[0][ilow].clslenx, thePixelTemp_[index_id_].entx[0][ihigh].clslenx);
1340 for(i=0; i<2 ; ++
i) {
1341 for(j=0; j<5 ; ++j) {
1344 xpar0_[1-
i][j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][j];
1345 xparl_[1-
i][j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][j];
1346 xparh_[1-
i][j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][j];
1348 xpar0_[
i][j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][j];
1349 xparl_[
i][j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][j];
1350 xparh_[
i][j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][j];
1357 pixmax_=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].pixmax)
1358 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].pixmax);
1361 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)
1362 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].r_qMeas_qTrue + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].r_qMeas_qTrue);
1365 for(i=0; i<4; ++
i) {
1366 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])
1367 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavg[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavg[
i]);
1368 if(flip_x) {xavg_[
i] = -xavg_[
i];}
1370 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])
1371 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrms[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrms[
i]);
1379 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])
1380 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavgc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavgc2m[
i]);
1381 if(flip_x) {xavgc2m_[
i] = -xavgc2m_[
i];}
1383 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])
1384 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrmsc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrmsc2m[
i]);
1400 chi2xavg_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavg[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavg[i]);
1401 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];}
1403 chi2xmin_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xmin[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xmin[i]);
1404 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];}
1406 chi2xavgc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgc2m[i]);
1407 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];}
1409 chi2xminc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminc2m[i]);
1410 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];}
1412 for(j=0; j<6 ; ++j) {
1413 xflparll_[
i][j] = thePixelTemp_[index_id_].entx[iylow][ilow].xflpar[
i][j];
1414 xflparlh_[
i][j] = thePixelTemp_[index_id_].entx[iylow][ihigh].xflpar[
i][j];
1415 xflparhl_[
i][j] = thePixelTemp_[index_id_].entx[iyhigh][ilow].xflpar[
i][j];
1416 xflparhh_[
i][j] = thePixelTemp_[index_id_].entx[iyhigh][ihigh].xflpar[
i][j];
1418 if(flip_x && (j == 0 || j == 2 || j == 4)) {
1419 xflparll_[
i][j] = -xflparll_[
i][j];
1420 xflparlh_[
i][j] = -xflparlh_[
i][j];
1421 xflparhl_[
i][j] = -xflparhl_[
i][j];
1422 xflparhh_[
i][j] = -xflparhh_[
i][j];
1430 chi2xavgone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgone);
1431 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone != 0.
f) {chi2xavgone_=chi2xavgone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone*chi2xavgone;}
1433 chi2xminone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminone);
1434 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone != 0.
f) {chi2xminone_=chi2xminone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone*chi2xminone;}
1436 fracxone_ = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].fracxone + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].fracxone)
1437 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].fracxone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].fracxone);
1438 fracxtwo_ = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].fracxtwo + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].fracxtwo)
1439 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].fracxtwo + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].fracxtwo);
1450 cotbeta0 = thePixelTemp_[index_id_].entx[iyhigh][0].cotbeta;
1451 qxtempcor=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta0*cotbeta0+cotalpha*cotalpha));
1453 for(i=0; i<9; ++
i) {
1456 xtemp_[
i][
BXM2] = 0.f;
1457 xtemp_[
i][
BXM1] = 0.f;
1458 for(j=0; j<
TXSIZE; ++j) {
1463 xtemp_[8-
i][
BXM3-j]=qxtempcor*((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xtemp[i][j] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xtemp[i][j]);
1465 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]);
1470 lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
1471 lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
1472 lorybias_ = thePixelTemp_[index_id_].head.lorybias;
1473 lorxbias_ = thePixelTemp_[index_id_].head.lorxbias;
1474 if(flip_x) {lorxwidth_ = -lorxwidth_; lorxbias_ = -lorxbias_;}
1475 if(flip_y) {lorywidth_ = -lorywidth_; lorybias_ = -lorybias_;}
1501 if(cotbeta < 0.
f) {locBx = -1.f;}
1503 if(cotalpha < 0.
f) {locBz = -locBx;}
1543 float sigi, sigi2, sigi3, sigi4, symax, qscale, s25;
1547 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1548 if(fypix < 2 || fypix >=
BYM2) {
1549 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with fypix = " << fypix << std::endl;
1552 assert(fypix > 1 && fypix <
BYM2);
1554 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1555 if(lypix < fypix || lypix >=
BYM2) {
1556 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with lypix/fypix = " << lypix <<
"/" << fypix << std::endl;
1559 assert(lypix >= fypix && lypix <
BYM2);
1566 if(symax_ > syparmax_) {symax = syparmax_;}
1570 for(i=fypix-2; i<=lypix+2; ++
i) {
1571 if(i < fypix || i > lypix) {
1575 ysig2[
i] = s50_*s50_;
1577 if(ysum[i] < symax) {
1580 if(sigi < s25) sigi = s25;
1583 qscale = ysum[
i]/symax;
1585 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1587 ysig2[
i] = (1.f-yratio_)*
1588 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1590 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1592 ysig2[
i] = (1.f-yratio_)*
1593 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1595 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1598 if(ysum[i] > sythr) {ysig2[
i] = 1.e8;}
1599 if(ysig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1600 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1622 float sigi, sigi2, sigi3, sigi4, symax, qscale, err2, s25;
1626 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1627 if(index < 2 || index >=
BYM2) {
1628 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with index = " << index << std::endl;
1631 assert(index > 1 && index <
BYM2);
1638 if(symax_ > syparmax_) {symax = syparmax_;}
1642 if(qpixel < symax) {
1645 if(sigi < s25) sigi = s25;
1648 qscale = qpixel/symax;
1650 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1652 err2 = (1.f-yratio_)*
1653 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1655 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1657 err2 = (1.f-yratio_)*
1658 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1660 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1663 if(ysig2 <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1664 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1690 float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale, s25;
1694 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1695 if(fxpix < 2 || fxpix >=
BXM2) {
1696 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with fxpix = " << fxpix << std::endl;
1699 assert(fxpix > 1 && fxpix <
BXM2);
1701 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1702 if(lxpix < fxpix || lxpix >=
BXM2) {
1703 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with lxpix/fxpix = " << lxpix <<
"/" << fxpix << std::endl;
1706 assert(lxpix >= fxpix && lxpix <
BXM2);
1713 if(sxmax_ > sxparmax_) {sxmax = sxparmax_;}
1717 for(i=fxpix-2; i<=lxpix+2; ++
i) {
1718 if(i < fxpix || i > lxpix) {
1722 xsig2[
i] = s50_*s50_;
1724 if(xsum[i] < sxmax) {
1727 if(sigi < s25) sigi = s25;
1730 qscale = xsum[
i]/sxmax;
1732 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1737 yint = (1.f-yratio_)*
1738 (xparly0_[0][0]+xparly0_[0][1]*sigi+xparly0_[0][2]*sigi2+xparly0_[0][3]*sigi3+xparly0_[0][4]*sigi4)
1740 (xparhy0_[0][0]+xparhy0_[0][1]*sigi+xparhy0_[0][2]*sigi2+xparhy0_[0][3]*sigi3+xparhy0_[0][4]*sigi4);
1742 yint = (1.f-yratio_)*
1743 (xparly0_[1][0]+xparly0_[1][1]*sigi+xparly0_[1][2]*sigi2+xparly0_[1][3]*sigi3+xparly0_[1][4]*sigi4)
1745 (xparhy0_[1][0]+xparhy0_[1][1]*sigi+xparhy0_[1][2]*sigi2+xparhy0_[1][3]*sigi3+xparhy0_[1][4]*sigi4);
1751 xsig2[
i] = (1.f-xxratio_)*
1752 (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4)
1754 (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4);
1756 xsig2[
i] = (1.f-xxratio_)*
1757 (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4)
1759 (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4);
1765 x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4;
1767 x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4;
1772 if(x0 != 0.
f) {xsig2[
i] = xsig2[
i]/x0 * yint;}
1774 if(xsum[i] > sxthr) {xsig2[
i] = 1.e8;}
1775 if(xsig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg x-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1776 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1800 float qfl, qfl2, qfl3, qfl4, qfl5,
dy;
1804 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1805 if(binq < 0 || binq > 3) {
1806 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with binq = " << binq << std::endl;
1809 assert(binq >= 0 && binq < 4);
1811 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1812 if(fabs((
double)qfly) > 1.) {
1813 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with qfly = " << qfly << std::endl;
1816 assert(fabs((
double)qfly) <= 1.);
1823 if(qfl < -0.9
f) {qfl = -0.9f;}
1824 if(qfl > 0.9
f) {qfl = 0.9f;}
1828 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1829 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)
1830 + yratio_*(yflparh_[binq][0]+yflparh_[binq][1]*qfl+yflparh_[binq][2]*qfl2+yflparh_[binq][3]*qfl3+yflparh_[binq][4]*qfl4+yflparh_[binq][5]*qfl5);
1852 float qfl, qfl2, qfl3, qfl4, qfl5,
dx;
1856 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1857 if(binq < 0 || binq > 3) {
1858 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with binq = " << binq << std::endl;
1861 assert(binq >= 0 && binq < 4);
1863 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1864 if(fabs((
double)qflx) > 1.) {
1865 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with qflx = " << qflx << std::endl;
1868 assert(fabs((
double)qflx) <= 1.);
1875 if(qfl < -0.9
f) {qfl = -0.9f;}
1876 if(qfl > 0.9
f) {qfl = 0.9f;}
1880 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1881 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)
1882 + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5))
1883 + 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)
1884 + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5));
1908 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1909 if(fybin < 0 || fybin > 40) {
1910 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with fybin = " << fybin << std::endl;
1913 assert(fybin >= 0 && fybin < 41);
1915 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1916 if(lybin < 0 || lybin > 40) {
1917 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with lybin = " << lybin << std::endl;
1920 assert(lybin >= 0 && lybin < 41);
1925 for(i=0; i<9; ++
i) {
1926 for(j=0; j<
BYSIZE; ++j) {
1927 ytemplate[i+16][j]=ytemp_[
i][j];
1930 for(i=0; i<8; ++
i) {
1931 ytemplate[i+8][
BYM1] = 0.f;
1932 for(j=0; j<
BYM1; ++j) {
1933 ytemplate[i+8][j]=ytemp_[
i][j+1];
1936 for(i=1; i<9; ++
i) {
1937 ytemplate[i+24][0] = 0.f;
1938 for(j=0; j<
BYM1; ++j) {
1939 ytemplate[i+24][j+1]=ytemp_[
i][j];
1946 for(i=0; i<8; ++
i) {
1947 ytemplate[
i][
BYM2] = 0.f;
1948 ytemplate[
i][
BYM1] = 0.f;
1949 for(j=0; j<
BYM2; ++j) {
1950 ytemplate[
i][j]=ytemp_[
i][j+2];
1955 for(i=1; i<9; ++
i) {
1956 ytemplate[i+32][0] = 0.f;
1957 ytemplate[i+32][1] = 0.f;
1958 for(j=0; j<
BYM2; ++j) {
1959 ytemplate[i+32][j+2]=ytemp_[
i][j];
1986 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1987 if(fxbin < 0 || fxbin > 40) {
1988 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with fxbin = " << fxbin << std::endl;
1991 assert(fxbin >= 0 && fxbin < 41);
1993 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1994 if(lxbin < 0 || lxbin > 40) {
1995 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with lxbin = " << lxbin << std::endl;
1998 assert(lxbin >= 0 && lxbin < 41);
2003 for(i=0; i<9; ++
i) {
2004 for(j=0; j<
BXSIZE; ++j) {
2005 xtemplate[i+16][j]=xtemp_[
i][j];
2008 for(i=0; i<8; ++
i) {
2009 xtemplate[i+8][
BXM1] = 0.f;
2010 for(j=0; j<
BXM1; ++j) {
2011 xtemplate[i+8][j]=xtemp_[
i][j+1];
2014 for(i=1; i<9; ++
i) {
2015 xtemplate[i+24][0] = 0.f;
2016 for(j=0; j<
BXM1; ++j) {
2017 xtemplate[i+24][j+1]=xtemp_[
i][j];
2024 for(i=0; i<8; ++
i) {
2025 xtemplate[
i][
BXM2] = 0.f;
2026 xtemplate[
i][
BXM1] = 0.f;
2027 for(j=0; j<
BXM2; ++j) {
2028 xtemplate[
i][j]=xtemp_[
i][j+2];
2033 for(i=1; i<9; ++
i) {
2034 xtemplate[i+32][0] = 0.f;
2035 xtemplate[i+32][1] = 0.f;
2036 for(j=0; j<
BXM2; ++j) {
2037 xtemplate[i+32][j+2]=xtemp_[
i][j];
2062 float qedge = 2.*s50_;
2065 for(j=0; j<
BYSIZE; ++j) {
2066 if(ytemp_[4][j] > sigmax) {
2067 sigmax = ytemp_[4][j];
2071 if(sigmax < qedge) {qedge = s50_;}
2072 if(sigmax < qedge || jmax<1 || jmax>
BYM2) {
return -1;}
2078 for(j=jmax+1; j<
BYM1; ++j) {
2079 if(ytemp_[4][j] < qedge)
break;
2085 for(j=jmax-1; j>0; --j) {
2086 if(ytemp_[4][j] < qedge)
break;
2090 return (jbeg+jend)/2;
2111 float qedge = 2.*s50_;
2114 for(j=0; j<
BXSIZE; ++j) {
2115 if(xtemp_[4][j] > sigmax) {
2116 sigmax = xtemp_[4][j];
2120 if(sigmax < qedge) {qedge = s50_;}
2121 if(sigmax < qedge || jmax<1 || jmax>
BXM2) {
return -1;}
2127 for(j=jmax+1; j<
BXM1; ++j) {
2128 if(xtemp_[4][j] < qedge)
break;
2134 for(j=jmax-1; j>0; --j) {
2135 if(xtemp_[4][j] < qedge)
break;
2139 return (jbeg+jend)/2;
2157 int ioff0, ioffp, ioffm;
2161 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2162 if(nypix < 1 || nypix >=
BYM3) {
2163 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp3d called with nypix = " << nypix << std::endl;
2166 assert(nypix > 0 && nypix <
BYM3);
2171 float diff = fabsf(nypix - clsleny_)/2. + 1.f;
2172 int nshift = (
int)diff;
2173 if((diff - nshift) > 0.5f) {++nshift;}
2177 nybins_ = 9 + 16*nshift;
2181 temp2dy_.resize(boost::extents[nybins_][
BYSIZE]);
2187 for(i=0; i<9; ++
i) {
2188 for(j=0; j<
BYSIZE; ++j) {
2189 temp2dy_[i+ioff0][j]=ytemp_[
i][j];
2195 for(k=1; k<=nshift; ++
k) {
2197 for(i=0; i<8; ++
i) {
2198 for(j=0; j<
k; ++j) {
2199 temp2dy_[i+ioffm][
BYM1-j] = 0.f;
2201 for(j=0; j<BYSIZE-
k; ++j) {
2202 temp2dy_[i+ioffm][j]=ytemp_[
i][j+
k];
2206 for(i=1; i<9; ++
i) {
2207 for(j=0; j<
k; ++j) {
2208 temp2dy_[i+ioffp][j] = 0.f;
2210 for(j=0; j<BYSIZE-
k; ++j) {
2211 temp2dy_[i+ioffp][j+
k]=ytemp_[
i][j];
2231 if(i >= 0 && i < nybins_ && j <= i) {
2233 ytemplate[
k]=temp2dy_[
i][
k]+temp2dy_[j][
k];
2258 int ioff0, ioffp, ioffm;
2262 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2263 if(nxpix < 1 || nxpix >=
BXM3) {
2264 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl;
2267 assert(nxpix > 0 && nxpix <
BXM3);
2272 float diff = fabsf(nxpix - clslenx_)/2.f + 1.f;
2273 int nshift = (
int)diff;
2274 if((diff - nshift) > 0.5f) {++nshift;}
2278 nxbins_ = 9 + 16*nshift;
2282 temp2dx_.resize(boost::extents[nxbins_][
BXSIZE]);
2288 for(i=0; i<9; ++
i) {
2289 for(j=0; j<
BXSIZE; ++j) {
2290 temp2dx_[i+ioff0][j]=xtemp_[
i][j];
2296 for(k=1; k<=nshift; ++
k) {
2298 for(i=0; i<8; ++
i) {
2299 for(j=0; j<
k; ++j) {
2300 temp2dx_[i+ioffm][
BXM1-j] = 0.f;
2302 for(j=0; j<BXSIZE-
k; ++j) {
2303 temp2dx_[i+ioffm][j]=xtemp_[
i][j+
k];
2307 for(i=1; i<9; ++
i) {
2308 for(j=0; j<
k; ++j) {
2309 temp2dx_[i+ioffp][j] = 0.f;
2311 for(j=0; j<BXSIZE-
k; ++j) {
2312 temp2dx_[i+ioffp][j+
k]=xtemp_[
i][j];
2334 if(i >= 0 && i < nxbins_ && j <= i) {
2336 xtemplate[
k]=temp2dx_[
i][
k]+temp2dx_[j][
k];
2379 float& sigmay,
float& deltay,
float& sigmax,
float& deltax,
float& sy1,
float& dy1,
float& sy2,
2380 float& dy2,
float& sx1,
float& dx1,
float& sx2,
float& dx2)
2388 for(
int i=0;
i<(
int)thePixelTemp_.size(); ++
i) {
2389 if(
id == thePixelTemp_[
i].head.ID) {
2395 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2396 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2397 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin can't find needed template ID = " <<
id << std::endl;
2400 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2406 auto const & templ = thePixelTemp_[
index];
2414 auto cotalpha0 = thePixelTemp_[
index].enty[0].cotalpha;
2415 auto qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
2419 float cota = cotalpha;
2420 float cotb = abs_cotb_;
2421 bool flip_x =
false;
2422 bool flip_y =
false;
2423 switch(thePixelTemp_[index_id_].head.Dtype) {
2425 if(cotbeta < 0.
f) {flip_y =
true;}
2439 if(locBx*locBz < 0.
f) {
2451 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2452 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
2454 std::cout <<
"SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
2462 auto qscale = thePixelTemp_[
index].head.qscale;
2472 auto Ny = thePixelTemp_[
index].head.NTy;
2473 auto Nyx = thePixelTemp_[
index].head.NTyx;
2474 auto Nxx = thePixelTemp_[
index].head.NTxx;
2476 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2477 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2478 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2481 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2491 auto j = std::lower_bound(templ.cotbetaY,templ.cotbetaY+Ny,cotb);
2492 if (j==templ.cotbetaY+Ny) { --j; yratio = 1.f; }
2493 else if (j==templ.cotbetaY) { ++j; yratio = 0.f;}
2494 else { yratio = (cotb - (*(j-1)) )/( (*j) - (*(j-1)) ) ; }
2496 ihigh = j-templ.cotbetaY;
2504 dy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dyone + yratio*thePixelTemp_[index].enty[ihigh].dyone;
2505 if(flip_y) {dy1 = -dy1;}
2506 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2507 dy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dytwo + yratio*thePixelTemp_[index].enty[ihigh].dytwo;
2508 if(flip_y) {dy2 = -dy2;}
2509 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2511 auto qavg = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qavg + yratio*thePixelTemp_[index].enty[ihigh].qavg;
2513 auto qmin = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin + yratio*thePixelTemp_[index].enty[ihigh].qmin;
2515 auto qmin2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin2 + yratio*thePixelTemp_[index].enty[ihigh].qmin2;
2519 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2520 if(qavg <= 0.
f || qmin <= 0.
f) {
2521 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin, qavg or qmin <= 0," 2522 <<
" Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
2525 assert(qavg > 0.
f && qmin > 0.
f);
2530 auto qtotal = qscale*qclus;
2533 auto fq = qtotal/qavg;
2552 auto yavggen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yavggen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yavggen[binq];
2553 if(flip_y) {yavggen = -yavggen;}
2554 auto yrmsgen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrmsgen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yrmsgen[binq];
2565 auto j = std::lower_bound(templ.cotbetaX,templ.cotbetaX+Nyx,acotb);
2566 if (j==templ.cotbetaX+Nyx) { --j; yxratio = 1.f; }
2567 else if (j==templ.cotbetaX) { ++j; yxratio = 0.f;}
2568 else { yxratio = (acotb - (*(j-1)) )/( (*j) - (*(j-1)) ) ; }
2570 iyhigh = j-templ.cotbetaX;
2579 auto j = std::lower_bound(templ.cotalphaX,templ.cotalphaX+Nxx,cotalpha);
2580 if (j==templ.cotalphaX+Nxx) { --j; xxratio = 1.f; }
2581 else if (j==templ.cotalphaX) { ++j; xxratio = 0.f;}
2582 else { xxratio = (cota - (*(j-1)) )/( (*j) - (*(j-1)) ) ; }
2584 ihigh = j-templ.cotalphaX;
2590 dx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxone + xxratio*thePixelTemp_[index].entx[0][ihigh].dxone;
2591 if(flip_x) {dx1 = -dx1;}
2592 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2593 dx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].dxtwo;
2594 if(flip_x) {dx2 = -dx2;}
2595 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2599 pixmx=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].pixmax)
2600 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].pixmax);
2602 auto xavggen = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xavggen[binq] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xavggen[binq])
2603 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xavggen[binq] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xavggen[binq]);
2604 if(flip_x) {xavggen = -xavggen;}
2606 auto xrmsgen = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrmsgen[binq] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrmsgen[binq])
2607 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrmsgen[binq] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrmsgen[binq]);
2613 sigmay = yrmsgen; deltay = yavggen;
2615 sigmax = xrmsgen; deltax = xavggen;
2619 if(qtotal < 0.95
f*qmin) {binq = 5;}
else {
if(qtotal < 0.95
f*qmin2) {binq = 4;}}
2656 float& sigmay,
float& deltay,
float& sigmax,
float& deltax,
float& sy1,
float& dy1,
float& sy2,
2657 float& dy2,
float& sx1,
float& dx1,
float& sx2,
float& dx2)
2664 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, locBx, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2665 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2717 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz;
2720 if(cotbeta < 0.
f) {locBx = -1.f;}
2722 if(cotalpha < 0.
f) {locBz = -locBx;}
2724 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, locBx, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2725 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2741 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz, locBx;
2742 const float cotalpha = 0.f;
2744 if(cotbeta < 0.
f) {locBx = -1.f;}
2746 if(cotalpha < 0.
f) {locBz = -locBx;}
2747 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, locBx, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2748 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2775 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2776 float yratio, yxratio, xxratio;
2785 for(i=0; i<(
int)thePixelTemp_.size(); ++
i) {
2787 if(
id == thePixelTemp_[i].head.ID) {
2794 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2795 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2796 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2799 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2803 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2804 if(qBin < 0 || qBin > 5) {
2805 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors called with illegal qBin = " << qBin << std::endl;
2808 assert(qBin >= 0 && qBin < 6);
2813 if(qBin > 3) {qBin = 3;}
2818 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);
2881 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2882 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2883 yrms=(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrms[qBin] + yratio*thePixelTemp_[index].enty[ihigh].yrms[qBin];
2891 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2896 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2898 for (i=0; i<Nyx-1; ++
i) {
2900 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2903 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2914 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2921 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2923 for (i=0; i<Nxx-1; ++
i) {
2925 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2928 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2937 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2938 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2940 xrms=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrms[
qBin] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrms[
qBin])
2941 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrms[
qBin] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrms[
qBin]);
2967 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)
2974 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2975 float yratio, yxratio, xxratio;
2983 for(i=0; i<(
int)thePixelTemp_.size(); ++
i) {
2985 if(
id == thePixelTemp_[i].head.ID) {
2993 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2994 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2995 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2998 assert(index >= 0 && index < (
int)thePixelTemp_.size());
3005 acotb = fabs((
double)cotbeta);
3027 Ny = thePixelTemp_[
index].head.NTy;
3028 Nyx = thePixelTemp_[
index].head.NTyx;
3029 Nxx = thePixelTemp_[
index].head.NTxx;
3031 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3032 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
3033 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
3036 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
3044 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
3051 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
3053 for (i=0; i<Ny-1; ++
i) {
3055 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
3058 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
3068 ny1_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracyone + yratio*thePixelTemp_[index].enty[ihigh].fracyone;
3069 ny2_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracytwo + yratio*thePixelTemp_[index].enty[ihigh].fracytwo;
3076 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
3081 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
3083 for (i=0; i<Nyx-1; ++
i) {
3085 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
3088 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
3099 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
3106 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
3108 for (i=0; i<Nxx-1; ++
i) {
3110 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
3113 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
3122 for(i=0; i<3; ++
i) {
3123 qfrac[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].qbfrac[
i])
3124 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].qbfrac[
i]);
3126 nx1_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxone)
3127 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxone);
3128 nx2_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxtwo)
3129 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxtwo);
3133 qbin_frac[0] = qfrac[0];
3134 qbin_frac[1] = qbin_frac[0] + qfrac[1];
3135 qbin_frac[2] = qbin_frac[1] + qfrac[2];
3156 float x0, y0, xf, yf,
xi, yi, sf, si, s0, qpix, slopey, slopex, ds;
3157 int i, j, jpix0, ipix0, jpixf, ipixf, jpix, ipix, nx, ny, anx,
any, jmax, imax;
3160 std::list<SimplePixel>
list;
3161 std::list<SimplePixel>::iterator listIter, listEnd;
3165 x0 = xhit - 0.5*zsize_*cota_current_;
3166 y0 = yhit - 0.5*zsize_*cotb_current_;
3168 jpix0 = floor(x0/xsize_)+1;
3169 ipix0 = floor(y0/ysize_)+1;
3171 if(jpix0 < 0 || jpix0 >
BXM3) {
return false;}
3172 if(ipix0 < 0 || ipix0 >
BYM3) {
return false;}
3174 xf = xhit + 0.5*zsize_*cota_current_ + lorxwidth_;
3175 yf = yhit + 0.5*zsize_*cotb_current_ + lorywidth_;
3177 jpixf = floor(xf/xsize_)+1;
3178 ipixf = floor(yf/ysize_)+1;
3180 if(jpixf < 0 || jpixf > BXM3) {
return false;}
3181 if(ipixf < 0 || ipixf > BYM3) {
return false;}
3185 sf =
std::sqrt((xf-x0)*(xf-x0) + (yf-y0)*(yf-y0));
3186 if((xf-x0) != 0.
f) {slopey = (yf-y0)/(xf-x0);}
else { slopey = 1.e10;}
3187 if((yf-y0) != 0.f) {slopex = (xf-x0)/(yf-y0);}
else { slopex = 1.e10;}
3200 list.push_back(element);
3208 for(j=jpix0; j<jpixf; ++j) {
3210 yi = slopey*(xi-x0) + y0;
3211 ipix = (
int)(yi/ysize_)+1;
3212 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3219 list.push_back(element);
3222 for(j=jpix0; j>jpixf; --j) {
3224 yi = slopey*(xi-x0) + y0;
3225 ipix = (
int)(yi/ysize_)+1;
3226 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3233 list.push_back(element);
3242 for(i=ipix0; i<ipixf; ++
i) {
3244 xi = slopex*(yi-y0) + x0;
3245 jpix = (
int)(xi/xsize_)+1;
3246 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3253 list.push_back(element);
3256 for(i=ipix0; i>ipixf; --
i) {
3258 xi = slopex*(yi-y0) + x0;
3259 jpix = (
int)(xi/xsize_)+1;
3260 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
3267 list.push_back(element);
3281 for(i=1; i<imax; ++
i) {
3283 listIter = list.begin();
3285 while(listIter != list.end()) {
3286 if(listIter->i == i && listIter->btype == 2) {
3287 listIter = list.erase(listIter);
3290 if(listIter->i > i) {
3296 while(listIter != list.end()) {
3297 if(listIter->i == i+1 && listIter->btype == 2) {
3298 listIter = list.erase(listIter);
3301 if(listIter->i > i+1) {
3310 for(j=1; j<jmax; ++j) {
3312 listIter = list.begin();
3314 while(listIter != list.end()) {
3315 if(listIter->j == j && listIter->btype == 1) {
3316 listIter = list.erase(listIter);
3319 if(listIter->j > j) {
3325 while(listIter != list.end()) {
3326 if(listIter->j == j+1 && listIter->btype == 1) {
3327 listIter = list.erase(listIter);
3330 if(listIter->j > j+1) {
3342 listIter = list.begin();
3343 listEnd = list.end();
3344 for( ;listIter != listEnd; ++listIter) {
3350 if(sf > 0.
f) { qpix = qtotal*ds/sf;}
else {qpix = qtotal;}
3351 template2d[j][
i] += qpix;
3370 int ilow, ihigh, Ny;
3371 float yratio, cotb, cotalpha0,
arg;
3375 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3376 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3377 if(arg < 0.
f) arg = 0.f;
3382 Ny = thePixelTemp_[index_id_].head.NTy;
3384 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3386 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3397 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3404 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3406 for (i=0; i<Ny-1; ++
i) {
3408 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3411 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3422 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
3423 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
3424 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
3429 mpv = (double)mpvvav_;
3430 sigma = (double)sigmavav_;
3431 kappa = (double)kappavav_;
3448 int ilow, ihigh, Ny;
3449 float yratio, cotb, cotalpha0,
arg;
3453 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3454 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3455 if(arg < 0.
f) arg = 0.f;
3460 Ny = thePixelTemp_[index_id_].head.NTy;
3462 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3464 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3475 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3482 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3484 for (i=0; i<Ny-1; ++
i) {
3486 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3489 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3500 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
3501 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
3502 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
3506 mpv = (double)mpvvav2_;
3507 sigma = (double)sigmavav2_;
3508 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
bool interpolate(int id, float cotalpha, float cotbeta, float locBz, float locBx)
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 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)
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
int qbin(int id, float cotalpha, float cotbeta, float locBz, float locBx, 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)
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
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