73 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
89 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
94 #define LOGERROR(x) LogError(x)
95 #define LOGINFO(x) LogInfo(x)
102 #define LOGERROR(x) std::cout << x << ": "
103 #define LOGINFO(x) std::cout << x << ": "
104 #define ENDL std::endl
120 const char *tempfile;
123 const int code_version={17};
129 std::ostringstream tout;
133 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
134 tout <<
"CalibTracker/SiPixelESProducers/data/template_summary_zp"
135 << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
138 tempfile = (
file.fullPath()).c_str();
140 tout <<
"template_summary_zp" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
142 tempfile = tempf.c_str();
149 if(in_file.is_open()) {
157 for (i=0; (c=in_file.get()) !=
'\n'; ++
i) {
162 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
170 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file, no template load" <<
ENDL;
return false;}
173 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
174 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
176 <<
", 1/2 threshold " << theCurrentTemp.
head.
s50 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", x Lorentz width " << theCurrentTemp.
head.
lorxwidth
179 if(theCurrentTemp.
head.
templ_version < code_version) {
LOGERROR(
"SiPixelTemplate") <<
"code expects version " << code_version <<
", no template load" <<
ENDL;
return false;}
181 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
185 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
193 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
198 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
213 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
218 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
220 for (j=0; j<2; ++
j) {
225 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
229 for (j=0; j<9; ++
j) {
233 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
236 for (j=0; j<2; ++
j) {
241 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
246 for (j=0; j<9; ++
j) {
250 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
254 for (j=0; j<4; ++
j) {
258 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
261 for (j=0; j<4; ++
j) {
266 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
269 for (j=0; j<4; ++
j) {
273 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
276 for (j=0; j<4; ++
j) {
281 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
284 for (j=0; j<4; ++
j) {
288 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
291 for (j=0; j<4; ++
j) {
295 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
298 for (j=0; j<4; ++
j) {
302 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
305 for (j=0; j<4; ++
j) {
309 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
312 for (j=0; j<4; ++
j) {
316 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
322 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
328 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
334 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
336 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
341 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
349 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
356 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
362 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
364 for (j=0; j<2; ++
j) {
369 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
372 for (j=0; j<9; ++
j) {
376 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
379 for (j=0; j<2; ++
j) {
385 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
389 for (j=0; j<9; ++
j) {
393 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
397 for (j=0; j<4; ++
j) {
401 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
404 for (j=0; j<4; ++
j) {
409 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
412 for (j=0; j<4; ++
j) {
416 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
419 for (j=0; j<4; ++
j) {
424 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
427 for (j=0; j<4; ++
j) {
431 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
434 for (j=0; j<4; ++
j) {
438 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
441 for (j=0; j<4; ++
j) {
445 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
448 for (j=0; j<4; ++
j) {
452 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
455 for (j=0; j<4; ++
j) {
459 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
465 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
471 if(in_file.fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
481 thePixelTemp_.push_back(theCurrentTemp);
483 postInit(thePixelTemp_);
490 LOGERROR(
"SiPixelTemplate") <<
"Error opening File" << tempfile <<
ENDL;
498 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
514 const int code_version={16};
530 for (i=0; i<20; ++
i) {
539 LOGINFO(
"SiPixelTemplate") <<
"Loading Pixel Template File - " << theCurrentTemp.
head.
title <<
ENDL;
547 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file, no template load" <<
ENDL;
return false;}
550 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
551 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
553 <<
", 1/2 threshold " << theCurrentTemp.
head.
s50 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", x Lorentz width " << theCurrentTemp.
head.
lorxwidth
556 if(theCurrentTemp.
head.
templ_version < code_version) {
LOGERROR(
"SiPixelTemplate") <<
"code expects version " << code_version <<
", no template load" <<
ENDL;
return false;}
559 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
563 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
571 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
576 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
591 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
597 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 3, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
599 for (j=0; j<2; ++
j) {
604 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 4, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
608 for (j=0; j<9; ++
j) {
612 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 5, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
615 for (j=0; j<2; ++
j) {
620 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
625 for (j=0; j<9; ++
j) {
629 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
633 for (j=0; j<4; ++
j) {
637 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 8, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
640 for (j=0; j<4; ++
j) {
645 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 9, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
648 for (j=0; j<4; ++
j) {
652 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
655 for (j=0; j<4; ++
j) {
660 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
663 for (j=0; j<4; ++
j) {
667 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
670 for (j=0; j<4; ++
j) {
674 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 13, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
677 for (j=0; j<4; ++
j) {
681 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
684 for (j=0; j<4; ++
j) {
688 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14a, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
691 for (j=0; j<4; ++
j) {
695 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
702 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
708 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
714 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
716 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
721 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
729 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
736 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
742 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
744 for (j=0; j<2; ++
j) {
749 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
752 for (j=0; j<9; ++
j) {
756 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
759 for (j=0; j<2; ++
j) {
765 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
769 for (j=0; j<9; ++
j) {
773 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
777 for (j=0; j<4; ++
j) {
781 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
784 for (j=0; j<4; ++
j) {
789 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
792 for (j=0; j<4; ++
j) {
796 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
799 for (j=0; j<4; ++
j) {
804 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
807 for (j=0; j<4; ++
j) {
811 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
814 for (j=0; j<4; ++
j) {
818 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 29, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
821 for (j=0; j<4; ++
j) {
825 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
828 for (j=0; j<4; ++
j) {
832 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30a, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
835 for (j=0; j<4; ++
j) {
839 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 30b, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
846 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 31, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
852 if(db.
fail()) {
LOGERROR(
"SiPixelTemplate") <<
"Error reading file 32, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
860 thePixelTemp_.push_back(theCurrentTemp);
863 postInit(thePixelTemp_);
889 for (
auto & templ : thePixelTemp_) {
890 for (
auto iy=0; iy<templ.head.NTy; ++iy ) templ.cotbetaY[iy]=templ.enty[iy].cotbeta;
891 for (
auto iy=0; iy<templ.head.NTyx; ++iy ) templ.cotbetaX[iy]= templ.entx[iy][0].cotbeta;
892 for (
auto ix=0; ix<templ.head.NTxx; ++ix ) templ.cotalphaX[ix]=templ.entx[0][ix].cotalpha;
913 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx;
914 float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, symax, chi2xavgone, chi2xminone, cotb, cotalpha0, cotbeta0;
917 float chi2xavg[4], chi2xmin[4], chi2xavgc2m[4], chi2xminc2m[4];
922 if(
id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
924 cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ =
true;
926 if(
id != id_current_) {
931 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
933 if(
id == thePixelTemp_[i].head.ID) {
940 qscale_ = thePixelTemp_[index_id_].head.qscale;
944 s50_ = thePixelTemp_[index_id_].head.s50;
948 xsize_ = thePixelTemp_[index_id_].head.xsize;
949 ysize_ = thePixelTemp_[index_id_].head.ysize;
950 zsize_ = thePixelTemp_[index_id_].head.zsize;
957 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
958 if(index_id_ < 0 || index_id_ >= (
int)thePixelTemp_.size()) {
959 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::interpolate can't find needed template ID = " <<
id << std::endl;
962 assert(index_id_ >= 0 && index_id_ < (
int)thePixelTemp_.size());
971 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
972 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
975 if(thePixelTemp_[index_id_].head.Dtype == 0) {
978 if(cotbeta < 0.
f) {flip_y =
true;}
989 Ny = thePixelTemp_[index_id_].head.NTy;
990 Nyx = thePixelTemp_[index_id_].head.NTyx;
991 Nxx = thePixelTemp_[index_id_].head.NTxx;
993 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
994 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
995 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
998 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
1008 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
1016 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
1018 for (i=0; i<Ny-1; ++
i) {
1020 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
1023 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
1027 }
else { success_ =
false; }
1035 qavg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg;
1037 symax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].symax + yratio*thePixelTemp_[index_id_].enty[ihigh].symax;
1039 sxmax = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sxmax + yratio*thePixelTemp_[index_id_].enty[ihigh].sxmax;
1040 dyone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dyone + yratio*thePixelTemp_[index_id_].enty[ihigh].dyone;
1041 if(flip_y) {dyone_ = -dyone_;}
1042 syone_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].syone + yratio*thePixelTemp_[index_id_].enty[ihigh].syone;
1043 dytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].dytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].dytwo;
1044 if(flip_y) {dytwo_ = -dytwo_;}
1045 sytwo_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sytwo + yratio*thePixelTemp_[index_id_].enty[ihigh].sytwo;
1046 qmin_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin;
1048 qmin2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qmin2 + yratio*thePixelTemp_[index_id_].enty[ihigh].qmin2;
1050 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
1051 mpvvav_ *= qcorrect;
1052 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
1053 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
1054 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
1055 mpvvav2_ *= qcorrect;
1056 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
1057 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
1058 clsleny_ = fminf(thePixelTemp_[index_id_].enty[ilow].clsleny, thePixelTemp_[index_id_].enty[ihigh].clsleny);
1059 qavg_avg_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].qavg_avg + yratio*thePixelTemp_[index_id_].enty[ihigh].qavg_avg;
1060 qavg_avg_ *= qcorrect;
1061 for(i=0; i<2 ; ++
i) {
1062 for(j=0; j<5 ; ++
j) {
1065 yparl_[1-
i][
j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][
j];
1066 yparh_[1-
i][
j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][
j];
1068 yparl_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].ypar[
i][
j];
1069 yparh_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].ypar[
i][
j];
1071 xparly0_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].xpar[
i][
j];
1072 xparhy0_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].xpar[
i][
j];
1075 for(i=0; i<4; ++
i) {
1076 yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavg[i];
1077 if(flip_y) {yavg_[
i] = -yavg_[
i];}
1078 yrms_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrms[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrms[i];
1084 chi2yavg_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavg[i];
1085 chi2ymin_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2ymin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2ymin[i];
1086 chi2xavg[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavg[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavg[i];
1087 chi2xmin[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xmin[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xmin[i];
1088 yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yavgc2m[i];
1089 if(flip_y) {yavgc2m_[
i] = -yavgc2m_[
i];}
1090 yrmsc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].yrmsc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].yrmsc2m[i];
1091 chi2yavgc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgc2m[i];
1093 chi2yminc2m_[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminc2m[i];
1095 chi2xavgc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgc2m[i];
1096 chi2xminc2m[
i]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminc2m[i] + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminc2m[i];
1097 for(j=0; j<6 ; ++
j) {
1098 yflparl_[
i][
j] = thePixelTemp_[index_id_].enty[ilow].yflpar[
i][
j];
1099 yflparh_[
i][
j] = thePixelTemp_[index_id_].enty[ihigh].yflpar[
i][
j];
1103 if(flip_y && (j == 0 || j == 2 || j == 4)) {
1104 yflparl_[
i][
j] = - yflparl_[
i][
j];
1105 yflparh_[
i][
j] = - yflparh_[
i][
j];
1112 chi2yavgone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yavgone;
1113 chi2yminone_=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2yminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2yminone;
1114 chi2xavgone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xavgone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xavgone;
1115 chi2xminone=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].chi2xminone + yratio*thePixelTemp_[index_id_].enty[ihigh].chi2xminone;
1122 for(i=0; i<9; ++
i) {
1125 ytemp_[
i][
BYM2] = 0.f;
1126 ytemp_[
i][
BYM1] = 0.f;
1132 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];
1134 ytemp_[
i][j+2]=(1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].ytemp[i][j] + yratio*thePixelTemp_[index_id_].enty[ihigh].ytemp[i][j];
1144 if(abs_cotb_ >= thePixelTemp_[index_id_].entx[Nyx-1][0].cotbeta) {
1149 }
else if(abs_cotb_ >= thePixelTemp_[index_id_].entx[0][0].cotbeta) {
1151 for (i=0; i<Nyx-1; ++
i) {
1153 if( thePixelTemp_[index_id_].entx[i][0].cotbeta <= abs_cotb_ && abs_cotb_ < thePixelTemp_[index_id_].entx[i+1][0].cotbeta) {
1156 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);
1167 if(cotalpha >= thePixelTemp_[index_id_].entx[0][Nxx-1].cotalpha) {
1175 if(cotalpha >= thePixelTemp_[index_id_].entx[0][0].cotalpha) {
1177 for (i=0; i<Nxx-1; ++
i) {
1179 if( thePixelTemp_[index_id_].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index_id_].entx[0][i+1].cotalpha) {
1182 xxratio = (cotalpha - thePixelTemp_[index_id_].entx[0][
i].cotalpha)/(thePixelTemp_[index_id_].entx[0][i+1].cotalpha - thePixelTemp_[index_id_].entx[0][i].cotalpha);
1186 }
else { success_ =
false; }
1198 sxparmax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].sxmax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].sxmax;
1200 if(thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax != 0.
f) {sxmax_=sxmax_/thePixelTemp_[index_id_].entx[imaxx][imidy].sxmax*sxmax;}
1201 symax_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[imaxx][ilow].symax + xxratio*thePixelTemp_[index_id_].entx[imaxx][ihigh].symax;
1202 if(thePixelTemp_[index_id_].entx[imaxx][imidy].symax != 0.
f) {symax_=symax_/thePixelTemp_[index_id_].entx[imaxx][imidy].symax*symax;}
1203 dxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxone;
1204 sxone_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxone + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxone;
1205 dxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].dxtwo;
1206 sxtwo_ = (1.f - xxratio)*thePixelTemp_[index_id_].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index_id_].entx[0][ihigh].sxtwo;
1207 clslenx_ = fminf(thePixelTemp_[index_id_].entx[0][ilow].clslenx, thePixelTemp_[index_id_].entx[0][ihigh].clslenx);
1208 for(i=0; i<2 ; ++
i) {
1209 for(j=0; j<5 ; ++
j) {
1210 xpar0_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
1211 xparl_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
1212 xparh_[
i][
j] = thePixelTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
1218 pixmax_=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iylow][ihigh].pixmax)
1219 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].pixmax);
1221 for(i=0; i<4; ++
i) {
1222 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])
1223 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavg[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavg[
i]);
1225 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])
1226 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrms[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrms[
i]);
1234 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])
1235 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xavgc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xavgc2m[
i]);
1237 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])
1238 +yxratio*((1.
f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].xrmsc2m[
i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].xrmsc2m[
i]);
1254 chi2xavg_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavg[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavg[i]);
1255 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];}
1257 chi2xmin_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xmin[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xmin[i]);
1258 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];}
1260 chi2xavgc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgc2m[i]);
1261 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];}
1263 chi2xminc2m_[
i]=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminc2m[i] + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminc2m[i]);
1264 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];}
1266 for(j=0; j<6 ; ++
j) {
1267 xflparll_[
i][
j] = thePixelTemp_[index_id_].entx[iylow][ilow].xflpar[
i][
j];
1268 xflparlh_[
i][
j] = thePixelTemp_[index_id_].entx[iylow][ihigh].xflpar[
i][
j];
1269 xflparhl_[
i][
j] = thePixelTemp_[index_id_].entx[iyhigh][ilow].xflpar[
i][
j];
1270 xflparhh_[
i][
j] = thePixelTemp_[index_id_].entx[iyhigh][ihigh].xflpar[
i][
j];
1276 chi2xavgone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xavgone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgone);
1277 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone != 0.
f) {chi2xavgone_=chi2xavgone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone*chi2xavgone;}
1279 chi2xminone_=((1.f - xxratio)*thePixelTemp_[index_id_].entx[iyhigh][ilow].chi2xminone + xxratio*thePixelTemp_[index_id_].entx[iyhigh][ihigh].chi2xminone);
1280 if(thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone != 0.
f) {chi2xminone_=chi2xminone_/thePixelTemp_[index_id_].entx[iyhigh][imidy].chi2xminone*chi2xminone;}
1290 cotbeta0 = thePixelTemp_[index_id_].entx[iyhigh][0].cotbeta;
1291 qxtempcor=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta0*cotbeta0+cotalpha*cotalpha));
1293 for(i=0; i<9; ++
i) {
1296 xtemp_[
i][
BXM2] = 0.f;
1297 xtemp_[
i][
BXM1] = 0.f;
1302 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]);
1306 lorywidth_ = thePixelTemp_[index_id_].head.lorywidth;
1307 if(locBz > 0.
f) {lorywidth_ = -lorywidth_;}
1308 lorxwidth_ = thePixelTemp_[index_id_].head.lorxwidth;
1332 if(cotbeta < 0.
f) {locBz = -locBz;}
1355 float sigi, sigi2, sigi3, sigi4, symax, qscale;
1359 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1360 if(fypix < 2 || fypix >=
BYM2) {
1361 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with fypix = " << fypix << std::endl;
1364 assert(fypix > 1 && fypix <
BYM2);
1366 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1367 if(lypix < fypix || lypix >=
BYM2) {
1368 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with lypix/fypix = " << lypix <<
"/" << fypix << std::endl;
1371 assert(lypix >= fypix && lypix <
BYM2);
1377 if(symax_ > syparmax_) {symax = syparmax_;}
1381 for(i=fypix-2; i<=lypix+2; ++
i) {
1382 if(i < fypix || i > lypix) {
1386 ysig2[
i] = s50_*s50_;
1388 if(ysum[i] < symax) {
1393 qscale = ysum[
i]/symax;
1395 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1397 ysig2[
i] = (1.f-yratio_)*
1398 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1400 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1402 ysig2[
i] = (1.f-yratio_)*
1403 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1405 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1408 if(ysum[i] > sythr) {ysig2[
i] = 1.e8;}
1409 if(ysig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1410 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1432 float sigi, sigi2, sigi3, sigi4, symax, qscale, err2;
1436 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1437 if(index < 2 || index >=
BYM2) {
1438 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ysigma2 called with index = " << index << std::endl;
1441 assert(index > 1 && index <
BYM2);
1447 if(symax_ > syparmax_) {symax = syparmax_;}
1451 if(qpixel < symax) {
1456 qscale = qpixel/symax;
1458 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1460 err2 = (1.f-yratio_)*
1461 (yparl_[0][0]+yparl_[0][1]*sigi+yparl_[0][2]*sigi2+yparl_[0][3]*sigi3+yparl_[0][4]*sigi4)
1463 (yparh_[0][0]+yparh_[0][1]*sigi+yparh_[0][2]*sigi2+yparh_[0][3]*sigi3+yparh_[0][4]*sigi4);
1465 err2 = (1.f-yratio_)*
1466 (yparl_[1][0]+yparl_[1][1]*sigi+yparl_[1][2]*sigi2+yparl_[1][3]*sigi3+yparl_[1][4]*sigi4)
1468 (yparh_[1][0]+yparh_[1][1]*sigi+yparh_[1][2]*sigi2+yparh_[1][3]*sigi3+yparh_[1][4]*sigi4);
1471 if(ysig2 <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg y-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1472 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1498 float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale;
1502 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1503 if(fxpix < 2 || fxpix >=
BXM2) {
1504 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with fxpix = " << fxpix << std::endl;
1507 assert(fxpix > 1 && fxpix <
BXM2);
1509 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1510 if(lxpix < fxpix || lxpix >=
BXM2) {
1511 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xsigma2 called with lxpix/fxpix = " << lxpix <<
"/" << fxpix << std::endl;
1514 assert(lxpix >= fxpix && lxpix <
BXM2);
1520 if(sxmax_ > sxparmax_) {sxmax = sxparmax_;}
1524 for(i=fxpix-2; i<=lxpix+2; ++
i) {
1525 if(i < fxpix || i > lxpix) {
1529 xsig2[
i] = s50_*s50_;
1531 if(xsum[i] < sxmax) {
1536 qscale = xsum[
i]/sxmax;
1538 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1543 yint = (1.f-yratio_)*
1544 (xparly0_[0][0]+xparly0_[0][1]*sigi+xparly0_[0][2]*sigi2+xparly0_[0][3]*sigi3+xparly0_[0][4]*sigi4)
1546 (xparhy0_[0][0]+xparhy0_[0][1]*sigi+xparhy0_[0][2]*sigi2+xparhy0_[0][3]*sigi3+xparhy0_[0][4]*sigi4);
1548 yint = (1.f-yratio_)*
1549 (xparly0_[1][0]+xparly0_[1][1]*sigi+xparly0_[1][2]*sigi2+xparly0_[1][3]*sigi3+xparly0_[1][4]*sigi4)
1551 (xparhy0_[1][0]+xparhy0_[1][1]*sigi+xparhy0_[1][2]*sigi2+xparhy0_[1][3]*sigi3+xparhy0_[1][4]*sigi4);
1557 xsig2[
i] = (1.f-xxratio_)*
1558 (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4)
1560 (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4);
1562 xsig2[
i] = (1.f-xxratio_)*
1563 (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4)
1565 (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4);
1571 x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4;
1573 x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4;
1578 if(x0 != 0.
f) {xsig2[
i] = xsig2[
i]/x0 * yint;}
1580 if(xsum[i] > sxthr) {xsig2[
i] = 1.e8;}
1581 if(xsig2[i] <= 0.
f) {
LOGERROR(
"SiPixelTemplate") <<
"neg x-error-squared, id = " << id_current_ <<
", index = " << index_id_ <<
1582 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
ENDL;}
1606 float qfl, qfl2, qfl3, qfl4, qfl5, dy;
1610 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1611 if(binq < 0 || binq > 3) {
1612 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with binq = " << binq << std::endl;
1615 assert(binq >= 0 && binq < 4);
1617 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1618 if(fabs((
double)qfly) > 1.) {
1619 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::yflcorr called with qfly = " << qfly << std::endl;
1622 assert(fabs((
double)qfly) <= 1.);
1629 if(qfl < -0.9
f) {qfl = -0.9f;}
1630 if(qfl > 0.9
f) {qfl = 0.9f;}
1634 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1635 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)
1636 + yratio_*(yflparh_[binq][0]+yflparh_[binq][1]*qfl+yflparh_[binq][2]*qfl2+yflparh_[binq][3]*qfl3+yflparh_[binq][4]*qfl4+yflparh_[binq][5]*qfl5);
1658 float qfl, qfl2, qfl3, qfl4, qfl5, dx;
1662 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1663 if(binq < 0 || binq > 3) {
1664 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with binq = " << binq << std::endl;
1667 assert(binq >= 0 && binq < 4);
1669 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1670 if(fabs((
double)qflx) > 1.) {
1671 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xflcorr called with qflx = " << qflx << std::endl;
1674 assert(fabs((
double)qflx) <= 1.);
1681 if(qfl < -0.9
f) {qfl = -0.9f;}
1682 if(qfl > 0.9
f) {qfl = 0.9f;}
1686 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1687 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)
1688 + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5))
1689 + 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)
1690 + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5));
1714 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1715 if(fybin < 0 || fybin > 40) {
1716 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with fybin = " << fybin << std::endl;
1719 assert(fybin >= 0 && fybin < 41);
1721 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1722 if(lybin < 0 || lybin > 40) {
1723 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp called with lybin = " << lybin << std::endl;
1726 assert(lybin >= 0 && lybin < 41);
1731 for(i=0; i<9; ++
i) {
1733 ytemplate[i+16][
j]=ytemp_[
i][
j];
1736 for(i=0; i<8; ++
i) {
1737 ytemplate[i+8][
BYM1] = 0.f;
1738 for(j=0; j<
BYM1; ++
j) {
1739 ytemplate[i+8][
j]=ytemp_[
i][j+1];
1742 for(i=1; i<9; ++
i) {
1743 ytemplate[i+24][0] = 0.f;
1744 for(j=0; j<
BYM1; ++
j) {
1745 ytemplate[i+24][j+1]=ytemp_[
i][
j];
1752 for(i=0; i<8; ++
i) {
1753 ytemplate[
i][
BYM2] = 0.f;
1754 ytemplate[
i][
BYM1] = 0.f;
1755 for(j=0; j<
BYM2; ++
j) {
1756 ytemplate[
i][
j]=ytemp_[
i][j+2];
1761 for(i=1; i<9; ++
i) {
1762 ytemplate[i+32][0] = 0.f;
1763 ytemplate[i+32][1] = 0.f;
1764 for(j=0; j<
BYM2; ++
j) {
1765 ytemplate[i+32][j+2]=ytemp_[
i][
j];
1792 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1793 if(fxbin < 0 || fxbin > 40) {
1794 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with fxbin = " << fxbin << std::endl;
1797 assert(fxbin >= 0 && fxbin < 41);
1799 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1800 if(lxbin < 0 || lxbin > 40) {
1801 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp called with lxbin = " << lxbin << std::endl;
1804 assert(lxbin >= 0 && lxbin < 41);
1809 for(i=0; i<9; ++
i) {
1811 xtemplate[i+16][
j]=xtemp_[
i][
j];
1814 for(i=0; i<8; ++
i) {
1815 xtemplate[i+8][
BXM1] = 0.f;
1816 for(j=0; j<
BXM1; ++
j) {
1817 xtemplate[i+8][
j]=xtemp_[
i][j+1];
1820 for(i=1; i<9; ++
i) {
1821 xtemplate[i+24][0] = 0.f;
1822 for(j=0; j<
BXM1; ++
j) {
1823 xtemplate[i+24][j+1]=xtemp_[
i][
j];
1830 for(i=0; i<8; ++
i) {
1831 xtemplate[
i][
BXM2] = 0.f;
1832 xtemplate[
i][
BXM1] = 0.f;
1833 for(j=0; j<
BXM2; ++
j) {
1834 xtemplate[
i][
j]=xtemp_[
i][j+2];
1839 for(i=1; i<9; ++
i) {
1840 xtemplate[i+32][0] = 0.f;
1841 xtemplate[i+32][1] = 0.f;
1842 for(j=0; j<
BXM2; ++
j) {
1843 xtemplate[i+32][j+2]=xtemp_[
i][
j];
1868 float qedge = 2.*s50_;
1872 if(ytemp_[4][j] > sigmax) {
1873 sigmax = ytemp_[4][
j];
1877 if(sigmax < qedge) {qedge = s50_;}
1878 if(sigmax < qedge || jmax<1 || jmax>
BYM2) {
return -1;}
1884 for(j=jmax+1; j<
BYM1; ++
j) {
1885 if(ytemp_[4][j] < qedge)
break;
1891 for(j=jmax-1; j>0; --
j) {
1892 if(ytemp_[4][j] < qedge)
break;
1896 return (jbeg+jend)/2;
1917 float qedge = 2.*s50_;
1921 if(xtemp_[4][j] > sigmax) {
1922 sigmax = xtemp_[4][
j];
1926 if(sigmax < qedge) {qedge = s50_;}
1927 if(sigmax < qedge || jmax<1 || jmax>
BXM2) {
return -1;}
1933 for(j=jmax+1; j<
BXM1; ++
j) {
1934 if(xtemp_[4][j] < qedge)
break;
1940 for(j=jmax-1; j>0; --
j) {
1941 if(xtemp_[4][j] < qedge)
break;
1945 return (jbeg+jend)/2;
1963 int ioff0, ioffp, ioffm;
1967 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1968 if(nypix < 1 || nypix >=
BYM3) {
1969 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::ytemp3d called with nypix = " << nypix << std::endl;
1972 assert(nypix > 0 && nypix <
BYM3);
1977 float diff = fabsf(nypix - clsleny_)/2. + 1.f;
1978 int nshift = (int)diff;
1979 if((diff - nshift) > 0.5f) {++nshift;}
1983 nybins_ = 9 + 16*nshift;
1987 temp2dy_.resize(boost::extents[nybins_][
BYSIZE]);
1993 for(i=0; i<9; ++
i) {
1995 temp2dy_[i+ioff0][
j]=ytemp_[
i][
j];
2001 for(k=1; k<=nshift; ++
k) {
2003 for(i=0; i<8; ++
i) {
2004 for(j=0; j<
k; ++
j) {
2005 temp2dy_[i+ioffm][
BYM1-
j] = 0.f;
2007 for(j=0; j<BYSIZE-
k; ++
j) {
2008 temp2dy_[i+ioffm][
j]=ytemp_[
i][j+
k];
2012 for(i=1; i<9; ++
i) {
2013 for(j=0; j<
k; ++
j) {
2014 temp2dy_[i+ioffp][
j] = 0.f;
2016 for(j=0; j<BYSIZE-
k; ++
j) {
2017 temp2dy_[i+ioffp][j+
k]=ytemp_[
i][
j];
2037 if(i >= 0 && i < nybins_ && j <= i) {
2039 ytemplate[
k]=temp2dy_[
i][
k]+temp2dy_[
j][
k];
2064 int ioff0, ioffp, ioffm;
2068 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2069 if(nxpix < 1 || nxpix >=
BXM3) {
2070 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl;
2073 assert(nxpix > 0 && nxpix <
BXM3);
2078 float diff = fabsf(nxpix - clslenx_)/2. + 1.f;
2079 int nshift = (int)diff;
2080 if((diff - nshift) > 0.5f) {++nshift;}
2084 nxbins_ = 9 + 16*nshift;
2088 temp2dx_.resize(boost::extents[nxbins_][
BXSIZE]);
2094 for(i=0; i<9; ++
i) {
2096 temp2dx_[i+ioff0][
j]=xtemp_[
i][
j];
2102 for(k=1; k<=nshift; ++
k) {
2104 for(i=0; i<8; ++
i) {
2105 for(j=0; j<
k; ++
j) {
2106 temp2dx_[i+ioffm][
BXM1-
j] = 0.f;
2108 for(j=0; j<BXSIZE-
k; ++
j) {
2109 temp2dx_[i+ioffm][
j]=xtemp_[
i][j+
k];
2113 for(i=1; i<9; ++
i) {
2114 for(j=0; j<
k; ++
j) {
2115 temp2dx_[i+ioffp][
j] = 0.f;
2117 for(j=0; j<BXSIZE-
k; ++
j) {
2118 temp2dx_[i+ioffp][j+
k]=xtemp_[
i][
j];
2140 if(i >= 0 && i < nxbins_ && j <= i) {
2142 xtemplate[
k]=temp2dx_[
i][
k]+temp2dx_[
j][
k];
2180 int SiPixelTemplate::qbin(
int id,
float cotalpha,
float cotbeta,
float locBz,
float qclus,
float& pixmx,
float& sigmay,
float& deltay,
float& sigmax,
float& deltax,
2181 float& sy1,
float& dy1,
float& sy2,
float& dy2,
float& sx1,
float& dx1,
float& sx2,
float& dx2)
2190 for(
int i=0; i<(int)thePixelTemp_.size(); ++
i) {
2191 if(
id == thePixelTemp_[i].head.ID) {
2197 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2198 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2199 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin can't find needed template ID = " <<
id << std::endl;
2202 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2208 auto const & templ = thePixelTemp_[
index];
2216 auto cotalpha0 = thePixelTemp_[
index].enty[0].cotalpha;
2217 auto qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
2221 float cotb;
bool flip_y;
2222 if(thePixelTemp_[index].head.Dtype == 0) {
2225 if(cotbeta < 0.
f) {flip_y =
true;}
2238 auto qscale = thePixelTemp_[
index].head.qscale;
2248 auto Ny = thePixelTemp_[
index].head.NTy;
2249 auto Nyx = thePixelTemp_[
index].head.NTyx;
2250 auto Nxx = thePixelTemp_[
index].head.NTxx;
2252 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2253 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2254 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2257 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2267 auto j = std::lower_bound(templ.cotbetaY,templ.cotbetaY+Ny,cotb);
2268 if (
j==templ.cotbetaY+Ny) { --
j; yratio = 1.f; }
2269 else if (
j==templ.cotbetaY) { ++
j; yratio = 0.f;}
2270 else { yratio = (cotb - (*(
j-1)) )/( (*
j) - (*(
j-1)) ) ; }
2272 ihigh =
j-templ.cotbetaY;
2280 dy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dyone + yratio*thePixelTemp_[index].enty[ihigh].dyone;
2281 if(flip_y) {dy1 = -dy1;}
2282 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2283 dy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].dytwo + yratio*thePixelTemp_[index].enty[ihigh].dytwo;
2284 if(flip_y) {dy2 = -dy2;}
2285 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2287 auto qavg = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qavg + yratio*thePixelTemp_[index].enty[ihigh].qavg;
2289 auto qmin = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin + yratio*thePixelTemp_[index].enty[ihigh].qmin;
2291 auto qmin2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].qmin2 + yratio*thePixelTemp_[index].enty[ihigh].qmin2;
2295 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2296 if(qavg <= 0.
f || qmin <= 0.
f) {
2297 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::qbin, qavg or qmin <= 0,"
2298 <<
" Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
2301 assert(qavg > 0.
f && qmin > 0.
f);
2306 auto qtotal = qscale*qclus;
2310 auto fq = qtotal/qavg;
2326 auto yavggen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yavggen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yavggen[binq];
2327 if(flip_y) {yavggen = -yavggen;}
2328 auto yrmsgen =(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrmsgen[binq] + yratio*thePixelTemp_[index].enty[ihigh].yrmsgen[binq];
2339 auto j = std::lower_bound(templ.cotbetaX,templ.cotbetaX+Nyx,acotb);
2340 if (
j==templ.cotbetaX+Nyx) { --
j; yxratio = 1.f; }
2341 else if (
j==templ.cotbetaX) { ++
j; yxratio = 0.f;}
2342 else { yxratio = (acotb - (*(
j-1)) )/( (*
j) - (*(
j-1)) ) ; }
2344 iyhigh =
j-templ.cotbetaX;
2354 auto j = std::lower_bound(templ.cotalphaX,templ.cotalphaX+Nxx,cotalpha);
2355 if (
j==templ.cotalphaX+Nxx) { --
j; xxratio = 1.f; }
2356 else if (
j==templ.cotalphaX) { ++
j; xxratio = 0.f;}
2357 else { xxratio = (cotalpha - (*(
j-1)) )/( (*
j) - (*(
j-1)) ) ; }
2359 ihigh =
j-templ.cotalphaX;
2365 dx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxone + xxratio*thePixelTemp_[index].entx[0][ihigh].dxone;
2366 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2367 dx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].dxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].dxtwo;
2368 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2372 pixmx=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].pixmax)
2373 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].pixmax + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].pixmax);
2375 auto xavggen = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xavggen[binq] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xavggen[binq])
2376 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xavggen[binq] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xavggen[binq]);
2378 auto xrmsgen = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrmsgen[binq] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrmsgen[binq])
2379 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrmsgen[binq] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrmsgen[binq]);
2385 sigmay = yrmsgen; deltay = yavggen;
2387 sigmax = xrmsgen; deltax = xavggen;
2391 if(qtotal < 0.95
f*qmin) {binq = 5;}
else {
if(qtotal < 0.95
f*qmin2) {binq = 4;}}
2445 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz;
2447 if(cotbeta < 0.
f) {locBz = -locBz;}
2448 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2449 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2465 float pixmx, sigmay, deltay, sigmax, deltax, sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2, locBz;
2466 const float cotalpha = 0.f;
2468 if(cotbeta < 0.
f) {locBz = -locBz;}
2469 return SiPixelTemplate::qbin(
id, cotalpha, cotbeta, locBz, qclus, pixmx, sigmay, deltay, sigmax, deltax,
2470 sy1, dy1, sy2, dy2, sx1, dx1, sx2, dx2);
2489 void SiPixelTemplate::temperrors(
int id,
float cotalpha,
float cotbeta,
int qBin,
float& sigmay,
float& sigmax,
float& sy1,
float& sy2,
float& sx1,
float& sx2)
2496 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2497 float yratio, yxratio, xxratio;
2506 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2508 if(
id == thePixelTemp_[i].head.ID) {
2515 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2516 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2517 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2520 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2524 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2525 if(qBin < 0 || qBin > 5) {
2526 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors called with illegal qBin = " << qBin << std::endl;
2529 assert(qBin >= 0 && qBin < 6);
2534 if(qBin > 3) {qBin = 3;}
2539 acotb = fabs((
double)cotbeta);
2560 Ny = thePixelTemp_[
index].head.NTy;
2561 Nyx = thePixelTemp_[
index].head.NTyx;
2562 Nxx = thePixelTemp_[
index].head.NTxx;
2564 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2565 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2566 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2569 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2577 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2584 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2586 for (i=0; i<Ny-1; ++
i) {
2588 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2591 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2602 sy1 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].syone + yratio*thePixelTemp_[index].enty[ihigh].syone;
2603 sy2 = (1.f - yratio)*thePixelTemp_[index].enty[ilow].sytwo + yratio*thePixelTemp_[index].enty[ihigh].sytwo;
2604 yrms=(1.f - yratio)*thePixelTemp_[index].enty[ilow].yrms[qBin] + yratio*thePixelTemp_[index].enty[ihigh].yrms[qBin];
2612 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2617 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2619 for (i=0; i<Nyx-1; ++
i) {
2621 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2624 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2635 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2642 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2644 for (i=0; i<Nxx-1; ++
i) {
2646 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2649 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2658 sx1 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxone + xxratio*thePixelTemp_[index].entx[0][ihigh].sxone;
2659 sx2 = (1.f - xxratio)*thePixelTemp_[index].entx[0][ilow].sxtwo + xxratio*thePixelTemp_[index].entx[0][ihigh].sxtwo;
2661 xrms=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].xrms[qBin] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].xrms[qBin])
2662 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].xrms[qBin] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].xrms[qBin]);
2688 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)
2695 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx,
index;
2696 float yratio, yxratio, xxratio;
2704 for(i=0; i<(int)thePixelTemp_.size(); ++
i) {
2706 if(
id == thePixelTemp_[i].head.ID) {
2714 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2715 if(index < 0 || index >= (
int)thePixelTemp_.size()) {
2716 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::temperrors can't find needed template ID = " <<
id << std::endl;
2719 assert(index >= 0 && index < (
int)thePixelTemp_.size());
2726 acotb = fabs((
double)cotbeta);
2748 Ny = thePixelTemp_[
index].head.NTy;
2749 Nyx = thePixelTemp_[
index].head.NTyx;
2750 Nxx = thePixelTemp_[
index].head.NTxx;
2752 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
2753 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
2754 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
2757 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
2765 if(cotb >= thePixelTemp_[index].enty[Ny-1].cotbeta) {
2772 if(cotb >= thePixelTemp_[index].enty[0].cotbeta) {
2774 for (i=0; i<Ny-1; ++
i) {
2776 if( thePixelTemp_[index].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index].enty[i+1].cotbeta) {
2779 yratio = (cotb - thePixelTemp_[
index].enty[
i].cotbeta)/(thePixelTemp_[index].enty[i+1].cotbeta - thePixelTemp_[index].enty[i].cotbeta);
2789 ny1_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracyone + yratio*thePixelTemp_[index].enty[ihigh].fracyone;
2790 ny2_frac = (1.f - yratio)*thePixelTemp_[index].enty[ilow].fracytwo + yratio*thePixelTemp_[index].enty[ihigh].fracytwo;
2797 if(acotb >= thePixelTemp_[index].entx[Nyx-1][0].cotbeta) {
2802 }
else if(acotb >= thePixelTemp_[index].entx[0][0].cotbeta) {
2804 for (i=0; i<Nyx-1; ++
i) {
2806 if( thePixelTemp_[index].entx[i][0].cotbeta <= acotb && acotb < thePixelTemp_[index].entx[i+1][0].cotbeta) {
2809 yxratio = (acotb - thePixelTemp_[
index].entx[
i][0].cotbeta)/(thePixelTemp_[index].entx[i+1][0].cotbeta - thePixelTemp_[index].entx[i][0].cotbeta);
2820 if(cotalpha >= thePixelTemp_[index].entx[0][Nxx-1].cotalpha) {
2827 if(cotalpha >= thePixelTemp_[index].entx[0][0].cotalpha) {
2829 for (i=0; i<Nxx-1; ++
i) {
2831 if( thePixelTemp_[index].entx[0][i].cotalpha <= cotalpha && cotalpha < thePixelTemp_[index].entx[0][i+1].cotalpha) {
2834 xxratio = (cotalpha - thePixelTemp_[
index].entx[0][
i].cotalpha)/(thePixelTemp_[index].entx[0][i+1].cotalpha - thePixelTemp_[index].entx[0][i].cotalpha);
2843 for(i=0; i<3; ++
i) {
2844 qfrac[
i]=(1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].qbfrac[
i])
2845 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].qbfrac[
i] + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].qbfrac[
i]);
2847 nx1_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxone)
2848 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxone + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxone);
2849 nx2_frac = (1.f - yxratio)*((1.
f - xxratio)*thePixelTemp_[
index].entx[iylow][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iylow][ihigh].fracxtwo)
2850 +yxratio*((1.
f - xxratio)*thePixelTemp_[
index].entx[iyhigh][ilow].fracxtwo + xxratio*thePixelTemp_[
index].entx[iyhigh][ihigh].fracxtwo);
2854 qbin_frac[0] = qfrac[0];
2855 qbin_frac[1] = qbin_frac[0] + qfrac[1];
2856 qbin_frac[2] = qbin_frac[1] + qfrac[2];
2877 float x0, y0, xf, yf, xi, yi, sf, si, s0, qpix, slopey, slopex, ds;
2878 int i,
j, jpix0, ipix0, jpixf, ipixf, jpix, ipix, nx, ny, anx,
any, jmax, imax;
2881 std::list<SimplePixel>
list;
2882 std::list<SimplePixel>::iterator listIter, listEnd;
2886 x0 = xhit - 0.5*zsize_*cota_current_;
2887 y0 = yhit - 0.5*zsize_*cotb_current_;
2889 jpix0 = floor(x0/xsize_)+1;
2890 ipix0 = floor(y0/ysize_)+1;
2892 if(jpix0 < 0 || jpix0 >
BXM3) {
return false;}
2893 if(ipix0 < 0 || ipix0 >
BYM3) {
return false;}
2895 xf = xhit + 0.5*zsize_*cota_current_ + lorxwidth_;
2896 yf = yhit + 0.5*zsize_*cotb_current_ + lorywidth_;
2898 jpixf = floor(xf/xsize_)+1;
2899 ipixf = floor(yf/ysize_)+1;
2901 if(jpixf < 0 || jpixf > BXM3) {
return false;}
2902 if(ipixf < 0 || ipixf > BYM3) {
return false;}
2906 sf =
std::sqrt((xf-x0)*(xf-x0) + (yf-y0)*(yf-y0));
2907 if((xf-x0) != 0.
f) {slopey = (yf-y0)/(xf-x0);}
else { slopey = 1.e10;}
2908 if((yf-y0) != 0.f) {slopex = (xf-x0)/(yf-y0);}
else { slopex = 1.e10;}
2921 list.push_back(element);
2929 for(j=jpix0; j<jpixf; ++
j) {
2931 yi = slopey*(xi-x0) + y0;
2932 ipix = (int)(yi/ysize_)+1;
2933 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2940 list.push_back(element);
2943 for(j=jpix0; j>jpixf; --
j) {
2945 yi = slopey*(xi-x0) + y0;
2946 ipix = (int)(yi/ysize_)+1;
2947 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2954 list.push_back(element);
2963 for(i=ipix0; i<ipixf; ++
i) {
2965 xi = slopex*(yi-y0) + x0;
2966 jpix = (int)(xi/xsize_)+1;
2967 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2974 list.push_back(element);
2977 for(i=ipix0; i>ipixf; --
i) {
2979 xi = slopex*(yi-y0) + x0;
2980 jpix = (int)(xi/xsize_)+1;
2981 si =
std::sqrt((xi-x0)*(xi-x0) + (yi-y0)*(yi-y0));
2988 list.push_back(element);
3002 for(i=1; i<imax; ++
i) {
3004 listIter = list.begin();
3006 while(listIter != list.end()) {
3007 if(listIter->i == i && listIter->btype == 2) {
3008 listIter = list.erase(listIter);
3011 if(listIter->i > i) {
3017 while(listIter != list.end()) {
3018 if(listIter->i == i+1 && listIter->btype == 2) {
3019 listIter = list.erase(listIter);
3022 if(listIter->i > i+1) {
3031 for(j=1; j<jmax; ++
j) {
3033 listIter = list.begin();
3035 while(listIter != list.end()) {
3036 if(listIter->j == j && listIter->btype == 1) {
3037 listIter = list.erase(listIter);
3040 if(listIter->j > j) {
3046 while(listIter != list.end()) {
3047 if(listIter->j == j+1 && listIter->btype == 1) {
3048 listIter = list.erase(listIter);
3051 if(listIter->j > j+1) {
3063 listIter = list.begin();
3064 listEnd = list.end();
3065 for( ;listIter != listEnd; ++listIter) {
3071 if(sf > 0.
f) { qpix = qtotal*ds/sf;}
else {qpix = qtotal;}
3072 template2d[
j][
i] += qpix;
3091 int ilow, ihigh, Ny;
3092 float yratio, cotb, cotalpha0,
arg;
3096 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3097 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3098 if(arg < 0.
f) arg = 0.f;
3103 Ny = thePixelTemp_[index_id_].head.NTy;
3105 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3107 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3118 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3125 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3127 for (i=0; i<Ny-1; ++
i) {
3129 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3132 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3143 mpvvav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav;
3144 sigmavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav;
3145 kappavav_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav;
3150 mpv = (double)mpvvav_;
3151 sigma = (double)sigmavav_;
3152 kappa = (double)kappavav_;
3169 int ilow, ihigh, Ny;
3170 float yratio, cotb, cotalpha0,
arg;
3174 cotalpha0 = thePixelTemp_[index_id_].enty[0].cotalpha;
3175 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
3176 if(arg < 0.
f) arg = 0.f;
3181 Ny = thePixelTemp_[index_id_].head.NTy;
3183 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
3185 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
3196 if(cotb >= thePixelTemp_[index_id_].enty[Ny-1].cotbeta) {
3203 if(cotb >= thePixelTemp_[index_id_].enty[0].cotbeta) {
3205 for (i=0; i<Ny-1; ++
i) {
3207 if( thePixelTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < thePixelTemp_[index_id_].enty[i+1].cotbeta) {
3210 yratio = (cotb - thePixelTemp_[index_id_].enty[
i].cotbeta)/(thePixelTemp_[index_id_].enty[i+1].cotbeta - thePixelTemp_[index_id_].enty[i].cotbeta);
3221 mpvvav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].mpvvav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].mpvvav2;
3222 sigmavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].sigmavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].sigmavav2;
3223 kappavav2_ = (1.f - yratio)*thePixelTemp_[index_id_].enty[ilow].kappavav2 + yratio*thePixelTemp_[index_id_].enty[ihigh].kappavav2;
3227 mpv = (double)mpvvav2_;
3228 sigma = (double)sigmavav2_;
3229 kappa = (double)kappavav2_;
float qavg_avg
average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) ...
int runnum
< Basic template entry corresponding to a single set of track angles
float xflpar[4][6]
Aqfl-parameterized x-correction in 4 charge bins.
float xrms[4]
average x-rms of reconstruction binned in 4 charge bins
void vavilov2_pars(double &mpv, double &sigma, double &kappa)
float clslenx
cluster x-length in pixels at signal height sxmax/2
float qavg
average cluster charge for this set of track angles (now includes threshold effects) ...
float syone
rms for one pixel y-clusters
float chi2yavgone
average y chi^2 for 1 pixel clusters
int cytemp()
Return central pixel of y template pixels above readout threshold.
float dyone
mean offset/correction for one pixel y-clusters
float sigmavav
"sigma" scale fctor for Vavilov distribution
float fracxtwo
fraction of double pixel sample with xsize = 1
float yavggen[4]
generic algorithm: average y-bias of reconstruction binned in 4 charge bins
float sxmax
average pixel signal for x-projection of cluster
int qbin(int id, float cotalpha, float cotbeta, float locBz, float qclus, float &pixmx, float &sigmay, float &deltay, float &sigmax, float &deltax, float &sy1, float &dy1, float &sy2, float &dy2, float &sx1, float &dx1, float &sx2, float &dx2)
int btype
type of boundary (0=end, 1 = x-boundary, 2 = y-boundary)
void xsigma2(int fxpix, int lxpix, float sxthr, float xsum[13+4], float xsig2[13+4])
float chi2yminc2m[4]
1st pass chi2 min search: minimum of y chi^2 in 4 charge bins (merged clusters)
float xavgc2m[4]
1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins ...
bool any(const std::vector< T > &v, const T &what)
float chi2xavgone
average x chi^2 for 1 pixel clusters
float fracytwo
fraction of double pixel sample with ysize = 1
float yrms[4]
average y-rms of reconstruction binned in 4 charge bins
float mpvvav2
most probable charge in Vavilov distribution for 2 merged clusters (not actually for larger kappa) ...
float ygx0gen[4]
generic algorithm: average y0 from Gaussian fit binned in 4 charge bins
float xavg[4]
average x-bias of reconstruction binned in 4 charge bins
static bool pushfile(int filenum, std::vector< SiPixelTemplateStore > &thePixelTemp_)
bool simpletemplate2D(float xhitp, float yhitp, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[13+2][21+2])
Make simple 2-D templates from track angles set in interpolate and hit position.
float y
y coordinate of boundary intersection
float dytwo
mean offset/correction for one double-pixel y-clusters
float dxone
mean offset/correction for one pixel x-clusters
float pixmax
maximum charge for individual pixels in cluster
float chi2yavgc2m[4]
1st pass chi2 min search: average y chi^2 in 4 charge bins (merged clusters)
float qmin
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)
float chi2xavgc2m[4]
1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters)
float xflcorr(int binq, float qflx)
float xgsiggen[4]
generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins
float chi2xminc2m[4]
1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters)
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float ytemp[9][21]
templates for y-reconstruction (binned over 1 central pixel)
bool interpolate(int id, float cotalpha, float cotbeta, float locBz)
float yrmsc2m[4]
1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins ...
void ytemp(int fybin, int lybin, float ytemplate[41][21+4])
int cxtemp()
Return central pixel of x-template pixels above readout threshold.
float xpar[2][5]
projected x-pixel uncertainty parameterization
float ygx0[4]
average y0 from Gaussian fit binned in 4 charge bins
float xgx0gen[4]
generic algorithm: average x0 from Gaussian fit binned in 4 charge bins
float symax
average pixel signal for y-projection of cluster
float kappavav2
kappa parameter for Vavilov distribution for 2 merged clusters
float xgsig[4]
average sigma_x from Gaussian fit binned in 4 charge bins
float cotbeta
cot(beta) is proportional to cluster length in y and is basis of interpolation
float beta
beta track angle (defined in CMS CMS IN 2004/014)
void vavilov_pars(double &mpv, double &sigma, double &kappa)
float yflcorr(int binq, float qfly)
float s
distance from track entry
float xrmsc2m[4]
1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins ...
void ytemp3d(int j, int k, std::vector< float > &ytemplate)
void temperrors(int id, float cotalpha, float cotbeta, int qBin, float &sigmay, float &sigmax, float &sy1, float &sy2, float &sx1, float &sx2)
float xgx0[4]
average x0 from Gaussian fit binned in 4 charge bins
Abs< T >::type abs(const T &t)
void ysigma2(int fypix, int lypix, float sythr, float ysum[21+4], float ysig2[21+4])
int j
y index of traversed pixel
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)
void xtemp(int fxbin, int lxbin, float xtemplate[41][13+4])
void qbin_dist(int id, float cotalpha, float cotbeta, float qbin_frac[4], float &ny1_frac, float &ny2_frac, float &nx1_frac, float &nx2_frac)
float qbfrac[3]
fraction of sample in qbin = 0-2 (>=3 is the complement)
void ytemp3d_int(int nypix, int &nybins)
float fracyone
fraction of sample with ysize = 1
float qmin2
tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits)
float yavg[4]
average y-bias of reconstruction binned in 4 charge bins
void xtemp3d_int(int nxpix, int &nxbins)
float chi2ymin[4]
minimum of y chi^2 in 4 charge bins
float yavgc2m[4]
1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins ...
float x
x coordinate of boundary intersection
float dxtwo
mean offset/correction for one double-pixel x-clusters
int i
x index of traversed pixel
float yflpar[4][6]
Aqfl-parameterized y-correction in 4 charge bins.
float sxone
rms for one pixel x-clusters
float chi2xmin[4]
minimum of x chi^2 in 4 charge bins
static const G4double kappa
float chi2yminone
minimum of y chi^2 for 1 pixel clusters
float costrk[3]
direction cosines of tracks used to generate this entry
static void postInit(std::vector< SiPixelTemplateStore > &thePixelTemp_)
SiPixelTemplateEntry entx[5][29]
29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5...
float ygsig[4]
average sigma_y from Gaussian fit binned in 4 charge bins
SiPixelTemplateEntry enty[60]
60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fpix] ...
float sigmavav2
"sigma" scale fctor for Vavilov distribution for 2 merged clusters
float sytwo
rms for one double-pixel y-clusters
for(const auto &isodef:isoDefs)
float xrmsgen[4]
generic algorithm: average x-rms of reconstruction binned in 4 charge bins
float chi2xavg[4]
average x chi^2 in 4 charge bins
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
float kappavav
kappa parameter for Vavilov distribution
float xavggen[4]
generic algorithm: average x-bias of reconstruction binned in 4 charge bins
float yrmsgen[4]
generic algorithm: average y-rms of reconstruction binned in 4 charge bins
float clsleny
cluster y-length in pixels at signal height symax/2