75 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
91 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
96 #define LOGERROR(x) LogError(x)
97 #define LOGINFO(x) LogInfo(x)
104 #define LOGERROR(x) std::cout << x << ": "
105 #define LOGINFO(x) std::cout << x << ": "
106 #define ENDL std::endl
122 const char *tempfile;
125 const int code_version={17};
131 std::ostringstream tout;
135 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
136 tout <<
"CalibTracker/SiPixelESProducers/data/template_summary_zp"
137 << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
138 std::string tempf = tout.str();
140 tempfile = (
file.fullPath()).c_str();
142 tout <<
"template_summary_zp" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
143 std::string tempf = tout.str();
144 tempfile = tempf.c_str();
151 if(in_file.is_open()) {
159 for (i=0; (c=in_file.get()) !=
'\n'; ++
i) {
164 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
172 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file, no template load" <<
ENDL;
return false;}
175 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
176 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
178 <<
", 1/2 threshold " << theCurrentTemp.
head.
s50 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", x Lorentz width " << theCurrentTemp.
head.
lorxwidth
181 if(theCurrentTemp.
head.
templ_version < code_version) {
LOGERROR(
"SiPixelTemplate") <<
"code expects version " << code_version <<
", no template load" <<
ENDL;
return false;}
183 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
187 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
195 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
200 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
215 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
220 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
222 for (j=0; j<2; ++
j) {
227 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
231 for (j=0; j<9; ++
j) {
235 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
238 for (j=0; j<2; ++
j) {
243 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
248 for (j=0; j<9; ++
j) {
252 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
256 for (j=0; j<4; ++
j) {
260 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
263 for (j=0; j<4; ++
j) {
268 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
271 for (j=0; j<4; ++
j) {
275 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
278 for (j=0; j<4; ++
j) {
283 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
286 for (j=0; j<4; ++
j) {
290 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
293 for (j=0; j<4; ++
j) {
297 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
300 for (j=0; j<4; ++
j) {
304 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
307 for (j=0; j<4; ++
j) {
311 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, 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 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
324 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
330 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
336 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
338 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
343 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
351 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
358 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
364 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
366 for (j=0; j<2; ++
j) {
371 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
374 for (j=0; j<9; ++
j) {
378 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
381 for (j=0; j<2; ++
j) {
387 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
391 for (j=0; j<9; ++
j) {
395 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
399 for (j=0; j<4; ++
j) {
403 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
406 for (j=0; j<4; ++
j) {
411 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
414 for (j=0; j<4; ++
j) {
418 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
421 for (j=0; j<4; ++
j) {
426 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
429 for (j=0; j<4; ++
j) {
433 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
436 for (j=0; j<4; ++
j) {
440 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
443 for (j=0; j<4; ++
j) {
447 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
450 for (j=0; j<4; ++
j) {
454 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, 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 30b, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
467 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
473 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
483 thePixelTemp_.push_back(theCurrentTemp);
491 LOGERROR(
"SiPixelTemplate") <<
"Error opening File" << tempfile <<
ENDL;
499 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
514 const int code_version={16};
529 for (i=0; i<20; ++
i) {
538 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
546 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file, no template load" <<
ENDL;
return false;}
549 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
550 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
552 <<
", 1/2 threshold " << theCurrentTemp.
head.
s50 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", x Lorentz width " << theCurrentTemp.
head.
lorxwidth
555 if(theCurrentTemp.
head.
templ_version < code_version) {
LOGERROR(
"SiPixelTemplate") <<
"code expects version " << code_version <<
", no template load" <<
ENDL;
return false;}
558 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
562 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
570 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
575 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
590 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
596 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
598 for (j=0; j<2; ++
j) {
603 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
607 for (j=0; j<9; ++
j) {
611 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
614 for (j=0; j<2; ++
j) {
619 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
624 for (j=0; j<9; ++
j) {
628 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
632 for (j=0; j<4; ++
j) {
636 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
639 for (j=0; j<4; ++
j) {
644 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
647 for (j=0; j<4; ++
j) {
651 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
654 for (j=0; j<4; ++
j) {
659 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
662 for (j=0; j<4; ++
j) {
666 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
669 for (j=0; j<4; ++
j) {
673 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
676 for (j=0; j<4; ++
j) {
680 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
683 for (j=0; j<4; ++
j) {
687 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
690 for (j=0; j<4; ++
j) {
694 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
701 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
707 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
713 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
715 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
720 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
728 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
735 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
741 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
743 for (j=0; j<2; ++
j) {
748 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
751 for (j=0; j<9; ++
j) {
755 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
758 for (j=0; j<2; ++
j) {
764 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
768 for (j=0; j<9; ++
j) {
772 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
776 for (j=0; j<4; ++
j) {
780 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
783 for (j=0; j<4; ++
j) {
788 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
791 for (j=0; j<4; ++
j) {
795 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
798 for (j=0; j<4; ++
j) {
803 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
806 for (j=0; j<4; ++
j) {
810 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
813 for (j=0; j<4; ++
j) {
817 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
820 for (j=0; j<4; ++
j) {
824 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
827 for (j=0; j<4; ++
j) {
831 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
834 for (j=0; j<4; ++
j) {
838 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
845 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
851 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
859 thePixelTemp_.push_back(theCurrentTemp);
882 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx;
883 float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, symax, chi2xavgone, chi2xminone, cotb, cotalpha0, cotbeta0;
886 float chi2xavg[4], chi2xmin[4], chi2xavgc2m[4], chi2xminc2m[4];
891 if(
id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
893 cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ =
true;
895 if(
id != id_current_) {
900 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
902 if(
id == thePixelTemp_[i].head.ID) {
909 qscale_ = thePixelTemp_[index_id_].head.qscale;
913 s50_ = thePixelTemp_[index_id_].head.s50;
917 xsize_ = thePixelTemp_[index_id_].head.xsize;
918 ysize_ = thePixelTemp_[index_id_].head.ysize;
919 zsize_ = thePixelTemp_[index_id_].head.zsize;
926 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
927 if(index_id_ < 0 || index_id_ >= (
int)thePixelTemp_.size()) {
928 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::interpolate can't find needed template ID = " <<
id << std::endl;
931 assert(index_id_ >= 0 && index_id_ < (
int)thePixelTemp_.size());
940 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
941 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
944 if(thePixelTemp_[index_id_].head.Dtype == 0) {
947 if(cotbeta < 0.
f) {flip_y =
true;}
958 Ny = thePixelTemp_[index_id_].head.NTy;
959 Nyx = thePixelTemp_[index_id_].head.NTyx;
960 Nxx = thePixelTemp_[index_id_].head.NTxx;
962 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
963 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
964 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
967 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
977 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
985 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
987 for (i=0; i<Ny-1; ++
i) {
989 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
992 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
996 }
else { success_ =
false; }
1004 qavg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg;
1006 symax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].symax + yratio*thePixelTemp_[index_id_].enty[ihigh].symax;
1008 sxmax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sxmax + yratio*thePixelTemp_[index_id_].enty[ihigh].sxmax;
1009 dyone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dyone + yratio*thePixelTemp_[index_id_].enty[ihigh].dyone;
1010 if(flip_y) {dyone_ = -dyone_;}
1011 syone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].syone + yratio*thePixelTemp_[index_id_].enty[ihigh].syone;
1012 dytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].dytwo;
1013 if(flip_y) {dytwo_ = -dytwo_;}
1014 sytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].sytwo;
1015 qmin_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin;
1017 qmin2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin2 + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin2;
1019 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
1020 mpvvav_ *= qcorrect;
1021 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
1022 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
1023 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
1024 mpvvav2_ *= qcorrect;
1025 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
1026 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
1027 clsleny_ = fminf(thePixelTemp_[index_id_].enty[ilow].clsleny, thePixelTemp_[index_id_].enty[ihigh].clsleny);
1028 qavg_avg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg_avg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg_avg;
1029 qavg_avg_ *= qcorrect;
1030 for(i=0; i<2 ; ++
i) {
1031 for(j=0; j<5 ; ++
j) {
1034 yparl_[1-
i][
j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][
j];
1035 yparh_[1-
i][
j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][
j];
1037 yparl_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][
j];
1038 yparh_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][
j];
1040 xparly0_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].xpar[
i][
j];
1041 xparhy0_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].xpar[
i][
j];
1044 for(i=0; i<4; ++
i) {
1045 yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavg[i];
1046 if(flip_y) {yavg_[
i] = -yavg_[
i];}
1047 yrms_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrms[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrms[i];
1053 chi2yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavg[i];
1054 chi2ymin_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2ymin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2ymin[i];
1055 chi2xavg[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavg[i];
1056 chi2xmin[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xmin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xmin[i];
1057 yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavgc2m[i];
1058 if(flip_y) {yavgc2m_[
i] = -yavgc2m_[
i];}
1059 yrmsc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrmsc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrmsc2m[i];
1060 chi2yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgc2m[i];
1062 chi2yminc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminc2m[i];
1064 chi2xavgc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgc2m[i];
1065 chi2xminc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminc2m[i];
1066 for(j=0; j<6 ; ++
j) {
1067 yflparl_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].yflpar[
i][
j];
1068 yflparh_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].yflpar[
i][
j];
1072 if(flip_y && (j == 0 || j == 2 || j == 4)) {
1073 yflparl_[
i][
j] = - yflparl_[
i][
j];
1074 yflparh_[
i][
j] = - yflparh_[
i][
j];
1081 chi2yavgone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgone;
1082 chi2yminone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminone;
1083 chi2xavgone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgone;
1084 chi2xminone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminone;
1091 for(i=0; i<9; ++
i) {
1094 ytemp_[
i][
BYM2] = 0.f;
1095 ytemp_[
i][
BYM1] = 0.f;
1101 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];
1103 ytemp_[
i][j+2]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].ytemp[i][j] + yratio*thePixelTemp_[index_id_].enty[ihigh].ytemp[i][j];
1113 if(abs_cotb_ >= thePixelTemp_[index_id_].entx[Nyx-1][0].cotbeta) {
1118 }
else if(abs_cotb_ >= thePixelTemp_[index_id_].entx[0][0].cotbeta) {
1120 for (i=0; i<Nyx-1; ++
i) {
1122 if( thePixelTemp_[index_id_].entx[i][0].cotbeta <= abs_cotb_ && abs_cotb_ < thePixelTemp_[index_id_].entx[i+1][0].cotbeta) {
1125 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);
1136 if(cotalpha >= thePixelTemp_[index_id_].entx[0][Nxx-1].cotalpha) {
1144 if(cotalpha >= thePixelTemp_[index_id_].entx[0][0].cotalpha) {
1146 for (i=0; i<Nxx-1; ++
i) {
1148 if( thePixelTemp_[index_id_].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index_id_].entx[0][i+1].cotalpha) {
1151 xxratio = (cotalpha - thePixelTemp_[index_id_].entx[0][
i].cotalpha)/(thePixelTemp_[index_id_].entx[0][i+1].cotalpha - thePixelTemp_[index_id_].entx[0][i].cotalpha);
1155 }
else { success_ =
false; }
1167 sxparmax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].sxmax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].sxmax;
1169 if(thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax != 0.
f) {sxmax_=sxmax_/thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax*sxmax;}
1170 symax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].symax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].symax;
1171 if(thePixelTemp_[index_id_].entx[imaxx][imidy].symax != 0.
f) {symax_=symax_/thePixelTemp_[index_id_].entx[imaxx][imidy].symax*symax;}
1172 dxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxone;
1173 sxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxone;
1174 dxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxtwo;
1175 sxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxtwo;
1176 clslenx_ = fminf(thePixelTemp_[index_id_].entx[0][ilow].clslenx, thePixelTemp_[index_id_].entx[0][ihigh].clslenx);
1177 for(i=0; i<2 ; ++
i) {
1178 for(j=0; j<5 ; ++
j) {
1179 xpar0_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
1180 xparl_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
1181 xparh_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
1187 pixmax_=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].pixmax)
1188 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].pixmax);
1190 for(i=0; i<4; ++
i) {
1191 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])
1192 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavg[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavg[
i]);
1194 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])
1195 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrms[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrms[
i]);
1203 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])
1204 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavgc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavgc2m[
i]);
1206 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])
1207 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrmsc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrmsc2m[
i]);
1223 chi2xavg_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavg[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavg[i]);
1224 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];}
1226 chi2xmin_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xmin[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xmin[i]);
1227 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];}
1229 chi2xavgc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgc2m[i]);
1230 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];}
1232 chi2xminc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminc2m[i]);
1233 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];}
1235 for(j=0; j<6 ; ++
j) {
1236 xflparll_[
i][
j] = thePixelTemp_[index_id_].entx[iylow][ilow].xflpar[
i][
j];
1237 xflparlh_[
i][
j] = thePixelTemp_[index_id_].entx[iylow][ihigh].xflpar[
i][
j];
1238 xflparhl_[
i][
j] = thePixelTemp_[index_id_].entx[iyhigh][ilow].xflpar[
i][
j];
1239 xflparhh_[
i][
j] = thePixelTemp_[index_id_].entx[iyhigh][ihigh].xflpar[
i][
j];
1245 chi2xavgone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgone);
1246 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone != 0.
f) {chi2xavgone_=chi2xavgone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone*chi2xavgone;}
1248 chi2xminone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminone);
1249 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone != 0.
f) {chi2xminone_=chi2xminone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone*chi2xminone;}
1259 cotbeta0 = thePixelTemp_[index_id_].entx[iyhigh][0].cotbeta;
1260 qxtempcor=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta0*cotbeta0+cotalpha*cotalpha));
1262 for(i=0; i<9; ++
i) {
1265 xtemp_[
i][
BXM2] = 0.f;
1266 xtemp_[
i][
BXM1] = 0.f;
1271 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]);
1275 lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
1276 if(locBz > 0.
f) {lorywidth_ = -lorywidth_;}
1277 lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
1301 if(cotbeta < 0.
f) {locBz = -locBz;}
1324 float sigi, sigi2, sigi3, sigi4, symax, qscale;
1328 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1329 if(fypix < 2 || fypix >=
BYM2) {
1330 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with fypix = " << fypix << std::endl;
1333 assert(fypix > 1 && fypix <
BYM2);
1335 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1336 if(lypix < fypix || lypix >=
BYM2) {
1337 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with lypix/fypix = " << lypix <<
"/" << fypix << std::endl;
1340 assert(lypix >= fypix && lypix <
BYM2);
1346 if(symax_ > syparmax_) {symax = syparmax_;}
1350 for(i=fypix-2; i<=lypix+2; ++
i) {
1351 if(i < fypix || i > lypix) {
1355 ysig2[
i] = s50_*s50_;
1357 if(ysum[i] < symax) {
1362 qscale = ysum[
i]/symax;
1364 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1366 ysig2[
i] = (1.f-yratio_)*
1367 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1369 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1371 ysig2[
i] = (1.f-yratio_)*
1372 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1374 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1377 if(ysum[i] > sythr) {ysig2[
i] = 1.e8;}
1378 if(ysig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1379 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1401 float sigi, sigi2, sigi3, sigi4, symax, qscale, err2;
1405 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1406 if(index < 2 || index >=
BYM2) {
1407 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with index = " << index << std::endl;
1410 assert(index > 1 && index <
BYM2);
1416 if(symax_ > syparmax_) {symax = syparmax_;}
1420 if(qpixel < symax) {
1425 qscale = qpixel/symax;
1427 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1429 err2 = (1.f-yratio_)*
1430 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1432 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1434 err2 = (1.f-yratio_)*
1435 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1437 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1440 if(ysig2 <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1441 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1467 float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale;
1471 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1472 if(fxpix < 2 || fxpix >=
BXM2) {
1473 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with fxpix = " << fxpix << std::endl;
1476 assert(fxpix > 1 && fxpix <
BXM2);
1478 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1479 if(lxpix < fxpix || lxpix >=
BXM2) {
1480 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with lxpix/fxpix = " << lxpix <<
"/" << fxpix << std::endl;
1483 assert(lxpix >= fxpix && lxpix <
BXM2);
1489 if(sxmax_ > sxparmax_) {sxmax = sxparmax_;}
1493 for(i=fxpix-2; i<=lxpix+2; ++
i) {
1494 if(i < fxpix || i > lxpix) {
1498 xsig2[
i] = s50_*s50_;
1500 if(xsum[i] < sxmax) {
1505 qscale = xsum[
i]/sxmax;
1507 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1512 yint = (1.f-yratio_)*
1513 (xparly0_[0][0]+xparly0_[0][1]*sigi+xparly0_[0][2]*sigi2+xparly0_[0][3]*sigi3+xparly0_[0][4]*sigi4)
1515 (xparhy0_[0][0]+xparhy0_[0][1]*sigi+xparhy0_[0][2]*sigi2+xparhy0_[0][3]*sigi3+xparhy0_[0][4]*sigi4);
1517 yint = (1.f-yratio_)*
1518 (xparly0_[1][0]+xparly0_[1][1]*sigi+xparly0_[1][2]*sigi2+xparly0_[1][3]*sigi3+xparly0_[1][4]*sigi4)
1520 (xparhy0_[1][0]+xparhy0_[1][1]*sigi+xparhy0_[1][2]*sigi2+xparhy0_[1][3]*sigi3+xparhy0_[1][4]*sigi4);
1526 xsig2[
i] = (1.f-xxratio_)*
1527 (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4)
1529 (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4);
1531 xsig2[
i] = (1.f-xxratio_)*
1532 (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4)
1534 (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4);
1540 x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4;
1542 x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4;
1547 if(x0 != 0.
f) {xsig2[
i] = xsig2[
i]/x0 * yint;}
1549 if(xsum[i] > sxthr) {xsig2[
i] = 1.e8;}
1550 if(xsig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg x-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1551 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1575 float qfl, qfl2, qfl3, qfl4, qfl5, dy;
1579 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1580 if(binq < 0 || binq > 3) {
1581 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with binq = " << binq << std::endl;
1584 assert(binq >= 0 && binq < 4);
1586 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1587 if(fabs((
double)qfly) > 1.) {
1588 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with qfly = " << qfly << std::endl;
1591 assert(fabs((
double)qfly) <= 1.);
1598 if(qfl < -0.9
f) {qfl = -0.9f;}
1599 if(qfl > 0.9
f) {qfl = 0.9f;}
1603 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1604 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)
1605 + yratio_*(yflparh_[binq][0]+yflparh_[binq][1]*qfl+yflparh_[binq][2]*qfl2+yflparh_[binq][3]*qfl3+yflparh_[binq][4]*qfl4+yflparh_[binq][5]*qfl5);
1627 float qfl, qfl2, qfl3, qfl4, qfl5, dx;
1631 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1632 if(binq < 0 || binq > 3) {
1633 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with binq = " << binq << std::endl;
1636 assert(binq >= 0 && binq < 4);
1638 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1639 if(fabs((
double)qflx) > 1.) {
1640 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with qflx = " << qflx << std::endl;
1643 assert(fabs((
double)qflx) <= 1.);
1650 if(qfl < -0.9
f) {qfl = -0.9f;}
1651 if(qfl > 0.9
f) {qfl = 0.9f;}
1655 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1656 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)
1657 + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5))
1658 + 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)
1659 + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5));
1683 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1684 if(fybin < 0 || fybin > 40) {
1685 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with fybin = " << fybin << std::endl;
1688 assert(fybin >= 0 && fybin < 41);
1690 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1691 if(lybin < 0 || lybin > 40) {
1692 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with lybin = " << lybin << std::endl;
1695 assert(lybin >= 0 && lybin < 41);
1700 for(i=0; i<9; ++
i) {
1702 ytemplate[i+16][
j]=ytemp_[
i][
j];
1705 for(i=0; i<8; ++
i) {
1706 ytemplate[i+8][
BYM1] = 0.f;
1707 for(j=0; j<
BYM1; ++
j) {
1708 ytemplate[i+8][
j]=ytemp_[
i][j+1];
1711 for(i=1; i<9; ++
i) {
1712 ytemplate[i+24][0] = 0.f;
1713 for(j=0; j<
BYM1; ++
j) {
1714 ytemplate[i+24][j+1]=ytemp_[
i][
j];
1721 for(i=0; i<8; ++
i) {
1722 ytemplate[
i][
BYM2] = 0.f;
1723 ytemplate[
i][
BYM1] = 0.f;
1724 for(j=0; j<
BYM2; ++
j) {
1725 ytemplate[
i][
j]=ytemp_[
i][j+2];
1730 for(i=1; i<9; ++
i) {
1731 ytemplate[i+32][0] = 0.f;
1732 ytemplate[i+32][1] = 0.f;
1733 for(j=0; j<
BYM2; ++
j) {
1734 ytemplate[i+32][j+2]=ytemp_[
i][
j];
1761 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1762 if(fxbin < 0 || fxbin > 40) {
1763 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with fxbin = " << fxbin << std::endl;
1766 assert(fxbin >= 0 && fxbin < 41);
1768 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1769 if(lxbin < 0 || lxbin > 40) {
1770 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with lxbin = " << lxbin << std::endl;
1773 assert(lxbin >= 0 && lxbin < 41);
1778 for(i=0; i<9; ++
i) {
1780 xtemplate[i+16][
j]=xtemp_[
i][
j];
1783 for(i=0; i<8; ++
i) {
1784 xtemplate[i+8][
BXM1] = 0.f;
1785 for(j=0; j<
BXM1; ++
j) {
1786 xtemplate[i+8][
j]=xtemp_[
i][j+1];
1789 for(i=1; i<9; ++
i) {
1790 xtemplate[i+24][0] = 0.f;
1791 for(j=0; j<
BXM1; ++
j) {
1792 xtemplate[i+24][j+1]=xtemp_[
i][
j];
1799 for(i=0; i<8; ++
i) {
1800 xtemplate[
i][
BXM2] = 0.f;
1801 xtemplate[
i][
BXM1] = 0.f;
1802 for(j=0; j<
BXM2; ++
j) {
1803 xtemplate[
i][
j]=xtemp_[
i][j+2];
1808 for(i=1; i<9; ++
i) {
1809 xtemplate[i+32][0] = 0.f;
1810 xtemplate[i+32][1] = 0.f;
1811 for(j=0; j<
BXM2; ++
j) {
1812 xtemplate[i+32][j+2]=xtemp_[
i][
j];
1837 float qedge = 2.*s50_;
1841 if(ytemp_[4][j] > sigmax) {
1842 sigmax = ytemp_[4][
j];
1846 if(sigmax < qedge) {qedge = s50_;}
1847 if(sigmax < qedge || jmax<1 || jmax>
BYM2) {
return -1;}
1853 for(j=jmax+1; j<
BYM1; ++
j) {
1854 if(ytemp_[4][j] < qedge)
break;
1860 for(j=jmax-1; j>0; --
j) {
1861 if(ytemp_[4][j] < qedge)
break;
1865 return (jbeg+jend)/2;
1886 float qedge = 2.*s50_;
1890 if(xtemp_[4][j] > sigmax) {
1891 sigmax = xtemp_[4][
j];
1895 if(sigmax < qedge) {qedge = s50_;}
1896 if(sigmax < qedge || jmax<1 || jmax>
BXM2) {
return -1;}
1902 for(j=jmax+1; j<
BXM1; ++
j) {
1903 if(xtemp_[4][j] < qedge)
break;
1909 for(j=jmax-1; j>0; --
j) {
1910 if(xtemp_[4][j] < qedge)
break;
1914 return (jbeg+jend)/2;
1932 int ioff0, ioffp, ioffm;
1936 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1937 if(nypix < 1 || nypix >=
BYM3) {
1938 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp3d called with nypix = " << nypix << std::endl;
1941 assert(nypix > 0 && nypix <
BYM3);
1946 float diff = fabsf(nypix - clsleny_)/2. + 1.f;
1947 int nshift = (int)diff;
1948 if((diff - nshift) > 0.5f) {++nshift;}
1952 nybins_ = 9 + 16*nshift;
1956 temp2dy_.resize(boost::extents[nybins_][
BYSIZE]);
1962 for(i=0; i<9; ++
i) {
1964 temp2dy_[i+ioff0][
j]=ytemp_[
i][
j];
1970 for(k=1; k<=nshift; ++
k) {
1972 for(i=0; i<8; ++
i) {
1973 for(j=0; j<
k; ++
j) {
1974 temp2dy_[i+ioffm][
BYM1-
j] = 0.f;
1976 for(j=0; j<BYSIZE-
k; ++
j) {
1977 temp2dy_[i+ioffm][
j]=ytemp_[
i][j+
k];
1981 for(i=1; i<9; ++
i) {
1982 for(j=0; j<
k; ++
j) {
1983 temp2dy_[i+ioffp][
j] = 0.f;
1985 for(j=0; j<BYSIZE-
k; ++
j) {
1986 temp2dy_[i+ioffp][j+
k]=ytemp_[
i][
j];
2006 if(i >= 0 && i < nybins_ && j <= i) {
2008 ytemplate[
k]=temp2dy_[
i][
k]+temp2dy_[
j][
k];
2033 int ioff0, ioffp, ioffm;
2037 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2038 if(nxpix < 1 || nxpix >=
BXM3) {
2039 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl;
2042 assert(nxpix > 0 && nxpix <
BXM3);
2047 float diff = fabsf(nxpix - clslenx_)/2. + 1.f;
2048 int nshift = (int)diff;
2049 if((diff - nshift) > 0.5f) {++nshift;}
2053 nxbins_ = 9 + 16*nshift;
2057 temp2dx_.resize(boost::extents[nxbins_][
BXSIZE]);
2063 for(i=0; i<9; ++
i) {
2065 temp2dx_[i+ioff0][
j]=xtemp_[
i][
j];
2071 for(k=1; k<=nshift; ++
k) {
2073 for(i=0; i<8; ++
i) {
2074 for(j=0; j<
k; ++
j) {
2075 temp2dx_[i+ioffm][
BXM1-
j] = 0.f;
2077 for(j=0; j<BXSIZE-
k; ++
j) {
2078 temp2dx_[i+ioffm][
j]=xtemp_[
i][j+
k];
2082 for(i=1; i<9; ++
i) {
2083 for(j=0; j<
k; ++
j) {
2084 temp2dx_[i+ioffp][
j] = 0.f;
2086 for(j=0; j<BXSIZE-
k; ++
j) {
2087 temp2dx_[i+ioffp][j+
k]=xtemp_[
i][
j];
2109 if(i >= 0 && i < nxbins_ && j <= i) {
2111 xtemplate[
k]=temp2dx_[
i][
k]+temp2dx_[
j][
k];
2149 int SiPixelTemplate::qbin(
int id,
float cotalpha,
float cotbeta,
float locBz,
float qclus,
float& pixmx,
float& sigmay,
float& deltay,
float& sigmax,
float& deltax,
2150 float& sy1,
float& dy1,
float& sy2,
float& dy2,
float& sx1,
float& dx1,
float& sx2,
float& dx2,
float& lorywidth,
float& lorxwidth)
2157 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2158 float yratio, yxratio, xxratio;
2159 float acotb, qscale, qavg, qmin, qmin2, fq, qtotal, qcorrect, cotb, cotalpha0;
2160 float yavggen[4], yrmsgen[4], xavggen[4], xrmsgen[4];
2167 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2169 if(
id == thePixelTemp_[i].head.ID) {
2176 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2177 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2178 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin can't find needed template ID = " <<
id << std::endl;
2181 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2188 acotb = fabs((
double)cotbeta);
2194 cotalpha0 = thePixelTemp_[
index].enty[0].cotalpha;
2195 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
2199 if(thePixelTemp_[index].head.Dtype == 0) {
2202 if(cotbeta < 0.
f) {flip_y =
true;}
2215 qscale = thePixelTemp_[
index].head.qscale;
2217 Ny = thePixelTemp_[
index].head.NTy;
2218 Nyx = thePixelTemp_[
index].head.NTyx;
2219 Nxx = thePixelTemp_[
index].head.NTxx;
2221 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2222 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2223 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2226 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2234 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2241 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2243 for (i=0; i<Ny-1; ++
i) {
2245 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2248 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2259 qavg = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qavg + yratio*thePixelTemp_[index].enty[ihigh].qavg;
2261 dy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dyone + yratio*thePixelTemp_[index].enty[ihigh].dyone;
2262 if(flip_y) {dy1 = -dy1;}
2263 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2264 dy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dytwo + yratio*thePixelTemp_[index].enty[ihigh].dytwo;
2265 if(flip_y) {dy2 = -dy2;}
2266 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2267 qmin = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin + yratio*thePixelTemp_[index].enty[ihigh].qmin;
2269 qmin2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin2 + yratio*thePixelTemp_[index].enty[ihigh].qmin2;
2271 for(i=0; i<4; ++
i) {
2272 yavggen[
i]=(1.f - yratio)*thePixelTemp_[index].enty[ilow].yavggen[i] + yratio*thePixelTemp_[index].enty[ihigh].yavggen[i];
2273 if(flip_y) {yavggen[
i] = -yavggen[
i];}
2274 yrmsgen[
i]=(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrmsgen[i] + yratio*thePixelTemp_[index].enty[ihigh].yrmsgen[i];
2283 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2288 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2290 for (i=0; i<Nyx-1; ++
i) {
2292 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2295 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2306 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2313 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2315 for (i=0; i<Nxx-1; ++
i) {
2317 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2320 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2329 dx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxone + xxratio*thePixelTemp_[index].entx[0][ihigh].dxone;
2330 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2331 dx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].dxtwo;
2332 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2336 pixmx=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].pixmax)
2337 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].pixmax);
2339 for(i=0; i<4; ++
i) {
2341 xavggen[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xavggen[
i] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xavggen[
i])
2342 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xavggen[
i] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xavggen[
i]);
2344 xrmsgen[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrmsgen[
i] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrmsgen[
i])
2345 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrmsgen[
i] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrmsgen[
i]);
2348 lorywidth = thePixelTemp_[
index].head.lorywidth;
2349 if(locBz > 0.
f) {lorywidth = -lorywidth;}
2350 lorxwidth = thePixelTemp_[
index].head.lorxwidth;
2354 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2355 if(qavg <= 0.
f || qmin <= 0.
f) {
2356 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin, qavg or qmin <= 0,"
2357 <<
" Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
2360 assert(qavg > 0.
f && qmin > 0.
f);
2365 qtotal = qscale*qclus;
2386 sigmay = yrmsgen[binq]; deltay = yavggen[binq];
2388 sigmax = xrmsgen[binq]; deltax = xavggen[binq];
2392 if(qtotal < 0.95
f*qmin) {binq = 5;}
else {
if(qtotal < 0.95
f*qmin2) {binq = 4;}}
2421 int SiPixelTemplate::qbin(
int id,
float cotalpha,
float cotbeta,
float locBz,
float qclus,
float& pixmx,
float& sigmay,
float& deltay,
float& sigmax,
float& deltax,
2422 float& sy1,
float& dy1,
float& sy2,
float& dy2,
float& sx1,
float& dx1,
float& sx2,
float& dx2)
2425 float lorywidth, lorxwidth;
2426 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2427 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, lorywidth, lorxwidth);
2444 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz, lorywidth, lorxwidth;
2446 if(cotbeta < 0.
f) {locBz = -locBz;}
2447 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2448 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, lorywidth, lorxwidth);
2464 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz, lorywidth, lorxwidth;
2465 const float cotalpha = 0.f;
2467 if(cotbeta < 0.
f) {locBz = -locBz;}
2468 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2469 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, lorywidth, lorxwidth);
2488 void SiPixelTemplate::temperrors(
int id,
float cotalpha,
float cotbeta,
int qBin,
float& sigmay,
float& sigmax,
float& sy1,
float& sy2,
float& sx1,
float& sx2)
2495 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2496 float yratio, yxratio, xxratio;
2505 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2507 if(
id == thePixelTemp_[i].head.ID) {
2514 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2515 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2516 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2519 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2523 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2524 if(qBin < 0 || qBin > 5) {
2525 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors called with illegal qBin = " << qBin << std::endl;
2528 assert(qBin >= 0 && qBin < 6);
2533 if(qBin > 3) {qBin = 3;}
2538 acotb = fabs((
double)cotbeta);
2559 Ny = thePixelTemp_[
index].head.NTy;
2560 Nyx = thePixelTemp_[
index].head.NTyx;
2561 Nxx = thePixelTemp_[
index].head.NTxx;
2563 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2564 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2565 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2568 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2576 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2583 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2585 for (i=0; i<Ny-1; ++
i) {
2587 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2590 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2601 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2602 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2603 yrms=(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrms[qBin] + yratio*thePixelTemp_[index].enty[ihigh].yrms[qBin];
2611 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2616 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2618 for (i=0; i<Nyx-1; ++
i) {
2620 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2623 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2634 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2641 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2643 for (i=0; i<Nxx-1; ++
i) {
2645 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2648 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2657 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2658 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2660 xrms=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrms[qBin] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrms[qBin])
2661 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrms[qBin] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrms[qBin]);
2687 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)
2694 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2695 float yratio, yxratio, xxratio;
2703 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2705 if(
id == thePixelTemp_[i].head.ID) {
2713 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2714 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2715 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2718 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2725 acotb = fabs((
double)cotbeta);
2747 Ny = thePixelTemp_[
index].head.NTy;
2748 Nyx = thePixelTemp_[
index].head.NTyx;
2749 Nxx = thePixelTemp_[
index].head.NTxx;
2751 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2752 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2753 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2756 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2764 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2771 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2773 for (i=0; i<Ny-1; ++
i) {
2775 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2778 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2788 ny1_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracyone + yratio*thePixelTemp_[index].enty[ihigh].fracyone;
2789 ny2_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracytwo + yratio*thePixelTemp_[index].enty[ihigh].fracytwo;
2796 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2801 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2803 for (i=0; i<Nyx-1; ++
i) {
2805 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2808 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2819 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2826 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2828 for (i=0; i<Nxx-1; ++
i) {
2830 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2833 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2842 for(i=0; i<3; ++
i) {
2843 qfrac[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].qbfrac[
i])
2844 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].qbfrac[
i]);
2846 nx1_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxone)
2847 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxone);
2848 nx2_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxtwo)
2849 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxtwo);
2853 qbin_frac[0] = qfrac[0];
2854 qbin_frac[1] = qbin_frac[0] + qfrac[1];
2855 qbin_frac[2] = qbin_frac[1] + qfrac[2];
2876 float x0, y0, xf, yf, xi, yi, sf, si, s0, qpix, slopey, slopex, ds;
2877 int i,
j, jpix0, ipix0, jpixf, ipixf, jpix, ipix, nx, ny, anx,
any, jmax, imax;
2880 std::list<SimplePixel>
list;
2881 std::list<SimplePixel>::iterator listIter, listEnd;
2885 x0 = xhit - 0.5*zsize_*cota_current_;
2886 y0 = yhit - 0.5*zsize_*cotb_current_;
2888 jpix0 = floor(x0/xsize_)+1;
2889 ipix0 = floor(y0/ysize_)+1;
2891 if(jpix0 < 0 || jpix0 >
BXM3) {
return false;}
2892 if(ipix0 < 0 || ipix0 >
BYM3) {
return false;}
2894 xf = xhit + 0.5*zsize_*cota_current_ + lorxwidth_;
2895 yf = yhit + 0.5*zsize_*cotb_current_ + lorywidth_;
2897 jpixf = floor(xf/xsize_)+1;
2898 ipixf = floor(yf/ysize_)+1;
2900 if(jpixf < 0 || jpixf > BXM3) {
return false;}
2901 if(ipixf < 0 || ipixf > BYM3) {
return false;}
2905 sf =
std::sqrt((xf-x0)*(xf-x0) + (yf-y0)*(yf-y0));
2906 if((xf-x0) != 0.
f) {slopey = (yf-y0)/(xf-x0);}
else { slopey = 1.e10;}
2907 if((yf-y0) != 0.f) {slopex = (xf-x0)/(yf-y0);}
else { slopex = 1.e10;}
2920 list.push_back(element);
2928 for(j=jpix0; j<jpixf; ++
j) {
2930 yi = slopey*(xi-x0) + y0;
2931 ipix = (int)(yi/ysize_)+1;
2932 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2939 list.push_back(element);
2942 for(j=jpix0; j>jpixf; --
j) {
2944 yi = slopey*(xi-x0) + y0;
2945 ipix = (int)(yi/ysize_)+1;
2946 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2953 list.push_back(element);
2962 for(i=ipix0; i<ipixf; ++
i) {
2964 xi = slopex*(yi-y0) + x0;
2965 jpix = (int)(xi/xsize_)+1;
2966 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2973 list.push_back(element);
2976 for(i=ipix0; i>ipixf; --
i) {
2978 xi = slopex*(yi-y0) + x0;
2979 jpix = (int)(xi/xsize_)+1;
2980 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2987 list.push_back(element);
3001 for(i=1; i<imax; ++
i) {
3003 listIter = list.begin();
3005 while(listIter != list.end()) {
3006 if(listIter->i == i && listIter->btype == 2) {
3007 listIter = list.erase(listIter);
3010 if(listIter->i > i) {
3016 while(listIter != list.end()) {
3017 if(listIter->i == i+1 && listIter->btype == 2) {
3018 listIter = list.erase(listIter);
3021 if(listIter->i > i+1) {
3030 for(j=1; j<jmax; ++
j) {
3032 listIter = list.begin();
3034 while(listIter != list.end()) {
3035 if(listIter->j == j && listIter->btype == 1) {
3036 listIter = list.erase(listIter);
3039 if(listIter->j > j) {
3045 while(listIter != list.end()) {
3046 if(listIter->j == j+1 && listIter->btype == 1) {
3047 listIter = list.erase(listIter);
3050 if(listIter->j > j+1) {
3062 listIter = list.begin();
3063 listEnd = list.end();
3064 for( ;listIter != listEnd; ++listIter) {
3070 if(sf > 0.
f) { qpix = qtotal*ds/sf;}
else {qpix = qtotal;}
3071 template2d[
j][
i] += qpix;
3090 int ilow, ihigh, Ny;
3091 float yratio, cotb, cotalpha0,
arg;
3095 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3096 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3097 if(arg < 0.
f) arg = 0.f;
3102 Ny = thePixelTemp_[index_id_].head.NTy;
3104 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3106 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3117 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3124 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3126 for (i=0; i<Ny-1; ++
i) {
3128 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3131 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3142 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
3143 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
3144 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
3149 mpv = (double)mpvvav_;
3150 sigma = (double)sigmavav_;
3151 kappa = (double)kappavav_;
3168 int ilow, ihigh, Ny;
3169 float yratio, cotb, cotalpha0,
arg;
3173 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3174 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3175 if(arg < 0.
f) arg = 0.f;
3180 Ny = thePixelTemp_[index_id_].head.NTy;
3182 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3184 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3195 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3202 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3204 for (i=0; i<Ny-1; ++
i) {
3206 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3209 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3220 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
3221 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
3222 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
3226 mpv = (double)mpvvav2_;
3227 sigma = (double)sigmavav2_;
3228 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
int qbin(int id, float cotalpha, float cotbeta, float locBz, float qclus, float &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2, float &lorywidth, float &lorxwidth)
float qavg
average cluster charge for this set of track angles (now includes threshold effects) ...
float syone
rms for one pixel y-clusters
float chi2yavgone
average y chi^2 for 1 pixel clusters
int cytemp()
Return central pixel of y template pixels above readout threshold.
float dyone
mean offset/correction for one pixel y-clusters
float sigmavav
"sigma" scale fctor for Vavilov distribution
float fracxtwo
fraction of double pixel sample with xsize = 1
float yavggen[4]
generic algorithm: average y-bias of reconstruction binned in 4 charge bins
float sxmax
average pixel signal for x-projection of cluster
int 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 ...
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
bool simpletemplate2D(float xhitp, float yhitp, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[13+2][21+2])
Make simple 2-D templates from track angles set in interpolate and hit position.
float y
y coordinate of boundary intersection
float dytwo
mean offset/correction for one double-pixel y-clusters
float dxone
mean offset/correction for one pixel x-clusters
float pixmax
maximum charge for individual pixels in cluster
float chi2yavgc2m[4]
1st pass chi2 min search: average y chi^2 in 4 charge bins (merged clusters)
float qmin
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)
float chi2xavgc2m[4]
1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters)
float xflcorr(int binq, float qflx)
float xgsiggen[4]
generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins
float chi2xminc2m[4]
1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters)
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float ytemp[9][21]
templates for y-reconstruction (binned over 1 central pixel)
bool interpolate(int id, float cotalpha, float cotbeta, float locBz)
float yrmsc2m[4]
1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins ...
void ytemp(int fybin, int lybin, float ytemplate[41][21+4])
int cxtemp()
Return central pixel of x-template pixels above readout threshold.
float xpar[2][5]
projected x-pixel uncertainty parameterization
float ygx0[4]
average y0 from Gaussian fit binned in 4 charge bins
float xgx0gen[4]
generic algorithm: average x0 from Gaussian fit binned in 4 charge bins
float symax
average pixel signal for y-projection of cluster
float kappavav2
kappa parameter for Vavilov distribution for 2 merged clusters
float xgsig[4]
average sigma_x from Gaussian fit binned in 4 charge bins
const T & max(const T &a, const T &b)
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
void ysigma2(int fypix, int lypix, float sythr, float ysum[21+4], float ysig2[21+4])
int j
y index of traversed pixel
void incrementIndex(int i)
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
std::vector< float > sVector() const
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
float qavg_spare
spare cluster charge
void xtemp3d(int j, int k, std::vector< float > &xtemplate)
bool pushfile(int filenum)
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
float chi2yminone
minimum of y chi^2 for 1 pixel clusters
float costrk[3]
direction cosines of tracks used to generate this entry
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