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(); |
528 |
* 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). |
529 |
*/ |
*/ |
530 |
|
|
531 |
cTrkLevel1* TrkLevel1::GetLevel1Struct() { |
void TrkLevel1::GetLevel1Struct(cTrkLevel1* l1) { |
532 |
|
|
533 |
cTrkLevel1 *l1=0; |
// cTrkLevel1* l1 = &level1event_ ; |
534 |
// |
|
535 |
for(Int_t i=0; i<12 ; i++){ |
for(Int_t i=0; i<12 ; i++){ |
536 |
l1->good[i] = good[i]; |
l1->good[i] = good[i]; |
537 |
for(Int_t j=0; j<24 ; j++){ |
for(Int_t j=0; j<24 ; j++){ |
538 |
l1->cnev[j][i] = cn[j][i]; |
l1->cnev[j][i] = cn[j][i] ; |
539 |
// l1->cnrmsev[j][i] = cnrms[j][i]; |
l1->cnnev[j][i] = cnn[j][i] ; |
540 |
l1->cnnev[j][i] = cnn[j][i]; |
l1->cnrmsev[j][i] = 0. ; |
541 |
}; |
}; |
542 |
|
l1->fshower[i] = 0; |
543 |
}; |
}; |
544 |
|
|
545 |
// *** CLUSTERS *** |
l1->nclstr1=0; |
546 |
|
l1->totCLlength=0; |
547 |
|
Int_t index=0; |
548 |
if(Cluster){ |
if(Cluster){ |
549 |
l1->nclstr1 = Cluster->GetEntries(); |
Int_t i=0; |
550 |
for(Int_t i=0;i<l1->nclstr1;i++){ |
for(Int_t ii=0;ii<Cluster->GetEntries();ii++){ |
551 |
|
TrkCluster *clu = GetCluster(ii); |
552 |
l1->view[i] = ((TrkCluster *)Cluster->At(i))->view; |
// ---------------------------------------- |
553 |
l1->maxs[i] = ((TrkCluster *)Cluster->At(i))->maxs; |
// attenzione!! |
554 |
// COMPLETARE // |
// se il cluster non e` salvato (view = 0) |
555 |
// COMPLETARE // |
// DEVE essere escluso dal common F77 |
556 |
// COMPLETARE // |
// ---------------------------------------- |
557 |
// COMPLETARE // |
if(clu->view != 0 ){ |
558 |
// COMPLETARE // |
l1->view[i] = clu->view; |
559 |
// COMPLETARE // |
l1->ladder[i] = clu->GetLadder(); |
560 |
|
l1->maxs[i] = clu->maxs; |
561 |
|
l1->mult[i] = clu->GetMultiplicity(); |
562 |
|
l1->dedx[i] = clu->GetSignal(); |
563 |
|
l1->indstart[i] = index+1; |
564 |
|
l1->indmax[i] = l1->indstart[i] + clu->indmax; |
565 |
|
l1->totCLlength += clu->CLlength; |
566 |
|
for(Int_t iw=0; iw < clu->CLlength; iw++){ |
567 |
|
l1->clsignal[index] = clu->clsignal[iw]; |
568 |
|
l1->clsigma[index] = clu->clsigma[iw]; |
569 |
|
l1->cladc[index] = clu->cladc[iw]; |
570 |
|
l1->clbad[index] = clu->clbad[iw]; |
571 |
|
index++; |
572 |
|
} |
573 |
|
i++; |
574 |
|
} |
575 |
} |
} |
576 |
// COMPLETARE // |
l1->nclstr1 = i; |
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
|
// COMPLETARE // |
|
577 |
} |
} |
578 |
return l1; |
|
579 |
|
// return l1; |
580 |
} |
} |
581 |
//-------------------------------------- |
//-------------------------------------- |
582 |
// |
// |
627 |
// |
// |
628 |
// |
// |
629 |
//-------------------------------------- |
//-------------------------------------- |
630 |
/** |
// /** |
631 |
* Load Position-Finding-Algorythm parameters (call the F77 routine). |
// * Load Position-Finding-Algorythm parameters (call the F77 routine). |
632 |
* |
// * |
633 |
*/ |
// */ |
634 |
int TrkLevel1::LoadPfaParam(TString path){ |
// int TrkLevel1::LoadPfaParam(TString path){ |
635 |
|
|
636 |
if( strcmp(path_.path,path.Data()) ){ |
// if( path.IsNull() ){ |
637 |
cout <<"Loading p.f.a. param::eters\n"; |
// path = gSystem->Getenv("PAM_CALIB"); |
638 |
strcpy(path_.path,path.Data()); |
// if(path.IsNull()){ |
639 |
path_.pathlen = path.Length(); |
// cout << " TrkLevel1::LoadPfaParam() ==> No PAMELA environment variables defined "<<endl; |
640 |
path_.error = 0; |
// return 0; |
641 |
return readetaparam_(); |
// } |
642 |
} |
// path.Append("/trk-param/eta_param-0/"); |
643 |
return 0; |
// } |
644 |
} |
|
645 |
|
// strcpy(path_.path,path.Data()); |
646 |
|
// path_.pathlen = path.Length(); |
647 |
|
// path_.error = 0; |
648 |
|
// cout <<"Loading p.f.a. parameters: "<<path<<endl; |
649 |
|
// return readetaparam_(); |
650 |
|
// } |
651 |
|
|
652 |
|
// /** |
653 |
|
// * Load magnetic field parameters (call the F77 routine). |
654 |
|
// * |
655 |
|
// */ |
656 |
|
// int TrkLevel1::LoadFieldParam(TString path){ |
657 |
|
|
658 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
659 |
|
// if( path.IsNull() ){ |
660 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
661 |
|
// if(path.IsNull()){ |
662 |
|
// cout << " TrkLevel1::LoadFieldParam() ==> No PAMELA environment variables defined "<<endl; |
663 |
|
// return 0; |
664 |
|
// } |
665 |
|
// path.Append("/trk-param/field_param-0/"); |
666 |
|
// } |
667 |
|
// cout <<"Loading magnetic field "<<path<<endl; |
668 |
|
// strcpy(path_.path,path.Data()); |
669 |
|
// path_.pathlen = path.Length(); |
670 |
|
// path_.error = 0; |
671 |
|
// return readb_(); |
672 |
|
// // } |
673 |
|
// // return 0; |
674 |
|
// } |
675 |
|
// /** |
676 |
|
// * Load magnetic field parameters (call the F77 routine). |
677 |
|
// * |
678 |
|
// */ |
679 |
|
// int TrkLevel1::LoadChargeParam(TString path){ |
680 |
|
|
681 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
682 |
|
// if( path.IsNull() ){ |
683 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
684 |
|
// if(path.IsNull()){ |
685 |
|
// cout << " TrkLevel1::LoadChargeParam() ==> No PAMELA environment variables defined "<<endl; |
686 |
|
// return 0; |
687 |
|
// } |
688 |
|
// path.Append("/trk-param/charge_param-1/"); |
689 |
|
// } |
690 |
|
// cout <<"Loading charge-correlation parameters: "<<path<<endl; |
691 |
|
// strcpy(path_.path,path.Data()); |
692 |
|
// path_.pathlen = path.Length(); |
693 |
|
// path_.error = 0; |
694 |
|
// return readchargeparam_(); |
695 |
|
// // } |
696 |
|
// // return 0; |
697 |
|
// } |
698 |
|
// /** |
699 |
|
// * Load magnetic field parameters (call the F77 routine). |
700 |
|
// * |
701 |
|
// */ |
702 |
|
// int TrkLevel1::LoadAlignmentParam(TString path){ |
703 |
|
|
704 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
705 |
|
// if( path.IsNull() ){ |
706 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
707 |
|
// if(path.IsNull()){ |
708 |
|
// cout << " TrkLevel1::LoadAlignmentParam() ==> No PAMELA environment variables defined "<<endl; |
709 |
|
// return 0; |
710 |
|
// } |
711 |
|
// path.Append("/trk-param/align_param-0/"); |
712 |
|
// } |
713 |
|
// cout <<"Loading alignment parameters: "<<path<<endl; |
714 |
|
// strcpy(path_.path,path.Data()); |
715 |
|
// path_.pathlen = path.Length(); |
716 |
|
// path_.error = 0; |
717 |
|
// return readalignparam_(); |
718 |
|
// // } |
719 |
|
// // return 0; |
720 |
|
// } |
721 |
|
// /** |
722 |
|
// * Load magnetic field parameters (call the F77 routine). |
723 |
|
// * |
724 |
|
// */ |
725 |
|
// int TrkLevel1::LoadMipParam(TString path){ |
726 |
|
|
727 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
728 |
|
// if( path.IsNull() ){ |
729 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
730 |
|
// if(path.IsNull()){ |
731 |
|
// cout << " TrkLevel1::LoadMipParam() ==> No PAMELA environment variables defined "<<endl; |
732 |
|
// return 0; |
733 |
|
// } |
734 |
|
// path.Append("/trk-param/mip_param-0/"); |
735 |
|
// } |
736 |
|
// cout <<"Loading ADC-to-MIP conversion parameters: "<<path<<endl; |
737 |
|
// strcpy(path_.path,path.Data()); |
738 |
|
// path_.pathlen = path.Length(); |
739 |
|
// path_.error = 0; |
740 |
|
// return readmipparam_(); |
741 |
|
// // } |
742 |
|
// // return 0; |
743 |
|
// } |
744 |
|
// /** |
745 |
|
// * Load magnetic field parameters (call the F77 routine). |
746 |
|
// * |
747 |
|
// */ |
748 |
|
// int TrkLevel1::LoadVKMaskParam(TString path){ |
749 |
|
|
750 |
|
// // if( strcmp(path_.path,path.Data()) ){ |
751 |
|
// if( path.IsNull() ){ |
752 |
|
// path = gSystem->Getenv("PAM_CALIB"); |
753 |
|
// if(path.IsNull()){ |
754 |
|
// cout << " TrkLevel1::LoadVKMaskParam() ==> No PAMELA environment variables defined "<<endl; |
755 |
|
// return 0; |
756 |
|
// } |
757 |
|
// path.Append("/trk-param/mask_param-1/"); |
758 |
|
// } |
759 |
|
// cout <<"Loading VK-mask parameters: "<<path<<endl; |
760 |
|
// strcpy(path_.path,path.Data()); |
761 |
|
// path_.pathlen = path.Length(); |
762 |
|
// path_.error = 0; |
763 |
|
// return readvkmask_(); |
764 |
|
// // } |
765 |
|
// // return 0; |
766 |
|
// } |
767 |
|
|
768 |
|
// /** |
769 |
|
// * Load all (default) parameters. Environment variable must be defined. |
770 |
|
// * |
771 |
|
// */ |
772 |
|
// int TrkLevel1::LoadParams(){ |
773 |
|
|
774 |
|
// int result=0; |
775 |
|
|
776 |
|
// result = result * LoadFieldParam(); |
777 |
|
// result = result * LoadPfaParam(); |
778 |
|
// result = result * LoadChargeParam(); |
779 |
|
// result = result * LoadAlignmentParam(); |
780 |
|
// result = result * LoadMipParam(); |
781 |
|
// result = result * LoadVKMaskParam(); |
782 |
|
|
783 |
|
// return result; |
784 |
|
// } |
785 |
|
|
786 |
|
|
787 |
|
|
788 |
|
int TrkLevel1::GetPfaNbinsAngle(){ |
789 |
|
TrkParams::Load(4); |
790 |
|
if( !TrkParams::IsLoaded(4) ){ |
791 |
|
cout << "int TrkLevel1::GetPfaNbinsAngle() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
792 |
|
return 0; |
793 |
|
} |
794 |
|
return pfa_.nangbin; |
795 |
|
}; |
796 |
|
|
797 |
|
int TrkLevel1::GetPfaNbinsETA(){ |
798 |
|
TrkParams::Load(4); |
799 |
|
if( !TrkParams::IsLoaded(4) ){ |
800 |
|
cout << "int TrkLevel1::GetPfaNbinsETA() --- ERROR --- p.f.a. parameters not loaded"<<endl; |
801 |
|
return 0; |
802 |
|
} |
803 |
|
return pfa_.netaval; |
804 |
|
}; |
805 |
|
|
806 |
/** |
/** |
807 |
* |
* |
808 |
* |
* |
809 |
*/ |
*/ |
810 |
float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang){ |
811 |
|
|
812 |
|
TrkParams::Load(4); |
813 |
|
if( !TrkParams::IsLoaded(4) ){ |
814 |
|
cout << "float* TrkLevel1::GetPfaCoord(TString pfa, int nview, int nladder, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
815 |
|
return 0; |
816 |
|
} |
817 |
|
|
818 |
int nbins = GetPfaNbinsETA(); |
int nbins = GetPfaNbinsETA(); |
819 |
if(!nbins)return 0; |
if(!nbins)return 0; |
840 |
|
|
841 |
float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
float* TrkLevel1::GetPfaAbs(TString pfa, int nang){ |
842 |
|
|
843 |
|
TrkParams::Load(4); |
844 |
|
if( !TrkParams::IsLoaded(4) ){ |
845 |
|
cout << "float* TrkLevel1::GetPfaAbs(TString pfa, int nang) --- ERROR --- p.f.a. parameters not loaded"<<endl; |
846 |
|
return 0; |
847 |
|
} |
848 |
|
|
849 |
int nbins = GetPfaNbinsETA(); |
int nbins = GetPfaNbinsETA(); |
850 |
if(!nbins)return 0; |
if(!nbins)return 0; |
851 |
|
|
864 |
|
|
865 |
return fcorr; |
return fcorr; |
866 |
|
|
|
|
|
867 |
}; |
}; |
868 |
|
|
869 |
|
/** |
870 |
|
* Method to call the F77 routine that performs level1->level2 processing. |
871 |
|
* The level2 output is stored in a common block, which can be retrieved |
872 |
|
* by mean of the method TrkLevel2::SetFromLevel2Struct(). |
873 |
|
* @param pfa Position finding algorythm used to reconstruct the track |
874 |
|
* Implemented algorythms: |
875 |
|
* 0 ETA (default) |
876 |
|
* 1 --- |
877 |
|
* 2 ETA2 |
878 |
|
* 3 ETA3 |
879 |
|
* 4 ETA4 |
880 |
|
* 10 COG |
881 |
|
* 11 COG1 |
882 |
|
* 12 COG2 |
883 |
|
* 13 COG3 |
884 |
|
* 14 COG4 |
885 |
|
* NB If the TrkLevel1 object is readout from a tree, and the |
886 |
|
* TrkLevel1::ProcessEvent(int pfa) is used to reprocess the event, attention |
887 |
|
* should be payed to the fact that single clusters (clusters not associated |
888 |
|
* with any track) might not be stored. Full reprocessing should be done from |
889 |
|
* level0 data. |
890 |
|
*/ |
891 |
|
int TrkLevel1::ProcessEvent(int pfa){ |
892 |
|
|
893 |
|
// cout << "int TrkLevel1::ProcessEvent()" << endl; |
894 |
|
TrkParams::Load( ); |
895 |
|
if( !TrkParams::IsLoaded() )return 0; |
896 |
|
|
897 |
|
GetLevel1Struct(); |
898 |
|
|
899 |
|
analysisflight_(&pfa); |
900 |
|
|
901 |
|
return 1; |
902 |
|
|
903 |
|
} |
904 |
|
|
905 |
|
|
906 |
ClassImp(TrkLevel1); |
ClassImp(TrkLevel1); |