90 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 97 #include "boost/multi_array.hpp" 104 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 110 #define LOGERROR(x) LogError(x) 111 #define LOGINFO(x) LogInfo(x) 112 #define LOGWARNING(x) LogWarning(x) 119 #define LOGERROR(x) std::cout << x << ": " 120 #define LOGINFO(x) std::cout << x << ": " 121 #define ENDL std::endl 137 const int code_version = {17};
142 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 144 int nzeros = 4 - tempfile.length();
149 tempfile =
dir +
"template_summary_zp" + tempfile +
".out";
151 tempfile =
file.fullPath();
155 std::ostringstream tout;
156 tout <<
"template_summary_zp" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
157 tempfile = tout.str();
163 std::ifstream
in_file(tempfile);
171 for (
i = 0; (
c =
in_file.get()) !=
'\n'; ++
i) {
180 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
192 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0A, no template load" <<
ENDL;
201 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0B, no template load" <<
ENDL;
209 theCurrentTemp.
head.
fbin[1] = 1.00f;
210 theCurrentTemp.
head.
fbin[2] = 0.85f;
213 LOGINFO(
"SiPixelTemplate") <<
"Template ID = " << theCurrentTemp.
head.
ID <<
", Template Version " 215 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx 216 <<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype 217 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature " 219 <<
", Q-scaling factor " << theCurrentTemp.
head.
qscale <<
", 1/2 multi dcol threshold " 220 << theCurrentTemp.
head.
s50 <<
", 1/2 single dcol threshold " << theCurrentTemp.
head.
ss50 221 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", y Lorentz Bias " 224 <<
", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.
head.
fbin[0] <<
", " 226 <<
", pixel x-size " << theCurrentTemp.
head.
xsize <<
", y-size " 230 LOGERROR(
"SiPixelTemplate") <<
"code expects version " << code_version <<
" finds " 235 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST 243 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
251 for (
i = 0;
i < theCurrentTemp.
head.
NTy; ++
i) {
256 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum 264 static_cast<float>(atan2((
double)theCurrentTemp.
enty[
i].
costrk[2], (
double)theCurrentTemp.
enty[
i].
costrk[0]));
269 static_cast<float>(atan2((
double)theCurrentTemp.
enty[
i].
costrk[2], (
double)theCurrentTemp.
enty[
i].
costrk[1]));
278 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum 288 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum 294 LOGERROR(
"SiPixelTemplate") <<
"Error in template ID " << theCurrentTemp.
head.
ID 295 <<
" qmin = " << theCurrentTemp.
enty[
i].
qmin <<
", run # " 300 for (
j = 0;
j < 2; ++
j) {
305 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " 311 for (
j = 0;
j < 9; ++
j) {
317 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " 323 for (
j = 0;
j < 2; ++
j) {
328 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " 335 for (
j = 0;
j < 9; ++
j) {
342 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " 349 for (
j = 0;
j < 4; ++
j) {
354 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " 360 for (
j = 0;
j < 4; ++
j) {
366 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " 372 for (
j = 0;
j < 4; ++
j) {
377 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " 383 for (
j = 0;
j < 4; ++
j) {
389 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " 395 for (
j = 0;
j < 4; ++
j) {
400 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " 406 for (
j = 0;
j < 4; ++
j) {
411 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " 417 for (
j = 0;
j < 4; ++
j) {
422 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " 428 for (
j = 0;
j < 4; ++
j) {
433 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " 439 for (
j = 0;
j < 4; ++
j) {
444 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " 456 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " 468 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " 482 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " 489 theCurrentTemp.
entx[
k][
i].
alpha =
static_cast<float>(
494 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(
504 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " 515 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " 520 for (
j = 0;
j < 2; ++
j) {
526 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " 532 for (
j = 0;
j < 9; ++
j) {
538 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " 544 for (
j = 0;
j < 2; ++
j) {
550 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " 557 for (
j = 0;
j < 9; ++
j) {
564 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " 571 for (
j = 0;
j < 4; ++
j) {
576 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " 582 for (
j = 0;
j < 4; ++
j) {
588 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " 594 for (
j = 0;
j < 4; ++
j) {
599 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " 605 for (
j = 0;
j < 4; ++
j) {
611 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " 617 for (
j = 0;
j < 4; ++
j) {
622 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " 628 for (
j = 0;
j < 4; ++
j) {
633 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " 639 for (
j = 0;
j < 4; ++
j) {
644 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " 650 for (
j = 0;
j < 4; ++
j) {
655 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " 661 for (
j = 0;
j < 4; ++
j) {
666 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " 679 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " 692 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " 703 pixelTemp.push_back(theCurrentTemp);
711 LOGERROR(
"SiPixelTemplate") <<
"Error opening File" << tempfile <<
ENDL;
717 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 730 const int code_version = {17};
737 auto tmpPtr = std::make_unique<SiPixelTemplateStore>();
738 auto& theCurrentTemp = *tmpPtr;
741 for (
int m = 0;
m <
db.numOfTempl(); ++
m) {
745 for (
i = 0;
i < 20; ++
i) {
747 theCurrentTemp.head.title[4 *
i] =
temp.c[0];
748 theCurrentTemp.head.title[4 *
i + 1] =
temp.c[1];
749 theCurrentTemp.head.title[4 *
i + 2] =
temp.c[2];
750 theCurrentTemp.head.title[4 *
i + 3] =
temp.c[3];
751 db.incrementIndex(1);
753 theCurrentTemp.head.title[79] =
'\0';
754 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.head.title <<
ENDL;
758 db >> theCurrentTemp.head.ID >> theCurrentTemp.head.templ_version >> theCurrentTemp.head.Bfield >>
759 theCurrentTemp.head.NTy >> theCurrentTemp.head.NTyx >> theCurrentTemp.head.NTxx >> theCurrentTemp.head.Dtype >>
760 theCurrentTemp.head.Vbias >> theCurrentTemp.head.temperature >> theCurrentTemp.head.fluence >>
761 theCurrentTemp.head.qscale >> theCurrentTemp.head.s50 >> theCurrentTemp.head.lorywidth >>
762 theCurrentTemp.head.lorxwidth >> theCurrentTemp.head.ysize >> theCurrentTemp.head.xsize >>
763 theCurrentTemp.head.zsize;
766 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0A, no template load" <<
ENDL;
770 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.head.title
771 <<
" code version = " << code_version <<
" object version " 772 << theCurrentTemp.head.templ_version <<
ENDL;
774 if (theCurrentTemp.head.templ_version > 17) {
775 db >> theCurrentTemp.head.ss50 >> theCurrentTemp.head.lorybias >> theCurrentTemp.head.lorxbias >>
776 theCurrentTemp.head.fbin[0] >> theCurrentTemp.head.fbin[1] >> theCurrentTemp.head.fbin[2];
779 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 0B, no template load" <<
ENDL;
783 theCurrentTemp.head.ss50 = theCurrentTemp.head.s50;
784 theCurrentTemp.head.lorybias = theCurrentTemp.head.lorywidth / 2.f;
785 theCurrentTemp.head.lorxbias = theCurrentTemp.head.lorxwidth / 2.f;
786 theCurrentTemp.head.fbin[0] = 1.50f;
787 theCurrentTemp.head.fbin[1] = 1.00f;
788 theCurrentTemp.head.fbin[2] = 0.85f;
793 LOGINFO(
"SiPixelTemplate") <<
"Template ID = " << theCurrentTemp.head.ID <<
", Template Version " 794 << theCurrentTemp.head.templ_version <<
", Bfield = " << theCurrentTemp.head.Bfield
795 <<
", NTy = " << theCurrentTemp.head.NTy <<
", NTyx = " << theCurrentTemp.head.NTyx
796 <<
", NTxx = " << theCurrentTemp.head.NTxx <<
", Dtype = " << theCurrentTemp.head.Dtype
797 <<
", Bias voltage " << theCurrentTemp.head.Vbias <<
", temperature " 798 << theCurrentTemp.head.temperature <<
", fluence " << theCurrentTemp.head.fluence
799 <<
", Q-scaling factor " << theCurrentTemp.head.qscale <<
", 1/2 multi dcol threshold " 800 << theCurrentTemp.head.s50 <<
", 1/2 single dcol threshold " << theCurrentTemp.head.ss50
801 <<
", y Lorentz Width " << theCurrentTemp.head.lorywidth <<
", y Lorentz Bias " 802 << theCurrentTemp.head.lorybias <<
", x Lorentz width " << theCurrentTemp.head.lorxwidth
803 <<
", x Lorentz Bias " << theCurrentTemp.head.lorxbias
804 <<
", Q/Q_avg fractions for Qbin defs " << theCurrentTemp.head.fbin[0] <<
", " 805 << theCurrentTemp.head.fbin[1] <<
", " << theCurrentTemp.head.fbin[2]
806 <<
", pixel x-size " << theCurrentTemp.head.xsize <<
", y-size " 807 << theCurrentTemp.head.ysize <<
", zsize " << theCurrentTemp.head.zsize <<
ENDL;
809 if (theCurrentTemp.head.templ_version < code_version) {
810 LOGINFO(
"SiPixelTemplate") <<
"code expects version " << code_version <<
" finds " 811 << theCurrentTemp.head.templ_version <<
", load anyway " <<
ENDL;
815 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST 818 theCurrentTemp.cotbetaY = std::vector<float>(theCurrentTemp.head.NTy);
819 theCurrentTemp.cotbetaX = std::vector<float>(theCurrentTemp.head.NTyx);
820 theCurrentTemp.cotalphaX = std::vector<float>(theCurrentTemp.head.NTxx);
821 theCurrentTemp.enty.resize(boost::extents[theCurrentTemp.head.NTy]);
822 theCurrentTemp.entx.resize(boost::extents[theCurrentTemp.head.NTyx][theCurrentTemp.head.NTxx]);
828 for (
i = 0;
i < theCurrentTemp.head.NTy; ++
i) {
829 db >> theCurrentTemp.enty[
i].runnum >> theCurrentTemp.enty[
i].costrk[0] >> theCurrentTemp.enty[
i].costrk[1] >>
830 theCurrentTemp.enty[
i].costrk[2];
833 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.enty[
i].runnum
840 theCurrentTemp.enty[
i].alpha =
841 static_cast<float>(atan2((
double)theCurrentTemp.enty[
i].costrk[2], (
double)theCurrentTemp.enty[
i].costrk[0]));
843 theCurrentTemp.enty[
i].cotalpha = theCurrentTemp.enty[
i].costrk[0] / theCurrentTemp.enty[
i].costrk[2];
845 theCurrentTemp.enty[
i].beta =
846 static_cast<float>(atan2((
double)theCurrentTemp.enty[
i].costrk[2], (
double)theCurrentTemp.enty[
i].costrk[1]));
848 theCurrentTemp.enty[
i].cotbeta = theCurrentTemp.enty[
i].costrk[1] / theCurrentTemp.enty[
i].costrk[2];
850 db >> theCurrentTemp.enty[
i].qavg >> theCurrentTemp.enty[
i].pixmax >> theCurrentTemp.enty[
i].symax >>
851 theCurrentTemp.enty[
i].dyone >> theCurrentTemp.enty[
i].syone >> theCurrentTemp.enty[
i].sxmax >>
852 theCurrentTemp.enty[
i].dxone >> theCurrentTemp.enty[
i].sxone;
855 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.enty[
i].runnum
860 db >> theCurrentTemp.enty[
i].dytwo >> theCurrentTemp.enty[
i].sytwo >> theCurrentTemp.enty[
i].dxtwo >>
861 theCurrentTemp.enty[
i].sxtwo >> theCurrentTemp.enty[
i].qmin >> theCurrentTemp.enty[
i].clsleny >>
862 theCurrentTemp.enty[
i].clslenx;
866 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.enty[
i].runnum
871 if (theCurrentTemp.enty[
i].qmin <= 0.) {
872 LOGERROR(
"SiPixelTemplate") <<
"Error in template ID " << theCurrentTemp.head.ID
873 <<
" qmin = " << theCurrentTemp.enty[
i].qmin <<
", run # " 874 << theCurrentTemp.enty[
i].runnum <<
ENDL;
878 for (
j = 0;
j < 2; ++
j) {
879 db >> theCurrentTemp.enty[
i].ypar[
j][0] >> theCurrentTemp.enty[
i].ypar[
j][1] >>
880 theCurrentTemp.enty[
i].ypar[
j][2] >> theCurrentTemp.enty[
i].ypar[
j][3] >> theCurrentTemp.enty[
i].ypar[
j][4];
883 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " 884 << theCurrentTemp.enty[
i].runnum <<
ENDL;
889 for (
j = 0;
j < 9; ++
j) {
891 db >> theCurrentTemp.enty[
i].ytemp[
j][
k];
895 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " 896 << theCurrentTemp.enty[
i].runnum <<
ENDL;
901 for (
j = 0;
j < 2; ++
j) {
902 db >> theCurrentTemp.enty[
i].xpar[
j][0] >> theCurrentTemp.enty[
i].xpar[
j][1] >>
903 theCurrentTemp.enty[
i].xpar[
j][2] >> theCurrentTemp.enty[
i].xpar[
j][3] >> theCurrentTemp.enty[
i].xpar[
j][4];
906 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " 907 << theCurrentTemp.enty[
i].runnum <<
ENDL;
913 for (
j = 0;
j < 9; ++
j) {
915 db >> theCurrentTemp.enty[
i].xtemp[
j][
k];
916 qavg_avg += theCurrentTemp.enty[
i].xtemp[
j][
k];
920 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " 921 << theCurrentTemp.enty[
i].runnum <<
ENDL;
925 theCurrentTemp.enty[
i].qavg_avg = qavg_avg / 9.;
927 for (
j = 0;
j < 4; ++
j) {
928 db >> theCurrentTemp.enty[
i].yavg[
j] >> theCurrentTemp.enty[
i].yrms[
j] >> theCurrentTemp.enty[
i].ygx0[
j] >>
929 theCurrentTemp.enty[
i].ygsig[
j];
932 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " 933 << theCurrentTemp.enty[
i].runnum <<
ENDL;
938 for (
j = 0;
j < 4; ++
j) {
939 db >> theCurrentTemp.enty[
i].yflpar[
j][0] >> theCurrentTemp.enty[
i].yflpar[
j][1] >>
940 theCurrentTemp.enty[
i].yflpar[
j][2] >> theCurrentTemp.enty[
i].yflpar[
j][3] >>
941 theCurrentTemp.enty[
i].yflpar[
j][4] >> theCurrentTemp.enty[
i].yflpar[
j][5];
944 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " 945 << theCurrentTemp.enty[
i].runnum <<
ENDL;
950 for (
j = 0;
j < 4; ++
j) {
951 db >> theCurrentTemp.enty[
i].xavg[
j] >> theCurrentTemp.enty[
i].xrms[
j] >> theCurrentTemp.enty[
i].xgx0[
j] >>
952 theCurrentTemp.enty[
i].xgsig[
j];
955 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " 956 << theCurrentTemp.enty[
i].runnum <<
ENDL;
961 for (
j = 0;
j < 4; ++
j) {
962 db >> theCurrentTemp.enty[
i].xflpar[
j][0] >> theCurrentTemp.enty[
i].xflpar[
j][1] >>
963 theCurrentTemp.enty[
i].xflpar[
j][2] >> theCurrentTemp.enty[
i].xflpar[
j][3] >>
964 theCurrentTemp.enty[
i].xflpar[
j][4] >> theCurrentTemp.enty[
i].xflpar[
j][5];
967 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " 968 << theCurrentTemp.enty[
i].runnum <<
ENDL;
973 for (
j = 0;
j < 4; ++
j) {
974 db >> theCurrentTemp.enty[
i].chi2yavg[
j] >> theCurrentTemp.enty[
i].chi2ymin[
j] >>
975 theCurrentTemp.enty[
i].chi2xavg[
j] >> theCurrentTemp.enty[
i].chi2xmin[
j];
978 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " 979 << theCurrentTemp.enty[
i].runnum <<
ENDL;
984 for (
j = 0;
j < 4; ++
j) {
985 db >> theCurrentTemp.enty[
i].yavgc2m[
j] >> theCurrentTemp.enty[
i].yrmsc2m[
j] >>
986 theCurrentTemp.enty[
i].chi2yavgc2m[
j] >> theCurrentTemp.enty[
i].chi2yminc2m[
j];
989 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " 990 << theCurrentTemp.enty[
i].runnum <<
ENDL;
995 for (
j = 0;
j < 4; ++
j) {
996 db >> theCurrentTemp.enty[
i].xavgc2m[
j] >> theCurrentTemp.enty[
i].xrmsc2m[
j] >>
997 theCurrentTemp.enty[
i].chi2xavgc2m[
j] >> theCurrentTemp.enty[
i].chi2xminc2m[
j];
1000 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " 1001 << theCurrentTemp.enty[
i].runnum <<
ENDL;
1006 for (
j = 0;
j < 4; ++
j) {
1007 db >> theCurrentTemp.enty[
i].yavggen[
j] >> theCurrentTemp.enty[
i].yrmsgen[
j] >>
1008 theCurrentTemp.enty[
i].ygx0gen[
j] >> theCurrentTemp.enty[
i].ygsiggen[
j];
1011 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " 1012 << theCurrentTemp.enty[
i].runnum <<
ENDL;
1017 for (
j = 0;
j < 4; ++
j) {
1018 db >> theCurrentTemp.enty[
i].xavggen[
j] >> theCurrentTemp.enty[
i].xrmsgen[
j] >>
1019 theCurrentTemp.enty[
i].xgx0gen[
j] >> theCurrentTemp.enty[
i].xgsiggen[
j];
1022 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " 1023 << theCurrentTemp.enty[
i].runnum <<
ENDL;
1028 db >> theCurrentTemp.enty[
i].chi2yavgone >> theCurrentTemp.enty[
i].chi2yminone >>
1029 theCurrentTemp.enty[
i].chi2xavgone >> theCurrentTemp.enty[
i].chi2xminone >> theCurrentTemp.enty[
i].qmin2 >>
1030 theCurrentTemp.enty[
i].mpvvav >> theCurrentTemp.enty[
i].sigmavav >> theCurrentTemp.enty[
i].kappavav >>
1031 theCurrentTemp.enty[
i].r_qMeas_qTrue >> theCurrentTemp.enty[
i].spare[0];
1034 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " 1035 << theCurrentTemp.enty[
i].runnum <<
ENDL;
1039 db >> theCurrentTemp.enty[
i].mpvvav2 >> theCurrentTemp.enty[
i].sigmavav2 >> theCurrentTemp.enty[
i].kappavav2 >>
1040 theCurrentTemp.enty[
i].qbfrac[0] >> theCurrentTemp.enty[
i].qbfrac[1] >> theCurrentTemp.enty[
i].qbfrac[2] >>
1041 theCurrentTemp.enty[
i].fracyone >> theCurrentTemp.enty[
i].fracxone >> theCurrentTemp.enty[
i].fracytwo >>
1042 theCurrentTemp.enty[
i].fracxtwo;
1046 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " 1047 << theCurrentTemp.enty[
i].runnum <<
ENDL;
1054 for (
k = 0;
k < theCurrentTemp.head.NTyx; ++
k) {
1055 for (
i = 0;
i < theCurrentTemp.head.NTxx; ++
i) {
1056 db >> theCurrentTemp.entx[
k][
i].runnum >> theCurrentTemp.entx[
k][
i].costrk[0] >>
1057 theCurrentTemp.entx[
k][
i].costrk[1] >> theCurrentTemp.entx[
k][
i].costrk[2];
1060 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " 1061 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1067 theCurrentTemp.entx[
k][
i].alpha =
static_cast<float>(
1068 atan2((
double)theCurrentTemp.entx[
k][
i].costrk[2], (
double)theCurrentTemp.entx[
k][
i].costrk[0]));
1070 theCurrentTemp.entx[
k][
i].cotalpha = theCurrentTemp.entx[
k][
i].costrk[0] / theCurrentTemp.entx[
k][
i].costrk[2];
1072 theCurrentTemp.entx[
k][
i].beta =
static_cast<float>(
1073 atan2((
double)theCurrentTemp.entx[
k][
i].costrk[2], (
double)theCurrentTemp.entx[
k][
i].costrk[1]));
1075 theCurrentTemp.entx[
k][
i].cotbeta = theCurrentTemp.entx[
k][
i].costrk[1] / theCurrentTemp.entx[
k][
i].costrk[2];
1077 db >> theCurrentTemp.entx[
k][
i].qavg >> theCurrentTemp.entx[
k][
i].pixmax >> theCurrentTemp.entx[
k][
i].symax >>
1078 theCurrentTemp.entx[
k][
i].dyone >> theCurrentTemp.entx[
k][
i].syone >> theCurrentTemp.entx[
k][
i].sxmax >>
1079 theCurrentTemp.entx[
k][
i].dxone >> theCurrentTemp.entx[
k][
i].sxone;
1082 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " 1083 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1087 db >> theCurrentTemp.entx[
k][
i].dytwo >> theCurrentTemp.entx[
k][
i].sytwo >> theCurrentTemp.entx[
k][
i].dxtwo >>
1088 theCurrentTemp.entx[
k][
i].sxtwo >> theCurrentTemp.entx[
k][
i].qmin >> theCurrentTemp.entx[
k][
i].clsleny >>
1089 theCurrentTemp.entx[
k][
i].clslenx;
1093 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " 1094 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1098 for (
j = 0;
j < 2; ++
j) {
1099 db >> theCurrentTemp.entx[
k][
i].ypar[
j][0] >> theCurrentTemp.entx[
k][
i].ypar[
j][1] >>
1100 theCurrentTemp.entx[
k][
i].ypar[
j][2] >> theCurrentTemp.entx[
k][
i].ypar[
j][3] >>
1101 theCurrentTemp.entx[
k][
i].ypar[
j][4];
1104 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " 1105 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1110 for (
j = 0;
j < 9; ++
j) {
1112 db >> theCurrentTemp.entx[
k][
i].ytemp[
j][
l];
1116 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " 1117 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1122 for (
j = 0;
j < 2; ++
j) {
1123 db >> theCurrentTemp.entx[
k][
i].xpar[
j][0] >> theCurrentTemp.entx[
k][
i].xpar[
j][1] >>
1124 theCurrentTemp.entx[
k][
i].xpar[
j][2] >> theCurrentTemp.entx[
k][
i].xpar[
j][3] >>
1125 theCurrentTemp.entx[
k][
i].xpar[
j][4];
1128 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " 1129 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1135 for (
j = 0;
j < 9; ++
j) {
1137 db >> theCurrentTemp.entx[
k][
i].xtemp[
j][
l];
1138 qavg_avg += theCurrentTemp.entx[
k][
i].xtemp[
j][
l];
1142 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " 1143 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1147 theCurrentTemp.entx[
k][
i].qavg_avg = qavg_avg / 9.;
1149 for (
j = 0;
j < 4; ++
j) {
1150 db >> theCurrentTemp.entx[
k][
i].yavg[
j] >> theCurrentTemp.entx[
k][
i].yrms[
j] >>
1151 theCurrentTemp.entx[
k][
i].ygx0[
j] >> theCurrentTemp.entx[
k][
i].ygsig[
j];
1154 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " 1155 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1160 for (
j = 0;
j < 4; ++
j) {
1161 db >> theCurrentTemp.entx[
k][
i].yflpar[
j][0] >> theCurrentTemp.entx[
k][
i].yflpar[
j][1] >>
1162 theCurrentTemp.entx[
k][
i].yflpar[
j][2] >> theCurrentTemp.entx[
k][
i].yflpar[
j][3] >>
1163 theCurrentTemp.entx[
k][
i].yflpar[
j][4] >> theCurrentTemp.entx[
k][
i].yflpar[
j][5];
1166 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " 1167 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1172 for (
j = 0;
j < 4; ++
j) {
1173 db >> theCurrentTemp.entx[
k][
i].xavg[
j] >> theCurrentTemp.entx[
k][
i].xrms[
j] >>
1174 theCurrentTemp.entx[
k][
i].xgx0[
j] >> theCurrentTemp.entx[
k][
i].xgsig[
j];
1177 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " 1178 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1183 for (
j = 0;
j < 4; ++
j) {
1184 db >> theCurrentTemp.entx[
k][
i].xflpar[
j][0] >> theCurrentTemp.entx[
k][
i].xflpar[
j][1] >>
1185 theCurrentTemp.entx[
k][
i].xflpar[
j][2] >> theCurrentTemp.entx[
k][
i].xflpar[
j][3] >>
1186 theCurrentTemp.entx[
k][
i].xflpar[
j][4] >> theCurrentTemp.entx[
k][
i].xflpar[
j][5];
1189 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " 1190 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1195 for (
j = 0;
j < 4; ++
j) {
1196 db >> theCurrentTemp.entx[
k][
i].chi2yavg[
j] >> theCurrentTemp.entx[
k][
i].chi2ymin[
j] >>
1197 theCurrentTemp.entx[
k][
i].chi2xavg[
j] >> theCurrentTemp.entx[
k][
i].chi2xmin[
j];
1200 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " 1201 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1206 for (
j = 0;
j < 4; ++
j) {
1207 db >> theCurrentTemp.entx[
k][
i].yavgc2m[
j] >> theCurrentTemp.entx[
k][
i].yrmsc2m[
j] >>
1208 theCurrentTemp.entx[
k][
i].chi2yavgc2m[
j] >> theCurrentTemp.entx[
k][
i].chi2yminc2m[
j];
1211 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " 1212 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1217 for (
j = 0;
j < 4; ++
j) {
1218 db >> theCurrentTemp.entx[
k][
i].xavgc2m[
j] >> theCurrentTemp.entx[
k][
i].xrmsc2m[
j] >>
1219 theCurrentTemp.entx[
k][
i].chi2xavgc2m[
j] >> theCurrentTemp.entx[
k][
i].chi2xminc2m[
j];
1222 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " 1223 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1228 for (
j = 0;
j < 4; ++
j) {
1229 db >> theCurrentTemp.entx[
k][
i].yavggen[
j] >> theCurrentTemp.entx[
k][
i].yrmsgen[
j] >>
1230 theCurrentTemp.entx[
k][
i].ygx0gen[
j] >> theCurrentTemp.entx[
k][
i].ygsiggen[
j];
1233 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " 1234 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1239 for (
j = 0;
j < 4; ++
j) {
1240 db >> theCurrentTemp.entx[
k][
i].xavggen[
j] >> theCurrentTemp.entx[
k][
i].xrmsgen[
j] >>
1241 theCurrentTemp.entx[
k][
i].xgx0gen[
j] >> theCurrentTemp.entx[
k][
i].xgsiggen[
j];
1244 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " 1245 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1250 db >> theCurrentTemp.entx[
k][
i].chi2yavgone >> theCurrentTemp.entx[
k][
i].chi2yminone >>
1251 theCurrentTemp.entx[
k][
i].chi2xavgone >> theCurrentTemp.entx[
k][
i].chi2xminone >>
1252 theCurrentTemp.entx[
k][
i].qmin2 >> theCurrentTemp.entx[
k][
i].mpvvav >> theCurrentTemp.entx[
k][
i].sigmavav >>
1253 theCurrentTemp.entx[
k][
i].kappavav >> theCurrentTemp.entx[
k][
i].r_qMeas_qTrue >>
1254 theCurrentTemp.entx[
k][
i].spare[0];
1257 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " 1258 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1262 db >> theCurrentTemp.entx[
k][
i].mpvvav2 >> theCurrentTemp.entx[
k][
i].sigmavav2 >>
1263 theCurrentTemp.entx[
k][
i].kappavav2 >> theCurrentTemp.entx[
k][
i].qbfrac[0] >>
1264 theCurrentTemp.entx[
k][
i].qbfrac[1] >> theCurrentTemp.entx[
k][
i].qbfrac[2] >>
1265 theCurrentTemp.entx[
k][
i].fracyone >> theCurrentTemp.entx[
k][
i].fracxone >>
1266 theCurrentTemp.entx[
k][
i].fracytwo >> theCurrentTemp.entx[
k][
i].fracxtwo;
1270 LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " 1271 << theCurrentTemp.entx[
k][
i].runnum <<
ENDL;
1279 pixelTemp.push_back(theCurrentTemp);
1281 postInit(pixelTemp);
1306 for (
auto& templ : thePixelTemp_) {
1307 for (
auto iy = 0; iy < templ.head.NTy; ++iy)
1308 templ.cotbetaY[iy] = templ.enty[iy].cotbeta;
1309 for (
auto iy = 0; iy < templ.head.NTyx; ++iy)
1310 templ.cotbetaX[iy] = templ.entx[iy][0].cotbeta;
1311 for (
auto ix = 0; ix < templ.head.NTxx; ++ix)
1312 templ.cotalphaX[ix] = templ.entx[0][ix].cotalpha;
1339 int ilow, ihigh, iylow, iyhigh,
Ny, Nxx, Nyx, imidy, imaxx;
1340 float yxratio, xxratio, sxmax, qcorrect, qxtempcor, symax, chi2xavgone, chi2xminone, cota, cotb, cotalpha0, cotbeta0;
1341 float chi2xavg[4], chi2xmin[4], chi2xavgc2m[4], chi2xminc2m[4];
1345 if (entry_sideloaded_ !=
nullptr) {
1351 if (
id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
1352 cota_current_ = cotalpha;
1353 cotb_current_ = cotbeta;
1356 if (
id != id_current_) {
1360 for (
i = 0;
i < (
int)thePixelTemp_.size(); ++
i) {
1363 if (
id == thePixelTemp_[
i].head.ID) {
1369 dtype_ = thePixelTemp_[index_id_].head.Dtype;
1373 qscale_ = thePixelTemp_[index_id_].head.qscale;
1377 s50_ = thePixelTemp_[index_id_].head.s50;
1381 for (
j = 0;
j < 3; ++
j) {
1382 fbin_[
j] = thePixelTemp_[index_id_].head.fbin[
j];
1388 xsize_ = thePixelTemp_[index_id_].head.xsize;
1389 ysize_ = thePixelTemp_[index_id_].head.ysize;
1390 zsize_ = thePixelTemp_[index_id_].head.zsize;
1397 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1398 if (index_id_ < 0 || index_id_ >= (
int)thePixelTemp_.size()) {
1400 <<
"SiPixelTemplate::interpolate can't find needed template ID = " <<
id << std::endl;
1403 assert(index_id_ >= 0 && index_id_ < (
int)thePixelTemp_.size());
1408 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
1410 std::sqrt((1.
f + cotbeta * cotbeta + cotalpha * cotalpha) / (1.
f + cotbeta * cotbeta + cotalpha0 * cotalpha0));
1414 cotb = abs_cotb_ =
std::abs(cotbeta);
1419 if (cotbeta < 0.
f) {
1435 if (locBx * locBz < 0.
f) {
1447 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1448 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::illegal subdetector ID = " << dtype_ << std::endl;
1450 std::cout <<
"SiPixelTemplate::illegal subdetector ID = " << dtype_ << std::endl;
1454 Ny = thePixelTemp_[index_id_].head.NTy;
1455 Nyx = thePixelTemp_[index_id_].head.NTyx;
1456 Nxx = thePixelTemp_[index_id_].head.NTxx;
1458 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 1459 if (
Ny < 2 || Nyx < 1 || Nxx < 2) {
1461 <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " <<
Ny <<
"/" << Nyx <<
"/" << Nxx
1465 assert(
Ny > 1 && Nyx > 0 && Nxx > 1);
1475 if (cotb >= thePixelTemp_[index_id_].enty[
Ny - 1].cotbeta) {
1481 if (cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
1482 for (
i = 0;
i <
Ny - 1; ++
i) {
1483 if (thePixelTemp_[index_id_].enty[
i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[
i + 1].cotbeta) {
1485 yratio_ = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta) /
1486 (thePixelTemp_[index_id_].enty[
i + 1].cotbeta - thePixelTemp_[index_id_].enty[
i].cotbeta);
1499 enty0_ = &thePixelTemp_[index_id_].enty[ilow];
1500 enty1_ = &thePixelTemp_[index_id_].enty[ihigh];
1504 qavg_ = (1.f - yratio_) * enty0_->qavg + yratio_ * enty1_->qavg;
1506 symax = (1.f - yratio_) * enty0_->symax + yratio_ * enty1_->symax;
1508 sxmax = (1.f - yratio_) * enty0_->sxmax + yratio_ * enty1_->sxmax;
1509 dyone_ = (1.f - yratio_) * enty0_->dyone + yratio_ * enty1_->dyone;
1513 syone_ = (1.f - yratio_) * enty0_->syone + yratio_ * enty1_->syone;
1514 dytwo_ = (1.f - yratio_) * enty0_->dytwo + yratio_ * enty1_->dytwo;
1518 sytwo_ = (1.f - yratio_) * enty0_->sytwo + yratio_ * enty1_->sytwo;
1519 qmin_ = (1.f - yratio_) * enty0_->qmin + yratio_ * enty1_->qmin;
1521 qmin2_ = (1.f - yratio_) * enty0_->qmin2 + yratio_ * enty1_->qmin2;
1523 mpvvav_ = (1.f - yratio_) * enty0_->mpvvav + yratio_ * enty1_->mpvvav;
1524 mpvvav_ *= qcorrect;
1525 sigmavav_ = (1.f - yratio_) * enty0_->sigmavav + yratio_ * enty1_->sigmavav;
1526 kappavav_ = (1.f - yratio_) * enty0_->kappavav + yratio_ * enty1_->kappavav;
1527 mpvvav2_ = (1.f - yratio_) * enty0_->mpvvav2 + yratio_ * enty1_->mpvvav2;
1528 mpvvav2_ *= qcorrect;
1529 sigmavav2_ = (1.f - yratio_) * enty0_->sigmavav2 + yratio_ * enty1_->sigmavav2;
1530 kappavav2_ = (1.f - yratio_) * enty0_->kappavav2 + yratio_ * enty1_->kappavav2;
1531 clsleny_ = fminf(enty0_->clsleny, enty1_->clsleny);
1532 qavg_avg_ = (1.f - yratio_) * enty0_->qavg_avg + yratio_ * enty1_->qavg_avg;
1533 qavg_avg_ *= qcorrect;
1534 for (
i = 0;
i < 2; ++
i) {
1535 for (
j = 0;
j < 5; ++
j) {
1539 yparl_[1 -
i][
j] = enty0_->ypar[
i][
j];
1540 yparh_[1 -
i][
j] = enty1_->ypar[
i][
j];
1542 yparl_[
i][
j] = enty0_->ypar[
i][
j];
1543 yparh_[
i][
j] = enty1_->ypar[
i][
j];
1546 xparly0_[1 -
i][
j] = enty0_->xpar[
i][
j];
1547 xparhy0_[1 -
i][
j] = enty1_->xpar[
i][
j];
1549 xparly0_[
i][
j] = enty0_->xpar[
i][
j];
1550 xparhy0_[
i][
j] = enty1_->xpar[
i][
j];
1555 for (
i = 0;
i < 4; ++
i) {
1556 yavg_[
i] = (1.f - yratio_) * thePixelTemp_[index_id_].enty[ilow].yavg[
i] +
1557 yratio_ * thePixelTemp_[index_id_].enty[ihigh].yavg[
i];
1559 yavg_[
i] = -yavg_[
i];
1561 yavg_[
i] = (1.f - yratio_) * enty0_->yavg[
i] + yratio_ * enty1_->yavg[
i];
1563 yavg_[
i] = -yavg_[
i];
1565 yrms_[
i] = (1.f - yratio_) * enty0_->yrms[
i] + yratio_ * enty1_->yrms[
i];
1566 chi2yavg_[
i] = (1.f - yratio_) * enty0_->chi2yavg[
i] + yratio_ * enty1_->chi2yavg[
i];
1567 chi2ymin_[
i] = (1.f - yratio_) * enty0_->chi2ymin[
i] + yratio_ * enty1_->chi2ymin[
i];
1568 chi2xavg[
i] = (1.f - yratio_) * enty0_->chi2xavg[
i] + yratio_ * enty1_->chi2xavg[
i];
1569 chi2xmin[
i] = (1.f - yratio_) * enty0_->chi2xmin[
i] + yratio_ * enty1_->chi2xmin[
i];
1570 yavgc2m_[
i] = (1.f - yratio_) * enty0_->yavgc2m[
i] + yratio_ * enty1_->yavgc2m[
i];
1572 yavgc2m_[
i] = -yavgc2m_[
i];
1574 yrmsc2m_[
i] = (1.f - yratio_) * enty0_->yrmsc2m[
i] + yratio_ * enty1_->yrmsc2m[
i];
1575 chi2yavgc2m_[
i] = (1.f - yratio_) * enty0_->chi2yavgc2m[
i] + yratio_ * enty1_->chi2yavgc2m[
i];
1577 chi2yminc2m_[
i] = (1.f - yratio_) * enty0_->chi2yminc2m[
i] + yratio_ * enty1_->chi2yminc2m[
i];
1579 chi2xavgc2m[
i] = (1.f - yratio_) * enty0_->chi2xavgc2m[
i] + yratio_ * enty1_->chi2xavgc2m[
i];
1580 chi2xminc2m[
i] = (1.f - yratio_) * enty0_->chi2xminc2m[
i] + yratio_ * enty1_->chi2xminc2m[
i];
1581 for (
j = 0;
j < 6; ++
j) {
1582 yflparl_[
i][
j] = enty0_->yflpar[
i][
j];
1583 yflparh_[
i][
j] = enty1_->yflpar[
i][
j];
1587 if (flip_y_ && (
j == 0 ||
j == 2 ||
j == 4)) {
1588 yflparl_[
i][
j] = -yflparl_[
i][
j];
1589 yflparh_[
i][
j] = -yflparh_[
i][
j];
1596 chi2yavgone_ = (1.f - yratio_) * enty0_->chi2yavgone + yratio_ * enty1_->chi2yavgone;
1597 chi2yminone_ = (1.f - yratio_) * enty0_->chi2yminone + yratio_ * enty1_->chi2yminone;
1598 chi2xavgone = (1.f - yratio_) * enty0_->chi2xavgone + yratio_ * enty1_->chi2xavgone;
1599 chi2xminone = (1.f - yratio_) * enty0_->chi2xminone + yratio_ * enty1_->chi2xminone;
1601 fracyone_ = (1.f - yratio_) * enty0_->fracyone + yratio_ * enty1_->fracyone;
1602 fracytwo_ = (1.f - yratio_) * enty0_->fracytwo + yratio_ * enty1_->fracytwo;
1610 for (
i = 0;
i < 9; ++
i) {
1613 ytemp_[
i][
BYM2] = 0.f;
1614 ytemp_[
i][
BYM1] = 0.f;
1619 ytemp_[8 -
i][
BYM3 -
j] = (1.f - yratio_) * enty0_->ytemp[
i][
j] + yratio_ * enty1_->ytemp[
i][
j];
1621 ytemp_[
i][
j + 2] = (1.f - yratio_) * enty0_->ytemp[
i][
j] + yratio_ * enty1_->ytemp[
i][
j];
1631 if (abs_cotb_ >= thePixelTemp_[index_id_].entx[Nyx - 1][0].cotbeta) {
1635 }
else if (abs_cotb_ >= thePixelTemp_[index_id_].entx[0][0].cotbeta) {
1636 for (
i = 0;
i < Nyx - 1; ++
i) {
1637 if (thePixelTemp_[index_id_].entx[
i][0].cotbeta <= abs_cotb_ &&
1638 abs_cotb_ < thePixelTemp_[index_id_].entx[
i + 1][0].cotbeta) {
1640 yxratio = (abs_cotb_ - thePixelTemp_[index_id_].entx[
i][0].cotbeta) /
1641 (thePixelTemp_[index_id_].entx[
i + 1][0].cotbeta - thePixelTemp_[index_id_].entx[
i][0].cotbeta);
1652 if (cota >= thePixelTemp_[index_id_].entx[0][Nxx - 1].cotalpha) {
1658 if (cota >= thePixelTemp_[index_id_].entx[0][0].cotalpha) {
1659 for (
i = 0;
i < Nxx - 1; ++
i) {
1660 if (thePixelTemp_[index_id_].entx[0][
i].cotalpha <= cota &&
1661 cota < thePixelTemp_[index_id_].entx[0][
i + 1].cotalpha) {
1663 xxratio = (cota - thePixelTemp_[index_id_].entx[0][
i].cotalpha) /
1664 (thePixelTemp_[index_id_].entx[0][
i + 1].cotalpha - thePixelTemp_[index_id_].entx[0][
i].cotalpha);
1682 sxparmax_ = (1.f - xxratio) * thePixelTemp_[index_id_].entx[imaxx][ilow].sxmax +
1683 xxratio * thePixelTemp_[index_id_].entx[imaxx][ihigh].sxmax;
1685 if (thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax != 0.
f) {
1686 sxmax_ = sxmax_ / thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax * sxmax;
1688 symax_ = (1.f - xxratio) * thePixelTemp_[index_id_].entx[imaxx][ilow].symax +
1689 xxratio * thePixelTemp_[index_id_].entx[imaxx][ihigh].symax;
1690 if (thePixelTemp_[index_id_].entx[imaxx][imidy].symax != 0.
f) {
1691 symax_ = symax_ / thePixelTemp_[index_id_].entx[imaxx][imidy].symax * symax;
1693 dxone_ = (1.f - xxratio) * thePixelTemp_[index_id_].entx[0][ilow].dxone +
1694 xxratio * thePixelTemp_[index_id_].entx[0][ihigh].dxone;
1698 sxone_ = (1.f - xxratio) * thePixelTemp_[index_id_].entx[0][ilow].sxone +
1699 xxratio * thePixelTemp_[index_id_].entx[0][ihigh].sxone;
1700 dxtwo_ = (1.f - xxratio) * thePixelTemp_[index_id_].entx[0][ilow].dxtwo +
1701 xxratio * thePixelTemp_[index_id_].entx[0][ihigh].dxtwo;
1705 sxtwo_ = (1.f - xxratio) * thePixelTemp_[index_id_].entx[0][ilow].sxtwo +
1706 xxratio * thePixelTemp_[index_id_].entx[0][ihigh].sxtwo;
1707 clslenx_ = fminf(thePixelTemp_[index_id_].entx[0][ilow].clslenx, thePixelTemp_[index_id_].entx[0][ihigh].clslenx);
1709 for (
i = 0;
i < 2; ++
i) {
1710 for (
j = 0;
j < 5; ++
j) {
1713 xpar0_[1 -
i][
j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
1714 xparl_[1 -
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
1715 xparh_[1 -
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
1717 xpar0_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
1718 xparl_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
1719 xparh_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
1724 entx00_ = &thePixelTemp_[index_id_].entx[iylow][ilow];
1725 entx02_ = &thePixelTemp_[index_id_].entx[iylow][ihigh];
1726 entx20_ = &thePixelTemp_[index_id_].entx[iyhigh][ilow];
1727 entx22_ = &thePixelTemp_[index_id_].entx[iyhigh][ihigh];
1728 entx21_ = &thePixelTemp_[index_id_].entx[iyhigh][imidy];
1731 pixmax_ = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->pixmax + xxratio * entx02_->pixmax) +
1732 yxratio * ((1.
f - xxratio) * entx20_->pixmax + xxratio * entx22_->pixmax);
1734 r_qMeas_qTrue_ = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->r_qMeas_qTrue + xxratio * entx02_->r_qMeas_qTrue) +
1735 yxratio * ((1.
f - xxratio) * entx20_->r_qMeas_qTrue + xxratio * entx22_->r_qMeas_qTrue);
1737 for (
i = 0;
i < 4; ++
i) {
1738 xavg_[
i] = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->xavg[
i] + xxratio * entx02_->xavg[
i]) +
1739 yxratio * ((1.
f - xxratio) * entx20_->xavg[
i] + xxratio * entx22_->xavg[
i]);
1741 xavg_[
i] = -xavg_[
i];
1744 xrms_[
i] = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->xrms[
i] + xxratio * entx02_->xrms[
i]) +
1745 yxratio * ((1.
f - xxratio) * entx20_->xrms[
i] + xxratio * entx22_->xrms[
i]);
1747 xavgc2m_[
i] = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->xavgc2m[
i] + xxratio * entx02_->xavgc2m[
i]) +
1748 yxratio * ((1.
f - xxratio) * entx20_->xavgc2m[
i] + xxratio * entx22_->xavgc2m[
i]);
1750 xavgc2m_[
i] = -xavgc2m_[
i];
1753 xrmsc2m_[
i] = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->xrmsc2m[
i] + xxratio * entx02_->xrmsc2m[
i]) +
1754 yxratio * ((1.
f - xxratio) * entx20_->xrmsc2m[
i] + xxratio * entx22_->xrmsc2m[
i]);
1771 chi2xavg_[
i] = ((1.f - xxratio) * entx20_->chi2xavg[
i] + xxratio * entx22_->chi2xavg[
i]);
1772 if (entx21_->chi2xavg[
i] != 0.f) {
1773 chi2xavg_[
i] = chi2xavg_[
i] / entx21_->chi2xavg[
i] * chi2xavg[
i];
1776 chi2xmin_[
i] = ((1.f - xxratio) * entx20_->chi2xmin[
i] + xxratio * entx22_->chi2xmin[
i]);
1777 if (entx21_->chi2xmin[
i] != 0.f) {
1778 chi2xmin_[
i] = chi2xmin_[
i] / entx21_->chi2xmin[
i] * chi2xmin[
i];
1781 chi2xavgc2m_[
i] = ((1.f - xxratio) * entx20_->chi2xavgc2m[
i] + xxratio * entx22_->chi2xavgc2m[
i]);
1782 if (entx21_->chi2xavgc2m[
i] != 0.f) {
1783 chi2xavgc2m_[
i] = chi2xavgc2m_[
i] / entx21_->chi2xavgc2m[
i] * chi2xavgc2m[
i];
1786 chi2xminc2m_[
i] = ((1.f - xxratio) * entx20_->chi2xminc2m[
i] + xxratio * entx22_->chi2xminc2m[
i]);
1787 if (entx21_->chi2xminc2m[
i] != 0.f) {
1788 chi2xminc2m_[
i] = chi2xminc2m_[
i] / entx21_->chi2xminc2m[
i] * chi2xminc2m[
i];
1791 for (
j = 0;
j < 6; ++
j) {
1792 xflparll_[
i][
j] = entx00_->xflpar[
i][
j];
1793 xflparlh_[
i][
j] = entx02_->xflpar[
i][
j];
1794 xflparhl_[
i][
j] = entx20_->xflpar[
i][
j];
1795 xflparhh_[
i][
j] = entx22_->xflpar[
i][
j];
1797 if (flip_x_ && (
j == 0 ||
j == 2 ||
j == 4)) {
1798 xflparll_[
i][
j] = -xflparll_[
i][
j];
1799 xflparlh_[
i][
j] = -xflparlh_[
i][
j];
1800 xflparhl_[
i][
j] = -xflparhl_[
i][
j];
1801 xflparhh_[
i][
j] = -xflparhh_[
i][
j];
1808 chi2xavgone_ = ((1.f - xxratio) * entx20_->chi2xavgone + xxratio * entx22_->chi2xavgone);
1809 if (entx21_->chi2xavgone != 0.f) {
1810 chi2xavgone_ = chi2xavgone_ / entx21_->chi2xavgone * chi2xavgone;
1813 chi2xminone_ = ((1.f - xxratio) * entx20_->chi2xminone + xxratio * entx22_->chi2xminone);
1814 if (entx21_->chi2xminone != 0.f) {
1815 chi2xminone_ = chi2xminone_ / entx21_->chi2xminone * chi2xminone;
1818 fracxone_ = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->fracxone + xxratio * entx02_->fracxone) +
1819 yxratio * ((1.
f - xxratio) * entx20_->fracxone + xxratio * entx22_->fracxone);
1820 fracxtwo_ = (1.f - yxratio) * ((1.
f - xxratio) * entx00_->fracxtwo + xxratio * entx02_->fracxtwo) +
1821 yxratio * ((1.
f - xxratio) * entx20_->fracxtwo + xxratio * entx22_->fracxtwo);
1833 cotbeta0 = thePixelTemp_[index_id_].entx[iyhigh][0].cotbeta;
1835 std::sqrt((1.
f + cotbeta * cotbeta + cotalpha * cotalpha) / (1.
f + cotbeta0 * cotbeta0 + cotalpha * cotalpha));
1837 for (
i = 0;
i < 9; ++
i) {
1840 xtemp_[
i][
BXM2] = 0.f;
1841 xtemp_[
i][
BXM1] = 0.f;
1847 xtemp_[8 -
i][
BXM3 -
j] =
1848 qxtempcor * ((1.f - xxratio) * entx20_->xtemp[
i][
j] + xxratio * entx22_->xtemp[
i][
j]);
1850 xtemp_[
i][
j + 2] = qxtempcor * ((1.f - xxratio) * entx20_->xtemp[
i][
j] + xxratio * entx22_->xtemp[
i][
j]);
1855 lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
1856 lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
1857 lorybias_ = thePixelTemp_[index_id_].head.lorybias;
1858 lorxbias_ = thePixelTemp_[index_id_].head.lorxbias;
1860 lorxwidth_ = -lorxwidth_;
1861 lorxbias_ = -lorxbias_;
1864 lorywidth_ = -lorywidth_;
1865 lorybias_ = -lorybias_;
1884 if (cotbeta < 0.
f) {
1887 float locBz = locBx;
1888 if (cotalpha < 0.
f) {
1916 #ifdef SI_PIXEL_TEMPLATE_STANDALONE 1929 entry_sideloaded_ =
entry;
1941 lorywidth_ = lorwdy;
1942 lorxwidth_ = lorwdx;
1948 for (
int i = 0;
i < 3; ++
i) {
1958 qavg_ =
entry->qavg;
1962 pixmax_ =
entry->pixmax;
1963 sxmax_ =
entry->sxmax;
1964 symax_ =
entry->symax;
1965 clsleny_ =
entry->clsleny;
1966 clslenx_ =
entry->clslenx;
1973 dyone_ =
entry->dyone;
1974 syone_ =
entry->syone;
1975 dytwo_ =
entry->dytwo;
1976 sytwo_ =
entry->sytwo;
1978 dxone_ =
entry->dxone;
1979 sxone_ =
entry->sxone;
1980 dxtwo_ =
entry->dxtwo;
1981 sxtwo_ =
entry->sxtwo;
1988 for (
int i = 0;
i < 4; ++
i) {
2004 for (
int j = 0;
j < 6;
j++) {
2005 yflparl_[
i][
j] = yflparh_[
i][
j] =
entry->yflpar[
i][
j];
2006 xflparhh_[
i][
j] = xflparhl_[
i][
j] = xflparll_[
i][
j] = xflparlh_[
i][
j] =
entry->xflpar[
i][
j];
2010 sxparmax_ =
entry->sxmax;
2011 syparmax_ =
entry->symax;
2017 float cotbeta =
entry->cotbeta;
2020 if (cotbeta < 0.
f) {
2033 if (locBx * locBz < 0.
f) {
2041 std::cout <<
"SiPixelTemplate:illegal subdetector ID = " << dtype_ << std::endl;
2049 float qxtempcor = 1.f;
2051 for (
int i = 0;
i < 9; ++
i) {
2054 xtemp_[
i][
BXM2] = 0.f;
2055 xtemp_[
i][
BXM1] = 0.f;
2058 xtemp_[8 -
i][
BXM3 -
j] = qxtempcor * entry_sideloaded_->xtemp[
i][
j];
2060 xtemp_[
i][
j + 2] = qxtempcor * entry_sideloaded_->xtemp[
i][
j];
2065 for (
int i = 0;
i < 9; ++
i) {
2068 ytemp_[
i][
BYM2] = 0.f;
2069 ytemp_[
i][
BYM1] = 0.f;
2074 ytemp_[8 -
i][
BYM3 -
j] = entry_sideloaded_->ytemp[
i][
j];
2076 ytemp_[
i][
j + 2] = entry_sideloaded_->ytemp[
i][
j];
2082 for (
int i = 0;
i < 2;
i++) {
2083 for (
int j = 0;
j < 5;
j++) {
2085 yparl_[1 -
i][
j] = yparh_[1 -
i][
j] =
entry->ypar[
i][
j];
2091 xpar0_[1 -
i][
j] = xparly0_[1 -
i][
j] = xparhy0_[1 -
i][
j] = xparl_[1 -
i][
j] = xparh_[1 -
i][
j] =
2094 xpar0_[
i][
j] = xparly0_[
i][
j] = xparhy0_[
i][
j] = xparl_[
i][
j] = xparh_[
i][
j] =
entry->xpar[
i][
j];
2119 float sigi, sigi2, sigi3, sigi4, symax, qscale, s25;
2123 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2124 if (fypix < 2 || fypix >=
BYM2) {
2125 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with fypix = " << fypix << std::endl;
2130 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2131 if (lypix < fypix || lypix >=
BYM2) {
2132 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with lypix/fypix = " << lypix <<
"/" 2133 << fypix << std::endl;
2143 if (symax_ > syparmax_) {
2149 for (
i = fypix - 2;
i <= lypix + 2; ++
i) {
2150 if (i < fypix || i > lypix) {
2153 ysig2[
i] = s50_ * s50_;
2155 if (ysum[
i] < symax) {
2162 qscale = ysum[
i] / symax;
2164 sigi2 = sigi * sigi;
2165 sigi3 = sigi2 * sigi;
2166 sigi4 = sigi3 * sigi;
2168 ysig2[
i] = (1.f - yratio_) * (yparl_[0][0] + yparl_[0][1] * sigi + yparl_[0][2] * sigi2 + yparl_[0][3] * sigi3 +
2169 yparl_[0][4] * sigi4) +
2170 yratio_ * (yparh_[0][0] + yparh_[0][1] * sigi + yparh_[0][2] * sigi2 + yparh_[0][3] * sigi3 +
2171 yparh_[0][4] * sigi4);
2173 ysig2[
i] = (1.f - yratio_) * (yparl_[1][0] + yparl_[1][1] * sigi + yparl_[1][2] * sigi2 + yparl_[1][3] * sigi3 +
2174 yparl_[1][4] * sigi4) +
2175 yratio_ * (yparh_[1][0] + yparh_[1][1] * sigi + yparh_[1][2] * sigi2 + yparh_[1][3] * sigi3 +
2176 yparh_[1][4] * sigi4);
2179 if (ysum[
i] > sythr) {
2182 if (ysig2[
i] <= 0.
f) {
2183 LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_
2184 <<
", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_
2185 <<
", sigi = " << sigi <<
ENDL;
2207 float sigi, sigi2, sigi3, sigi4, symax, qscale, err2, s25;
2211 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2212 if (index < 2 || index >=
BYM2) {
2213 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with index = " <<
index << std::endl;
2223 if (symax_ > syparmax_) {
2229 if (qpixel < symax) {
2236 qscale = qpixel / symax;
2238 sigi2 = sigi * sigi;
2239 sigi3 = sigi2 * sigi;
2240 sigi4 = sigi3 * sigi;
2244 (yparl_[0][0] + yparl_[0][1] * sigi + yparl_[0][2] * sigi2 + yparl_[0][3] * sigi3 + yparl_[0][4] * sigi4) +
2246 (yparh_[0][0] + yparh_[0][1] * sigi + yparh_[0][2] * sigi2 + yparh_[0][3] * sigi3 + yparh_[0][4] * sigi4);
2250 (yparl_[1][0] + yparl_[1][1] * sigi + yparl_[1][2] * sigi2 + yparl_[1][3] * sigi3 + yparl_[1][4] * sigi4) +
2252 (yparh_[1][0] + yparh_[1][1] * sigi + yparh_[1][2] * sigi2 + yparh_[1][3] * sigi3 + yparh_[1][4] * sigi4);
2254 ysig2 = qscale * err2;
2256 LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_
2257 <<
", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_
2258 <<
", sigi = " << sigi <<
ENDL;
2281 float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale, s25;
2285 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2286 if (fxpix < 2 || fxpix >=
BXM2) {
2287 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with fxpix = " << fxpix << std::endl;
2292 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2293 if (lxpix < fxpix || lxpix >=
BXM2) {
2294 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with lxpix/fxpix = " << lxpix <<
"/" 2295 << fxpix << std::endl;
2305 if (sxmax_ > sxparmax_) {
2311 for (
i = fxpix - 2;
i <= lxpix + 2; ++
i) {
2312 if (i < fxpix || i > lxpix) {
2315 xsig2[
i] = s50_ * s50_;
2317 if (xsum[
i] < sxmax) {
2324 qscale = xsum[
i] / sxmax;
2326 sigi2 = sigi * sigi;
2327 sigi3 = sigi2 * sigi;
2328 sigi4 = sigi3 * sigi;
2333 yint = (1.f - yratio_) * (xparly0_[0][0] + xparly0_[0][1] * sigi + xparly0_[0][2] * sigi2 +
2334 xparly0_[0][3] * sigi3 + xparly0_[0][4] * sigi4) +
2335 yratio_ * (xparhy0_[0][0] + xparhy0_[0][1] * sigi + xparhy0_[0][2] * sigi2 + xparhy0_[0][3] * sigi3 +
2336 xparhy0_[0][4] * sigi4);
2338 yint = (1.f - yratio_) * (xparly0_[1][0] + xparly0_[1][1] * sigi + xparly0_[1][2] * sigi2 +
2339 xparly0_[1][3] * sigi3 + xparly0_[1][4] * sigi4) +
2340 yratio_ * (xparhy0_[1][0] + xparhy0_[1][1] * sigi + xparhy0_[1][2] * sigi2 + xparhy0_[1][3] * sigi3 +
2341 xparhy0_[1][4] * sigi4);
2347 xsig2[
i] = (1.f - xxratio_) * (xparl_[0][0] + xparl_[0][1] * sigi + xparl_[0][2] * sigi2 +
2348 xparl_[0][3] * sigi3 + xparl_[0][4] * sigi4) +
2349 xxratio_ * (xparh_[0][0] + xparh_[0][1] * sigi + xparh_[0][2] * sigi2 + xparh_[0][3] * sigi3 +
2350 xparh_[0][4] * sigi4);
2352 xsig2[
i] = (1.f - xxratio_) * (xparl_[1][0] + xparl_[1][1] * sigi + xparl_[1][2] * sigi2 +
2353 xparl_[1][3] * sigi3 + xparl_[1][4] * sigi4) +
2354 xxratio_ * (xparh_[1][0] + xparh_[1][1] * sigi + xparh_[1][2] * sigi2 + xparh_[1][3] * sigi3 +
2355 xparh_[1][4] * sigi4);
2361 x0 = xpar0_[0][0] + xpar0_[0][1] * sigi + xpar0_[0][2] * sigi2 + xpar0_[0][3] * sigi3 + xpar0_[0][4] * sigi4;
2363 x0 = xpar0_[1][0] + xpar0_[1][1] * sigi + xpar0_[1][2] * sigi2 + xpar0_[1][3] * sigi3 + xpar0_[1][4] * sigi4;
2369 xsig2[
i] = xsig2[
i] / x0 * yint;
2372 if (xsum[
i] > sxthr) {
2375 if (xsig2[
i] <= 0.
f) {
2376 LOGERROR(
"SiPixelTemplate") <<
"neg x-error-squared, id = " << id_current_ <<
", index = " << index_id_
2377 <<
", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_
2378 <<
", sigi = " << sigi <<
ENDL;
2398 float qfl, qfl2, qfl3, qfl4, qfl5,
dy;
2402 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2403 if (binq < 0 || binq > 3) {
2404 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with binq = " << binq << std::endl;
2407 assert(binq >= 0 && binq < 4);
2409 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2410 if (fabs((
double)qfly) > 1.) {
2411 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with qfly = " << qfly << std::endl;
2414 assert(fabs((
double)qfly) <= 1.);
2434 dy = (1.f - yratio_) * (yflparl_[binq][0] + yflparl_[binq][1] * qfl + yflparl_[binq][2] * qfl2 +
2435 yflparl_[binq][3] * qfl3 + yflparl_[binq][4] * qfl4 + yflparl_[binq][5] * qfl5) +
2436 yratio_ * (yflparh_[binq][0] + yflparh_[binq][1] * qfl + yflparh_[binq][2] * qfl2 + yflparh_[binq][3] * qfl3 +
2437 yflparh_[binq][4] * qfl4 + yflparh_[binq][5] * qfl5);
2454 float qfl, qfl2, qfl3, qfl4, qfl5,
dx;
2458 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2459 if (binq < 0 || binq > 3) {
2460 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with binq = " << binq << std::endl;
2463 assert(binq >= 0 && binq < 4);
2465 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2466 if (fabs((
double)qflx) > 1.) {
2467 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with qflx = " << qflx << std::endl;
2470 assert(fabs((
double)qflx) <= 1.);
2490 dx = (1.f - yxratio_) *
2491 ((1.
f - xxratio_) * (xflparll_[binq][0] + xflparll_[binq][1] * qfl + xflparll_[binq][2] * qfl2 +
2492 xflparll_[binq][3] * qfl3 + xflparll_[binq][4] * qfl4 + xflparll_[binq][5] * qfl5) +
2493 xxratio_ * (xflparlh_[binq][0] + xflparlh_[binq][1] * qfl + xflparlh_[binq][2] * qfl2 +
2494 xflparlh_[binq][3] * qfl3 + xflparlh_[binq][4] * qfl4 + xflparlh_[binq][5] * qfl5)) +
2496 ((1.
f - xxratio_) * (xflparhl_[binq][0] + xflparhl_[binq][1] * qfl + xflparhl_[binq][2] * qfl2 +
2497 xflparhl_[binq][3] * qfl3 + xflparhl_[binq][4] * qfl4 + xflparhl_[binq][5] * qfl5) +
2498 xxratio_ * (xflparhh_[binq][0] + xflparhh_[binq][1] * qfl + xflparhh_[binq][2] * qfl2 +
2499 xflparhh_[binq][3] * qfl3 + xflparhh_[binq][4] * qfl4 + xflparhh_[binq][5] * qfl5));
2521 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2522 if (fybin < 0 || fybin > 40) {
2523 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with fybin = " << fybin << std::endl;
2526 assert(fybin >= 0 && fybin < 41);
2528 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2529 if (lybin < 0 || lybin > 40) {
2530 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with lybin = " << lybin << std::endl;
2533 assert(lybin >= 0 && lybin < 41);
2538 for (
i = 0;
i < 9; ++
i) {
2540 ytemplate[
i + 16][
j] = ytemp_[
i][
j];
2543 for (
i = 0;
i < 8; ++
i) {
2544 ytemplate[
i + 8][
BYM1] = 0.f;
2546 ytemplate[
i + 8][
j] = ytemp_[
i][
j + 1];
2549 for (
i = 1;
i < 9; ++
i) {
2550 ytemplate[
i + 24][0] = 0.f;
2552 ytemplate[
i + 24][
j + 1] = ytemp_[
i][
j];
2559 for (
i = 0;
i < 8; ++
i) {
2560 ytemplate[
i][
BYM2] = 0.f;
2561 ytemplate[
i][
BYM1] = 0.f;
2563 ytemplate[
i][
j] = ytemp_[
i][
j + 2];
2568 for (
i = 1;
i < 9; ++
i) {
2569 ytemplate[
i + 32][0] = 0.f;
2570 ytemplate[
i + 32][1] = 0.f;
2572 ytemplate[
i + 32][
j + 2] = ytemp_[
i][
j];
2595 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2596 if (fxbin < 0 || fxbin > 40) {
2597 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with fxbin = " << fxbin << std::endl;
2600 assert(fxbin >= 0 && fxbin < 41);
2602 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2603 if (lxbin < 0 || lxbin > 40) {
2604 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with lxbin = " << lxbin << std::endl;
2607 assert(lxbin >= 0 && lxbin < 41);
2612 for (
i = 0;
i < 9; ++
i) {
2614 xtemplate[
i + 16][
j] = xtemp_[
i][
j];
2617 for (
i = 0;
i < 8; ++
i) {
2618 xtemplate[
i + 8][
BXM1] = 0.f;
2620 xtemplate[
i + 8][
j] = xtemp_[
i][
j + 1];
2623 for (
i = 1;
i < 9; ++
i) {
2624 xtemplate[
i + 24][0] = 0.f;
2626 xtemplate[
i + 24][
j + 1] = xtemp_[
i][
j];
2631 for (
i = 0;
i < 8; ++
i) {
2632 xtemplate[
i][
BXM2] = 0.f;
2633 xtemplate[
i][
BXM1] = 0.f;
2635 xtemplate[
i][
j] = xtemp_[
i][
j + 2];
2640 for (
i = 1;
i < 9; ++
i) {
2641 xtemplate[
i + 32][0] = 0.f;
2642 xtemplate[
i + 32][1] = 0.f;
2644 xtemplate[
i + 32][
j + 2] = xtemp_[
i][
j];
2668 float qedge = 2. * s50_;
2672 if (ytemp_[4][
j] > sigmax) {
2673 sigmax = ytemp_[4][
j];
2677 if (sigmax < qedge) {
2680 if (sigmax < qedge || jmax < 1 || jmax >
BYM2) {
2688 for (
j = jmax + 1;
j <
BYM1; ++
j) {
2689 if (ytemp_[4][
j] < qedge)
2696 for (
j = jmax - 1;
j > 0; --
j) {
2697 if (ytemp_[4][
j] < qedge)
2702 return (jbeg + jend) / 2;
2721 float qedge = 2. * s50_;
2725 if (xtemp_[4][
j] > sigmax) {
2726 sigmax = xtemp_[4][
j];
2730 if (sigmax < qedge) {
2733 if (sigmax < qedge || jmax < 1 || jmax >
BXM2) {
2741 for (
j = jmax + 1;
j <
BXM1; ++
j) {
2742 if (xtemp_[4][
j] < qedge)
2749 for (
j = jmax - 1;
j > 0; --
j) {
2750 if (xtemp_[4][
j] < qedge)
2755 return (jbeg + jend) / 2;
2771 int ioff0, ioffp, ioffm;
2775 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2776 if (nypix < 1 || nypix >=
BYM3) {
2777 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp3d called with nypix = " << nypix << std::endl;
2785 float diff = fabsf(nypix - clsleny_) / 2. + 1.f;
2787 if ((
diff - nshift) > 0.5f) {
2793 nybins_ = 9 + 16 * nshift;
2797 temp2dy_.resize(boost::extents[nybins_][
BYSIZE]);
2803 for (
i = 0;
i < 9; ++
i) {
2805 temp2dy_[
i + ioff0][
j] = ytemp_[
i][
j];
2811 for (
k = 1;
k <= nshift; ++
k) {
2812 ioffm = ioff0 -
k * 8;
2813 for (
i = 0;
i < 8; ++
i) {
2814 for (
j = 0;
j <
k; ++
j) {
2815 temp2dy_[
i + ioffm][
BYM1 -
j] = 0.f;
2818 temp2dy_[
i + ioffm][
j] = ytemp_[
i][
j +
k];
2821 ioffp = ioff0 +
k * 8;
2822 for (
i = 1;
i < 9; ++
i) {
2823 for (
j = 0;
j <
k; ++
j) {
2824 temp2dy_[
i + ioffp][
j] = 0.f;
2827 temp2dy_[
i + ioffp][
j +
k] = ytemp_[
i][
j];
2846 if (
i >= 0 &&
i < nybins_ &&
j <=
i) {
2848 ytemplate[
k] = temp2dy_[
i][
k] + temp2dy_[
j][
k];
2872 int ioff0, ioffp, ioffm;
2876 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 2877 if (nxpix < 1 || nxpix >=
BXM3) {
2878 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl;
2886 float diff = fabsf(nxpix - clslenx_) / 2.f + 1.f;
2888 if ((
diff - nshift) > 0.5f) {
2894 nxbins_ = 9 + 16 * nshift;
2898 temp2dx_.resize(boost::extents[nxbins_][
BXSIZE]);
2904 for (
i = 0;
i < 9; ++
i) {
2906 temp2dx_[
i + ioff0][
j] = xtemp_[
i][
j];
2912 for (
k = 1;
k <= nshift; ++
k) {
2913 ioffm = ioff0 -
k * 8;
2914 for (
i = 0;
i < 8; ++
i) {
2915 for (
j = 0;
j <
k; ++
j) {
2916 temp2dx_[
i + ioffm][
BXM1 -
j] = 0.f;
2919 temp2dx_[
i + ioffm][
j] = xtemp_[
i][
j +
k];
2922 ioffp = ioff0 +
k * 8;
2923 for (
i = 1;
i < 9; ++
i) {
2924 for (
j = 0;
j <
k; ++
j) {
2925 temp2dx_[
i + ioffp][
j] = 0.f;
2928 temp2dx_[
i + ioffp][
j +
k] = xtemp_[
i][
j];
2948 if (
i >= 0 &&
i < nxbins_ &&
j <=
i) {
2950 xtemplate[
k] = temp2dx_[
i][
k] + temp2dx_[
j][
k];
3018 for (
int i = 0;
i < (
int)thePixelTemp_.size(); ++
i) {
3019 if (
id == thePixelTemp_[
i].head.ID) {
3025 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3026 if (index < 0 || index >= (
int)thePixelTemp_.size()) {
3027 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin can't find needed template ID = " <<
id << std::endl;
3035 auto const& templ = thePixelTemp_[
index];
3043 auto cotalpha0 = thePixelTemp_[
index].enty[0].cotalpha;
3045 std::sqrt((1.
f + cotbeta * cotbeta + cotalpha * cotalpha) / (1.
f + cotbeta * cotbeta + cotalpha0 * cotalpha0));
3049 float cota = cotalpha;
3050 bool flip_x =
false;
3059 if (locBx * locBz < 0.
f) {
3065 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3067 <<
"SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
3069 std::cout <<
"SiPixelTemplate::illegal subdetector ID = " << thePixelTemp_[index_id_].head.Dtype << std::endl;
3075 auto qscale = thePixelTemp_[
index].head.qscale;
3083 auto Ny = thePixelTemp_[
index].head.NTy;
3084 auto Nyx = thePixelTemp_[
index].head.NTyx;
3085 auto Nxx = thePixelTemp_[
index].head.NTxx;
3087 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3088 if (
Ny < 2 || Nyx < 1 || Nxx < 2) {
3089 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " <<
Ny 3090 <<
"/" << Nyx <<
"/" << Nxx << std::endl;
3093 assert(
Ny > 1 && Nyx > 0 && Nxx > 1);
3098 dy1 = (1.f - yratio_) * enty0_->dyone + yratio_ * enty1_->dyone;
3102 sy1 = (1.f - yratio_) * enty0_->syone + yratio_ * enty1_->syone;
3103 dy2 = (1.f - yratio_) * enty0_->dytwo + yratio_ * enty1_->dytwo;
3107 sy2 = (1.f - yratio_) * enty0_->sytwo + yratio_ * enty1_->sytwo;
3109 auto qavg = (1.f - yratio_) * enty0_->qavg + yratio_ * enty1_->qavg;
3111 auto qmin = (1.f - yratio_) * enty0_->qmin + yratio_ * enty1_->qmin;
3113 auto qmin2 = (1.f - yratio_) * enty0_->qmin2 + yratio_ * enty1_->qmin2;
3116 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3117 if (qavg <= 0.
f || qmin <= 0.
f) {
3119 <<
"SiPixelTemplate::qbin, qavg or qmin <= 0," 3120 <<
" Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
3128 auto qtotal = qscale * qclus;
3131 auto fq = qtotal / qavg;
3134 if (fq > fbin_[0]) {
3139 if (fq > fbin_[1]) {
3142 if (fq > fbin_[2]) {
3150 auto yavggen = (1.f - yratio_) * enty0_->yavggen[binq] + yratio_ * enty1_->yavggen[binq];
3154 auto yrmsgen = (1.f - yratio_) * enty0_->yrmsgen[binq] + yratio_ * enty1_->yrmsgen[binq];
3163 auto j =
std::lower_bound(templ.cotbetaX.begin(), templ.cotbetaX.begin() + Nyx, acotb);
3164 if (
j == templ.cotbetaX.begin() + Nyx) {
3167 }
else if (
j == templ.cotbetaX.begin()) {
3171 yxratio = (acotb - (*(
j - 1))) / ((*
j) - (*(
j - 1)));
3174 iyhigh =
j - templ.cotbetaX.begin();
3183 auto j =
std::lower_bound(templ.cotalphaX.begin(), templ.cotalphaX.begin() + Nxx, cota);
3184 if (
j == templ.cotalphaX.begin() + Nxx) {
3187 }
else if (
j == templ.cotalphaX.begin()) {
3191 xxratio = (cota - (*(
j - 1))) / ((*
j) - (*(
j - 1)));
3194 ihigh =
j - templ.cotalphaX.begin();
3199 (1.f - xxratio) * thePixelTemp_[
index].entx[0][ilow].dxone + xxratio * thePixelTemp_[
index].entx[0][ihigh].dxone;
3204 (1.f - xxratio) * thePixelTemp_[
index].entx[0][ilow].sxone + xxratio * thePixelTemp_[
index].entx[0][ihigh].sxone;
3206 (1.f - xxratio) * thePixelTemp_[
index].entx[0][ilow].dxtwo + xxratio * thePixelTemp_[
index].entx[0][ihigh].dxtwo;
3211 (1.f - xxratio) * thePixelTemp_[
index].entx[0][ilow].sxtwo + xxratio * thePixelTemp_[
index].entx[0][ihigh].sxtwo;
3215 pixmx = (1.f - yxratio) * ((1.
f - xxratio) * thePixelTemp_[
index].entx[iylow][ilow].pixmax +
3216 xxratio * thePixelTemp_[
index].entx[iylow][ihigh].pixmax) +
3217 yxratio * ((1.
f - xxratio) * thePixelTemp_[
index].entx[iyhigh][ilow].pixmax +
3218 xxratio * thePixelTemp_[
index].entx[iyhigh][ihigh].pixmax);
3220 auto xavggen = (1.f - yxratio) * ((1.
f - xxratio) * thePixelTemp_[
index].entx[iylow][ilow].xavggen[binq] +
3221 xxratio * thePixelTemp_[
index].entx[iylow][ihigh].xavggen[binq]) +
3222 yxratio * ((1.
f - xxratio) * thePixelTemp_[
index].entx[iyhigh][ilow].xavggen[binq] +
3223 xxratio * thePixelTemp_[
index].entx[iyhigh][ihigh].xavggen[binq]);
3228 auto xrmsgen = (1.f - yxratio) * ((1.
f - xxratio) * thePixelTemp_[
index].entx[iylow][ilow].xrmsgen[binq] +
3229 xxratio * thePixelTemp_[
index].entx[iylow][ihigh].xrmsgen[binq]) +
3230 yxratio * ((1.
f - xxratio) * thePixelTemp_[
index].entx[iyhigh][ilow].xrmsgen[binq] +
3231 xxratio * thePixelTemp_[
index].entx[iyhigh][ihigh].xrmsgen[binq]);
3243 if (qtotal < 0.95
f * qmin) {
3246 if (qtotal < 0.95
f * qmin2) {
3377 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz;
3380 if (cotbeta < 0.
f) {
3384 if (cotalpha < 0.
f) {
3421 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz,
3423 const float cotalpha = 0.f;
3425 if (cotbeta < 0.
f) {
3429 if (cotalpha < 0.
f) {
3483 int ilow, ihigh, iylow, iyhigh,
Ny, Nxx, Nyx,
index;
3499 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3501 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id 3508 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3509 if (qBin < 0 || qBin > 5) {
3510 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors called with illegal qBin = " <<
qBin 3534 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3535 if (
Ny < 2 || Nyx < 1 || Nxx < 2) {
3537 <<
"/" << Nyx <<
"/" << Nxx << std::endl;
3540 assert(
Ny > 1 && Nyx > 0 && Nxx > 1);
3561 for (
i = 0;
i < Nyx - 1; ++
i) {
3582 for (
i = 0;
i < Nxx - 1; ++
i) {
3641 int ilow, ihigh, iylow, iyhigh,
Ny, Nxx, Nyx,
index;
3658 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3660 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id 3671 acotb = fabs((
double)cotbeta);
3679 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 3680 if (
Ny < 2 || Nyx < 1 || Nxx < 2) {
3682 <<
"/" << Nyx <<
"/" << Nxx << std::endl;
3685 assert(
Ny > 1 && Nyx > 0 && Nxx > 1);
3702 for (
i = 0;
i < Nyx - 1; ++
i) {
3723 for (
i = 0;
i < Nxx - 1; ++
i) {
3737 for (
i = 0;
i < 3; ++
i) {
3752 qbin_frac[0] = qfrac[0];
3753 qbin_frac[1] = qbin_frac[0] + qfrac[1];
3754 qbin_frac[2] = qbin_frac[1] + qfrac[2];
3771 float xhit,
float yhit, std::vector<bool>& ydouble, std::vector<bool>& xdouble,
float template2d[
BXM2][
BYM2]) {
3774 float x0, y0, xf, yf,
xi, yi, sf, si, s0, qpix, slopey, slopex, ds;
3775 int i,
j, jpix0, ipix0, jpixf, ipixf, jpix, ipix, nx, ny, anx,
any, jmax, imax;
3778 std::list<SimplePixel> list;
3779 std::list<SimplePixel>::iterator listIter, listEnd;
3786 jpix0 = floor(x0 /
xsize_) + 1;
3787 ipix0 = floor(y0 /
ysize_) + 1;
3789 if (jpix0 < 0 || jpix0 >
BXM3) {
3792 if (ipix0 < 0 || ipix0 >
BYM3) {
3799 jpixf = floor(xf /
xsize_) + 1;
3800 ipixf = floor(yf /
ysize_) + 1;
3802 if (jpixf < 0 || jpixf >
BXM3) {
3805 if (ipixf < 0 || ipixf >
BYM3) {
3811 sf =
std::sqrt((xf - x0) * (xf - x0) + (yf - y0) * (yf - y0));
3812 if ((xf - x0) != 0.
f) {
3813 slopey = (yf - y0) / (xf - x0);
3817 if ((yf - y0) != 0.f) {
3818 slopex = (xf - x0) / (yf - y0);
3834 list.push_back(element);
3842 for (
j = jpix0;
j < jpixf; ++
j) {
3844 yi = slopey * (
xi - x0) + y0;
3846 si =
std::sqrt((
xi - x0) * (
xi - x0) + (yi - y0) * (yi - y0));
3853 list.push_back(element);
3856 for (
j = jpix0;
j > jpixf; --
j) {
3858 yi = slopey * (
xi - x0) + y0;
3860 si =
std::sqrt((
xi - x0) * (
xi - x0) + (yi - y0) * (yi - y0));
3867 list.push_back(element);
3876 for (
i = ipix0;
i < ipixf; ++
i) {
3878 xi = slopex * (yi - y0) + x0;
3880 si =
std::sqrt((
xi - x0) * (
xi - x0) + (yi - y0) * (yi - y0));
3887 list.push_back(element);
3890 for (
i = ipix0;
i > ipixf; --
i) {
3892 xi = slopex * (yi - y0) + x0;
3894 si =
std::sqrt((
xi - x0) * (
xi - x0) + (yi - y0) * (yi - y0));
3901 list.push_back(element);
3915 for (
i = 1;
i < imax; ++
i) {
3916 if (ydouble[
i - 1]) {
3917 listIter = list.begin();
3919 while (listIter != list.end()) {
3920 if (listIter->i ==
i && listIter->btype == 2) {
3921 listIter = list.erase(listIter);
3924 if (listIter->i >
i) {
3930 while (listIter != list.end()) {
3931 if (listIter->i ==
i + 1 && listIter->btype == 2) {
3932 listIter = list.erase(listIter);
3935 if (listIter->i >
i + 1) {
3944 for (
j = 1;
j < jmax; ++
j) {
3945 if (xdouble[
j - 1]) {
3946 listIter = list.begin();
3948 while (listIter != list.end()) {
3949 if (listIter->j ==
j && listIter->btype == 1) {
3950 listIter = list.erase(listIter);
3953 if (listIter->j >
j) {
3959 while (listIter != list.end()) {
3960 if (listIter->j ==
j + 1 && listIter->btype == 1) {
3961 listIter = list.erase(listIter);
3964 if (listIter->j >
j + 1) {
3976 listIter = list.begin();
3977 listEnd = list.end();
3978 for (; listIter != listEnd; ++listIter) {
3985 qpix = qtotal * ds / sf;
3989 template2d[
j][
i] += qpix;
4007 int ilow, ihigh,
Ny;
4022 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 4042 for (
i = 0;
i <
Ny - 1; ++
i) {
4068 LOGERROR(
"SiPixelTemplate") <<
"Vavilov kappa value is " <<
kappavav_ <<
" changing it to be above 0.01" <<
ENDL;
4091 int ilow, ihigh,
Ny;
4106 #ifndef SI_PIXEL_TEMPLATE_STANDALONE 4126 for (
i = 0;
i <
Ny - 1; ++
i) {
float cota_current_
current cot alpha
float qavg_avg
average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) ...
float mpvvav_
most probable charge in Vavilov distribution (not actually for larger kappa)
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)
std::array< float, 100 > cotbetaY
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)
float kappavav2()
kappa parameter for 2-cluster Vavilov distribution
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
for(int i=first, nt=offsets[nh];i< nt;i+=gridDim.x *blockDim.x)
float fracytwo
fraction of double pixel sample with ysize = 1
float yrms[4]
average y-rms of reconstruction binned in 4 charge bins
std::array< float, 80 > cotalphaX
60 y templates spanning cluster lengths from 0px to +18px
float mpvvav()
most probable charge in Vavilov distribution (not actually for larger kappa)
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
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 yratio()
fractional distance in y between cotbeta templates
float dytwo
mean offset/correction for one double-pixel y-clusters
float xrms(int i)
average x-rms of reconstruction binned in 4 charge bins
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 mpvvav2()
most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) ...
float xflcorr(int binq, float qflx)
float xgsiggen[4]
generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins
float cotb_current_
current cot beta
float chi2xminc2m[4]
1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters)
constexpr bool isFinite(T x)
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)
static std::string to_string(const XMLCh *ch)
float sxone()
rms for one pixel x-clusters
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 kappavav2_
kappa parameter for 2-cluster Vavilov distribution
float symax
average pixel signal for y-projection of cluster
float sigmavav_
"sigma" scale fctor for Vavilov distribution
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 kappavav()
kappa parameter for Vavilov distribution
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 yrms(int i)
average y-rms of reconstruction binned in 4 charge bins
const SiPixelTemplateEntry * enty0_
float lorywidth_
Lorentz y-width (sign corrected for fpix frame)
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])
float sigmavav2_
"sigma" scale fctor for 2-cluster Vavilov distribution
int j
y index of traversed pixel
float sigmavav2()
"sigma" scale fctor for 2-cluster Vavilov distribution
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 sxtwo()
rms for one double-pixel x-clusters
float mpvvav
most probable charge in Vavilov distribution (not actually for larger kappa)
float ysize_
Pixel y-size.
float xsize_
Pixel x-size.
float kappavav_
kappa parameter for Vavilov distribution
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
std::array< float, 80 > cotbetaX
const SiPixelTemplateEntry * enty1_
void xtemp3d(int j, int k, std::vector< float > &xtemplate)
const std::vector< SiPixelTemplateStore > & thePixelTemp_
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 qavg_avg_
average of cluster charge less than qavg
float fracyone
fraction of sample with ysize = 1
float qmin2
tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits)
float yxratio()
fractional distance in y between cotalpha templates slices
float yavg[4]
average y-bias of reconstruction binned in 4 charge bins
void xtemp3d_int(int nxpix, int &nxbins)
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &pixelTemp, std::string dir="CalibTracker/SiPixelESProducers/data/")
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
SiPixelTemplateEntry entx[80][80]
int i
x index of traversed pixel
float sigmavav()
"sigma" scale fctor for Vavilov distribution
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
float lorxwidth_
Lorentz x-width.
int index_id_
current index
float chi2yminone
minimum of y chi^2 for 1 pixel clusters
SiPixelTemplateEntry enty[100]
60 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 6...
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_)
float mpvvav2_
most probable charge in 2-cluster Vavilov distribution (not actually for larger kappa) ...
float ygsig[4]
average sigma_y from Gaussian fit binned in 4 charge bins
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
int id_current_
current id
float zsize_
Pixel z-size (thickness)
float chi2xavg[4]
average x chi^2 in 4 charge bins
float yratio_
fractional distance in y between cotbeta templates
float xxratio()
fractional distance in x between cotalpha templates
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