29 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
39 #include "Math/DistFunc.h"
44 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
48 #define LOGERROR(x) edm::LogError(x)
49 #define LOGDEBUG(x) LogDebug(x)
58 #define LOGERROR(x) std::cout << x << ": "
59 #define LOGDEBUG(x) std::cout << x << ": "
60 #define ENDL std::endl
63 using namespace SiPixelTemplateSplit;
98 std::vector<bool>& ydouble, std::vector<bool>& xdouble,
100 float& yrec1,
float& yrec2,
float& sigmay,
float& prob2y,
101 float& xrec1,
float& xrec2,
float& sigmax,
float& prob2x,
int& q2bin,
float& prob2Q,
bool resolve,
int speed,
float& dchisq,
bool deadpix, std::vector<std::pair<int, int> >& zeropix,
SiPixelTemplate2D& templ2D)
105 int i,
j,
k, binq, midpix, fypix, nypix, lypix, logypx, lparm;
106 int fxpix, nxpix, lxpix, logxpx, shifty, shiftx, nyzero[
TYSIZE];
108 int nybin, ycbin, nxbin, xcbin, minbinj, minbink;
109 int deltaj, jmin, jmax, kmin, kmax, km, fxbin, lxbin, fybin, lybin, djy, djx;
110 float sythr, sxthr,
delta, sigma, sigavg, pseudopix,
xsize,
ysize, qscale, lanpar[2][5];
111 float ss2, ssa, sa2, rat, fq, qtotal, qpixel, qavg;
112 float x1p, x2p, y1p, y2p, deltachi2;
113 float originx, originy, bias,
maxpix, minmax;
114 double chi2x, meanx, chi2y, meany, chi2ymin, chi2xmin, chi21max;
115 double hchi2, hndof, sigmal1, sigmal2, mpv1, mpv2, arg1, arg2, q05, like, loglike1, loglike2;
116 double prvav, mpv, sigmaQ, kappa, xvav, beta2;
122 const float sqrt2x={3.0000}, sqrt2y={1.7000};
123 const float sqrt12={3.4641};
124 const float probmin={1.110223e-16};
125 const float prob2Qmin={1.e-5};
126 std::pair<int, int> pixel;
133 const double mean1pix={0.100}, chi21min={0.160};
139 LOGDEBUG(
"SiPixelTemplateReco") <<
"input cluster direction cot(alpha) = " << cotalpha <<
", cot(beta) = " << cotbeta
140 <<
" is not within the acceptance of template ID = " <<
id <<
", no reconstruction performed" <<
ENDL;
146 xsize = templ.
xsize();
147 ysize = templ.
ysize();
151 pseudopix = templ.
s50();
153 q05 = 0.05f*pseudopix;
165 if(cluster.num_dimensions() != 2) {
166 LOGERROR(
"SiPixelTemplateReco") <<
"input cluster container (BOOST Multiarray) has wrong number of dimensions" <<
ENDL;
169 nclusx = (int)cluster.shape()[0];
170 nclusy = (int)cluster.shape()[1];
171 if(nclusx != (
int)xdouble.size()) {
172 LOGERROR(
"SiPixelTemplateReco") <<
"input cluster container x-size is not equal to double pixel flag container size" <<
ENDL;
175 if(nclusy != (
int)ydouble.size()) {
176 LOGERROR(
"SiPixelTemplateReco") <<
"input cluster container y-size is not equal to double pixel flag container size" <<
ENDL;
187 for(i=0; i<nclusy; ++
i) {
188 for(j=0; j<nclusx; ++
j) {
189 if(cluster[j][i] > 0) {cluster[
j][
i] *= qscale;}
196 minmax = 2.0f*templ.
pixmax();
197 for(i=0; i<nclusy; ++
i) {
199 if(ydouble[i]) {maxpix *=2.f;}
200 for(j=0; j<nclusx; ++
j) {
201 qtotal += cluster[
j][
i];
202 if(cluster[j][i] > maxpix) {cluster[
j][
i] =
maxpix;}
209 fypix =
BYM3; lypix = -1;
210 for(i=0; i<nclusy; ++
i) {
211 ysum[
i] = 0.f; nyzero[
i] = 0;
213 for(j=0; j<nclusx; ++
j) {
214 ysum[
i] += cluster[
j][
i];
218 if(i < fypix) {fypix =
i;}
219 if(i > lypix) {lypix =
i;}
227 std::vector<std::pair<int, int> >::const_iterator zeroIter = zeropix.begin(), zeroEnd = zeropix.end();
228 for ( ; zeroIter != zeroEnd; ++zeroIter ) {
229 i = zeroIter->second;
230 if(i<0 || i>
TYSIZE-1) {
LOGERROR(
"SiPixelTemplateReco") <<
"dead pixel column y-index " << i <<
", no reconstruction performed" <<
ENDL;
236 if(i < fypix) {fypix =
i;}
237 if(i > lypix) {lypix =
i;}
240 nypix = lypix-fypix+1;
244 for (zeroIter = zeropix.begin(); zeroIter != zeroEnd; ++zeroIter ) {
245 i = zeroIter->second; j = zeroIter->first;
246 if(j<0 || j>
TXSIZE-1) {
LOGERROR(
"SiPixelTemplateReco") <<
"dead pixel column x-index " << j <<
", no reconstruction performed" <<
ENDL;
248 if((i == fypix || i == lypix) && nypix > 1) {maxpix = templ.
symax()/2.;}
else {maxpix = templ.
symax();}
249 if(ydouble[i]) {maxpix *=2.;}
250 if(nyzero[i] > 0 && nyzero[i] < 3) {qpixel = (maxpix - ysum[
i])/(
float)nyzero[
i];}
else {qpixel = 1.;}
251 if(qpixel < 1.
f) {qpixel = 1.f;}
252 cluster[
j][
i] = qpixel;
261 for(i=0; i<
BYSIZE; ++
i) { ysum[
i] = 0.f; yd[
i] =
false;}
264 for(i=0; i<nclusy; ++
i) {
265 for(j=0; j<nclusx; ++
j) {
266 ysum[
k] += cluster[
j][
i];
282 if(k >
BYM1) {
break;}
287 for(i=0; i<
BXSIZE; ++
i) { xsum[
i] = 0.f; xd[
i] =
false;}
290 for(j=0; j<nclusx; ++
j) {
291 for(i=0; i<nclusy; ++
i) {
292 xsum[
k] += cluster[
j][
i];
308 if(k >
BXM1) {
break;}
319 if(fypix == -1) {fypix =
i;}
321 ysort[logypx] = ysum[
i];
331 if((lypix-fypix+1) != nypix || nypix == 0) {
332 LOGDEBUG(
"SiPixelTemplateReco") <<
"y-length of pixel cluster doesn't agree with number of pixels above threshold" <<
ENDL;
334 LOGDEBUG(
"SiPixelTemplateReco") <<
"ysum[] = ";
335 for(i=0; i<BYSIZE-1; ++
i) {
LOGDEBUG(
"SiPixelTemplateReco") << ysum[
i] <<
", ";}
336 LOGDEBUG(
"SiPixelTemplateReco") << ysum[BYSIZE-1] <<
ENDL;
345 LOGDEBUG(
"SiPixelTemplateReco") <<
"y-length of pixel cluster is larger than maximum template size" <<
ENDL;
347 LOGDEBUG(
"SiPixelTemplateReco") <<
"ysum[] = ";
348 for(i=0; i<BYSIZE-1; ++
i) {
LOGDEBUG(
"SiPixelTemplateReco") << ysum[
i] <<
", ";}
349 LOGDEBUG(
"SiPixelTemplateReco") << ysum[BYSIZE-1] <<
ENDL;
357 midpix = (fypix+lypix)/2;
359 shifty = templ.
cytemp() - midpix;
361 for(i=lypix; i>=fypix; --
i) {
362 ysum[i+shifty] = ysum[
i];
364 yd[i+shifty] = yd[
i];
367 }
else if (shifty < 0) {
368 for(i=fypix; i<=lypix; ++
i) {
369 ysum[i+shifty] = ysum[
i];
371 yd[i+shifty] = yd[
i];
380 if(fypix > 1 && fypix <
BYM2) {
381 ysum[fypix-1] = pseudopix;
382 ysum[fypix-2] = 0.2f*pseudopix;
384 if(lypix > 1 && lypix <
BYM2) {
385 ysum[lypix+1] = pseudopix;
386 ysum[lypix+2] = 0.2f*pseudopix;
405 if(fxpix == -1) {fxpix =
i;}
407 xsort[logxpx] = xsum[
i];
417 if((lxpix-fxpix+1) != nxpix) {
419 LOGDEBUG(
"SiPixelTemplateReco") <<
"x-length of pixel cluster doesn't agree with number of pixels above threshold" <<
ENDL;
421 LOGDEBUG(
"SiPixelTemplateReco") <<
"xsum[] = ";
422 for(i=0; i<BXSIZE-1; ++
i) {
LOGDEBUG(
"SiPixelTemplateReco") << xsum[
i] <<
", ";}
423 LOGDEBUG(
"SiPixelTemplateReco") << ysum[BXSIZE-1] <<
ENDL;
433 LOGDEBUG(
"SiPixelTemplateReco") <<
"x-length of pixel cluster is larger than maximum template size" <<
ENDL;
435 LOGDEBUG(
"SiPixelTemplateReco") <<
"xsum[] = ";
436 for(i=0; i<BXSIZE-1; ++
i) {
LOGDEBUG(
"SiPixelTemplateReco") << xsum[
i] <<
", ";}
437 LOGDEBUG(
"SiPixelTemplateReco") << ysum[BXSIZE-1] <<
ENDL;
445 midpix = (fxpix+lxpix)/2;
447 shiftx = templ.
cxtemp() - midpix;
449 for(i=lxpix; i>=fxpix; --
i) {
450 xsum[i+shiftx] = xsum[
i];
452 xd[i+shiftx] = xd[
i];
455 }
else if (shiftx < 0) {
456 for(i=fxpix; i<=lxpix; ++
i) {
457 xsum[i+shiftx] = xsum[
i];
459 xd[i+shiftx] = xd[
i];
468 if(fxpix > 1 && fxpix <
BXM2) {
469 xsum[fxpix-1] = pseudopix;
470 xsum[fxpix-2] = 0.2f*pseudopix;
472 if(lxpix > 1 && lxpix <
BXM2) {
473 xsum[lxpix+1] = pseudopix;
474 xsum[lxpix+2] = 0.2f*pseudopix;
508 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
509 if((sigmaQ <=0.) || (mpv <= 0.) || (kappa < 0.01) || (kappa > 9.9)) {
510 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplateSplit::Vavilov parameters mpv/sigmaQ/kappa = " << mpv <<
"/" << sigmaQ <<
"/" << kappa << std::endl;
513 assert((sigmaQ > 0.) && (mpv > 0.) && (kappa > 0.01) && (kappa < 10.));
515 xvav = ((double)qtotal-mpv)/sigmaQ;
518 VVIObj vvidist(kappa, beta2, 1);
519 prvav = vvidist.
fcn(xvav);
521 if(prob2Q < prob2Qmin) {prob2Q = prob2Qmin;}
530 if(!deadpix && qtotal < 1.9
f*templ.
qmin()) {q2bin = 5;}
else {
531 if(!deadpix && qtotal < 1.9
f*templ.
qmin(1)) {q2bin = 4;}
537 " cot(alpha) = " << cotalpha <<
" cot(beta) = " << cotbeta <<
538 " nclusx = " << nclusx <<
" nclusy = " << nclusy <<
ENDL;
557 #ifndef SI_PIXEL_TEMPLATE_STANDALONE
558 if(speed < -1 || speed > 2) {
559 throw cms::Exception(
"DataCorrupt") <<
"SiPixelTemplateReco::PixelTempReco2D called with illegal speed = " << speed << std::endl;
562 assert(speed >= -1 && speed < 3);
564 fybin = 0; lybin = nybin-1; fxbin = 0; lxbin = nxbin-1; djy = 1; djx = 1;
568 if(!anyyd) {djy = 4;}
569 if(!anyxd) {djx = 4;}
575 "fypix " << fypix <<
" lypix = " << lypix <<
576 " fybin = " << fybin <<
" lybin = " << lybin <<
577 " djy = " << djy <<
" logypx = " << logypx <<
ENDL;
579 "fxpix " << fxpix <<
" lxpix = " << lxpix <<
580 " fxbin = " << fxbin <<
" lxbin = " << lxbin <<
581 " djx = " << djx <<
" logxpx = " << logxpx <<
ENDL;
590 sythr = 2.1f*(templ.
symax());
595 if(logypx == 1) {sythr = 1.01f*ysort[0];}
else {
596 if (ysort[1] > sythr) { sythr = 1.01f*ysort[1]; }
602 templ.
ysigma2(fypix, lypix, sythr, ysum, ysig2);
608 for(i=fypix-2; i<=lypix+2; ++
i) {
609 yw2[
i] = 1.f/ysig2[
i];
610 ysw[
i] = ysum[
i]*yw2[
i];
611 ss2 += ysum[
i]*ysw[
i];
620 std::vector<float> ytemp(BYSIZE);
622 for(j=jmin; j<jmax; j+=deltaj) {
624 for(k=kmin; k<=km; k+=deltaj) {
635 if(yd[i] && !yd[i+1]) {
639 sigavg = (ytemp[
i] + ytemp[i+1])/2.
f;
650 for(i=fypix-2; i<=lypix+2; ++
i) {
651 ssa += ysw[
i]*ytemp[
i];
652 sa2 += ytemp[
i]*ytemp[
i]*yw2[
i];
655 if(rat <= 0.) {
LOGERROR(
"SiPixelTemplateSplit") <<
"illegal chi2ymin normalization = " << rat <<
ENDL; rat = 1.;}
656 chi2y=ss2-2.f*ssa/rat+sa2/(rat*rat);
657 if(chi2y < chi2ymin) {
665 if(minbinj > fybin) {jmin = minbinj - deltaj;}
else {jmin = fybin;}
666 if(minbinj < lybin) {jmax = minbinj + deltaj;}
else {jmax = lybin;}
667 if(minbink > fybin) {kmin = minbink - deltaj;}
else {kmin = fybin;}
668 if(minbink < lybin) {kmax = minbink + deltaj;}
else {kmax = lybin;}
673 "minbins " << minbinj <<
"," << minbink <<
" chi2ymin = " << chi2ymin <<
ENDL;
681 delta = templ.
dyone();
682 sigma = templ.
syone();
684 delta = templ.
dytwo();
685 sigma = templ.
sytwo();
688 yrec1 = 0.5f*(fypix+lypix-2*shifty+2.f*originy)*ysize-delta;
692 sigmay = ysize/sqrt12;
699 chi21max = fmax(chi21min, (
double)templ.
chi2yminone());
701 if(chi2ymin < 0.) {chi2ymin = 0.;}
703 meany = fmax(mean1pix, (
double)templ.
chi2yavgone());
704 hchi2 = chi2ymin/2.; hndof = meany/2.;
713 if(logypx == 2 && fabsf(cotbeta) < 0.25
f) {
717 yrec1 = (fypix-shifty+originy)*ysize;
718 yrec2 = (lypix-shifty+originy)*ysize;
719 sigmay = ysize/sqrt12;
724 yrec1 = (fypix+0.5f-shifty+originy)*ysize;
725 yrec2 = (lypix-shifty+originy)*ysize;
726 sigmay = ysize/sqrt12;
728 yrec1 = (fypix-shifty+originy)*ysize;
729 yrec2 = (lypix-0.5f-shifty+originy)*ysize;
730 sigmay = 1.5f*ysize/sqrt12;
735 yrec1 = (fypix+0.5f-shifty+originy)*ysize;
736 yrec2 = (lypix-0.5f-shifty+originy)*ysize;
737 sigmay = 2.f*ysize/sqrt12;
741 LOGERROR(
"SiPixelTemplateReco") <<
"weird problem: logical y-pixels = " << logypx <<
", total ysize in normal pixels = " << nypix <<
ENDL;
749 yrec1 = (0.125f*(minbink-ycbin)+
BHY-(
float)shifty+originy)*ysize - bias;
750 yrec2 = (0.125f*(minbinj-ycbin)+
BHY-(
float)shifty+originy)*ysize - bias;
751 sigmay = sqrt2y*templ.
yrmsc2m(binq);
757 if(chi2ymin < 0.0) {chi2ymin = 0.0;}
759 if(meany < 0.01) {meany = 0.01;}
763 hchi2 = chi2ymin/2.; hndof = meany/2.;
772 sxthr = 2.1f*templ.
sxmax();
776 if(logxpx == 1) {sxthr = 1.01f*xsort[0];}
else {
777 if (xsort[1] > sxthr) { sxthr = 1.01f*xsort[1]; }
783 templ.
xsigma2(fxpix, lxpix, sxthr, xsum, xsig2);
789 for(i=fxpix-2; i<=lxpix+2; ++
i) {
790 xw2[
i] = 1.f/xsig2[
i];
791 xsw[
i] = xsum[
i]*xw2[
i];
792 ss2 += xsum[
i]*xsw[
i];
801 std::vector<float> xtemp(BXSIZE);
803 for(j=jmin; j<jmax; j+=deltaj) {
805 for(k=kmin; k<=km; k+=deltaj) {
816 if(xd[i] && !xd[i+1]) {
820 sigavg = (xtemp[
i] + xtemp[i+1])/2.
f;
831 for(i=fxpix-2; i<=lxpix+2; ++
i) {
832 ssa += xsw[
i]*xtemp[
i];
833 sa2 += xtemp[
i]*xtemp[
i]*xw2[
i];
836 if(rat <= 0.
f) {
LOGERROR(
"SiPixelTemplateSplit") <<
"illegal chi2xmin normalization = " << rat <<
ENDL; rat = 1.;}
837 chi2x=ss2-2.f*ssa/rat+sa2/(rat*rat);
838 if(chi2x < chi2xmin) {
846 if(minbinj > fxbin) {jmin = minbinj - deltaj;}
else {jmin = fxbin;}
847 if(minbinj < lxbin) {jmax = minbinj + deltaj;}
else {jmax = lxbin;}
848 if(minbink > fxbin) {kmin = minbink - deltaj;}
else {kmin = fxbin;}
849 if(minbink < lxbin) {kmax = minbink + deltaj;}
else {kmax = lxbin;}
854 "minbinj/minbink " << minbinj<<
"/" << minbink <<
" chi2xmin = " << chi2xmin <<
ENDL;
862 delta = templ.
dxone();
863 sigma = templ.
sxone();
865 delta = templ.
dxtwo();
866 sigma = templ.
sxtwo();
868 xrec1 = 0.5f*(fxpix+lxpix-2*shiftx+2.f*originx)*xsize-delta;
871 sigmax = xsize/sqrt12;
878 chi21max = fmax(chi21min, (
double)templ.
chi2xminone());
880 if(chi2xmin < 0.) {chi2xmin = 0.;}
881 meanx = fmax(mean1pix, (
double)templ.
chi2xavgone());
882 hchi2 = chi2xmin/2.; hndof = meanx/2.;
894 xrec1 = (0.125f*(minbink-xcbin)+
BHX-(
float)shiftx+originx)*xsize - bias;
895 xrec2 = (0.125f*(minbinj-xcbin)+
BHX-(
float)shiftx+originx)*xsize - bias;
896 sigmax = sqrt2x*templ.
xrmsc2m(binq);
900 if(chi2xmin < 0.0) {chi2xmin = 0.0;}
902 if(meanx < 0.01) {meanx = 0.01;}
903 hchi2 = chi2xmin/2.; hndof = meanx/2.;
909 if(prob2y < probmin) {prob2y = probmin;}
910 if(prob2x < probmin) {prob2x = probmin;}
919 for(i=0; i<
BYM2; ++
i) {
920 for(j=0; j<
BXM2; ++
j) {
921 if((i>0 && i<
BYM3)&&(j>0 && j<
BXM3)) {
922 cluster2[
j][
i] = qscale*clust[j-1][i-1];
924 cluster2[
j][
i] = 0.f;
935 x1p = xrec1+xsize/2.f;
936 x2p = xrec2+xsize/2.f;
943 y1p = yrec1+ysize/2.f;
944 y2p = yrec2+ysize/2.f;
951 for(i=0; i<
BYM2; ++
i) {
952 for(j=0; j<
BXM2; ++
j) {
961 any2dfail = templ2D.
xytemp(
id, cotalpha, cotbeta, x1p, y1p, xdouble, ydouble, temp2d1) && templ2D.
xytemp(
id, cotalpha, cotbeta, x2p, y2p, xdouble, ydouble, temp2d1);
965 any2dfail = any2dfail && templ2D.
xytemp(
id, cotalpha, cotbeta, x1p, y2p, xdouble, ydouble, temp2d2);
967 any2dfail = any2dfail && templ2D.
xytemp(
id, cotalpha, cotbeta, x2p, y1p, xdouble, ydouble, temp2d2);
975 for(i=0; i<
BYM2; ++
i) {
976 for(j=0; j<
BXM2; ++
j) {
984 if(!templ.
simpletemplate2D(x1p, y1p, xdouble, ydouble, temp2d1)) {
return 1;}
986 if(!templ.
simpletemplate2D(x2p, y2p, xdouble, ydouble, temp2d1)) {
return 1;}
990 if(!templ.
simpletemplate2D(x1p, y2p, xdouble, ydouble, temp2d2)) {
return 1;}
992 if(!templ.
simpletemplate2D(x2p, y1p, xdouble, ydouble, temp2d2)) {
return 1;}
997 std::list<std::pair<int, int> > pixellst;
1001 for(i=0; i<
BYM2; ++
i) {
1002 for(j=0; j<
BXM2; ++
j) {
1003 if(cluster2[j][i] > 0.
f || temp2d1[j][i] > 0.
f || temp2d2[j][i] > 0.
f) {
1004 pixel.first =
j; pixel.second =
i;
1005 pixellst.push_back(pixel);
1013 loglike1 = 0.; loglike2 = 0.;
1018 std::list<std::pair<int, int> >::const_iterator pixIter, pixEnd;
1019 pixIter = pixellst.begin();
1020 pixEnd = pixellst.end();
1021 for( ; pixIter != pixEnd; ++pixIter ) {
1022 j = pixIter->first; i = pixIter->second;
1023 if((i < BHY && cotbeta > 0.) || (i >=
BHY && cotbeta < 0.)) {lparm = 0;}
else {lparm = 1;}
1024 mpv1 = lanpar[lparm][0] + lanpar[lparm][1]*temp2d1[
j][
i];
1025 sigmal1 = lanpar[lparm][2]*mpv1;
1026 sigmal1 =
sqrt(sigmal1*sigmal1+lanpar[lparm][3]*lanpar[lparm][3]);
1027 if(sigmal1 < q05) sigmal1 = q05;
1028 arg1 = (cluster2[
j][
i]-mpv1)/sigmal1-0.22278;
1029 mpv2 = lanpar[lparm][0] + lanpar[lparm][1]*temp2d2[
j][
i];
1030 sigmal2 = lanpar[lparm][2]*mpv2;
1031 sigmal2 =
sqrt(sigmal2*sigmal2+lanpar[lparm][3]*lanpar[lparm][3]);
1032 if(sigmal2 < q05) sigmal2 = q05;
1033 arg2 = (cluster2[
j][
i]-mpv2)/sigmal2-0.22278;
1035 like = ROOT::Math::landau_pdf(arg1);
1036 if(like < 1.
e-30) like = 1.e-30;
1037 loglike1 +=
log(like);
1039 like = ROOT::Math::landau_pdf(arg2);
1040 if(like < 1.
e-30) like = 1.e-30;
1041 loglike2 +=
log(like);
1046 deltachi2 = loglike1 - loglike2;
1048 if(deltachi2 < 0.) {
1059 dchisq = fabs(deltachi2);
1092 std::vector<bool>& ydouble, std::vector<bool>& xdouble,
1094 float& yrec1,
float& yrec2,
float& sigmay,
float& prob2y,
1095 float& xrec1,
float& xrec2,
float& sigmax,
float& prob2x,
int& q2bin,
float& prob2Q,
bool resolve,
int speed,
float& dchisq,
SiPixelTemplate2D& templ2D)
1098 const bool deadpix =
false;
1099 std::vector<std::pair<int, int> > zeropix;
1102 yrec1, yrec2, sigmay, prob2y, xrec1, xrec2, sigmax, prob2x, q2bin, prob2Q, resolve, speed, dchisq, deadpix, zeropix, templ2D);
1133 std::vector<bool>& ydouble, std::vector<bool>& xdouble,
1135 float& yrec1,
float& yrec2,
float& sigmay,
float& prob2y,
1136 float& xrec1,
float& xrec2,
float& sigmax,
float& prob2x,
int& q2bin,
float& prob2Q,
bool resolve,
float& dchisq,
SiPixelTemplate2D& templ2D)
1139 const bool deadpix =
false;
1140 std::vector<std::pair<int, int> > zeropix;
1141 const int speed = 1;
1144 yrec1, yrec2, sigmay, prob2y, xrec1, xrec2, sigmax, prob2x, q2bin, prob2Q, resolve, speed, dchisq, deadpix, zeropix, templ2D);
1172 std::vector<bool>& ydouble, std::vector<bool>& xdouble,
1174 float& yrec1,
float& yrec2,
float& sigmay,
float& prob2y,
1175 float& xrec1,
float& xrec2,
float& sigmax,
float& prob2x,
int& q2bin,
float& prob2Q,
SiPixelTemplate2D& templ2D)
1178 const bool deadpix =
false;
1179 const bool resolve =
true;
1181 std::vector<std::pair<int, int> > zeropix;
1182 const int speed = 1;
1185 yrec1, yrec2, sigmay, prob2y, xrec1, xrec2, sigmax, prob2x, q2bin, prob2Q, resolve, speed, dchisq, deadpix, zeropix, templ2D);
1214 std::vector<bool>& ydouble, std::vector<bool>& xdouble,
1216 float& yrec1,
float& yrec2,
float& sigmay,
float& prob2y,
1217 float& xrec1,
float& xrec2,
float& sigmax,
float& prob2x,
int& q2bin,
SiPixelTemplate2D& templ2D)
1220 const bool deadpix =
false;
1221 const bool resolve =
true;
1222 float dchisq, prob2Q;
1223 std::vector<std::pair<int, int> > zeropix;
1224 const int speed = 1;
1227 yrec1, yrec2, sigmay, prob2y, xrec1, xrec2, sigmax, prob2x, q2bin, prob2Q, resolve, speed, dchisq, deadpix, zeropix, templ2D);
float yrmsc2m(int i)
1st pass chi2 min search: average y-rms of reconstruction binned in 4 charge bins ...
void vavilov2_pars(double &mpv, double &sigma, double &kappa)
float chi2xminone()
//!< minimum of x chi^2 for 1 pixel clusters
float chi2yavgc2m(int i)
1st pass chi2 min search: average y-chisq for merged clusters
float symax()
average pixel signal for y-projection of cluster
int cytemp()
Return central pixel of y template pixels above readout threshold.
float qmin()
minimum cluster charge for valid hit (keeps 99.9% of simulated hits)
float xavgc2m(int i)
1st pass chi2 min search: average x-bias of reconstruction binned in 4 charge bins ...
float sytwo()
rms for one double-pixel y-clusters
float chi2yminone()
//!< minimum of y chi^2 for 1 pixel clusters
bool interpolate(int id, float cotalpha, float cotbeta, float locBz)
float sxone()
rms for one pixel x-clusters
bool xytemp(int id, float cotalpha, float cotbeta, float locBz, float xhit, float yhit, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[BXM2][BYM2])
int cxtemp()
Return central pixel of x-template pixels above readout threshold.
float qscale()
charge scaling factor
float chi2xavgc2m(int i)
1st pass chi2 min search: average x-chisq for merged clusters
bool simpletemplate2D(float xhitp, float yhitp, std::vector< bool > &ydouble, std::vector< bool > &xdouble, float template2d[BXM2][BYM2])
Make simple 2-D templates from track angles set in interpolate and hit position.
float dxone()
mean offset/correction for one pixel x-clusters
static int theVerboseLevel
const T & max(const T &a, const T &b)
void ytemp3d(int j, int k, std::vector< float > &ytemplate)
int PixelTempSplit(int id, float cotalpha, float cotbeta, array_2d &cluster, std::vector< bool > &ydouble, std::vector< bool > &xdouble, SiPixelTemplate &templ, float &yrec1, float &yrec2, float &sigmay, float &prob2y, float &xrec1, float &xrec2, float &sigmax, float &prob2x, int &q2bin, float &prob2Q, bool resolve, int speed, float &dchisq, bool deadpix, std::vector< std::pair< int, int > > &zeropix, SiPixelTemplate2D &templ2D)
float xsize()
pixel x-size (microns)
float sxtwo()
rms for one double-pixel x-clusters
float dytwo()
mean offset/correction for one double-pixel y-clusters
double fcn(double x) const
float s50()
1/2 of the pixel threshold signal in electrons
float yavgc2m(int i)
1st pass chi2 min search: average y-bias of reconstruction binned in 4 charge bins ...
void xtemp3d(int j, int k, std::vector< float > &xtemplate)
float syone()
rms for one pixel y-clusters
void ytemp3d_int(int nypix, int &nybins)
float chi2yavgone()
//!< average y chi^2 for 1 pixel clusters
void xtemp3d_int(int nxpix, int &nxbins)
float qavg()
average cluster charge for this set of track angles
float sxmax()
average pixel signal for x-projection of cluster
void xsigma2(int fxpix, int lxpix, float sxthr, float xsum[BXSIZE], float xsig2[BXSIZE])
float chi2xavgone()
//!< average x chi^2 for 1 pixel clusters
float pixmax()
maximum pixel charge
void landau_par(float lanpar[2][5])
Return the Landau probability parameters for this set of cot(alpha, cot(beta)
void ysigma2(int fypix, int lypix, float sythr, float ysum[BYSIZE], float ysig2[BYSIZE])
float dyone()
mean offset/correction for one pixel y-clusters
float dxtwo()
mean offset/correction for one double-pixel x-clusters
boost::multi_array< float, 2 > array_2d
float ysize()
pixel y-size (microns)
float xrmsc2m(int i)
1st pass chi2 min search: average x-rms of reconstruction binned in 4 charge bins ...