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;
85 std::vector<TrackFP420> rhits;
87 rhits.reserve(restracks);
89 double Ax[10];
double Bx[10];
double Cx[10];
int Mx[10];
90 double Ay[10];
double By[10];
double Cy[10];
int My[10];
91 double AxW[10];
double BxW[10];
double CxW[10];
int MxW[10];
92 double AyW[10];
double ByW[10];
double CyW[10];
int MyW[10];
94 std::cout <<
"===============================================================================" << std::endl;
95 std::cout <<
"=================================================================" << std::endl;
96 std::cout <<
"==========================================================" << std::endl;
98 std::cout <<
"TrackProducerFP420: Start trackFinderSophisticated " << std::endl;
103 if( xytype < 1 || xytype > 2 ){
104 std::cout <<
"TrackProducerFP420:ERROR in trackFinderSophisticated: check xytype = " << xytype << std::endl;
110 std::cout <<
"TrackProducerFP420:ERROR in trackFinderSophisticated: check sn0 (configuration) = " << sn0 << std::endl;
114 int zbeg = 1,
zmax=3;
122 double zX[24][20], xX[24][20], wX[24][20];
123 double zY[24][20], yY[24][20], wY[24][20];
124 double yXW[24][20], wXW[24][20];
125 double xYW[24][20], wYW[24][20];
126 bool qX[24][20], qY[24][20];
128 int txf = 0;
int txs1 = 0;
int txss = 0;
129 int tyf = 0;
int tys1 = 0;
int tyss = 0;
144 float Xshift = pitch/2.;
145 float Yshift = pitchW/2.;
150 unsigned int ii0 = 999999;
151 int allplacesforsensors=7;
152 for (
int sector=1; sector < sn0; sector++) {
153 for (
int zmodule=1; zmodule<pn0; zmodule++) {
154 for (
int zsideinorder=1; zsideinorder<allplacesforsensors; zsideinorder++) {
157 std::cout <<
"TrackProducerFP420: sector= " << sector <<
" zmodule= " << zmodule <<
" zsideinorder= " << zsideinorder <<
" zside= " << zside <<
" det= " << det << std::endl;
161 if(justlayer<1||justlayer>2) {
162 std::cout <<
"TrackProducerFP420:WRONG justlayer= " << justlayer << std::endl;
165 if(copyinlayer<1||copyinlayer>3) {
166 std::cout <<
"TrackProducerFP420:WRONG copyinlayer= " << copyinlayer << std::endl;
169 if(orientation<1||orientation>2) {
170 std::cout <<
"TrackProducerFP420:WRONG orientation= " << orientation << std::endl;
181 std::cout <<
"TrackProducerFP420: justlayer= " << justlayer <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
184 double zdiststat = 0.;
186 if(sector==2) zdiststat = zD3;
189 if(sector==2) zdiststat = zD2;
190 if(sector==3) zdiststat = zD3;
192 double kplane = -(pn0-1)/2 - 0.5 + (zmodule-1);
193 double zcurrent = zinibeg + z420 + (ZSiStep-ZSiPlane)/2 + kplane*ZSiStep + zdiststat;
197 if(orientation==1) zcurrent += (ZGapLDet+ZSiDet/2);
198 if(orientation==2) zcurrent += zBlade-(ZGapLDet+ZSiDet/2);
201 if(orientation==1) zcurrent += (ZGapLDet+ZSiDet/2)+zBlade+gapBlade;
202 if(orientation==2) zcurrent += 2*zBlade+gapBlade-(ZGapLDet+ZSiDet/2);
206 if(det == 2) zcurrent = -zcurrent;
221 if (UseHalfPitchShiftInX ==
true){
225 if (UseHalfPitchShiftInXW ==
true){
230 double XXXDelta = 0.0;
231 if(copyinlayer==2) { XXXDelta = XsensorSize;}
232 if(copyinlayer==3) { XXXDelta = 2.*XsensorSize;}
233 double YYYDelta = 0.0;
234 if(copyinlayer==2) { YYYDelta = XsensorSize;}
235 if(copyinlayer==3) { YYYDelta = 2.*XsensorSize;}
241 std::cout <<
"TrackProducerFP420: check iu = " << iu << std::endl;
242 std::cout <<
"TrackProducerFP420: sector= " << sector <<
" zmodule= " << zmodule <<
" zside= " << zside <<
" det= " << det <<
" rn0= " << rn0 <<
" pn0= " << pn0 <<
" sn0= " << sn0 <<
" copyinlayer= " << copyinlayer << std::endl;
245 std::vector<ClusterFP420> currentclust;
246 currentclust.clear();
248 outputRange = input->get(iu);
252 for ( ;sort_begin != sort_end; ++sort_begin ) {
254 currentclust.push_back(*sort_begin);
258 std::cout <<
"TrackProducerFP420: currentclust.size = " << currentclust.size() << std::endl;
262 std::vector<ClusterFP420>::const_iterator simHitIter = currentclust.begin();
263 std::vector<ClusterFP420>::const_iterator simHitIterEnd = currentclust.end();
282 for (;simHitIter != simHitIterEnd; ++simHitIter) {
291 if(copyinlayer==1 && nY[ii]>reshits1){
293 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;
295 if(copyinlayer !=1 && nY[ii]>reshits2){
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 zY[nY[
ii]-1][
ii] = zcurrent;
300 yY[nY[
ii]-1][
ii] = icluster.
barycenter()*pitch+0.5*pitch+YYYDelta;
303 yY[nY[
ii]-1][
ii] = yY[nY[
ii]-1][
ii] - dYYcur;
305 wY[nY[
ii]-1][
ii] *= wY[nY[
ii]-1][
ii];
307 xYW[nY[
ii]-1][
ii] =(xYW[nY[
ii]-1][
ii]+dYYWcur);
310 xYW[nY[
ii]-1][
ii] =-(xYW[nY[
ii]-1][
ii]+dYYWcur);
313 wYW[nY[
ii]-1][
ii] *= wYW[nY[
ii]-1][
ii];
314 qY[nY[
ii]-1][
ii] =
true;
315 if(copyinlayer==1 && nY[ii]==reshits1)
break;
316 if(copyinlayer !=1 && nY[ii]==reshits2)
break;
322 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;
324 if(copyinlayer==1 && nX[ii]>reshits1){
325 std::cout <<
"WARNING-ERROR:TrackproducerFP420: nX[ii]= " << nX[
ii] <<
" bigger reservated number of hits" <<
" currentclust.size()= " << currentclust.size() <<
" copyinlayer= " << copyinlayer <<
" ii= " << ii << std::endl;
328 if(copyinlayer !=1 && nX[ii]>reshits2){
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 zX[nX[
ii]-1][
ii] = zcurrent;
333 xX[nX[
ii]-1][
ii] = icluster.
barycenter()*pitch+0.5*pitch+XXXDelta;
336 xX[nX[
ii]-1][
ii] =-(xX[nX[
ii]-1][
ii]+dXXcur);
338 wX[nX[
ii]-1][
ii] *= wX[nX[
ii]-1][
ii];
340 yXW[nX[
ii]-1][
ii] = -(yXW[nX[
ii]-1][
ii] - dXXWcur);
343 yXW[nX[
ii]-1][
ii] = yXW[nX[
ii]-1][
ii] - dXXWcur;
346 wXW[nX[
ii]-1][
ii] *= wXW[nX[
ii]-1][
ii];
347 qX[nX[
ii]-1][
ii] =
true;
349 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;
350 std::cout <<
" XXXDelta= " << XXXDelta <<
" dXXcur= " << dXXcur <<
" -dXXWcur= " << -dXXWcur << std::endl;
351 std::cout <<
" icluster.barycerrorW()*pitchW= " << icluster.
barycerrorW()*pitchW <<
" wXW[nX[ii]-1][ii]= " <<wXW[nX[
ii]-1][
ii] << std::endl;
352 std::cout <<
" -icluster.barycenterW()*pitchW+0.5*pitchW = " << icluster.
barycenterW()*pitchW+0.5*pitchW << std::endl;
353 std::cout <<
"============================================================" << std::endl;
356 std::cout <<
"trackFinderSophisticated: nX[ii]= " << nX[
ii]<<
" ii = " << ii <<
" zcurrent = " << zcurrent <<
" xX[nX[ii]-1][ii] = " << xX[nX[
ii]-1][
ii] << std::endl;
357 std::cout <<
" wX[nX[ii]-1][ii] = " << wX[nX[
ii]-1][
ii] <<
" wXW[nX[ii]-1][ii] = " << wXW[nX[
ii]-1][
ii] << std::endl;
358 std::cout <<
" -icluster.barycenter()*pitch-0.5*pitch = " << -icluster.
barycenter()*pitch-0.5*pitch <<
" -dXXcur = " << -dXXcur <<
" -XXXDelta = " << -XXXDelta << std::endl;
359 std::cout <<
"============================================================" << std::endl;
362 if(copyinlayer==1 && nX[ii]==reshits1)
break;
363 if(copyinlayer !=1 && nX[ii]==reshits2)
break;
370 if(nY[ii] > nmetcury) {
372 ++tyf;
if(sector==1) ++tys1;
if(sector==(sn0-1)) ++tyss;
377 if(nX[ii] > nmetcurx) {
379 ++txf;
if(sector==1) ++txs1;
if(sector==(sn0-1)) ++txss;
388 std::cout <<
"trackFinderSophisticated: tyf= " << tyf<<
" tys1 = " << tys1 <<
" tyss = " << tyss << std::endl;
389 std::cout <<
"trackFinderSophisticated: txf= " << txf<<
" txs1 = " << txs1 <<
" txss = " << txss << std::endl;
390 std::cout <<
"============================================================" << std::endl;
409 int pys1Cut = 3, pyssCut = 1, pyallCut= 5;
431 double sigman=0.18, ssigma = 2.5, sigmam=0.18;
443 sigman=0.30, ssigma = 8.0, sigmam=1.0;
447 std::cout <<
"trackFinderSophisticated: ssigma= " << ssigma << std::endl;
459 int numberXtracks=0, numberYtracks=0, totpl = 2*(pn0-1)*(sn0-1);
double sigma;
461 for (
int xytypecurrent=xytype; xytypecurrent<xytype+1; ++xytypecurrent) {
463 std::cout <<
"trackFinderSophisticated: xytypecurrent= " << xytypecurrent << std::endl;
469 int qAcl[20], qAii[20], fip=0, niteration = 0;
470 int ry = 0, rys1 = 0, ryss = 0;
471 int tas1=tys1, tass=tyss, taf=tyf;
472 bool SelectTracks =
true;
477 double yA[24][20], zA[24][20], wA[24][20];
int nA[20], uA[20];
bool qA[24][20];
481 if(xytypecurrent ==1){
484 tg0= 3*1./(800.+20.);
488 for (
int ii=0;
ii < totpl; ++
ii) {
490 std::cout <<
"trackFinderSophisticated: ii= " <<
ii <<
" nY[ii]= " << nY[
ii] << std::endl;
491 std::cout <<
"trackFinderSophisticated: ii= " <<
ii <<
" uY[ii]= " << uY[
ii] << std::endl;
497 std::cout <<
" cl= " <<
cl <<
" yY[cl][ii]= " << yY[
cl][
ii] << std::endl;
498 std::cout <<
" zY[cl][ii]= " << zY[
cl][
ii] <<
" wY[cl][ii]= " << wY[
cl][
ii] <<
" qY[cl][ii]= " << qY[
cl][
ii] << std::endl;
510 else if(xytypecurrent ==2){
513 tg0= 3*2./(800.+20.);
517 for (
int ii=0;
ii < totpl; ++
ii) {
519 std::cout <<
"trackFinderSophisticated: ii= " <<
ii <<
" nX[ii]= " << nX[
ii] << std::endl;
520 std::cout <<
"trackFinderSophisticated: ii= " <<
ii <<
" uX[ii]= " << uX[
ii] << std::endl;
526 std::cout <<
" cl= " <<
cl <<
" xX[cl][ii]= " << xX[
cl][
ii] << std::endl;
527 std::cout <<
" zX[cl][ii]= " << zX[
cl][
ii] <<
" wX[cl][ii]= " << wX[
cl][
ii] <<
" qX[cl][ii]= " << qX[
cl][
ii] << std::endl;
542 std::cout <<
" start road finder " << std::endl;
545 double fyY[20], fzY[20], fwY[20];
546 double fyYW[20], fwYW[20];
547 int py = 0, pys1 = 0, pyss = 0;
548 bool NewStation =
false, py1first =
false;
549 for (
int sector=1; sector < sn0; ++sector) {
550 double tav=0., t1=0.,
t2=0.,
t=0., sm;
555 for (
int zmodule=1; zmodule<pn0; ++zmodule) {
556 for (
int justlayer=zbeg; justlayer<
zmax; justlayer++) {
563 if(nA[ii]!=0 && uA[ii]!= nA[ii]) {
565 ++py;
if(sector==1) ++pys1;
if(sector==(sn0-1)) ++pyss;
566 if(py==2 && sector==1) {
568 double dymin=9999999., df2;
int cl2=-1;
580 t=(yA[
cl2][
ii]-fyY[fip])/(zA[cl2][ii]-fzY[fip]);
584 std::cout <<
" t= " <<
t <<
" tg0= " << tg0 << std::endl;
588 fyY[py-1]=yA[
cl2][
ii];
589 fzY[py-1]=zA[
cl2][
ii];
590 fwY[py-1]=wA[
cl2][
ii];
595 std::cout <<
" point is taken, mark it for not using again uA[ii]= " << uA[
ii] << std::endl;
598 ++
ry;
if(sector==1) ++rys1;
if(sector==(sn0-1)) ++ryss;
602 py--;
if(sector==1) pys1--;
if(sector==(sn0-1)) pyss--;
607 py--;
if(sector==1) pys1--;
if(sector==(sn0-1)) pyss--;
612 bool clLoopTrue =
true;
614 for (
int clind=0; clind<nA[
ii]; ++clind) {
624 fyY[py-1]=yA[
cl][
ii];
625 fzY[py-1]=zA[
cl][
ii];
626 fwY[py-1]=wA[
cl][
ii];
630 if (verbos > 0)
std::cout <<
" point is taken, mark it uA[ii]= " << uA[
ii] << std::endl;
633 ++
ry;
if(sector==1) ++rys1;
if(sector==(sn0-1)) ++ryss;
643 sigma = ssigma/(sn0-1-sector);
647 if(stattimes==1 || sector==3 ) sigma = sigmam;
650 double cov00, cov01, cov11, c0Y, c1Y, chisqY;
651 gsl_fit_wlinear (fzY, 1, fwY, 1, fyY, 1, py-1,
652 &c0Y, &c1Y, &cov00, &cov01, &cov11,
657 double dymin=9999999., df2;
658 for (
int clmatch=0; clmatch<nA[
ii]; ++clmatch) {
660 double smmatch = c0Y+ c1Y*zA[clmatch][
ii];
661 df2 =
std::abs(smmatch-yA[clmatch][ii]);
674 sm = c0Y+ c1Y*zA[
cl][
ii];
677 std::cout <<
" sector= " << sector <<
" sn0= " << sn0 <<
" sigma= " << sigma << std::endl;
678 std::cout <<
" stattimes= " << stattimes <<
" ssigma= " << ssigma <<
" sigmam= " << sigmam << std::endl;
679 std::cout <<
" sm= " << sm <<
" c0Y= " << c0Y <<
" c1Y= " << c1Y <<
" chisqY= " << chisqY << std::endl;
680 std::cout <<
" zA[cl][ii]= " << zA[
cl][
ii] <<
" ii= " << ii <<
" cl= " << cl << std::endl;
681 for (
int ct=0; ct<py-1; ++ct) {
682 std::cout <<
" py-1= " << py-1 <<
" fzY[ct]= " << fzY[ct] << std::endl;
683 std::cout <<
" fyY[ct]= " << fyY[ct] <<
" fwY[ct]= " << fwY[ct] << std::endl;
689 t=(yA[
cl][
ii]-fyY[fip])/(zA[cl][ii]-fzY[fip]);
693 sm = fyY[fip]+tav*(zA[
cl][
ii]-fzY[fip]);
698 double diffpo = yA[
cl][
ii]-sm;
700 std::cout <<
" diffpo= " << diffpo <<
" yA[cl][ii]= " << yA[
cl][
ii] <<
" sm= " << sm <<
" sigma= " << sigma << std::endl;
710 else if(stattimes==2){
712 t=(yA[
cl][
ii]-fyY[fip])/(zA[cl][ii]-fzY[fip]);
719 fyY[py-1]=yA[
cl][
ii];
720 fzY[py-1]=zA[
cl][
ii];
721 fwY[py-1]=wA[
cl][
ii];
727 std::cout <<
" 3333 point is taken, mark it uA[ii]= " << uA[
ii] << std::endl;
730 ++
ry;
if(sector==1) ++rys1;
if(sector==(sn0-1)) ++ryss;
739 if(!qA[cl][ii])
break;
744 if( (py!=1 && clcurr != -1 && qA[clcurr][ii]) || (py==1 && !py1first)) {
746 py--;
if(sector==1) pys1--;
if(sector==(sn0-1)) pyss--;
757 std::cout <<
"END: pys1= " << pys1 <<
" pyss = " << pyss <<
" py = " << py << std::endl;
761 if( pys1 < pys1Cut || pyss < pyssCut || py < pyallCut ){
767 double cov00, cov01, cov11;
768 double c0Y, c1Y, chisqY;
769 gsl_fit_wlinear (fzY, 1, fwY, 1, fyY, 1, py,
770 &c0Y, &c1Y, &cov00, &cov01, &cov11,
785 chindfx = chisqY/(py-2);
793 std::cout <<
" Do FIT XZ: chindfx= " << chindfx <<
" chisqY= " << chisqY <<
" py= " << py << std::endl;
798 std::cout <<
" preparation for second order fit for Wide pixels= " << std::endl;
800 for (
int ipy=0; ipy<py; ++ipy) {
801 if(xytypecurrent ==1){
802 fyYW[ipy]=xYW[qAcl[ipy]][qAii[ipy]];
803 fwYW[ipy]=wYW[qAcl[ipy]][qAii[ipy]];
805 std::cout <<
" ipy= " << ipy << std::endl;
806 std::cout <<
" qAcl[ipy]= " << qAcl[ipy] <<
" qAii[ipy]= " << qAii[ipy] << std::endl;
807 std::cout <<
" fyYW[ipy]= " << fyYW[ipy] <<
" fwYW[ipy]= " << fwYW[ipy] << std::endl;
810 else if(xytypecurrent ==2){
811 fyYW[ipy]=yXW[qAcl[ipy]][qAii[ipy]];
812 fwYW[ipy]=wXW[qAcl[ipy]][qAii[ipy]];
814 std::cout <<
" ipy= " << ipy << std::endl;
815 std::cout <<
" qAcl[ipy]= " << qAcl[ipy] <<
" qAii[ipy]= " << qAii[ipy] << std::endl;
816 std::cout <<
" fyYW[ipy]= " << fyYW[ipy] <<
" fwYW[ipy]= " << fwYW[ipy] << std::endl;
824 std::cout <<
" start second order fit for Wide pixels= " << std::endl;
826 double wov00, wov01, wov11;
827 double w0Y, w1Y, whisqY;
828 gsl_fit_wlinear (fzY, 1, fwYW, 1, fyYW, 1, py,
829 &w0Y, &w1Y, &wov00, &wov01, &wov11,
837 chindfy = whisqY/(py-2);
845 std::cout <<
" chindfy= " << chindfy <<
" chiCutY= " << chiCutY << std::endl;
849 if(xytypecurrent ==1){
850 if(chindfx < chiCutX && chindfy < chiCutY) {
852 Ay[numberYtracks-1] = c0Y;
853 By[numberYtracks-1] = c1Y;
854 Cy[numberYtracks-1] = chisqY;
856 My[numberYtracks-1] = py;
857 AyW[numberYtracks-1] = w0Y;
858 ByW[numberYtracks-1] = w1Y;
859 CyW[numberYtracks-1] = whisqY;
860 MyW[numberYtracks-1] = py;
863 std::cout <<
" niteration = " << niteration << std::endl;
864 std::cout <<
" chindfy= " << chindfy <<
" py= " << py << std::endl;
865 std::cout <<
" c0Y= " << c0Y <<
" c1Y= " << c1Y << std::endl;
866 std::cout <<
" pys1= " << pys1 <<
" pyss = " << pyss << std::endl;
871 else if(xytypecurrent ==2){
872 if(chindfx < chiCutX && chindfy < chiCutY) {
874 Ax[numberXtracks-1] = c0Y;
875 Bx[numberXtracks-1] = c1Y;
876 Cx[numberXtracks-1] = chisqY;
878 Mx[numberXtracks-1] = py;
879 AxW[numberXtracks-1] = w0Y;
880 BxW[numberXtracks-1] = w1Y;
881 CxW[numberXtracks-1] = whisqY;
882 MxW[numberXtracks-1] = py;
884 std::cout <<
" niteration = " << niteration << std::endl;
885 std::cout <<
" chindfx= " << chindfy <<
" px= " << py << std::endl;
886 std::cout <<
" c0X= " << c0Y <<
" c1X= " << c1Y << std::endl;
887 std::cout <<
" pxs1= " << pys1 <<
" pxss = " << pyss << std::endl;
897 std::cout <<
"Current iteration, niteration >= " << niteration << std::endl;
898 std::cout <<
" numberYtracks= " << numberYtracks << std::endl;
899 std::cout <<
" numberXtracks= " << numberXtracks << std::endl;
900 std::cout <<
" pys1= " << pys1 <<
" pyss = " << pyss <<
" py = " << py << std::endl;
901 std::cout <<
" tas1= " << tas1 <<
" tass = " << tass <<
" taf = " << taf << std::endl;
902 std::cout <<
" rys1= " << rys1 <<
" ryss = " << ryss <<
" ry = " << ry << std::endl;
903 std::cout <<
" tas1-rys1= " << tas1-rys1 <<
" tass-ryss = " << tass-ryss <<
" taf-ry = " << taf-ry << std::endl;
904 std::cout <<
"---------------------------------------------------------- " << std::endl;
907 if( tas1-rys1<pys1Cut || tass-ryss<pyssCut || taf-ry<pyallCut ){
908 SelectTracks =
false;
914 }
while(SelectTracks && niteration < nitMax );
926 std::cout <<
" numberXtracks= " << numberXtracks <<
" numberYtracks= " << numberYtracks << std::endl;
940 std::cout <<
" numberXtracks= " << numberXtracks <<
" numberYtracks= " << numberYtracks << std::endl;
942 if(numberXtracks>0) {
943 int newxnum[10], newynum[10];
946 double dthmin= 999999.;
947 int trminx=-1, trminy=-1;
948 for (
int trx=0; trx<numberXtracks; ++trx) {
950 std::cout <<
"----------- trx= " << trx <<
" nmathed= " << nmathed << std::endl;
952 for (
int tr=0; tr<numberYtracks; ++tr) {
954 std::cout <<
"--- tr= " << tr <<
" nmathed= " << nmathed << std::endl;
957 for (
int nmx=0; nmx<nmathed; ++nmx) {
958 if(trx==newxnum[nmx]) YesY=
true;
960 for (
int nm=0; nm<nmathed; ++nm) {
961 if(tr==newynum[nm]) YesY=
true;
977 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;
980 if( dthdif < dthmin ) {
991 newxnum[nmathed-1] = trminx;
994 newxnum[nmathed-1] = nmathed-1;
997 std::cout <<
" trminx= " << trminx << std::endl;
999 if(nmathed>numberYtracks){
1000 newynum[nmathed-1] = -1;
1002 std::cout <<
"!!! nmathed= " << nmathed <<
" > numberYtracks= " << numberYtracks << std::endl;
1007 std::cout <<
" trminy= " << trminy << std::endl;
1009 newynum[nmathed-1] = trminy;
1011 }
while(nmathed<numberXtracks && nmathed < restracks);
1016 for (
int tr=0; tr<nmathed; ++tr) {
1031 std::cout <<
" for track tr= " << tr <<
" tx= " << tx <<
" ty= " << ty << std::endl;
1032 std::cout <<
" Ax= " << Ax[tx] <<
" Ay= " << Ay[ty] << std::endl;
1033 std::cout <<
" Bx= " << Bx[tx] <<
" By= " << By[ty] << std::endl;
1034 std::cout <<
" Cx= " << Cx[tx] <<
" Cy= " << Cy[ty] << std::endl;
1035 std::cout <<
" Mx= " << Mx[tx] <<
" My= " << My[ty] << std::endl;
1036 std::cout <<
" AxW= " << AxW[tx] <<
" AyW= " << AyW[ty] << std::endl;
1037 std::cout <<
" BxW= " << BxW[tx] <<
" ByW= " << ByW[ty] << std::endl;
1038 std::cout <<
" CxW= " << CxW[tx] <<
" CyW= " << CyW[ty] << std::endl;
1039 std::cout <<
" MxW= " << MxW[tx] <<
" MyW= " << MyW[ty] << std::endl;
1043 rhits.push_back(
TrackFP420(Ax[tx],Bx[tx],Cx[tx],Mx[tx],Ay[ty],By[ty],Cy[ty],My[ty]) );
1051 else if(xytype==1) {
1052 for (
int ty=0; ty<numberYtracks; ++ty) {
1054 std::cout <<
" for track ty= " << ty << std::endl;
1055 std::cout <<
" Ay= " << Ay[ty] << std::endl;
1056 std::cout <<
" By= " << By[ty] << std::endl;
1057 std::cout <<
" Cy= " << Cy[ty] << std::endl;
1058 std::cout <<
" My= " << My[ty] << std::endl;
1059 std::cout <<
" AyW= " << AyW[ty] << std::endl;
1060 std::cout <<
" ByW= " << ByW[ty] << std::endl;
1061 std::cout <<
" CyW= " << CyW[ty] << std::endl;
1062 std::cout <<
" MyW= " << MyW[ty] << std::endl;
1064 rhits.push_back(
TrackFP420(AyW[ty],ByW[ty],CyW[ty],MyW[ty],Ay[ty],By[ty],Cy[ty],My[ty]) );
1069 else if(xytype==2) {
1070 for (
int tx=0; tx<numberXtracks; ++tx) {
1072 std::cout <<
" for track tx= " << tx << std::endl;
1073 std::cout <<
" Ax= " << Ax[tx] << std::endl;
1074 std::cout <<
" Bx= " << Bx[tx] << std::endl;
1075 std::cout <<
" Cx= " << Cx[tx] << std::endl;
1076 std::cout <<
" Mx= " << Mx[tx] << std::endl;
1077 std::cout <<
" AxW= " << AxW[tx] << std::endl;
1078 std::cout <<
" BxW= " << BxW[tx] << std::endl;
1079 std::cout <<
" CxW= " << CxW[tx] << std::endl;
1080 std::cout <<
" MxW= " << MxW[tx] << std::endl;
1082 rhits.push_back(
TrackFP420(Ax[tx],Bx[tx],Cx[tx],Mx[tx],AxW[tx],BxW[tx],CxW[tx],MxW[tx]) );
static int unpackCopyIndex(int rn0, int zside)
std::vector< TrackFP420 > trackFinderSophisticated(edm::Handle< ClusterCollectionFP420 > input, int det)
std::vector< ClusterFP420 >::const_iterator ContainerIterator
static int realzside(int rn0, int zsideinorder)
const std::vector< short > & amplitudes() const
static int unpackLayerIndex(int rn0, int zside)
float barycerrorW() const
static std::string const input
float barycenterW() const
static unsigned packMYIndex(int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule)
auto const T2 &decltype(t1.eta()) t2
Abs< T >::type abs(const T &t)
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
static int unpackOrientation(int rn0, int zside)