313 |
/** |
/** |
314 |
* Method to fill a level1 struct with only one cluster (done to use F77 p.f.a. routines on a cluster basis). |
* Method to fill a level1 struct with only one cluster (done to use F77 p.f.a. routines on a cluster basis). |
315 |
*/ |
*/ |
316 |
cTrkLevel1* TrkCluster::GetLevel1Struct(){ |
void TrkCluster::GetLevel1Struct(cTrkLevel1* l1){ |
317 |
|
|
318 |
// cTrkLevel1* l1 = new cTrkLevel1; |
// cTrkLevel1* l1 = new cTrkLevel1; |
319 |
|
|
320 |
cTrkLevel1* l1 = &level1event_ ; |
// cTrkLevel1* l1 = &level1event_ ; |
321 |
|
|
322 |
l1->nclstr1 = 1; |
l1->nclstr1 = 1; |
323 |
l1->view[0] = view; |
l1->view[0] = view; |
335 |
l1->clbad[i] = clbad[i]; |
l1->clbad[i] = clbad[i]; |
336 |
}; |
}; |
337 |
|
|
338 |
return l1; |
// return l1; |
339 |
}; |
}; |
340 |
//-------------------------------------- |
//-------------------------------------- |
341 |
// |
// |
397 |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
// cout << "GetETA(neta,angle) "<< neta << " "<< angle; |
398 |
// LoadPfaParam(); |
// LoadPfaParam(); |
399 |
|
|
400 |
|
TrkParams::Load(4); |
401 |
|
if( !TrkParams::IsLoaded(4) ){ |
402 |
|
cout << "int Trajectory::DoTrack2(float* al) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
403 |
|
return 0; |
404 |
|
} |
405 |
|
|
406 |
float ax = angle; |
float ax = angle; |
407 |
int ic = 1; |
int ic = 1; |
408 |
GetLevel1Struct(); |
GetLevel1Struct(); |
436 |
// |
// |
437 |
// |
// |
438 |
//-------------------------------------- |
//-------------------------------------- |
439 |
|
void TrkLevel1::Set(){ |
440 |
|
if(!Cluster)Cluster = new TClonesArray("TrkCluster"); |
441 |
|
} |
442 |
|
//-------------------------------------- |
443 |
|
// |
444 |
|
// |
445 |
|
//-------------------------------------- |
446 |
void TrkLevel1::Dump(){ |
void TrkLevel1::Dump(){ |
447 |
|
|
448 |
cout<<"DSP status: "; |
cout<<"DSP status: "; |
472 |
*/ |
*/ |
473 |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){ |
void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full){ |
474 |
|
|
475 |
|
// cout << "void TrkLevel1::SetFromLevel1Struct(cTrkLevel1 *l1, Bool_t full)"<<endl; |
476 |
|
|
477 |
|
Clear(); |
478 |
// --------------- |
// --------------- |
479 |
// *** CLUSTER *** |
// *** CLUSTER *** |
480 |
// --------------- |
// --------------- |
531 |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
* Fills a struct cTrkLevel1 with values from a TrkLevel1 object (to put data into a F77 common). |
532 |
*/ |
*/ |
533 |
|
|
534 |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
void TrkLevel1::GetLevel1Struct(cTrkLevel1* l1) { |
535 |
|
|
536 |
cTrkLevel1 *l1=0; |
// cTrkLevel1* l1 = &level1event_ ; |
537 |
// |
|
538 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
539 |
l1->good[i] = good[i]; |
l1->good[i] = good[i]; |
540 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
541 |
l1->cnev[j][i] = cn[j][i]; |
l1->cnev[j][i] = cn[j][i] ; |
542 |
// l1->cnrmsev[j][i] = cnrms[j][i]; |
l1->cnnev[j][i] = cnn[j][i] ; |
543 |
l1->cnnev[j][i] = cnn[j][i]; |
l1->cnrmsev[j][i] = 0. ; |
544 |
}; |
}; |
545 |
|
l1->fshower[i] = 0; |
546 |
}; |
}; |
547 |
|
|
548 |
// *** CLUSTERS *** |
l1->nclstr1=0; |
549 |
|
l1->totCLlength=0; |
550 |
|
Int_t index=0; |
551 |
if(Cluster){ |
if(Cluster){ |
552 |
l1->nclstr1 = Cluster->GetEntries(); |
Int_t i=0; |
553 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
for(Int_t ii=0;ii<Cluster->GetEntries();ii++){ |
554 |
|
TrkCluster *clu = GetCluster(ii); |
555 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
// ---------------------------------------- |
556 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
// attenzione!! |
557 |
// COMPLETARE // |
// se il cluster non e` salvato (view = 0) |
558 |
// COMPLETARE // |
// DEVE essere escluso dal common F77 |
559 |
// COMPLETARE // |
// ---------------------------------------- |
560 |
// COMPLETARE // |
if(clu->view != 0 ){ |
561 |
// COMPLETARE // |
l1->view[i] = clu->view; |
562 |
// COMPLETARE // |
l1->ladder[i] = clu->GetLadder(); |
563 |
|
l1->maxs[i] = clu->maxs; |
564 |
|
l1->mult[i] = clu->GetMultiplicity(); |
565 |
|
l1->dedx[i] = clu->GetSignal(); |
566 |
|
l1->indstart[i] = index+1; |
567 |
|
l1->indmax[i] = l1->indstart[i] + clu->indmax; |
568 |
|
l1->totCLlength += clu->CLlength; |
569 |
|
for(Int_t iw=0; iw < clu->CLlength; iw++){ |
570 |
|
l1->clsignal[index] = clu->clsignal[iw]; |
571 |
|
l1->clsigma[index] = clu->clsigma[iw]; |
572 |
|
l1->cladc[index] = clu->cladc[iw]; |
573 |
|
l1->clbad[index] = clu->clbad[iw]; |
574 |
|
index++; |
575 |
|
} |
576 |
|
i++; |
577 |
|
} |
578 |
} |
} |
579 |
// COMPLETARE // |
l1->nclstr1 = i; |
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
580 |
} |
} |
581 |
return l1; |
|
582 |
|
// return l1; |
583 |
} |
} |
584 |
//-------------------------------------- |
//-------------------------------------- |
585 |
// |
// |
630 |
// |
// |
631 |
// |
// |
632 |
//-------------------------------------- |
//-------------------------------------- |
633 |
|
// /** |
634 |
|
// * Load Position-Finding-Algorythm parameters (call the F77 routine). |
635 |
|
// * |
636 |
|
// */ |
637 |
|
// int TrkLevel1::LoadPfaParam(TString path){ |
638 |
|
|
639 |
|
// if( path.IsNull() ){ |
640 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
641 |
|
// if(path.IsNull()){ |
642 |
|
// cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl; |
643 |
|
// return 0; |
644 |
|
// } |
645 |
|
// path.Append("/trk-param/eta_param-0/"); |
646 |
|
// } |
647 |
|
|
648 |
|
// strcpy(path_.path,path.Data()); |
649 |
|
// path_.pathlen = path.Length(); |
650 |
|
// path_.error = 0; |
651 |
|
// cout <<"Loading p.f.a. parameters: "<<path<<endl; |
652 |
|
// return readetaparam_(); |
653 |
|
// } |
654 |
|
|
655 |
|
// /** |
656 |
|
// * Load magnetic field parameters (call the F77 routine). |
657 |
|
// * |
658 |
|
// */ |
659 |
|
// int TrkLevel1::LoadFieldParam(TString path){ |
660 |
|
|
661 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
662 |
|
// if( path.IsNull() ){ |
663 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
664 |
|
// if(path.IsNull()){ |
665 |
|
// cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl; |
666 |
|
// return 0; |
667 |
|
// } |
668 |
|
// path.Append("/trk-param/field_param-0/"); |
669 |
|
// } |
670 |
|
// cout <<"Loading magnetic field "<<path<<endl; |
671 |
|
// strcpy(path_.path,path.Data()); |
672 |
|
// path_.pathlen = path.Length(); |
673 |
|
// path_.error = 0; |
674 |
|
// return readb_(); |
675 |
|
// // } |
676 |
|
// // return 0; |
677 |
|
// } |
678 |
|
// /** |
679 |
|
// * Load magnetic field parameters (call the F77 routine). |
680 |
|
// * |
681 |
|
// */ |
682 |
|
// int TrkLevel1::LoadChargeParam(TString path){ |
683 |
|
|
684 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
685 |
|
// if( path.IsNull() ){ |
686 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
687 |
|
// if(path.IsNull()){ |
688 |
|
// cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl; |
689 |
|
// return 0; |
690 |
|
// } |
691 |
|
// path.Append("/trk-param/charge_param-1/"); |
692 |
|
// } |
693 |
|
// cout <<"Loading charge-correlation parameters: "<<path<<endl; |
694 |
|
// strcpy(path_.path,path.Data()); |
695 |
|
// path_.pathlen = path.Length(); |
696 |
|
// path_.error = 0; |
697 |
|
// return readchargeparam_(); |
698 |
|
// // } |
699 |
|
// // return 0; |
700 |
|
// } |
701 |
|
// /** |
702 |
|
// * Load magnetic field parameters (call the F77 routine). |
703 |
|
// * |
704 |
|
// */ |
705 |
|
// int TrkLevel1::LoadAlignmentParam(TString path){ |
706 |
|
|
707 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
708 |
|
// if( path.IsNull() ){ |
709 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
710 |
|
// if(path.IsNull()){ |
711 |
|
// cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl; |
712 |
|
// return 0; |
713 |
|
// } |
714 |
|
// path.Append("/trk-param/align_param-0/"); |
715 |
|
// } |
716 |
|
// cout <<"Loading alignment parameters: "<<path<<endl; |
717 |
|
// strcpy(path_.path,path.Data()); |
718 |
|
// path_.pathlen = path.Length(); |
719 |
|
// path_.error = 0; |
720 |
|
// return readalignparam_(); |
721 |
|
// // } |
722 |
|
// // return 0; |
723 |
|
// } |
724 |
|
// /** |
725 |
|
// * Load magnetic field parameters (call the F77 routine). |
726 |
|
// * |
727 |
|
// */ |
728 |
|
// int TrkLevel1::LoadMipParam(TString path){ |
729 |
|
|
730 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
731 |
|
// if( path.IsNull() ){ |
732 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
733 |
|
// if(path.IsNull()){ |
734 |
|
// cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl; |
735 |
|
// return 0; |
736 |
|
// } |
737 |
|
// path.Append("/trk-param/mip_param-0/"); |
738 |
|
// } |
739 |
|
// cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl; |
740 |
|
// strcpy(path_.path,path.Data()); |
741 |
|
// path_.pathlen = path.Length(); |
742 |
|
// path_.error = 0; |
743 |
|
// return readmipparam_(); |
744 |
|
// // } |
745 |
|
// // return 0; |
746 |
|
// } |
747 |
|
// /** |
748 |
|
// * Load magnetic field parameters (call the F77 routine). |
749 |
|
// * |
750 |
|
// */ |
751 |
|
// int TrkLevel1::LoadVKMaskParam(TString path){ |
752 |
|
|
753 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
754 |
|
// if( path.IsNull() ){ |
755 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
756 |
|
// if(path.IsNull()){ |
757 |
|
// cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl; |
758 |
|
// return 0; |
759 |
|
// } |
760 |
|
// path.Append("/trk-param/mask_param-1/"); |
761 |
|
// } |
762 |
|
// cout <<"Loading VK-mask parameters: "<<path<<endl; |
763 |
|
// strcpy(path_.path,path.Data()); |
764 |
|
// path_.pathlen = path.Length(); |
765 |
|
// path_.error = 0; |
766 |
|
// return readvkmask_(); |
767 |
|
// // } |
768 |
|
// // return 0; |
769 |
|
// } |
770 |
|
|
771 |
|
// /** |
772 |
|
// * Load all (default) parameters. Environment variable must be defined. |
773 |
|
// * |
774 |
|
// */ |
775 |
|
// int TrkLevel1::LoadParams(){ |
776 |
|
|
777 |
|
// int result=0; |
778 |
|
|
779 |
|
// result = result * LoadFieldParam(); |
780 |
|
// result = result * LoadPfaParam(); |
781 |
|
// result = result * LoadChargeParam(); |
782 |
|
// result = result * LoadAlignmentParam(); |
783 |
|
// result = result * LoadMipParam(); |
784 |
|
// result = result * LoadVKMaskParam(); |
785 |
|
|
786 |
|
// return result; |
787 |
|
// } |
788 |
|
|
789 |
|
|
790 |
|
|
791 |
|
int TrkLevel1::GetPfaNbinsAngle(){ |
792 |
|
TrkParams::Load(4); |
793 |
|
if( !TrkParams::IsLoaded(4) ){ |
794 |
|
cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
795 |
|
return 0; |
796 |
|
} |
797 |
|
return pfa_.nangbin; |
798 |
|
}; |
799 |
|
|
800 |
|
int TrkLevel1::GetPfaNbinsETA(){ |
801 |
|
TrkParams::Load(4); |
802 |
|
if( !TrkParams::IsLoaded(4) ){ |
803 |
|
cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
804 |
|
return 0; |
805 |
|
} |
806 |
|
return pfa_.netaval; |
807 |
|
}; |
808 |
|
|
809 |
/** |
/** |
810 |
* Load Position-Finding-Algorythm parameters (call the F77 routine). |
* |
811 |
* |
* |
812 |
*/ |
*/ |
813 |
int TrkLevel1::LoadPfaParam(TString path){ |
float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
814 |
|
|
815 |
if( strcmp(path_.path,path.Data()) ){ |
TrkParams::Load(4); |
816 |
cout <<"Loading p.f.a. param::eters\n"; |
if( !TrkParams::IsLoaded(4) ){ |
817 |
strcpy(path_.path,path.Data()); |
cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
818 |
path_.pathlen = path.Length(); |
return 0; |
819 |
path_.error = 0; |
} |
820 |
return readetaparam_(); |
|
821 |
} |
int nbins = GetPfaNbinsETA(); |
822 |
return 0; |
if(!nbins)return 0; |
823 |
|
|
824 |
|
float *fcorr = new float [nbins]; |
825 |
|
|
826 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
827 |
|
for(int ib=0; ib<nbins; ib++){ |
828 |
|
fcorr[ib] = pfa_.feta2[nang][nladder][nview][ib]; |
829 |
|
cout << pfa_.eta2[nang][ib] << " - " << pfa_.feta2[nang][nladder][nview][ib]<<endl;; |
830 |
|
} |
831 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
832 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta3[nang][nladder][nview][ib]; |
833 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
834 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.feta4[nang][nladder][nview][ib]; |
835 |
|
}else{ |
836 |
|
cout << pfa<<" pfa parameters not implemented "<<endl; |
837 |
|
return 0; |
838 |
|
} |
839 |
|
|
840 |
|
return fcorr; |
841 |
|
|
842 |
|
}; |
843 |
|
|
844 |
|
float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
845 |
|
|
846 |
|
TrkParams::Load(4); |
847 |
|
if( !TrkParams::IsLoaded(4) ){ |
848 |
|
cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
849 |
|
return 0; |
850 |
|
} |
851 |
|
|
852 |
|
int nbins = GetPfaNbinsETA(); |
853 |
|
if(!nbins)return 0; |
854 |
|
|
855 |
|
float *fcorr = new float [nbins]; |
856 |
|
|
857 |
|
if(!pfa.CompareTo("ETA2",TString::kIgnoreCase)){ |
858 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta2[nang][ib]; |
859 |
|
}else if (!pfa.CompareTo("ETA3",TString::kIgnoreCase)){ |
860 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta3[nang][ib]; |
861 |
|
}else if (!pfa.CompareTo("ETA4",TString::kIgnoreCase)){ |
862 |
|
for(int ib=0; ib<nbins; ib++)fcorr[ib] = pfa_.eta4[nang][ib]; |
863 |
|
}else{ |
864 |
|
cout << pfa<<" pfa parameters not implemented "<<endl; |
865 |
|
return 0; |
866 |
|
} |
867 |
|
|
868 |
|
return fcorr; |
869 |
|
|
870 |
|
}; |
871 |
|
|
872 |
|
/** |
873 |
|
* Method to call the F77 routine that performs level1->level2 processing. |
874 |
|
* The level2 output is stored in a common block, which can be retrieved |
875 |
|
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
876 |
|
* @param pfa Position finding algorythm used to reconstruct the track |
877 |
|
* Implemented algorythms: |
878 |
|
* 0 ETA (default) |
879 |
|
* 1 --- |
880 |
|
* 2 ETA2 |
881 |
|
* 3 ETA3 |
882 |
|
* 4 ETA4 |
883 |
|
* 10 COG |
884 |
|
* 11 COG1 |
885 |
|
* 12 COG2 |
886 |
|
* 13 COG3 |
887 |
|
* 14 COG4 |
888 |
|
* NB If the TrkLevel1 object is readout from a tree, and the |
889 |
|
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
890 |
|
* should be payed to the fact that single clusters (clusters not associated |
891 |
|
* with any track) might not be stored. Full reprocessing should be done from |
892 |
|
* level0 data. |
893 |
|
*/ |
894 |
|
int TrkLevel1::ProcessEvent(int pfa){ |
895 |
|
|
896 |
|
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
897 |
|
TrkParams::Load( ); |
898 |
|
if( !TrkParams::IsLoaded() )return 0; |
899 |
|
|
900 |
|
GetLevel1Struct(); |
901 |
|
|
902 |
|
analysisflight_(&pfa); |
903 |
|
|
904 |
|
// cout << "...done"<<endl; |
905 |
|
|
906 |
|
return 1; |
907 |
|
|
908 |
} |
} |
909 |
|
|
910 |
|
|