| 12 | extern "C" { | extern "C" { | 
| 13 | void dotrack_(int*, double*, double*, double*, double*, int*); | void dotrack_(int*, double*, double*, double*, double*, int*); | 
| 14 | void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); | void dotrack2_(int*, double*, double*, double*, double*,double*, double*, double*,int*); | 
| 15 | void mini2_(int*,int*,int*); | void mini2_(int*,int*,int*); | 
| 16 | void guess_(); | void guess_(); | 
| 17 | void gufld_(float*, float*); | void gufld_(float*, float*); | 
| 18 |  | float risxeta2_(float *); | 
| 19 |  | float risxeta3_(float *); | 
| 20 |  | float risxeta4_(float *); | 
| 21 |  | float risyeta2_(float *); | 
| 22 | } | } | 
| 23 |  |  | 
| 24 | //-------------------------------------- | //-------------------------------------- | 
| 60 | //    clx = TRefArray(6,0); | //    clx = TRefArray(6,0); | 
| 61 | //    cly = TRefArray(6,0); | //    cly = TRefArray(6,0); | 
| 62 |  |  | 
| 63 |  | TrkParams::SetTrackingMode(); | 
| 64 |  | TrkParams::SetPrecisionFactor(); | 
| 65 |  | TrkParams::SetStepMin(); | 
| 66 |  | TrkParams::SetPFA(); | 
| 67 |  |  | 
| 68 | }; | }; | 
| 69 | //-------------------------------------- | //-------------------------------------- | 
| 70 | // | // | 
| 104 | //    clx = TRefArray(t.clx); | //    clx = TRefArray(t.clx); | 
| 105 | //    cly = TRefArray(t.cly); | //    cly = TRefArray(t.cly); | 
| 106 |  |  | 
| 107 |  | TrkParams::SetTrackingMode(); | 
| 108 |  | TrkParams::SetPrecisionFactor(); | 
| 109 |  | TrkParams::SetStepMin(); | 
| 110 |  | TrkParams::SetPFA(); | 
| 111 |  |  | 
| 112 | }; | }; | 
| 113 | //-------------------------------------- | //-------------------------------------- | 
| 114 | // | // | 
| 365 | } | } | 
| 366 | return (last_plane-first_plane+1); | return (last_plane-first_plane+1); | 
| 367 | } | } | 
| 368 |  | /** | 
| 369 |  | * Returns the reduced chi-square of track x-projection | 
| 370 |  | */ | 
| 371 |  | Float_t  TrkTrack::GetChi2X(){ | 
| 372 |  | float chiq=0; | 
| 373 |  | for(int ip=0; ip<6; ip++)if(XGood(ip))chiq+= pow((xv[ip]-xm[ip])/resx[ip],2.); | 
| 374 |  | if(GetNX()>3)chiq=chiq/(GetNX()-3); | 
| 375 |  | else chiq=0; | 
| 376 |  | if(chiq==0)cout << " Float_t  TrkTrack::GetChi2X() -- WARNING -- value not defined "<<chiq<<endl; | 
| 377 |  | return chiq; | 
| 378 |  | } | 
| 379 |  | /** | 
| 380 |  | * Returns the reduced chi-square of track y-projection | 
| 381 |  | */ | 
| 382 |  | Float_t  TrkTrack::GetChi2Y(){ | 
| 383 |  | float chiq=0; | 
| 384 |  | for(int ip=0; ip<6; ip++)if(YGood(ip))chiq+= pow((yv[ip]-ym[ip])/resy[ip],2.); | 
| 385 |  | if(GetNY()>2)chiq=chiq/(GetNY()-2); | 
| 386 |  | else chiq=0; | 
| 387 |  | if(chiq==0)cout << " Float_t  TrkTrack::GetChi2Y() -- WARNING -- value not defined "<<chiq<<endl; | 
| 388 |  | return chiq; | 
| 389 |  | } | 
| 390 |  | /** | 
| 391 |  | * Returns the logarythm of the likeliwood-function of  track x-projection | 
| 392 |  | */ | 
| 393 |  | Float_t TrkTrack::GetLnLX(){ | 
| 394 |  | float lnl=0; | 
| 395 |  | for(int ip=0; ip<6; ip++) | 
| 396 |  | if( XGood(ip) && tailx[ip]!=0 ) | 
| 397 |  | lnl += (tailx[ip]+1.) * log( (tailx[ip]*pow(resx[ip],2.) + pow(xv[ip]-xm[ip],2.)) / (tailx[ip]*pow(resx[ip],2)) ); | 
| 398 |  | if(GetNX()>3)lnl=lnl/(GetNX()-3); | 
| 399 |  | else lnl=0; | 
| 400 |  | if(lnl==0){ | 
| 401 |  | cout << " Float_t  TrkTrack::GetLnLX() -- WARNING -- value not defined "<<lnl<<endl; | 
| 402 |  | Dump(); | 
| 403 |  | } | 
| 404 |  | return lnl; | 
| 405 |  |  | 
| 406 |  | } | 
| 407 |  | /** | 
| 408 |  | * Returns the logarythm of the likeliwood-function of  track y-projection | 
| 409 |  | */ | 
| 410 |  | Float_t TrkTrack::GetLnLY(){ | 
| 411 |  | float lnl=0; | 
| 412 |  | for(int ip=0; ip<6; ip++) | 
| 413 |  | if( YGood(ip) && taily[ip]!=0 ) | 
| 414 |  | lnl += (taily[ip]+1.) * log( (taily[ip]*pow(resy[ip],2.) + pow(yv[ip]-ym[ip],2.)) / (taily[ip]*pow(resy[ip],2)) ); | 
| 415 |  | if(GetNY()>2)lnl=lnl/(GetNY()-2); | 
| 416 |  | else lnl=0; | 
| 417 |  | if(lnl==0){ | 
| 418 |  | cout << " Float_t  TrkTrack::GetLnLY() -- WARNING -- value not defined "<<lnl<<endl; | 
| 419 |  | Dump(); | 
| 420 |  | } | 
| 421 |  | return lnl; | 
| 422 |  |  | 
| 423 |  | } | 
| 424 | //-------------------------------------- | //-------------------------------------- | 
| 425 | // | // | 
| 426 | // | // | 
| 442 | cout << endl << "zv       : "; for(int i=0; i<6; i++)cout << zv[i] << " "; | cout << endl << "zv       : "; for(int i=0; i<6; i++)cout << zv[i] << " "; | 
| 443 | cout << endl << "resx     : "; for(int i=0; i<6; i++)cout << resx[i] << " "; | cout << endl << "resx     : "; for(int i=0; i<6; i++)cout << resx[i] << " "; | 
| 444 | cout << endl << "resy     : "; for(int i=0; i<6; i++)cout << resy[i] << " "; | cout << endl << "resy     : "; for(int i=0; i<6; i++)cout << resy[i] << " "; | 
| 445 |  | cout << endl << "tailx    : "; for(int i=0; i<6; i++)cout << tailx[i] << " "; | 
| 446 |  | cout << endl << "taily    : "; for(int i=0; i<6; i++)cout << taily[i] << " "; | 
| 447 | cout << endl << "coval    : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" "; | cout << endl << "coval    : "; for(int i=0; i<5; i++)cout << coval[0][i]<<" "; | 
| 448 | cout << endl << "           "; for(int i=0; i<5; i++)cout << coval[1][i]<<" "; | cout << endl << "           "; for(int i=0; i<5; i++)cout << coval[1][i]<<" "; | 
| 449 | cout << endl << "           "; for(int i=0; i<5; i++)cout << coval[2][i]<<" "; | cout << endl << "           "; for(int i=0; i<5; i++)cout << coval[2][i]<<" "; | 
| 469 | for(int i=0; i<6; i++) resy[i]=*ry++; | for(int i=0; i<6; i++) resy[i]=*ry++; | 
| 470 | } | } | 
| 471 | /** | /** | 
| 472 |  | * Set the TrkTrack tails position resolution | 
| 473 |  | */ | 
| 474 |  | void TrkTrack::SetTail(double *tx, double *ty, double factor){ | 
| 475 |  | for(int i=0; i<6; i++) tailx[i]=factor*(*tx++); | 
| 476 |  | for(int i=0; i<6; i++) taily[i]=factor*(*ty++); | 
| 477 |  | } | 
| 478 |  | /** | 
| 479 |  | * Set the TrkTrack Student parameter (resx,resy,tailx,taily) | 
| 480 |  | * from previous gausian fit | 
| 481 |  | *@param flag =0 standard, =1 with noise correction | 
| 482 |  | */ | 
| 483 |  | void TrkTrack::SetStudentParam(int flag){ | 
| 484 |  | float sx[11]={0.000128242, | 
| 485 |  | 0.000136942, | 
| 486 |  | 0.000162718, | 
| 487 |  | 0.000202644, | 
| 488 |  | 0.00025597, | 
| 489 |  | 0.000317456, | 
| 490 |  | 0.000349048, | 
| 491 |  | 0.000384638, | 
| 492 |  | 0.000457295, | 
| 493 |  | 0.000512319, | 
| 494 |  | 0.000538573}; | 
| 495 |  | float tx[11]={1.79402, | 
| 496 |  | 2.04876, | 
| 497 |  | 2.88376, | 
| 498 |  | 3.3, | 
| 499 |  | 3.14084, | 
| 500 |  | 4.07686, | 
| 501 |  | 4.44736, | 
| 502 |  | 3.5179, | 
| 503 |  | 3.38697, | 
| 504 |  | 3.45739, | 
| 505 |  | 3.18627}; | 
| 506 |  | float sy[11]={0.000483075, | 
| 507 |  | 0.000466925, | 
| 508 |  | 0.000431658, | 
| 509 |  | 0.000428317, | 
| 510 |  | 0.000433854, | 
| 511 |  | 0.000444044, | 
| 512 |  | 0.000482098, | 
| 513 |  | 0.000537579, | 
| 514 |  | 0.000636279, | 
| 515 |  | 0.000741998, | 
| 516 |  | 0.000864261}; | 
| 517 |  | float ty[11]={0.997032, | 
| 518 |  | 1.11147, | 
| 519 |  | 1.18526, | 
| 520 |  | 1.61404, | 
| 521 |  | 2.21908, | 
| 522 |  | 3.08959, | 
| 523 |  | 4.48833, | 
| 524 |  | 4.42687, | 
| 525 |  | 4.65253, | 
| 526 |  | 4.52043, | 
| 527 |  | 4.29926}; | 
| 528 |  | int index; | 
| 529 |  | float fact; | 
| 530 |  | for(int i=0; i<6; i++) { | 
| 531 |  | index = int((fabs(axv[i])+1.)/2.); | 
| 532 |  | if(index>10) index=10; | 
| 533 |  | tailx[i]=tx[index]; | 
| 534 |  | if(flag==1) { | 
| 535 |  | if(fabs(axv[i])<=10.) fact = resx[i]/risxeta2_(&(axv[i])); | 
| 536 |  | if(fabs(axv[i])>10.&&fabs(axv[i])<=15.) fact = resx[i]/risxeta3_(&(axv[i])); | 
| 537 |  | if(fabs(axv[i])>15.) fact = resx[i]/risxeta4_(&(axv[i])); | 
| 538 |  | } else fact = 1.; | 
| 539 |  | resx[i] = sx[index]*fact; | 
| 540 |  | } | 
| 541 |  | for(int i=0; i<6; i++) { | 
| 542 |  | index = int((fabs(ayv[i])+1.)/2.); | 
| 543 |  | if(index>10) index=10; | 
| 544 |  | taily[i]=ty[index]; | 
| 545 |  | if(flag==1) fact = resy[i]/risyeta2_(&(ayv[i])); | 
| 546 |  | else fact = 1.; | 
| 547 |  | resy[i] = sy[index]*fact; | 
| 548 |  | } | 
| 549 |  | } | 
| 550 |  | /** | 
| 551 | * Set the TrkTrack good measurement | * Set the TrkTrack good measurement | 
| 552 | */ | */ | 
| 553 | void TrkTrack::SetGood(int *xg, int *yg){ | void TrkTrack::SetGood(int *xg, int *yg){ | 
| 554 | // NB! si perdera` l'informazione sul numero del cluster |  | 
| 555 | for(int i=0; i<6; i++) xgood[i]=*xg++; | for(int i=0; i<6; i++) xgood[i]=*xg++; | 
| 556 | for(int i=0; i<6; i++) ygood[i]=*yg++; | for(int i=0; i<6; i++) ygood[i]=*yg++; | 
| 557 | } | } | 
| 566 | //     path_.error   = 0; | //     path_.error   = 0; | 
| 567 | //     readb_(); | //     readb_(); | 
| 568 |  |  | 
| 569 |  | TrkParams::SetTrackingMode(); | 
| 570 |  | TrkParams::SetPrecisionFactor(); | 
| 571 |  | TrkParams::SetStepMin(); | 
| 572 |  |  | 
| 573 | TrkParams::Set(path,1); | TrkParams::Set(path,1); | 
| 574 | TrkParams::Load(1); | TrkParams::Load(1); | 
| 575 |  |  | 
| 583 |  |  | 
| 584 | for(int i=0; i<6; i++){ | for(int i=0; i<6; i++){ | 
| 585 |  |  | 
| 586 | //      track.xgood[i]=xgood[i]; | //      cout << i<<" - "<<xgood[i]<<" "<<XGood(i)<<endl; | 
| 587 | //      track.ygood[i]=ygood[i]; | //      cout << i<<" - "<<ygood[i]<<" "<<YGood(i)<<endl; | 
| 588 | track.xgood[i]=XGood(i); | track.xgood[i]=XGood(i); | 
| 589 | track.ygood[i]=YGood(i); | track.ygood[i]=YGood(i); | 
| 590 |  |  | 
| 610 |  |  | 
| 611 | track.resx[i]=resx[i]; | track.resx[i]=resx[i]; | 
| 612 | track.resy[i]=resy[i]; | track.resy[i]=resy[i]; | 
| 613 |  | track.tailx[i]=tailx[i]; | 
| 614 |  | track.taily[i]=taily[i]; | 
| 615 | } | } | 
| 616 |  |  | 
| 617 | for(int i=0; i<5; i++) track.al[i]=al[i]; | for(int i=0; i<5; i++) track.al[i]=al[i]; | 
| 643 |  |  | 
| 644 | } | } | 
| 645 | /** | /** | 
| 646 | * Tracking method. It calls F77 mini routine. | * \brief Method to re-evaluate coordinates of clusters associated with a track. | 
| 647 |  | * | 
| 648 |  | * The method can be applied only after recovering level1 information | 
| 649 |  | * (either by reprocessing single events from level0 or from | 
| 650 |  | * the TrkLevel1 branch, if present); it calls F77 subroutines that | 
| 651 |  | * read the level1 common and fill the minimization-routine common. | 
| 652 |  | * Some clusters can be excluded or added by means of the methods: | 
| 653 |  | * | 
| 654 |  | * TrkTrack::ResetXGood(int ip) | 
| 655 |  | * TrkTrack::ResetYGood(int ip) | 
| 656 |  | * TrkTrack::SetXGood(int ip, int cid, int is) | 
| 657 |  | * TrkTrack::SetYGood(int ip, int cid, int is) | 
| 658 |  | * | 
| 659 |  | * NB! The method TrkTrack::SetGood(int *xg, int *yg) set the plane-mask (0-1) | 
| 660 |  | * for the minimization-routine common. It deletes the cluster information | 
| 661 |  | * (at least for the moment...) thus cannot be applied before | 
| 662 |  | * TrkTrack::EvaluateClusterPositions(). | 
| 663 |  | * | 
| 664 |  | * Different p.f.a. can be applied by calling (once) the method: | 
| 665 |  | * | 
| 666 |  | * TrkParams::SetPFA(0); //Set ETA p.f.a. | 
| 667 |  | * | 
| 668 |  | * @see TrkParams::SetPFA(int) | 
| 669 | */ | */ | 
| 670 | void TrkTrack::Fit(double pfixed, int& fail, int iprint){ | Bool_t TrkTrack::EvaluateClusterPositions(){ | 
| 671 |  |  | 
| 672 |  | //     cout << "void TrkTrack::GetClusterPositions() "<<endl; | 
| 673 |  |  | 
| 674 |  | TrkParams::Load( ); | 
| 675 |  | if( !TrkParams::IsLoaded() )return false; | 
| 676 |  |  | 
| 677 |  | for(int ip=0; ip<6; ip++){ | 
| 678 |  | //      cout << ip<<" ** "<<xm[ip]<<" / "<<ym[ip]<<endl;; | 
| 679 |  | int icx = GetClusterX_ID(ip)+1; | 
| 680 |  | int icy = GetClusterY_ID(ip)+1; | 
| 681 |  | int sensor = GetSensor(ip)+1;//<< convenzione "Paolo" | 
| 682 |  | if(ip==5 && sensor!=0)sensor=3-sensor;//<< convenzione "Elena" | 
| 683 |  | int ladder = GetLadder(ip)+1; | 
| 684 |  | float ax = axv[ip]; | 
| 685 |  | float ay = ayv[ip]; | 
| 686 |  | float v[3]; | 
| 687 |  | v[0]=xv[ip]; | 
| 688 |  | v[1]=yv[ip]; | 
| 689 |  | v[2]=zv[ip]; | 
| 690 |  | float bfx = 10*TrkParams::GetBX(v);//Tesla | 
| 691 |  | float bfy = 10*TrkParams::GetBY(v);//Tesla | 
| 692 |  | int ipp=ip+1; | 
| 693 |  | xyzpam_(&ipp,&icx,&icy,&ladder,&sensor,&ax,&ay,&bfx,&bfy); | 
| 694 |  | if(icx<0 || icy<0)return false; | 
| 695 |  | } | 
| 696 |  | return true; | 
| 697 |  | } | 
| 698 |  | /** | 
| 699 |  | * \brief Tracking method. It calls F77 mini routine. | 
| 700 |  | * | 
| 701 |  | * @param pfixed Particle momentum. If pfixed=0 the momentum | 
| 702 |  | * is left as a free parameter, otherwise it is fixed to the input value. | 
| 703 |  | * @param fail Output flag (!=0 if the fit failed). | 
| 704 |  | * @param iprint Flag to set debug mode ( 0 = no output; 1 = verbose; 2 = debug). | 
| 705 |  | * @param froml1 Flag to re-evaluate positions (see TrkTrack::GetClusterPositions()). | 
| 706 |  | * | 
| 707 |  | * The option to re-evaluate positions can be used only after recovering | 
| 708 |  | * level1 information, eg. by reprocessing the single event. | 
| 709 |  | * | 
| 710 |  | * Example: | 
| 711 |  | * | 
| 712 |  | * if( !event->GetTrkLevel0() )return false; | 
| 713 |  | * event->GetTrkLevel0()->ProcessEvent(); // re-processing level0->level1 | 
| 714 |  | * int fail=0; | 
| 715 |  | * event->GetTrkLevel2()->GetTrack(0)->Fit(0.,fail,0,1); | 
| 716 |  | * | 
| 717 |  | * @see EvaluateClusterPositions() | 
| 718 |  | * | 
| 719 |  | * The fitting procedure can be varied by changing the tracking mode, | 
| 720 |  | * the fit-precision factor and the minimum number of step. | 
| 721 |  | * @see SetTrackingMode(int) | 
| 722 |  | * @see SetPrecisionFactor(double) | 
| 723 |  | * @see SetStepMin(int) | 
| 724 |  | */ | 
| 725 |  | void TrkTrack::Fit(double pfixed, int& fail, int iprint, int froml1){ | 
| 726 |  |  | 
| 727 | float al_ini[] = {0.,0.,0.,0.,0.}; | float al_ini[] = {0.,0.,0.,0.,0.}; | 
| 728 |  |  | 
| 729 |  | TrkParams::Load( ); | 
| 730 |  | if( !TrkParams::IsLoaded() )return; | 
| 731 |  |  | 
| 732 | extern cMini2track track_; | extern cMini2track track_; | 
| 733 | fail = 0; | fail = 0; | 
|  | FillMiniStruct(track_); |  | 
| 734 |  |  | 
| 735 |  | FillMiniStruct(track_); | 
| 736 |  |  | 
| 737 |  | if(froml1!=0){ | 
| 738 |  | if( !EvaluateClusterPositions() ){ | 
| 739 |  | cout << "void TrkTrack::Fit("<<pfixed<<","<<fail<<","<<iprint<<","<<froml1<<") --- ERROR evaluating cluster positions "<<endl; | 
| 740 |  | FillMiniStruct(track_) ; | 
| 741 |  | fail = 1; | 
| 742 |  | return; | 
| 743 |  | } | 
| 744 |  | }else{ | 
| 745 |  | FillMiniStruct(track_); | 
| 746 |  | } | 
| 747 |  |  | 
| 748 | // if fit variables have been reset, evaluate the initial guess | // if fit variables have been reset, evaluate the initial guess | 
| 749 | if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_(); | if(al[0]==-9999.&&al[1]==-9999.&&al[2]==-9999.&&al[3]==-9999.&&al[4]==-9999.)guess_(); | 
| 750 |  |  | 
| 763 |  |  | 
| 764 | //  ------------------------------------------ | //  ------------------------------------------ | 
| 765 | //  call mini routine | //  call mini routine | 
| 766 | TrkParams::Load(1); | //     TrkParams::Load(1); | 
| 767 | if( !TrkParams::IsLoaded(1) ){ | //     if( !TrkParams::IsLoaded(1) ){ | 
| 768 | cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; | //      cout << "void TrkTrack::Fit(double pfixed, int& fail, int iprint) --- ERROR --- m.field not loaded"<<endl; | 
| 769 | return; | //      return; | 
| 770 | } | //     } | 
| 771 | int istep=0; | int istep=0; | 
| 772 | int ifail=0; | int ifail=0; | 
| 773 | mini2_(&istep,&ifail, &iprint); | mini2_(&istep,&ifail, &iprint); | 
| 778 | //  ------------------------------------------ | //  ------------------------------------------ | 
| 779 |  |  | 
| 780 | SetFromMiniStruct(&track_); | SetFromMiniStruct(&track_); | 
|  | //    cout << endl << "eta ===> " << track_.al[4] << endl; |  | 
|  |  |  | 
|  | //     for(int i=0; i<5; i++) al[i]=track_.al[i]; |  | 
|  | //     chi2=track_.chi2; |  | 
|  | //     nstep=track_.nstep; |  | 
|  | //     for(int i=0; i<6; i++) xv[i]=track_.xv[i]; |  | 
|  | //     for(int i=0; i<6; i++) yv[i]=track_.yv[i]; |  | 
|  | //     for(int i=0; i<6; i++) zv[i]=track_.zv[i]; |  | 
|  | //     for(int i=0; i<6; i++) axv[i]=track_.axv[i]; |  | 
|  | //     for(int i=0; i<6; i++) ayv[i]=track_.ayv[i]; |  | 
|  | //     for(int i=0; i<5; i++) { |  | 
|  | //      for(int j=0; j<5; j++) coval[i][j]=track_.cov[i][j]; |  | 
|  | //     } |  | 
| 781 |  |  | 
| 782 | if(fail){ | if(fail){ | 
| 783 | if(iprint)cout << " >>>> fit failed >>>> drawing initial par"<<endl; | if(iprint)cout << " >>>> fit failed "<<endl; | 
| 784 | for(int i=0; i<5; i++) al[i]=al_ini[i]; | for(int i=0; i<5; i++) al[i]=al_ini[i]; | 
| 785 | } | } | 
| 786 |  |  | 
| 787 | }; | }; | 
| 788 | /* | /** | 
| 789 | * Reset the fit parameters | * Reset the fit parameters | 
| 790 | */ | */ | 
| 791 | void TrkTrack::FitReset(){ | void TrkTrack::FitReset(){ | 
| 792 | for(int i=0; i<5; i++) al[i]=-9999.; | for(int i=0; i<5; i++) al[i]=-9999.; | 
| 793 | chi2=0.; | chi2=0.; | 
| 794 | nstep=0; | nstep=0; | 
| 795 | for(int i=0; i<6; i++) xv[i]=0.; | //     for(int i=0; i<6; i++) xv[i]=0.; | 
| 796 | for(int i=0; i<6; i++) yv[i]=0.; | //     for(int i=0; i<6; i++) yv[i]=0.; | 
| 797 | for(int i=0; i<6; i++) zv[i]=0.; | //     for(int i=0; i<6; i++) zv[i]=0.; | 
| 798 | for(int i=0; i<6; i++) axv[i]=0.; | //     for(int i=0; i<6; i++) axv[i]=0.; | 
| 799 | for(int i=0; i<6; i++) ayv[i]=0.; | //     for(int i=0; i<6; i++) ayv[i]=0.; | 
| 800 | for(int i=0; i<5; i++) { | for(int i=0; i<5; i++) { | 
| 801 | for(int j=0; j<5; j++) coval[i][j]=0.; | for(int j=0; j<5; j++) coval[i][j]=0.; | 
| 802 | } | } | 
| 803 | } | } | 
| 804 | /* | /** | 
| 805 | * Set the tracking mode | * Set the tracking mode | 
| 806 | */ | */ | 
| 807 | void TrkTrack::SetTrackingMode(int trackmode){ | void TrkTrack::SetTrackingMode(int trackmode){ | 
| 808 | extern cMini2track track_; | extern cMini2track track_; | 
| 809 | track_.trackmode = trackmode; | track_.trackmode = trackmode; | 
| 810 | } | } | 
| 811 | /* | /** | 
| 812 | * Set the factor scale for tracking precision | * Set the factor scale for tracking precision | 
| 813 | */ | */ | 
| 814 | void TrkTrack::SetPrecisionFactor(double fact){ | void TrkTrack::SetPrecisionFactor(double fact){ | 
| 815 | extern cMini2track track_; | extern cMini2track track_; | 
| 816 | track_.fact = fact; | track_.fact = fact; | 
| 817 | } | } | 
| 818 | /* | /** | 
| 819 | * Set the factor scale for tracking precision | * Set the minimum number of steps for tracking precision | 
| 820 | */ | */ | 
| 821 | void TrkTrack::SetStepMin(int istepmin){ | void TrkTrack::SetStepMin(int istepmin){ | 
| 822 | extern cMini2track track_; | extern cMini2track track_; | 
| 823 | track_.istepmin = istepmin; | track_.istepmin = istepmin; | 
| 824 | } | } | 
| 825 |  | /** | 
| 826 |  | * Returns 1 if the track is inside the magnet cavity | 
| 827 | /* | * Set the minimum number of steps for tracking precision | 
| 828 |  | */ | 
| 829 |  | Bool_t TrkTrack::IsInsideCavity(){ | 
| 830 |  | float xmagntop, ymagntop, xmagnbottom, ymagnbottom; | 
| 831 |  | xmagntop = xv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*axv[0]/180.); | 
| 832 |  | ymagntop = yv[0] + (ZMAGNHIGH-zv[0])*tan(cos(-1.0)*ayv[0]/180.); | 
| 833 |  | xmagnbottom = xv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*axv[5]/180.); | 
| 834 |  | ymagnbottom = yv[5] + (ZMAGNLOW-zv[5])*tan(cos(-1.0)*ayv[5]/180.); | 
| 835 |  | if( xmagntop>XMAGNLOW && xmagntop<XMAGNHIGH && | 
| 836 |  | ymagntop>YMAGNLOW && ymagntop<YMAGNHIGH && | 
| 837 |  | xmagnbottom>XMAGNLOW && xmagnbottom<XMAGNHIGH && | 
| 838 |  | ymagnbottom>YMAGNLOW && ymagnbottom<YMAGNHIGH ) return(true); | 
| 839 |  | else return(false); | 
| 840 |  | } | 
| 841 |  | /** | 
| 842 | * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. | * Method to retrieve ID (0,1,...) of x-cluster (if any) associated to this track. | 
| 843 | * If no cluster is associated, ID=-1. | * If no cluster is associated, ID=-1. | 
| 844 | * @param ip Tracker plane (0-5) | * @param ip Tracker plane (0-5) | 
| 846 | Int_t TrkTrack::GetClusterX_ID(int ip){ | Int_t TrkTrack::GetClusterX_ID(int ip){ | 
| 847 | return ((Int_t)fabs(xgood[ip]))%10000000-1; | return ((Int_t)fabs(xgood[ip]))%10000000-1; | 
| 848 | }; | }; | 
| 849 | /* | /** | 
| 850 | * Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. | * Method to retrieve ID (0-xxx) of y-cluster (if any) associated to this track. | 
| 851 | * If no cluster is associated, ID=-1. | * If no cluster is associated, ID=-1. | 
| 852 | * @param ip Tracker plane (0-5) | * @param ip Tracker plane (0-5) | 
| 854 | Int_t TrkTrack::GetClusterY_ID(int ip){ | Int_t TrkTrack::GetClusterY_ID(int ip){ | 
| 855 | return ((Int_t)fabs(ygood[ip]))%10000000-1; | return ((Int_t)fabs(ygood[ip]))%10000000-1; | 
| 856 | }; | }; | 
| 857 | /* | /** | 
| 858 | * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane. | * Method to retrieve the ladder (0-4, increasing x) traversed by the track on this plane. | 
| 859 | * If no ladder is traversed (dead area) the metod retuns -1. | * If no ladder is traversed (dead area) the metod retuns -1. | 
| 860 | * @param ip Tracker plane (0-5) | * @param ip Tracker plane (0-5) | 
| 864 | if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; | if(YGood(ip))return (Int_t)fabs(ygood[ip]/100000000)-1; | 
| 865 | return -1; | return -1; | 
| 866 | }; | }; | 
| 867 | /* | /** | 
| 868 | * Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane. | * Method to retrieve the sensor (0-1, increasing y) traversed by the track on this plane. | 
| 869 | * If no sensor is traversed (dead area) the metod retuns -1. | * If no sensor is traversed (dead area) the metod retuns -1. | 
| 870 | * @param ip Tracker plane (0-5) | * @param ip Tracker plane (0-5) | 
| 875 | return -1; | return -1; | 
| 876 | }; | }; | 
| 877 |  |  | 
| 878 |  | /** | 
| 879 |  | * \brief Method to include a x-cluster to the track. | 
| 880 |  | * @param ip Tracker plane (0-5) | 
| 881 |  | * @param clid Cluster ID (0,1,...) | 
| 882 |  | * @param is Sensor (0-1, increasing y) | 
| 883 |  | * @see Fit(double pfixed, int& fail, int iprint, int froml1) | 
| 884 |  | */ | 
| 885 |  | void TrkTrack::SetXGood(int ip, int clid, int is){ | 
| 886 |  | int il=0;       //ladder (temporary) | 
| 887 |  | bool bad=false; //ladder (temporary) | 
| 888 |  | xgood[ip]=il*100000000+is*10000000+clid; | 
| 889 |  | if(bad)xgood[ip]=-xgood[ip]; | 
| 890 |  | }; | 
| 891 |  | /** | 
| 892 |  | * \brief Method to include a y-cluster to the track. | 
| 893 |  | * @param ip Tracker plane (0-5) | 
| 894 |  | * @param clid Cluster ID (0,1,...) | 
| 895 |  | * @param is Sensor (0-1) | 
| 896 |  | * @see Fit(double pfixed, int& fail, int iprint, int froml1) | 
| 897 |  | */ | 
| 898 |  | void TrkTrack::SetYGood(int ip, int clid, int is){ | 
| 899 |  | int il=0;       //ladder (temporary) | 
| 900 |  | bool bad=false; //ladder (temporary) | 
| 901 |  | ygood[ip]=il*100000000+is*10000000+clid; | 
| 902 |  | if(bad)ygood[ip]=-ygood[ip]; | 
| 903 |  | }; | 
| 904 |  |  | 
| 905 | //-------------------------------------- | //-------------------------------------- | 
| 906 | // | // | 
| 1054 | for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); | for(int i=0; i<nclsy(); i++) ((TrkSinglet *)sy[i])->Dump(); | 
| 1055 | } | } | 
| 1056 | } | } | 
| 1057 |  | /** | 
| 1058 |  | * \brief Dump processing status | 
| 1059 |  | */ | 
| 1060 |  | void TrkLevel2::StatusDump(int view){ | 
| 1061 |  | cout << "DSP n. "<<view+1<<" status: "<<hex<<good[view]<<endl; | 
| 1062 |  | }; | 
| 1063 |  | /** | 
| 1064 |  | * \brief Check event status | 
| 1065 |  | * | 
| 1066 |  | * Check the event status, according to a flag-mask given as input. | 
| 1067 |  | * Return true if the view passes the check. | 
| 1068 |  | * | 
| 1069 |  | * @param view View number (0-11) | 
| 1070 |  | * @param flagmask Mask of flags to check (eg. flagmask=0x111 no missing packet, | 
| 1071 |  | *  no crc error, no software alarm) | 
| 1072 |  | * | 
| 1073 |  | * @see TrkLevel2 class definition to know how the status flag is defined | 
| 1074 |  | * | 
| 1075 |  | */ | 
| 1076 |  | Bool_t TrkLevel2::StatusCheck(int view, int flagmask){ | 
| 1077 |  |  | 
| 1078 |  | if( view<0 || view >= 12)return false; | 
| 1079 |  | return !(good[view]&flagmask); | 
| 1080 |  |  | 
| 1081 |  | }; | 
| 1082 |  |  | 
| 1083 |  |  | 
| 1084 | //-------------------------------------- | //-------------------------------------- | 
| 1085 | // | // | 
| 1086 | // | // | 
| 1548 | //     path_.error   = 0; | //     path_.error   = 0; | 
| 1549 | //     readb_(); | //     readb_(); | 
| 1550 |  |  | 
| 1551 |  | TrkParams::SetTrackingMode(); | 
| 1552 |  | TrkParams::SetPrecisionFactor(); | 
| 1553 |  | TrkParams::SetStepMin(); | 
| 1554 |  |  | 
| 1555 | TrkParams::Set(path,1); | TrkParams::Set(path,1); | 
| 1556 | TrkParams::Load(1); | TrkParams::Load(1); | 
| 1557 |  |  | 
| 1558 | // | // | 
| 1559 | }; | }; | 
| 1560 | /** | // /** | 
| 1561 | * Get BY (kGauss) | //  * Get BY (kGauss) | 
| 1562 | * @param v (x,y,z) coordinates in cm | //  * @param v (x,y,z) coordinates in cm | 
| 1563 | */ | //  */ | 
| 1564 | float TrkLevel2::GetBX(float* v){ | // float TrkLevel2::GetBX(float* v){ | 
| 1565 | float b[3]; | //     float b[3]; | 
| 1566 | gufld_(v,b); | //     gufld_(v,b); | 
| 1567 | return b[0]/10.; | //     return b[0]/10.; | 
| 1568 | } | // } | 
| 1569 | /** | // /** | 
| 1570 | * Get BY (kGauss) | //  * Get BY (kGauss) | 
| 1571 | * @param v (x,y,z) coordinates in cm | //  * @param v (x,y,z) coordinates in cm | 
| 1572 | */ | //  */ | 
| 1573 | float TrkLevel2::GetBY(float* v){ | // float TrkLevel2::GetBY(float* v){ | 
| 1574 | float b[3]; | //     float b[3]; | 
| 1575 | gufld_(v,b); | //     gufld_(v,b); | 
| 1576 | return b[1]/10.; | //     return b[1]/10.; | 
| 1577 | } | // } | 
| 1578 | /** | // /** | 
| 1579 | * Get BY (kGauss) | //  * Get BY (kGauss) | 
| 1580 | * @param v (x,y,z) coordinates in cm | //  * @param v (x,y,z) coordinates in cm | 
| 1581 | */ | //  */ | 
| 1582 | float TrkLevel2::GetBZ(float* v){ | // float TrkLevel2::GetBZ(float* v){ | 
| 1583 | float b[3]; | //     float b[3]; | 
| 1584 | gufld_(v,b); | //     gufld_(v,b); | 
| 1585 | return b[2]/10.; | //     return b[2]/10.; | 
| 1586 | } | // } | 
| 1587 | //-------------------------------------- | //-------------------------------------- | 
| 1588 | // | // | 
| 1589 | // | // |