9 #include <gsl/gsl_fit.h>
23 TrackProducerFP420::TrackProducerFP420(
int asn0,
int apn0,
int arn0,
int axytype,
double az420,
double azD2,
double azD3,
double apitchX,
double apitchY,
double apitchXW,
double apitchYW,
double aZGapLDet,
double aZSiStep,
double aZSiPlane,
double aZSiDet,
double azBlade,
double agapBlade,
bool aUseHalfPitchShiftInX,
bool aUseHalfPitchShiftInY,
bool aUseHalfPitchShiftInXW,
bool aUseHalfPitchShiftInYW,
double adXX,
double adYY,
float achiCutX,
float achiCutY,
double azinibeg,
int verbosity,
double aXsensorSize,
double aYsensorSize) {
47 UseHalfPitchShiftInX = aUseHalfPitchShiftInX;
48 UseHalfPitchShiftInY = aUseHalfPitchShiftInY;
49 UseHalfPitchShiftInXW = aUseHalfPitchShiftInXW;
50 UseHalfPitchShiftInYW = aUseHalfPitchShiftInYW;
56 XsensorSize = aXsensorSize;
57 YsensorSize = aYsensorSize;
60 std::cout <<
"TrackProducerFP420: call constructor" << std::endl;
61 std::cout <<
" sn0= " << sn0 <<
" pn0= " << pn0 <<
" rn0= " << rn0 <<
" xytype= " << xytype << std::endl;
62 std::cout <<
" zD2= " << zD2 <<
" zD3= " << zD3 <<
" zinibeg= " << zinibeg << std::endl;
64 std::cout <<
" pitchX= " << pitchX <<
" pitchY= " << pitchY << std::endl;
65 std::cout <<
" ZGapLDet= " << ZGapLDet << std::endl;
66 std::cout <<
" ZSiStep= " << ZSiStep <<
" ZSiPlane= " << ZSiPlane << std::endl;
67 std::cout <<
" ZSiDet= " <<ZSiDet << std::endl;
68 std::cout <<
" UseHalfPitchShiftInX= " << UseHalfPitchShiftInX <<
" UseHalfPitchShiftInY= " << UseHalfPitchShiftInY << std::endl;
69 std::cout <<
"TrackProducerFP420:----------------------" << std::endl;
70 std::cout <<
" dXX= " << dXX <<
" dYY= " << dYY << std::endl;
71 std::cout <<
" chiCutX= " << chiCutX <<
" chiCutY= " << chiCutY << std::endl;
89 std::vector<TrackFP420> rhits;
91 rhits.reserve(restracks);
93 double Ax[10];
double Bx[10];
double Cx[10];
int Mx[10];
94 double Ay[10];
double By[10];
double Cy[10];
int My[10];
95 double AxW[10];
double BxW[10];
double CxW[10];
int MxW[10];
96 double AyW[10];
double ByW[10];
double CyW[10];
int MyW[10];
98 std::cout <<
"===============================================================================" << std::endl;
99 std::cout <<
"=================================================================" << std::endl;
100 std::cout <<
"==========================================================" << std::endl;
102 std::cout <<
"TrackProducerFP420: Start trackFinderSophisticated " << std::endl;
107 if( xytype < 1 || xytype > 2 ){
108 std::cout <<
"TrackProducerFP420:ERROR in trackFinderSophisticated: check xytype = " << xytype << std::endl;
114 std::cout <<
"TrackProducerFP420:ERROR in trackFinderSophisticated: check sn0 (configuration) = " << sn0 << std::endl;
118 int zbeg = 1, zmax=3;
126 double zX[24][20], xX[24][20], wX[24][20];
127 double zY[24][20], yY[24][20], wY[24][20];
128 double yXW[24][20], wXW[24][20];
129 double xYW[24][20], wYW[24][20];
130 bool qX[24][20], qY[24][20];
132 int txf = 0;
int txs1 = 0;
int txss = 0;
133 int tyf = 0;
int tys1 = 0;
int tyss = 0;
148 float Xshift = pitch/2.;
149 float Yshift = pitchW/2.;
154 unsigned int ii0 = 999999;
155 int allplacesforsensors=7;
156 for (
int sector=1; sector < sn0; sector++) {
157 for (
int zmodule=1; zmodule<pn0; zmodule++) {
158 for (
int zsideinorder=1; zsideinorder<allplacesforsensors; zsideinorder++) {
159 int zside = theFP420NumberingScheme->FP420NumberingScheme::realzside(rn0, zsideinorder);
161 std::cout <<
"TrackProducerFP420: sector= " << sector <<
" zmodule= " << zmodule <<
" zsideinorder= " << zsideinorder <<
" zside= " << zside <<
" det= " << det << std::endl;
164 int justlayer = theFP420NumberingScheme->FP420NumberingScheme::unpackLayerIndex(rn0, zside);
165 if(justlayer<1||justlayer>2) {
166 std::cout <<
"TrackProducerFP420:WRONG justlayer= " << justlayer << std::endl;
168 int copyinlayer = theFP420NumberingScheme->FP420NumberingScheme::unpackCopyIndex(rn0, zside);
169 if(copyinlayer<1||copyinlayer>3) {
170 std::cout <<
"TrackProducerFP420:WRONG copyinlayer= " << copyinlayer << std::endl;
172 int orientation = theFP420NumberingScheme->FP420NumberingScheme::unpackOrientation(rn0, zside);
173 if(orientation<1||orientation>2) {
174 std::cout <<
"TrackProducerFP420:WRONG orientation= " << orientation << std::endl;
180 unsigned int ii = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(nlayers,pn0,sn0,detfixed,justlayer,sector,zmodule)-1;
185 std::cout <<
"TrackProducerFP420: justlayer= " << justlayer <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
188 double zdiststat = 0.;
190 if(sector==2) zdiststat = zD3;
193 if(sector==2) zdiststat = zD2;
194 if(sector==3) zdiststat = zD3;
196 double kplane = -(pn0-1)/2 - 0.5 + (zmodule-1);
197 double zcurrent = zinibeg + z420 + (ZSiStep-ZSiPlane)/2 + kplane*ZSiStep + zdiststat;
201 if(orientation==1) zcurrent += (ZGapLDet+ZSiDet/2);
202 if(orientation==2) zcurrent += zBlade-(ZGapLDet+ZSiDet/2);
205 if(orientation==1) zcurrent += (ZGapLDet+ZSiDet/2)+zBlade+gapBlade;
206 if(orientation==2) zcurrent += 2*zBlade+gapBlade-(ZGapLDet+ZSiDet/2);
210 if(det == 2) zcurrent = -zcurrent;
225 if (UseHalfPitchShiftInX ==
true){
229 if (UseHalfPitchShiftInXW ==
true){
234 double XXXDelta = 0.0;
235 if(copyinlayer==2) { XXXDelta = XsensorSize;}
236 if(copyinlayer==3) { XXXDelta = 2.*XsensorSize;}
237 double YYYDelta = 0.0;
238 if(copyinlayer==2) { YYYDelta = XsensorSize;}
239 if(copyinlayer==3) { YYYDelta = 2.*XsensorSize;}
243 unsigned int iu=theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(rn0,pn0,sn0,det,zside,sector,zmodule);
245 std::cout <<
"TrackProducerFP420: check iu = " << iu << std::endl;
246 std::cout <<
"TrackProducerFP420: sector= " << sector <<
" zmodule= " << zmodule <<
" zside= " << zside <<
" det= " << det <<
" rn0= " << rn0 <<
" pn0= " << pn0 <<
" sn0= " << sn0 <<
" copyinlayer= " << copyinlayer << std::endl;
249 std::vector<ClusterFP420> currentclust;
250 currentclust.clear();
252 outputRange = input->get(iu);
256 for ( ;sort_begin != sort_end; ++sort_begin ) {
258 currentclust.push_back(*sort_begin);
262 std::cout <<
"TrackProducerFP420: currentclust.size = " << currentclust.size() << std::endl;
266 std::vector<ClusterFP420>::const_iterator simHitIter = currentclust.begin();
267 std::vector<ClusterFP420>::const_iterator simHitIterEnd = currentclust.end();
286 for (;simHitIter != simHitIterEnd; ++simHitIter) {
295 if(copyinlayer==1 && nY[ii]>reshits1){
297 std::cout <<
"WARNING-ERROR:TrackproducerFP420: currentclust.size()= " << currentclust.size() <<
" bigger reservated number of hits" <<
" zcurrent=" << zY[nY[ii]-1][ii] <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
299 if(copyinlayer !=1 && nY[ii]>reshits2){
301 std::cout <<
"WARNING-ERROR:TrackproducerFP420: currentclust.size()= " << currentclust.size() <<
" bigger reservated number of hits" <<
" zcurrent=" << zY[nY[ii]-1][ii] <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
303 zY[nY[ii]-1][ii] = zcurrent;
304 yY[nY[ii]-1][ii] = icluster.
barycenter()*pitch+0.5*pitch+YYYDelta;
305 xYW[nY[ii]-1][ii] = icluster.
barycenterW()*pitchW+0.5*pitchW;
307 yY[nY[ii]-1][ii] = yY[nY[ii]-1][ii] - dYYcur;
308 wY[nY[ii]-1][ii] = 1./(icluster.
barycerror()*pitch);
309 wY[nY[ii]-1][ii] *= wY[nY[ii]-1][ii];
311 xYW[nY[ii]-1][ii] =(xYW[nY[ii]-1][ii]+dYYWcur);
314 xYW[nY[ii]-1][ii] =-(xYW[nY[ii]-1][ii]+dYYWcur);
316 wYW[nY[ii]-1][ii] = 1./(icluster.
barycerrorW()*pitchW);
317 wYW[nY[ii]-1][ii] *= wYW[nY[ii]-1][ii];
318 qY[nY[ii]-1][ii] =
true;
319 if(copyinlayer==1 && nY[ii]==reshits1)
break;
320 if(copyinlayer !=1 && nY[ii]==reshits2)
break;
326 std::cout <<
"TrackproducerFP420: nX[ii]= " << nX[ii] <<
" Ncl= " << currentclust.size() <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii <<
" zcurrent = " << zcurrent <<
" xX= " << icluster.
barycenter()*pitch+0.5*pitch+XXXDelta <<
" yXW= " << icluster.
barycenterW()*pitchW+0.5*pitchW <<
" det= " << det <<
" cl.size= " << icluster.
amplitudes().size() <<
" cl.ampl[0]= " << icluster.
amplitudes()[0] << std::endl;
328 if(copyinlayer==1 && nX[ii]>reshits1){
329 std::cout <<
"WARNING-ERROR:TrackproducerFP420: nX[ii]= " << nX[ii] <<
" bigger reservated number of hits" <<
" currentclust.size()= " << currentclust.size() <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
332 if(copyinlayer !=1 && nX[ii]>reshits2){
333 std::cout <<
"WARNING-ERROR:TrackproducerFP420: nX[ii]= " << nX[ii] <<
" bigger reservated number of hits" <<
" currentclust.size()= " << currentclust.size() <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
336 zX[nX[ii]-1][ii] = zcurrent;
337 xX[nX[ii]-1][ii] = icluster.
barycenter()*pitch+0.5*pitch+XXXDelta;
338 yXW[nX[ii]-1][ii] = icluster.
barycenterW()*pitchW+0.5*pitchW;
340 xX[nX[ii]-1][ii] =-(xX[nX[ii]-1][ii]+dXXcur);
341 wX[nX[ii]-1][ii] = 1./(icluster.
barycerror()*pitch);
342 wX[nX[ii]-1][ii] *= wX[nX[ii]-1][ii];
344 yXW[nX[ii]-1][ii] = -(yXW[nX[ii]-1][ii] - dXXWcur);
347 yXW[nX[ii]-1][ii] = yXW[nX[ii]-1][ii] - dXXWcur;
349 wXW[nX[ii]-1][ii] = 1./(icluster.
barycerrorW()*pitchW);
350 wXW[nX[ii]-1][ii] *= wXW[nX[ii]-1][ii];
351 qX[nX[ii]-1][ii] =
true;
353 std::cout <<
"trackFinderSophisticated: nX[ii]= " << nX[ii]<<
" ii = " << ii <<
" zcurrent = " << zcurrent <<
" yXW[nX[ii]-1][ii] = " << yXW[nX[ii]-1][ii] <<
" xX[nX[ii]-1][ii] = " << xX[nX[ii]-1][ii] << std::endl;
354 std::cout <<
" XXXDelta= " << XXXDelta <<
" dXXcur= " << dXXcur <<
" -dXXWcur= " << -dXXWcur << std::endl;
355 std::cout <<
" icluster.barycerrorW()*pitchW= " << icluster.
barycerrorW()*pitchW <<
" wXW[nX[ii]-1][ii]= " <<wXW[nX[ii]-1][ii] << std::endl;
356 std::cout <<
" -icluster.barycenterW()*pitchW+0.5*pitchW = " << icluster.
barycenterW()*pitchW+0.5*pitchW << std::endl;
357 std::cout <<
"============================================================" << std::endl;
360 std::cout <<
"trackFinderSophisticated: nX[ii]= " << nX[ii]<<
" ii = " << ii <<
" zcurrent = " << zcurrent <<
" xX[nX[ii]-1][ii] = " << xX[nX[ii]-1][ii] << std::endl;
361 std::cout <<
" wX[nX[ii]-1][ii] = " << wX[nX[ii]-1][ii] <<
" wXW[nX[ii]-1][ii] = " << wXW[nX[ii]-1][ii] << std::endl;
362 std::cout <<
" -icluster.barycenter()*pitch-0.5*pitch = " << -icluster.
barycenter()*pitch-0.5*pitch <<
" -dXXcur = " << -dXXcur <<
" -XXXDelta = " << -XXXDelta << std::endl;
363 std::cout <<
"============================================================" << std::endl;
366 if(copyinlayer==1 && nX[ii]==reshits1)
break;
367 if(copyinlayer !=1 && nX[ii]==reshits2)
break;
374 if(nY[ii] > nmetcury) {
376 ++tyf;
if(sector==1) ++tys1;
if(sector==(sn0-1)) ++tyss;
381 if(nX[ii] > nmetcurx) {
383 ++txf;
if(sector==1) ++txs1;
if(sector==(sn0-1)) ++txss;
392 std::cout <<
"trackFinderSophisticated: tyf= " << tyf<<
" tys1 = " << tys1 <<
" tyss = " << tyss << std::endl;
393 std::cout <<
"trackFinderSophisticated: txf= " << txf<<
" txs1 = " << txs1 <<
" txss = " << txss << std::endl;
394 std::cout <<
"============================================================" << std::endl;
413 int pys1Cut = 3, pyssCut = 1, pyallCut= 5;
435 double sigman=0.18, ssigma = 2.5, sigmam=0.18;
447 sigman=0.30, ssigma = 8.0, sigmam=1.0;
451 std::cout <<
"trackFinderSophisticated: ssigma= " << ssigma << std::endl;
463 int numberXtracks=0, numberYtracks=0, totpl = 2*(pn0-1)*(sn0-1);
double sigma;
465 for (
int xytypecurrent=xytype; xytypecurrent<xytype+1; ++xytypecurrent) {
467 std::cout <<
"trackFinderSophisticated: xytypecurrent= " << xytypecurrent << std::endl;
473 int qAcl[20], qAii[20], fip=0, niteration = 0;
474 int ry = 0, rys1 = 0, ryss = 0;
475 int tas1=tys1, tass=tyss, taf=tyf;
476 bool SelectTracks =
true;
481 double yA[24][20], zA[24][20], wA[24][20];
int nA[20], uA[20];
bool qA[24][20];
485 if(xytypecurrent ==1){
488 tg0= 3*1./(800.+20.);
492 for (
int ii=0; ii < totpl; ++ii) {
494 std::cout <<
"trackFinderSophisticated: ii= " << ii <<
" nY[ii]= " << nY[ii] << std::endl;
495 std::cout <<
"trackFinderSophisticated: ii= " << ii <<
" uY[ii]= " << uY[ii] << std::endl;
499 for (
int cl=0;
cl<nA[ii]; ++
cl) {
501 std::cout <<
" cl= " <<
cl <<
" yY[cl][ii]= " << yY[
cl][ii] << std::endl;
502 std::cout <<
" zY[cl][ii]= " << zY[
cl][ii] <<
" wY[cl][ii]= " << wY[
cl][ii] <<
" qY[cl][ii]= " << qY[
cl][ii] << std::endl;
504 yA[
cl][ii] = yY[
cl][ii];
505 zA[
cl][ii] = zY[
cl][ii];
506 wA[
cl][ii] = wY[
cl][ii];
507 qA[
cl][ii] = qY[
cl][ii];
514 else if(xytypecurrent ==2){
517 tg0= 3*2./(800.+20.);
521 for (
int ii=0; ii < totpl; ++ii) {
523 std::cout <<
"trackFinderSophisticated: ii= " << ii <<
" nX[ii]= " << nX[ii] << std::endl;
524 std::cout <<
"trackFinderSophisticated: ii= " << ii <<
" uX[ii]= " << uX[ii] << std::endl;
528 for (
int cl=0;
cl<nA[ii]; ++
cl) {
530 std::cout <<
" cl= " <<
cl <<
" xX[cl][ii]= " << xX[
cl][ii] << std::endl;
531 std::cout <<
" zX[cl][ii]= " << zX[
cl][ii] <<
" wX[cl][ii]= " << wX[
cl][ii] <<
" qX[cl][ii]= " << qX[
cl][ii] << std::endl;
533 yA[
cl][ii] = xX[
cl][ii];
534 zA[
cl][ii] = zX[
cl][ii];
535 wA[
cl][ii] = wX[
cl][ii];
536 qA[
cl][ii] = qX[
cl][ii];
546 std::cout <<
" start road finder " << std::endl;
549 double fyY[20], fzY[20], fwY[20];
550 double fyYW[20], fwYW[20];
551 int py = 0, pys1 = 0, pyss = 0;
552 bool NewStation =
false, py1first =
false;
553 for (
int sector=1; sector < sn0; ++sector) {
554 double tav=0., t1=0., t2=0.,
t=0., sm;
559 for (
int zmodule=1; zmodule<pn0; ++zmodule) {
560 for (
int justlayer=zbeg; justlayer<zmax; justlayer++) {
564 unsigned int ii = theFP420NumberingScheme->FP420NumberingScheme::packMYIndex(nlayers,pn0,sn0,detfixed,justlayer,sector,zmodule)-1;
567 if(nA[ii]!=0 && uA[ii]!= nA[ii]) {
569 ++py;
if(sector==1) ++pys1;
if(sector==(sn0-1)) ++pyss;
570 if(py==2 && sector==1) {
572 double dymin=9999999., df2;
int cl2=-1;
573 for (
int cl=0;
cl<nA[ii]; ++
cl) {
584 t=(yA[
cl2][ii]-fyY[fip])/(zA[cl2][ii]-fzY[fip]);
588 std::cout <<
" t= " <<
t <<
" tg0= " << tg0 << std::endl;
592 fyY[py-1]=yA[
cl2][ii];
593 fzY[py-1]=zA[
cl2][ii];
594 fwY[py-1]=wA[
cl2][ii];
599 std::cout <<
" point is taken, mark it for not using again uA[ii]= " << uA[ii] << std::endl;
602 ++
ry;
if(sector==1) ++rys1;
if(sector==(sn0-1)) ++ryss;
606 py--;
if(sector==1) pys1--;
if(sector==(sn0-1)) pyss--;
607 t1 -=
t*wA[
cl2][ii]; t2 -= wA[
cl2][ii];
611 py--;
if(sector==1) pys1--;
if(sector==(sn0-1)) pyss--;
616 bool clLoopTrue =
true;
618 for (
int clind=0; clind<nA[ii]; ++clind) {
628 fyY[py-1]=yA[
cl][ii];
629 fzY[py-1]=zA[
cl][ii];
630 fwY[py-1]=wA[
cl][ii];
634 if (verbos > 0)
std::cout <<
" point is taken, mark it uA[ii]= " << uA[ii] << std::endl;
637 ++
ry;
if(sector==1) ++rys1;
if(sector==(sn0-1)) ++ryss;
647 sigma = ssigma/(sn0-1-sector);
651 if(stattimes==1 || sector==3 ) sigma = sigmam;
654 double cov00, cov01, cov11, c0Y, c1Y, chisqY;
655 gsl_fit_wlinear (fzY, 1, fwY, 1, fyY, 1, py-1,
656 &c0Y, &c1Y, &cov00, &cov01, &cov11,
661 double dymin=9999999., df2;
662 for (
int clmatch=0; clmatch<nA[ii]; ++clmatch) {
664 double smmatch = c0Y+ c1Y*zA[clmatch][ii];
665 df2 =
std::abs(smmatch-yA[clmatch][ii]);
678 sm = c0Y+ c1Y*zA[
cl][ii];
681 std::cout <<
" sector= " << sector <<
" sn0= " << sn0 <<
" sigma= " << sigma << std::endl;
682 std::cout <<
" stattimes= " << stattimes <<
" ssigma= " << ssigma <<
" sigmam= " << sigmam << std::endl;
683 std::cout <<
" sm= " << sm <<
" c0Y= " << c0Y <<
" c1Y= " << c1Y <<
" chisqY= " << chisqY << std::endl;
684 std::cout <<
" zA[cl][ii]= " << zA[
cl][ii] <<
" ii= " << ii <<
" cl= " << cl << std::endl;
685 for (
int ct=0; ct<py-1; ++ct) {
686 std::cout <<
" py-1= " << py-1 <<
" fzY[ct]= " << fzY[ct] << std::endl;
687 std::cout <<
" fyY[ct]= " << fyY[ct] <<
" fwY[ct]= " << fwY[ct] << std::endl;
693 t=(yA[
cl][ii]-fyY[fip])/(zA[cl][ii]-fzY[fip]);
697 sm = fyY[fip]+tav*(zA[
cl][ii]-fzY[fip]);
702 double diffpo = yA[
cl][ii]-sm;
704 std::cout <<
" diffpo= " << diffpo <<
" yA[cl][ii]= " << yA[
cl][ii] <<
" sm= " << sm <<
" sigma= " << sigma << std::endl;
714 else if(stattimes==2){
716 t=(yA[
cl][ii]-fyY[fip])/(zA[cl][ii]-fzY[fip]);
723 fyY[py-1]=yA[
cl][ii];
724 fzY[py-1]=zA[
cl][ii];
725 fwY[py-1]=wA[
cl][ii];
731 std::cout <<
" 3333 point is taken, mark it uA[ii]= " << uA[ii] << std::endl;
734 ++
ry;
if(sector==1) ++rys1;
if(sector==(sn0-1)) ++ryss;
739 t1 -=
t*wA[
cl][ii]; t2 -= wA[
cl][ii];
743 if(!qA[cl][ii])
break;
748 if( (py!=1 && clcurr != -1 && qA[clcurr][ii]) || (py==1 && !py1first)) {
750 py--;
if(sector==1) pys1--;
if(sector==(sn0-1)) pyss--;
761 std::cout <<
"END: pys1= " << pys1 <<
" pyss = " << pyss <<
" py = " << py << std::endl;
765 if( pys1 < pys1Cut || pyss < pyssCut || py < pyallCut ){
771 double cov00, cov01, cov11;
772 double c0Y, c1Y, chisqY;
773 gsl_fit_wlinear (fzY, 1, fwY, 1, fyY, 1, py,
774 &c0Y, &c1Y, &cov00, &cov01, &cov11,
789 chindfx = chisqY/(py-2);
797 std::cout <<
" Do FIT XZ: chindfx= " << chindfx <<
" chisqY= " << chisqY <<
" py= " << py << std::endl;
802 std::cout <<
" preparation for second order fit for Wide pixels= " << std::endl;
804 for (
int ipy=0; ipy<py; ++ipy) {
805 if(xytypecurrent ==1){
806 fyYW[ipy]=xYW[qAcl[ipy]][qAii[ipy]];
807 fwYW[ipy]=wYW[qAcl[ipy]][qAii[ipy]];
809 std::cout <<
" ipy= " << ipy << std::endl;
810 std::cout <<
" qAcl[ipy]= " << qAcl[ipy] <<
" qAii[ipy]= " << qAii[ipy] << std::endl;
811 std::cout <<
" fyYW[ipy]= " << fyYW[ipy] <<
" fwYW[ipy]= " << fwYW[ipy] << std::endl;
814 else if(xytypecurrent ==2){
815 fyYW[ipy]=yXW[qAcl[ipy]][qAii[ipy]];
816 fwYW[ipy]=wXW[qAcl[ipy]][qAii[ipy]];
818 std::cout <<
" ipy= " << ipy << std::endl;
819 std::cout <<
" qAcl[ipy]= " << qAcl[ipy] <<
" qAii[ipy]= " << qAii[ipy] << std::endl;
820 std::cout <<
" fyYW[ipy]= " << fyYW[ipy] <<
" fwYW[ipy]= " << fwYW[ipy] << std::endl;
828 std::cout <<
" start second order fit for Wide pixels= " << std::endl;
830 double wov00, wov01, wov11;
831 double w0Y, w1Y, whisqY;
832 gsl_fit_wlinear (fzY, 1, fwYW, 1, fyYW, 1, py,
833 &w0Y, &w1Y, &wov00, &wov01, &wov11,
841 chindfy = whisqY/(py-2);
849 std::cout <<
" chindfy= " << chindfy <<
" chiCutY= " << chiCutY << std::endl;
853 if(xytypecurrent ==1){
854 if(chindfx < chiCutX && chindfy < chiCutY) {
856 Ay[numberYtracks-1] = c0Y;
857 By[numberYtracks-1] = c1Y;
858 Cy[numberYtracks-1] = chisqY;
860 My[numberYtracks-1] = py;
861 AyW[numberYtracks-1] = w0Y;
862 ByW[numberYtracks-1] = w1Y;
863 CyW[numberYtracks-1] = whisqY;
864 MyW[numberYtracks-1] = py;
867 std::cout <<
" niteration = " << niteration << std::endl;
868 std::cout <<
" chindfy= " << chindfy <<
" py= " << py << std::endl;
869 std::cout <<
" c0Y= " << c0Y <<
" c1Y= " << c1Y << std::endl;
870 std::cout <<
" pys1= " << pys1 <<
" pyss = " << pyss << std::endl;
875 else if(xytypecurrent ==2){
876 if(chindfx < chiCutX && chindfy < chiCutY) {
878 Ax[numberXtracks-1] = c0Y;
879 Bx[numberXtracks-1] = c1Y;
880 Cx[numberXtracks-1] = chisqY;
882 Mx[numberXtracks-1] = py;
883 AxW[numberXtracks-1] = w0Y;
884 BxW[numberXtracks-1] = w1Y;
885 CxW[numberXtracks-1] = whisqY;
886 MxW[numberXtracks-1] = py;
888 std::cout <<
" niteration = " << niteration << std::endl;
889 std::cout <<
" chindfx= " << chindfy <<
" px= " << py << std::endl;
890 std::cout <<
" c0X= " << c0Y <<
" c1X= " << c1Y << std::endl;
891 std::cout <<
" pxs1= " << pys1 <<
" pxss = " << pyss << std::endl;
901 std::cout <<
"Current iteration, niteration >= " << niteration << std::endl;
902 std::cout <<
" numberYtracks= " << numberYtracks << std::endl;
903 std::cout <<
" numberXtracks= " << numberXtracks << std::endl;
904 std::cout <<
" pys1= " << pys1 <<
" pyss = " << pyss <<
" py = " << py << std::endl;
905 std::cout <<
" tas1= " << tas1 <<
" tass = " << tass <<
" taf = " << taf << std::endl;
906 std::cout <<
" rys1= " << rys1 <<
" ryss = " << ryss <<
" ry = " << ry << std::endl;
907 std::cout <<
" tas1-rys1= " << tas1-rys1 <<
" tass-ryss = " << tass-ryss <<
" taf-ry = " << taf-ry << std::endl;
908 std::cout <<
"---------------------------------------------------------- " << std::endl;
911 if( tas1-rys1<pys1Cut || tass-ryss<pyssCut || taf-ry<pyallCut ){
912 SelectTracks =
false;
918 }
while(SelectTracks && niteration < nitMax );
930 std::cout <<
" numberXtracks= " << numberXtracks <<
" numberYtracks= " << numberYtracks << std::endl;
944 std::cout <<
" numberXtracks= " << numberXtracks <<
" numberYtracks= " << numberYtracks << std::endl;
946 if(numberXtracks>0) {
947 int newxnum[10], newynum[10];
950 double dthmin= 999999.;
951 int trminx=-1, trminy=-1;
952 for (
int trx=0; trx<numberXtracks; ++trx) {
954 std::cout <<
"----------- trx= " << trx <<
" nmathed= " << nmathed << std::endl;
956 for (
int tr=0; tr<numberYtracks; ++tr) {
958 std::cout <<
"--- tr= " << tr <<
" nmathed= " << nmathed << std::endl;
961 for (
int nmx=0; nmx<nmathed; ++nmx) {
962 if(trx==newxnum[nmx]) YesY=
true;
964 for (
int nm=0; nm<nmathed; ++nm) {
965 if(tr==newynum[nm]) YesY=
true;
981 std::cout <<
" abs(AxW[trx]-Ay[tr]) = " <<
std::abs(AxW[trx]-Ay[tr]) <<
" abs(BxW[trx]-By[tr])= " <<
std::abs(BxW[trx]-By[tr]) <<
" dthdif= " << dthdif << std::endl;
984 if( dthdif < dthmin ) {
995 newxnum[nmathed-1] = trminx;
998 newxnum[nmathed-1] = nmathed-1;
1001 std::cout <<
" trminx= " << trminx << std::endl;
1003 if(nmathed>numberYtracks){
1004 newynum[nmathed-1] = -1;
1006 std::cout <<
"!!! nmathed= " << nmathed <<
" > numberYtracks= " << numberYtracks << std::endl;
1011 std::cout <<
" trminy= " << trminy << std::endl;
1013 newynum[nmathed-1] = trminy;
1015 }
while(nmathed<numberXtracks && nmathed < restracks);
1020 for (
int tr=0; tr<nmathed; ++tr) {
1035 std::cout <<
" for track tr= " << tr <<
" tx= " << tx <<
" ty= " << ty << std::endl;
1036 std::cout <<
" Ax= " << Ax[tx] <<
" Ay= " << Ay[ty] << std::endl;
1037 std::cout <<
" Bx= " << Bx[tx] <<
" By= " << By[ty] << std::endl;
1038 std::cout <<
" Cx= " << Cx[tx] <<
" Cy= " << Cy[ty] << std::endl;
1039 std::cout <<
" Mx= " << Mx[tx] <<
" My= " << My[ty] << std::endl;
1040 std::cout <<
" AxW= " << AxW[tx] <<
" AyW= " << AyW[ty] << std::endl;
1041 std::cout <<
" BxW= " << BxW[tx] <<
" ByW= " << ByW[ty] << std::endl;
1042 std::cout <<
" CxW= " << CxW[tx] <<
" CyW= " << CyW[ty] << std::endl;
1043 std::cout <<
" MxW= " << MxW[tx] <<
" MyW= " << MyW[ty] << std::endl;
1047 rhits.push_back(
TrackFP420(Ax[tx],Bx[tx],Cx[tx],Mx[tx],Ay[ty],By[ty],Cy[ty],My[ty]) );
1055 else if(xytype==1) {
1056 for (
int ty=0; ty<numberYtracks; ++ty) {
1058 std::cout <<
" for track ty= " << ty << std::endl;
1059 std::cout <<
" Ay= " << Ay[ty] << std::endl;
1060 std::cout <<
" By= " << By[ty] << std::endl;
1061 std::cout <<
" Cy= " << Cy[ty] << std::endl;
1062 std::cout <<
" My= " << My[ty] << std::endl;
1063 std::cout <<
" AyW= " << AyW[ty] << std::endl;
1064 std::cout <<
" ByW= " << ByW[ty] << std::endl;
1065 std::cout <<
" CyW= " << CyW[ty] << std::endl;
1066 std::cout <<
" MyW= " << MyW[ty] << std::endl;
1068 rhits.push_back(
TrackFP420(AyW[ty],ByW[ty],CyW[ty],MyW[ty],Ay[ty],By[ty],Cy[ty],My[ty]) );
1073 else if(xytype==2) {
1074 for (
int tx=0; tx<numberXtracks; ++tx) {
1076 std::cout <<
" for track tx= " << tx << std::endl;
1077 std::cout <<
" Ax= " << Ax[tx] << std::endl;
1078 std::cout <<
" Bx= " << Bx[tx] << std::endl;
1079 std::cout <<
" Cx= " << Cx[tx] << std::endl;
1080 std::cout <<
" Mx= " << Mx[tx] << std::endl;
1081 std::cout <<
" AxW= " << AxW[tx] << std::endl;
1082 std::cout <<
" BxW= " << BxW[tx] << std::endl;
1083 std::cout <<
" CxW= " << CxW[tx] << std::endl;
1084 std::cout <<
" MxW= " << MxW[tx] << std::endl;
1086 rhits.push_back(
TrackFP420(Ax[tx],Bx[tx],Cx[tx],Mx[tx],AxW[tx],BxW[tx],CxW[tx],MxW[tx]) );
std::vector< TrackFP420 > trackFinderSophisticated(edm::Handle< ClusterCollectionFP420 > input, int det)
std::vector< ClusterFP420 >::const_iterator ContainerIterator
const std::vector< short > & amplitudes() const
float barycerrorW() const
float barycenterW() const
TrackProducerFP420(int, int, int, int, double, double, double, double, double, double, double, double, double, double, double, double, double, bool, bool, bool, bool, double, double, float, float, double, int, double, double)
std::pair< ContainerIterator, ContainerIterator > Range