16 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
32 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
36 #define LOGERROR(x) LogError(x)
37 #define LOGINFO(x) LogInfo(x)
43 #define LOGERROR(x) std::cout << x << ": "
44 #define LOGINFO(x) std::cout << x << ": "
45 #define ENDL std::endl
64 const int code_version={18};
70 std::ostringstream tout;
74 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
75 tout <<
"CalibTracker/SiPixelESProducers/data/stemplate_summary_p" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
78 tempfile = (
file.fullPath()).c_str();
80 tout <<
"stemplate_summary_p" << std::setw(4) << std::setfill(
'0') << std::right << filenum <<
".out" << std::ends;
82 tempfile = tempf.c_str();
89 if(in_file.is_open()) {
97 for (i=0; (c=in_file.get()) !=
'\n'; ++
i) {
102 LOGINFO(
"SiStripTemplate") <<
"Loading Strip Template File - " << theCurrentTemp.
head.
title <<
ENDL;
110 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file, no template load" <<
ENDL;
return false;}
113 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
114 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
116 <<
", 1/2 threshold " << theCurrentTemp.
head.
s50 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", x Lorentz width " << theCurrentTemp.
head.
lorxwidth
119 if(theCurrentTemp.
head.
templ_version < code_version) {
LOGERROR(
"SiStripTemplate") <<
"code expects version " << code_version <<
", no template load" <<
ENDL;
return false;}
121 #ifdef SI_STRIP_TEMPLATE_USE_BOOST
125 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
133 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
138 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
152 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
153 for (j=0; j<2; ++
j) {
158 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
163 for (j=0; j<9; ++
j) {
167 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
171 for (j=0; j<4; ++
j) {
175 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
178 for (j=0; j<4; ++
j) {
183 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
186 for (j=0; j<4; ++
j) {
190 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
193 for (j=0; j<4; ++
j) {
197 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
200 for (j=0; j<4; ++
j) {
204 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
207 for (j=0; j<4; ++
j) {
211 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 14c, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
218 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
224 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
230 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
232 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
237 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
245 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
251 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
253 for (j=0; j<2; ++
j) {
258 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
263 for (j=0; j<9; ++
j) {
267 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
271 for (j=0; j<4; ++
j) {
275 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
278 for (j=0; j<4; ++
j) {
283 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
286 for (j=0; j<4; ++
j) {
290 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
293 for (j=0; j<4; ++
j) {
297 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
300 for (j=0; j<4; ++
j) {
304 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
307 for (j=0; j<4; ++
j) {
311 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
318 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
324 if(in_file.fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
335 theStripTemp_.push_back(theCurrentTemp);
343 LOGERROR(
"SiStripTemplate") <<
"Error opening File " << tempfile <<
ENDL;
351 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
366 const int code_version={17};
381 for (i=0; i<20; ++
i) {
390 LOGINFO(
"SiStripTemplate") <<
"Loading Strip Template File - " << theCurrentTemp.
head.
title <<
ENDL;
398 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file, no template load" <<
ENDL;
return false;}
401 <<
", NTy = " << theCurrentTemp.
head.
NTy <<
", NTyx = " << theCurrentTemp.
head.
NTyx<<
", NTxx = " << theCurrentTemp.
head.
NTxx <<
", Dtype = " << theCurrentTemp.
head.
Dtype
402 <<
", Bias voltage " << theCurrentTemp.
head.
Vbias <<
", temperature "
404 <<
", 1/2 threshold " << theCurrentTemp.
head.
s50 <<
", y Lorentz Width " << theCurrentTemp.
head.
lorywidth <<
", x Lorentz width " << theCurrentTemp.
head.
lorxwidth
407 if(theCurrentTemp.
head.
templ_version < code_version) {
LOGERROR(
"SiStripTemplate") <<
"code expects version " << code_version <<
", no template load" <<
ENDL;
return false;}
410 #ifdef SI_PIXEL_TEMPLATE_USE_BOOST
414 theCurrentTemp.
enty.resize(boost::extents[theCurrentTemp.
head.
NTy]);
422 for (i=0; i < theCurrentTemp.
head.
NTy; ++
i) {
427 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 1, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
441 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 2, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
443 for (j=0; j<2; ++
j) {
448 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 6, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
453 for (j=0; j<9; ++
j) {
457 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 7, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
461 for (j=0; j<4; ++
j) {
465 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 10, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
468 for (j=0; j<4; ++
j) {
473 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 11, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
476 for (j=0; j<4; ++
j) {
480 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 12, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
483 for (j=0; j<4; ++
j) {
487 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 14, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
490 for (j=0; j<4; ++
j) {
494 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 14b, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
497 for (j=0; j<4; ++
j) {
501 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 14c, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
508 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 15, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
514 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 16, no template load, run # " << theCurrentTemp.
enty[
i].
runnum <<
ENDL;
return false;}
520 for (k=0; k < theCurrentTemp.
head.
NTyx; ++
k) {
522 for (i=0; i < theCurrentTemp.
head.
NTxx; ++
i) {
527 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 17, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
535 theCurrentTemp.
entx[
k][
i].
beta =
static_cast<float>(atan2((
double)theCurrentTemp.
entx[k][i].
costrk[2], (
double)theCurrentTemp.
entx[k][i].
costrk[1]));
541 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 18, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
543 for (j=0; j<2; ++
j) {
548 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 19, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
553 for (j=0; j<9; ++
j) {
557 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 20, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
561 for (j=0; j<4; ++
j) {
565 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 21, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
568 for (j=0; j<4; ++
j) {
573 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 22, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
576 for (j=0; j<4; ++
j) {
580 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 23, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
583 for (j=0; j<4; ++
j) {
587 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 24, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
590 for (j=0; j<4; ++
j) {
594 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 25, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
597 for (j=0; j<4; ++
j) {
601 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 26, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
608 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 27, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
614 if(db.
fail()) {
LOGERROR(
"SiStripTemplate") <<
"Error reading file 28, no template load, run # " << theCurrentTemp.
entx[
k][
i].
runnum <<
ENDL;
return false;}
624 theStripTemp_.push_back(theCurrentTemp);
647 int ilow, ihigh, iylow, iyhigh, Ny, Nxx, Nyx, imidy, imaxx;
648 float yratio, yxratio, xxratio, sxmax, qcorrect, qxtempcor, chi2xavgone, chi2xminone, cota, cotb, cotalpha0, cotbeta0;
651 std::vector <float> chi2xavg(4), chi2xmin(4), chi2xavgc2m(4), chi2xminc2m(4);
656 if(
id != id_current_ || cotalpha != cota_current_ || cotbeta != cotb_current_) {
658 cota_current_ = cotalpha; cotb_current_ = cotbeta; success_ =
true;
660 if(
id != id_current_) {
665 for(i=0; i<(int)theStripTemp_.size(); ++
i) {
667 if(
id == theStripTemp_[i].head.ID) {
674 qscale_ = theStripTemp_[index_id_].head.qscale;
678 s50_ = theStripTemp_[index_id_].head.s50;
682 xsize_ = theStripTemp_[index_id_].head.xsize;
683 ysize_ = theStripTemp_[index_id_].head.ysize;
684 zsize_ = theStripTemp_[index_id_].head.zsize;
691 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
692 if(index_id_ < 0 || index_id_ >= (
int)theStripTemp_.size()) {
693 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::interpolate can't find needed template ID = " <<
id << std::endl;
696 assert(index_id_ >= 0 && index_id_ < (
int)theStripTemp_.size());
706 cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha;
707 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
715 Ny = theStripTemp_[index_id_].head.NTy;
716 Nyx = theStripTemp_[index_id_].head.NTyx;
717 Nxx = theStripTemp_[index_id_].head.NTxx;
719 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
720 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
721 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
724 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
734 if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) {
742 if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) {
744 for (i=0; i<Ny-1; ++
i) {
746 if( theStripTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < theStripTemp_[index_id_].enty[i+1].cotbeta) {
749 yratio = (cotb - theStripTemp_[index_id_].enty[
i].cotbeta)/(theStripTemp_[index_id_].enty[i+1].cotbeta - theStripTemp_[index_id_].enty[i].cotbeta);
753 }
else { success_ =
false; }
761 qavg_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].qavg + yratio*theStripTemp_[index_id_].enty[ihigh].qavg;
763 sxmax = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].sxmax + yratio*theStripTemp_[index_id_].enty[ihigh].sxmax;
765 qmin_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].qmin + yratio*theStripTemp_[index_id_].enty[ihigh].qmin;
767 qmin2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].qmin2 + yratio*theStripTemp_[index_id_].enty[ihigh].qmin2;
769 mpvvav_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].mpvvav + yratio*theStripTemp_[index_id_].enty[ihigh].mpvvav;
771 sigmavav_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].sigmavav + yratio*theStripTemp_[index_id_].enty[ihigh].sigmavav;
772 kappavav_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].kappavav + yratio*theStripTemp_[index_id_].enty[ihigh].kappavav;
773 mpvvav2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].mpvvav2 + yratio*theStripTemp_[index_id_].enty[ihigh].mpvvav2;
774 mpvvav2_ *= qcorrect;
775 sigmavav2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].sigmavav2 + yratio*theStripTemp_[index_id_].enty[ihigh].sigmavav2;
776 kappavav2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].kappavav2 + yratio*theStripTemp_[index_id_].enty[ihigh].kappavav2;
777 qavg_avg_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].qavg_avg + yratio*theStripTemp_[index_id_].enty[ihigh].qavg_avg;
778 qavg_avg_ *= qcorrect;
779 for(i=0; i<2 ; ++
i) {
780 for(j=0; j<5 ; ++
j) {
783 xparly0_[1-
i][
j] = theStripTemp_[index_id_].enty[ilow].xpar[
i][
j];
784 xparhy0_[1-
i][
j] = theStripTemp_[index_id_].enty[ihigh].xpar[
i][
j];
786 xparly0_[
i][
j] = theStripTemp_[index_id_].enty[ilow].xpar[
i][
j];
787 xparhy0_[
i][
j] = theStripTemp_[index_id_].enty[ihigh].xpar[
i][
j];
792 chi2xavg[
i]=(1.f - yratio)*theStripTemp_[index_id_].enty[ilow].chi2xavg[i] + yratio*theStripTemp_[index_id_].enty[ihigh].chi2xavg[i];
793 chi2xmin[
i]=(1.f - yratio)*theStripTemp_[index_id_].enty[ilow].chi2xmin[i] + yratio*theStripTemp_[index_id_].enty[ihigh].chi2xmin[i];
794 chi2xavgc2m[
i]=(1.f - yratio)*theStripTemp_[index_id_].enty[ilow].chi2xavgc2m[i] + yratio*theStripTemp_[index_id_].enty[ihigh].chi2xavgc2m[i];
795 chi2xminc2m[
i]=(1.f - yratio)*theStripTemp_[index_id_].enty[ilow].chi2xminc2m[i] + yratio*theStripTemp_[index_id_].enty[ihigh].chi2xminc2m[i];
800 chi2xavgone=(1.f - yratio)*theStripTemp_[index_id_].enty[ilow].chi2xavgone + yratio*theStripTemp_[index_id_].enty[ihigh].chi2xavgone;
801 chi2xminone=(1.f - yratio)*theStripTemp_[index_id_].enty[ilow].chi2xminone + yratio*theStripTemp_[index_id_].enty[ihigh].chi2xminone;
812 if(abs_cotb_ >= theStripTemp_[index_id_].entx[Nyx-1][0].cotbeta) {
817 }
else if(abs_cotb_ >= theStripTemp_[index_id_].entx[0][0].cotbeta) {
819 for (i=0; i<Nyx-1; ++
i) {
821 if( theStripTemp_[index_id_].entx[i][0].cotbeta <= abs_cotb_ && abs_cotb_ < theStripTemp_[index_id_].entx[i+1][0].cotbeta) {
824 yxratio = (abs_cotb_ - theStripTemp_[index_id_].entx[
i][0].cotbeta)/(theStripTemp_[index_id_].entx[i+1][0].cotbeta - theStripTemp_[index_id_].entx[i][0].cotbeta);
834 if(flip_x) {cota = -cotalpha;}
else {cota = cotalpha;}
836 if(cota >= theStripTemp_[index_id_].entx[0][Nxx-1].cotalpha) {
844 if(cota >= theStripTemp_[index_id_].entx[0][0].cotalpha) {
846 for (i=0; i<Nxx-1; ++
i) {
848 if( theStripTemp_[index_id_].entx[0][i].cotalpha <= cota && cota < theStripTemp_[index_id_].entx[0][i+1].cotalpha) {
851 xxratio = (cota - theStripTemp_[index_id_].entx[0][
i].cotalpha)/(theStripTemp_[index_id_].entx[0][i+1].cotalpha - theStripTemp_[index_id_].entx[0][i].cotalpha);
855 }
else { success_ =
false; }
867 sxparmax_ = (1.f - xxratio)*theStripTemp_[index_id_].entx[imaxx][ilow].sxmax + xxratio*theStripTemp_[index_id_].entx[imaxx][ihigh].sxmax;
869 if(theStripTemp_[index_id_].entx[imaxx][imidy].sxmax != 0.
f) {sxmax_=sxmax_/theStripTemp_[index_id_].entx[imaxx][imidy].sxmax*sxmax;}
870 dxone_ = (1.f - xxratio)*theStripTemp_[index_id_].entx[0][ilow].dxone + xxratio*theStripTemp_[index_id_].entx[0][ihigh].dxone;
871 if(flip_x) {dxone_ = -dxone_;}
872 sxone_ = (1.f - xxratio)*theStripTemp_[index_id_].entx[0][ilow].sxone + xxratio*theStripTemp_[index_id_].entx[0][ihigh].sxone;
873 clslenx_ = fminf(theStripTemp_[index_id_].entx[0][ilow].clslenx, theStripTemp_[index_id_].entx[0][ihigh].clslenx);
874 for(i=0; i<2 ; ++
i) {
875 for(j=0; j<5 ; ++
j) {
877 xpar0_[1-
i][
j] = theStripTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
878 xparl_[1-
i][
j] = theStripTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
879 xparh_[1-
i][
j] = theStripTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
881 xpar0_[
i][
j] = theStripTemp_[index_id_].entx[imaxx][imidy].xpar[
i][
j];
882 xparl_[
i][
j] = theStripTemp_[index_id_].entx[imaxx][ilow].xpar[
i][
j];
883 xparh_[
i][
j] = theStripTemp_[index_id_].entx[imaxx][ihigh].xpar[
i][
j];
890 sxmax_=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].sxmax + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].sxmax)
891 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].sxmax + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].sxmax);
894 xavg_[
i]=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].xavg[
i] + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].xavg[
i])
895 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xavg[
i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xavg[
i]);
896 if(flip_x) {xavg_[
i] = -xavg_[
i];}
898 xrms_[
i]=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].xrms[
i] + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].xrms[
i])
899 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xrms[
i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xrms[
i]);
907 xavgc2m_[
i]=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].xavgc2m[
i] + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].xavgc2m[
i])
908 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xavgc2m[
i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xavgc2m[
i]);
909 if(flip_x) {xavgc2m_[
i] = -xavgc2m_[
i];}
911 xrmsc2m_[
i]=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].xrmsc2m[
i] + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].xrmsc2m[
i])
912 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xrmsc2m[
i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xrmsc2m[
i]);
914 xavgbcn_[
i]=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].xavgbcn[
i] + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].xavgbcn[
i])
915 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xavgbcn[
i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xavgbcn[
i]);
916 if(flip_x) {xavgbcn_[
i] = -xavgbcn_[
i];}
918 xrmsbcn_[
i]=(1.f - yxratio)*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iylow][ilow].xrmsbcn[
i] + xxratio*theStripTemp_[index_id_].entx[iylow][ihigh].xrmsbcn[
i])
919 +yxratio*((1.
f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xrmsbcn[
i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xrmsbcn[
i]);
935 chi2xavg_[
i]=((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].chi2xavg[i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].chi2xavg[i]);
936 if(theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xavg[i] != 0.
f) {chi2xavg_[
i]=chi2xavg_[
i]/theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xavg[
i]*chi2xavg[
i];}
938 chi2xmin_[
i]=((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].chi2xmin[i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].chi2xmin[i]);
939 if(theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xmin[i] != 0.
f) {chi2xmin_[
i]=chi2xmin_[
i]/theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xmin[
i]*chi2xmin[
i];}
941 chi2xavgc2m_[
i]=((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].chi2xavgc2m[i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgc2m[i]);
942 if(theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xavgc2m[i] != 0.
f) {chi2xavgc2m_[
i]=chi2xavgc2m_[
i]/theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xavgc2m[
i]*chi2xavgc2m[
i];}
944 chi2xminc2m_[
i]=((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].chi2xminc2m[i] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].chi2xminc2m[i]);
945 if(theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xminc2m[i] != 0.
f) {chi2xminc2m_[
i]=chi2xminc2m_[
i]/theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xminc2m[
i]*chi2xminc2m[
i];}
947 for(j=0; j<6 ; ++
j) {
948 xflparll_[
i][
j] = theStripTemp_[index_id_].entx[iylow][ilow].xflpar[
i][
j];
949 xflparlh_[
i][
j] = theStripTemp_[index_id_].entx[iylow][ihigh].xflpar[
i][
j];
950 xflparhl_[
i][
j] = theStripTemp_[index_id_].entx[iyhigh][ilow].xflpar[
i][
j];
951 xflparhh_[
i][
j] = theStripTemp_[index_id_].entx[iyhigh][ihigh].xflpar[
i][
j];
954 if(flip_x && (j == 0 || j == 2 || j == 4)) {
955 xflparll_[
i][
j] = -xflparll_[
i][
j];
956 xflparlh_[
i][
j] = -xflparlh_[
i][
j];
957 xflparhl_[
i][
j] = -xflparhl_[
i][
j];
958 xflparhh_[
i][
j] = -xflparhh_[
i][
j];
965 chi2xavgone_=((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].chi2xavgone + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].chi2xavgone);
966 if(theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone != 0.
f) {chi2xavgone_=chi2xavgone_/theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xavgone*chi2xavgone;}
968 chi2xminone_=((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].chi2xminone + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].chi2xminone);
969 if(theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xminone != 0.
f) {chi2xminone_=chi2xminone_/theStripTemp_[index_id_].entx[iyhigh][imidy].chi2xminone*chi2xminone;}
979 cotbeta0 = theStripTemp_[index_id_].entx[iyhigh][0].cotbeta;
980 qxtempcor=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta0*cotbeta0+cotalpha*cotalpha));
991 xtemp_[8-
i][
BSXM3-
j]=qxtempcor*((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xtemp[i][j] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xtemp[i][j]);
993 xtemp_[
i][j+2]=qxtempcor*((1.f - xxratio)*theStripTemp_[index_id_].entx[iyhigh][ilow].xtemp[i][j] + xxratio*theStripTemp_[index_id_].entx[iyhigh][ihigh].xtemp[i][j]);
998 lorxwidth_ = theStripTemp_[index_id_].head.lorxwidth;
999 if(locBy > 0.
f) {lorxwidth_ = -lorxwidth_;}
1024 float sigi, sigi2, sigi3, sigi4, yint, sxmax, x0, qscale;
1025 float sigiy, sigiy2, sigiy3, sigiy4;
1029 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1030 if(fxpix < 2 || fxpix >=
BSXM2) {
1031 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::xsigma2 called with fxpix = " << fxpix << std::endl;
1036 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1037 if(lxpix < fxpix || lxpix >=
BSXM2) {
1038 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::xsigma2 called with lxpix/fxpix = " << lxpix <<
"/" << fxpix << std::endl;
1047 if(sxmax_ > sxparmax_) {sxmax = sxparmax_;}
1051 for(i=fxpix-2; i<=lxpix+2; ++
i) {
1052 if(i < fxpix || i > lxpix) {
1056 xsig2[
i] = s50_*s50_;
1058 if(xsum[i] < sxmax) {
1063 qscale = xsum[
i]/sxmax;
1065 sigi2 = sigi*sigi; sigi3 = sigi2*sigi; sigi4 = sigi3*sigi;
1067 if(xsum[i] < syparmax_) {
1072 sigiy2 = sigiy*sigiy; sigiy3 = sigiy2*sigiy; sigiy4 = sigiy3*sigiy;
1077 yint = (1.f-yratio_)*
1078 (xparly0_[0][0]+xparly0_[0][1]*sigiy+xparly0_[0][2]*sigiy2+xparly0_[0][3]*sigiy3+xparly0_[0][4]*sigiy4)
1080 (xparhy0_[0][0]+xparhy0_[0][1]*sigiy+xparhy0_[0][2]*sigiy2+xparhy0_[0][3]*sigiy3+xparhy0_[0][4]*sigiy4);
1082 yint = (1.f-yratio_)*
1083 (xparly0_[1][0]+xparly0_[1][1]*sigiy+xparly0_[1][2]*sigiy2+xparly0_[1][3]*sigiy3+xparly0_[1][4]*sigiy4)
1085 (xparhy0_[1][0]+xparhy0_[1][1]*sigiy+xparhy0_[1][2]*sigiy2+xparhy0_[1][3]*sigiy3+xparhy0_[1][4]*sigiy4);
1091 xsig2[
i] = (1.f-xxratio_)*
1092 (xparl_[0][0]+xparl_[0][1]*sigi+xparl_[0][2]*sigi2+xparl_[0][3]*sigi3+xparl_[0][4]*sigi4)
1094 (xparh_[0][0]+xparh_[0][1]*sigi+xparh_[0][2]*sigi2+xparh_[0][3]*sigi3+xparh_[0][4]*sigi4);
1096 xsig2[
i] = (1.f-xxratio_)*
1097 (xparl_[1][0]+xparl_[1][1]*sigi+xparl_[1][2]*sigi2+xparl_[1][3]*sigi3+xparl_[1][4]*sigi4)
1099 (xparh_[1][0]+xparh_[1][1]*sigi+xparh_[1][2]*sigi2+xparh_[1][3]*sigi3+xparh_[1][4]*sigi4);
1105 x0 = xpar0_[0][0]+xpar0_[0][1]*sigi+xpar0_[0][2]*sigi2+xpar0_[0][3]*sigi3+xpar0_[0][4]*sigi4;
1107 x0 = xpar0_[1][0]+xpar0_[1][1]*sigi+xpar0_[1][2]*sigi2+xpar0_[1][3]*sigi3+xpar0_[1][4]*sigi4;
1112 if(x0 != 0.
f) {xsig2[
i] = xsig2[
i]/x0 * yint;}
1114 if(xsum[i] > sxthr) {xsig2[
i] = 1.e8f;}
1115 if(xsig2[i] <= 0.
f) {
LOGERROR(
"SiStripTemplate") <<
"neg x-error-squared = " << xsig2[
i] <<
", id = " << id_current_ <<
", index = " << index_id_ <<
1116 ", cot(alpha) = " << cota_current_ <<
", cot(beta) = " << cotb_current_ <<
", sigi = " << sigi <<
", sxparmax = " << sxparmax_ <<
", sxmax = " << sxmax_ <<
ENDL;}
1138 float qfl, qfl2, qfl3, qfl4, qfl5, dx;
1142 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1143 if(binq < 0 || binq > 3) {
1144 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::xflcorr called with binq = " << binq << std::endl;
1147 assert(binq >= 0 && binq < 4);
1149 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1150 if(fabs((
double)qflx) > 1.) {
1151 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::xflcorr called with qflx = " << qflx << std::endl;
1154 assert(fabs((
double)qflx) <= 1.);
1161 if(qfl < -0.9
f) {qfl = -0.9f;}
1162 if(qfl > 0.9
f) {qfl = 0.9f;}
1166 qfl2 = qfl*qfl; qfl3 = qfl2*qfl; qfl4 = qfl3*qfl; qfl5 = qfl4*qfl;
1167 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)
1168 + xxratio_*(xflparlh_[binq][0]+xflparlh_[binq][1]*qfl+xflparlh_[binq][2]*qfl2+xflparlh_[binq][3]*qfl3+xflparlh_[binq][4]*qfl4+xflparlh_[binq][5]*qfl5))
1169 + 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)
1170 + xxratio_*(xflparhh_[binq][0]+xflparhh_[binq][1]*qfl+xflparhh_[binq][2]*qfl2+xflparhh_[binq][3]*qfl3+xflparhh_[binq][4]*qfl4+xflparhh_[binq][5]*qfl5));
1193 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1194 if(fxbin < 0 || fxbin > 40) {
1195 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::xtemp called with fxbin = " << fxbin << std::endl;
1198 assert(fxbin >= 0 && fxbin < 41);
1200 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1201 if(lxbin < 0 || lxbin > 40) {
1202 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::xtemp called with lxbin = " << lxbin << std::endl;
1205 assert(lxbin >= 0 && lxbin < 41);
1210 for(i=0; i<9; ++
i) {
1212 xtemplate[i+16][
j]=xtemp_[
i][
j];
1215 for(i=0; i<8; ++
i) {
1216 xtemplate[i+8][
BSXM1] = 0.f;
1218 xtemplate[i+8][
j]=xtemp_[
i][j+1];
1221 for(i=1; i<9; ++
i) {
1222 xtemplate[i+24][0] = 0.f;
1224 xtemplate[i+24][j+1]=xtemp_[
i][
j];
1231 for(i=0; i<8; ++
i) {
1232 xtemplate[
i][
BSXM2] = 0.f;
1233 xtemplate[
i][
BSXM1] = 0.f;
1235 xtemplate[
i][
j]=xtemp_[
i][j+2];
1240 for(i=1; i<9; ++
i) {
1241 xtemplate[i+32][0] = 0.f;
1242 xtemplate[i+32][1] = 0.f;
1244 xtemplate[i+32][j+2]=xtemp_[
i][
j];
1269 float xpix = xhit/xsize_ + 0.5f;
1270 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1272 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::2xtemp called with xhit = " << xhit << std::endl;
1280 int cpix = (int)xpix;
1285 float xbin = 8.*(xpix-(float)cpix);
1286 int cbin = (int)xbin;
1288 float xfrac = xbin-(float)cbin;
1294 for(i=0; i<sizex; ++
i) {
1296 if(j < 0 || j > sizex-1) {cluster[
i] = 0.f;}
else {
1297 cluster[
i]=(1.f-xfrac)*xtemp_[cbin][j]+xfrac*xtemp_[cbin+1][j];
1298 if(cluster[i] < s50_) cluster[
i] = 0.f;
1303 cluster[
i] /= qscale_;
1329 if(xtemp_[4][j] > sigmax) {
1330 sigmax = xtemp_[4][
j];
1334 if(sigmax < 2.*s50_ || jmax<1 || jmax>
BSXM2) {
return -1;}
1340 for(j=jmax+1; j<
BSXM1; ++
j) {
1341 if(xtemp_[4][j] < 2.*s50_)
break;
1347 for(j=jmax-1; j>0; --
j) {
1348 if(xtemp_[4][j] < 2.*s50_)
break;
1352 return (jbeg+jend)/2;
1369 int ioff0, ioffp, ioffm;
1373 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1374 if(nxpix < 1 || nxpix >=
BSXM3) {
1375 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplate::xtemp3d called with nxpix = " << nxpix << std::endl;
1383 float diff = fabsf(nxpix - clslenx_)/2. + 1.f;
1384 int nshift = (int)diff;
1385 if((diff - nshift) > 0.5f) {++nshift;}
1389 nxbins_ = 9 + 16*nshift;
1393 temp2dx_.resize(boost::extents[nxbins_][
BSXSIZE]);
1399 for(i=0; i<9; ++
i) {
1401 temp2dx_[i+ioff0][
j]=xtemp_[
i][
j];
1407 for(k=1; k<=nshift; ++
k) {
1409 for(i=0; i<8; ++
i) {
1410 for(j=0; j<
k; ++
j) {
1411 temp2dx_[i+ioffm][
BSXM1-
j] = 0.f;
1413 for(j=0; j<BSXSIZE-
k; ++
j) {
1414 temp2dx_[i+ioffm][
j]=xtemp_[
i][j+
k];
1418 for(i=1; i<9; ++
i) {
1419 for(j=0; j<
k; ++
j) {
1420 temp2dx_[i+ioffp][
j] = 0.f;
1422 for(j=0; j<BSXSIZE-
k; ++
j) {
1423 temp2dx_[i+ioffp][j+
k]=xtemp_[
i][
j];
1445 if(i >= 0 && i < nxbins_ && j <= i) {
1447 xtemplate[
k]=temp2dx_[
i][
k]+temp2dx_[
j][
k];
1476 int ilow, ihigh, Ny, Nxx, Nyx,
index;
1478 float acotb, qscale, qavg, qmin, qmin2, fq, qtotal, qcorrect, cotalpha0;
1484 for(i=0; i<(int)theStripTemp_.size(); ++
i) {
1486 if(
id == theStripTemp_[i].head.ID) {
1493 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1494 if(index < 0 || index >= (
int)theStripTemp_.size()) {
1495 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::qbin can't find needed template ID = " <<
id << std::endl;
1498 assert(index >= 0 && index < (
int)theStripTemp_.size());
1505 acotb = fabs((
double)cotbeta);
1511 cotalpha0 = theStripTemp_[
index].enty[0].cotalpha;
1512 qcorrect=
std::sqrt((1.
f+cotbeta*cotbeta+cotalpha*cotalpha)/(1.
f+cotbeta*cotbeta+cotalpha0*cotalpha0));
1516 qscale = theStripTemp_[
index].head.qscale;
1518 Ny = theStripTemp_[
index].head.NTy;
1519 Nyx = theStripTemp_[
index].head.NTyx;
1520 Nxx = theStripTemp_[
index].head.NTxx;
1522 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1523 if(Ny < 2 || Nyx < 1 || Nxx < 2) {
1524 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny/Nyx/Nxx = " << Ny <<
"/" << Nyx <<
"/" << Nxx << std::endl;
1527 assert(Ny > 1 && Nyx > 0 && Nxx > 1);
1535 if(acotb >= theStripTemp_[index].enty[Ny-1].cotbeta) {
1542 if(acotb >= theStripTemp_[index].enty[0].cotbeta) {
1544 for (i=0; i<Ny-1; ++
i) {
1546 if( theStripTemp_[index].enty[i].cotbeta <= acotb && acotb < theStripTemp_[index].enty[i+1].cotbeta) {
1549 yratio = (acotb - theStripTemp_[
index].enty[
i].cotbeta)/(theStripTemp_[index].enty[i+1].cotbeta - theStripTemp_[index].enty[i].cotbeta);
1560 qavg = (1.f - yratio)*theStripTemp_[index].enty[ilow].qavg + yratio*theStripTemp_[index].enty[ihigh].qavg;
1562 qmin = (1.f - yratio)*theStripTemp_[index].enty[ilow].qmin + yratio*theStripTemp_[index].enty[ihigh].qmin;
1564 qmin2 = (1.f - yratio)*theStripTemp_[index].enty[ilow].qmin2 + yratio*theStripTemp_[index].enty[ihigh].qmin2;
1568 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1569 if(qavg <= 0.
f || qmin <= 0.
f) {
1570 throw cms::Exception(
"DataCorrupt") <<
"SiStripTemplate::qbin, qavg or qmin <= 0,"
1571 <<
" Probably someone called the generic pixel reconstruction with an illegal trajectory state" << std::endl;
1579 qtotal = qscale*qclus;
1600 if(qtotal < 0.95
f*qmin) {binq = 5;}
else {
if(qtotal < 0.95
f*qmin2) {binq = 4;}}
1618 int ilow, ihigh, Ny;
1619 float yratio, cotb, cotalpha0,
arg;
1623 cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha;
1624 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
1625 if(arg < 0.
f) arg = 0.f;
1630 Ny = theStripTemp_[index_id_].head.NTy;
1632 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1634 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
1645 if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) {
1652 if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) {
1654 for (i=0; i<Ny-1; ++
i) {
1656 if( theStripTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < theStripTemp_[index_id_].enty[i+1].cotbeta) {
1659 yratio = (cotb - theStripTemp_[index_id_].enty[
i].cotbeta)/(theStripTemp_[index_id_].enty[i+1].cotbeta - theStripTemp_[index_id_].enty[i].cotbeta);
1670 mpvvav_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].mpvvav + yratio*theStripTemp_[index_id_].enty[ihigh].mpvvav;
1671 sigmavav_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].sigmavav + yratio*theStripTemp_[index_id_].enty[ihigh].sigmavav;
1672 kappavav_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].kappavav + yratio*theStripTemp_[index_id_].enty[ihigh].kappavav;
1677 mpv = (double)mpvvav_;
1678 sigma = (double)sigmavav_;
1679 kappa = (double)kappavav_;
1696 int ilow, ihigh, Ny;
1697 float yratio, cotb, cotalpha0,
arg;
1701 cotalpha0 = theStripTemp_[index_id_].enty[0].cotalpha;
1702 arg = cotb_current_*cotb_current_ + cota_current_*cota_current_ - cotalpha0*cotalpha0;
1703 if(arg < 0.
f) arg = 0.f;
1708 Ny = theStripTemp_[index_id_].head.NTy;
1710 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
1712 throw cms::Exception(
"DataCorrupt") <<
"template ID = " << id_current_ <<
"has too few entries: Ny = " << Ny << std::endl;
1723 if(cotb >= theStripTemp_[index_id_].enty[Ny-1].cotbeta) {
1730 if(cotb >= theStripTemp_[index_id_].enty[0].cotbeta) {
1732 for (i=0; i<Ny-1; ++
i) {
1734 if( theStripTemp_[index_id_].enty[i].cotbeta <= cotb && cotb < theStripTemp_[index_id_].enty[i+1].cotbeta) {
1737 yratio = (cotb - theStripTemp_[index_id_].enty[
i].cotbeta)/(theStripTemp_[index_id_].enty[i+1].cotbeta - theStripTemp_[index_id_].enty[i].cotbeta);
1748 mpvvav2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].mpvvav2 + yratio*theStripTemp_[index_id_].enty[ihigh].mpvvav2;
1749 sigmavav2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].sigmavav2 + yratio*theStripTemp_[index_id_].enty[ihigh].sigmavav2;
1750 kappavav2_ = (1.f - yratio)*theStripTemp_[index_id_].enty[ilow].kappavav2 + yratio*theStripTemp_[index_id_].enty[ihigh].kappavav2;
1754 mpv = (double)mpvvav2_;
1755 sigma = (double)sigmavav2_;
1756 kappa = (double)kappavav2_;
float clslenx
cluster x-length in strips at signal height sxmax/2
float xavgc2m[4]
1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins ...
float xavggen[4]
generic algorithm: average x-bias of reconstruction binned in 4 charge bins
float xrmsgen[4]
generic algorithm: average x-rms of reconstruction binned in 4 charge bins
float beta
beta track angle (defined in CMS CMS IN 2004/014)
float qbfrac[3]
fraction of sample in qbin = 0-2 (>=3 is the complement)
float qavg_avg
average cluster charge of clusters that are less than qavg (normalize 2-D simple templates) ...
float mpvvav
most probable charge in Vavilov distribution (not actually for larger kappa)
void vavilov2_pars(double &mpv, double &sigma, double &kappa)
float costrk[3]
direction cosines of tracks used to generate this entry
float xgsiggen[4]
generic algorithm: average sigma_x from Gaussian fit binned in 4 charge bins
float chi2xavgc2m[4]
1st pass chi2 min search: average x chi^2 in 4 charge bins (merged clusters)
SiStripTemplateEntry enty[31]
60 Barrel y templates spanning cluster lengths from 0px to +18px [28 entries for fstrp] ...
float chi2xavgone
average x chi^2 for 1 strip clusters
void xtemp(int fxbin, int lxbin, float xtemplate[41][17+4])
void xtemp3d(int j, int k, std::vector< float > &xtemplate)
void vavilov_pars(double &mpv, double &sigma, double &kappa)
void xsigma2(int fxstrp, int lxstrp, float sxthr, float xsum[17+4], float xsig2[17+4])
float dxone
mean offset/correction for one strip x-clusters
float xflpar[4][6]
Aqfl-parameterized x-correction in 4 charge bins.
int qbin(int id, float cotalpha, float cotbeta, float qclus)
float sigmavav2
"sigma" scale fctor for Vavilov distribution for 2 merged clusters
float xavg[4]
average x-bias of reconstruction binned in 4 charge bins
int runnum
< Basic template entry corresponding to a single set of track angles
float xtemp[9][17]
templates for x-reconstruction (binned over 1 central strip)
float kappavav2
kappa parameter for Vavilov distribution for 2 merged clusters
float xavgbcn[4]
barycenter: average x-bias of reconstruction binned in 4 charge bins
SiStripTemplateEntry entx[5][73]
29 Barrel x templates spanning cluster lengths from -6px (-1.125Rad) to +6px (+1.125Rad) in each of 5...
float xflcorr(int binq, float qflx)
float chi2xavg[4]
average x chi^2 in 4 charge bins
void xtemp3d_int(int nxpix, int &nxbins)
SiStripTemplateHeader head
< template storage structure
int cxtemp()
Return central pixel of x-template pixels above readout threshold.
float chi2xminc2m[4]
1st pass chi2 min search: minimum of x chi^2 in 4 charge bins (merged clusters)
float fracxone
fraction of sample with xsize = 1
float mpvvav2
most probable charge in Vavilov distribution for 2 merged clusters (not actually for larger kappa) ...
float xrmsbcn[4]
barycenter: average x-rms of reconstruction binned in 4 charge bins
Abs< T >::type abs(const T &t)
float sxone
rms for one strip x-clusters
void incrementIndex(int i)
float xgx0c2m[4]
1st pass chi2 min search: average x0 from Gaussian fit binned in 4 charge bins
float kappavav
kappa parameter for Vavilov distribution
float chi2xminone
minimum of x chi^2 for 1 strip clusters
float qavg
average cluster charge for this set of track angles (now includes threshold effects) ...
void sxtemp(float xhit, std::vector< float > &cluster)
float alpha
alpha track angle (defined in CMS CMS IN 2004/014)
float xgx0bcn[4]
barycenter: average x0 from Gaussian fit binned in 4 charge bins
float xgx0gen[4]
generic algorithm: average x0 from Gaussian fit binned in 4 charge bins
float xgsigbcn[4]
barycenter: average sigma_x from Gaussian fit binned in 4 charge bins
float cotalpha
cot(alpha) is proportional to cluster length in x and is basis of interpolation
float chi2xmin[4]
minimum of x chi^2 in 4 charge bins
float sigmavav
"sigma" scale fctor for Vavilov distribution
static unsigned int const shift
std::vector< float > const & sVector() const
float xgx0[4]
average x0 from Gaussian fit binned in 4 charge bins
float xrms[4]
average x-rms of reconstruction binned in 4 charge bins
static const G4double kappa
float xpar[2][5]
projected x-strip uncertainty parameterization
bool interpolate(int id, float cotalpha, float cotbeta, float locBy)
float qmin2
tighter minimum cluster charge for valid hit (keeps 99.8% of simulated hits)
float sxmax
average strip signal for x-projection of cluster
float xrmsc2m[4]
1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins ...
static bool pushfile(int filenum, std::vector< SiStripTemplateStore > &theStripTemp_)
float xgsigc2m[4]
1st pass chi2 min search: average sigma_x from Gaussian fit binned in 4 charge bins ...
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 qmin
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)