Changeset 4958 for trunk/MagicSoft
- Timestamp:
- 09/12/04 21:13:24 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4957 r4958 37 37 - added functions ProjectArray(MArrayD,...) 38 38 and ProjectArray(MArrayF,...) 39 40 * mtools/MFFT.[h,cc] 41 - added functions: 42 MArrayF* PowerSpectrumDensity(const MArrayI *array); 43 MArrayF* PowerSpectrumDensity(const MArrayF *array); 44 MArrayD* PowerSpectrumDensity(const MArrayD *array); 39 45 40 46 * mbadpixels/MBadPixelsIntensityCam.[h,cc] -
trunk/MagicSoft/Mars/mbase/MArrayD.h
r4955 r4958 81 81 } 82 82 83 Double_t At(UInt_t i) 83 Double_t At(UInt_t i) const 84 84 { 85 85 return fArray[i]; -
trunk/MagicSoft/Mars/mbase/MArrayF.h
r4955 r4958 81 81 } 82 82 83 Float_t At(UInt_t i) 83 Float_t At(UInt_t i) const 84 84 { 85 85 return fArray[i]; -
trunk/MagicSoft/Mars/mbase/MArrayI.h
r4916 r4958 80 80 } 81 81 82 Int_t At(UInt_t i) 82 Int_t At(UInt_t i) const 83 83 { 84 84 return fArray[i]; -
trunk/MagicSoft/Mars/mtools/MFFT.cc
r3957 r4958 103 103 #include "MLogManip.h" 104 104 105 #include "MArrayD.h" 106 #include "MArrayF.h" 107 #include "MArrayI.h" 108 105 109 ClassImp(MFFT); 106 110 … … 628 632 } 629 633 630 634 //---------------------------------------------------------- 631 635 // 632 636 // Power Spectrum Density Calculation … … 678 682 } 679 683 684 // ------------------------------------------------- 680 685 // 681 686 // Power Spectrum Density calculation for TArrayF … … 710 715 // 711 716 c02 = (fDataF[0]*fDataF[0]); 712 //newarray->AddAt(c02/dim2,0);717 newarray->AddAt(c02/dim2,0); 713 718 // 714 719 // 2) P(k) = 1/(N*N) (|C(k)|*|C(k)|)) … … 724 729 // 725 730 cn2 = (fDataF[1]*fDataF[1]); 726 //newarray->AddAt(cn2,dim05-1);731 newarray->AddAt(cn2,dim05-1); 727 732 728 733 return newarray; 729 734 } 730 735 731 736 // ------------------------------------------------- 732 737 // 733 738 // Power Spectrum Density calculation for TArrayI … … 762 767 // 763 768 c02 = (fDataF[0]*fDataF[0]); 764 //newarray->AddAt(c02/dim2,0);769 newarray->AddAt(c02/dim2,0); 765 770 // 766 771 // 2) P(k) = 1/(N*N) (|C(k)|*|C(k)|)) … … 776 781 // 777 782 cn2 = (fDataF[1]*fDataF[1]); 778 //newarray->AddAt(cn2,dim05-1);783 newarray->AddAt(cn2,dim05-1); 779 784 780 785 return newarray; … … 782 787 783 788 789 // ------------------------------------------------- 790 // 791 // Power Spectrum Density calculation for TArrayD 792 // 784 793 TArrayD* MFFT::PowerSpectrumDensity(const TArrayD *array) 785 794 { … … 811 820 // 812 821 c02 = (fDataD[0]*fDataD[0]); 813 //newarray->AddAt(c02/dim2,0);822 newarray->AddAt(c02/dim2,0); 814 823 // 815 824 // 2) P(k) = 1/(N*N) (|C(k)|*|C(k)|)) … … 825 834 // 826 835 cn2 = (fDataD[1]*fDataD[1]); 836 newarray->AddAt(cn2,dim05-1); 837 838 return newarray; 839 } 840 841 // ------------------------------------------------- 842 // 843 // Power Spectrum Density calculation for MArrayF 844 // The difference to the TArrayF versions is that 845 // the resulting array has two entries less, namely 846 // the first and last one are skipped! 847 // 848 MArrayF* MFFT::PowerSpectrumDensity(const MArrayF *array) 849 { 850 851 fDim = array->GetSize(); 852 CheckDim(fDim); 853 854 fDataF.Set(fDim); 855 // 856 // Copy the hist into an array 857 // 858 for (Int_t i=0;i<fDim;i++) 859 fDataF[i] = array->At(i); 860 861 RealFTF(1); 862 863 const Int_t dim2 = fDim*fDim; 864 const Int_t dim05 = fDim/2; 865 Float_t ck2; 866 867 MArrayF *newarray = new MArrayF(dim05-2); 868 869 // 870 // Fill the new histogram: 871 // 872 // 1) P(0) = 1/(N*N) |C(0)|*|C(0)| 873 // 874 // c02 = (fDataF[0]*fDataF[0]); 875 // newarray->AddAt(c02/dim2,0); 876 // 877 // 2) P(k) = 1/(N*N) (|C(k)|*|C(k)|)) 878 // 879 for (Int_t k=1;k<dim05-1;k++) 880 { 881 const Int_t k2 = k+k; 882 ck2 = (fDataF[k2]*fDataF[k2] + fDataF[k2+1]*fDataF[k2+1]); 883 newarray->AddAt(ck2/dim2,k-1); 884 } 885 // 886 // 3) P(N) = 1/(N*N) (|C(n/2)|*|C(n/2)|) 887 // 888 // cn2 = (fDataF[1]*fDataF[1]); 827 889 // newarray->AddAt(cn2,dim05-1); 828 890 … … 830 892 } 831 893 832 894 //----------------------------------------------------- 895 // 896 // Power Spectrum Density calculation for MArrayI 897 // The difference to the TArrayI versions is that 898 // the resulting array has two entries less, namely 899 // the first and last one are skipped! 900 // 901 MArrayF* MFFT::PowerSpectrumDensity(const MArrayI *array) 902 { 903 904 fDim = array->GetSize(); 905 CheckDim(fDim); 906 907 fDataF.Set(fDim); 908 // 909 // Copy the hist into an array 910 // 911 for (Int_t i=0;i<fDim;i++) 912 fDataF[i] = (Float_t)array->At(i); 913 914 RealFTF(1); 915 916 const Int_t dim2 = fDim*fDim; 917 const Int_t dim05 = fDim/2; 918 Float_t ck2; 919 920 MArrayF *newarray = new MArrayF(dim05-2); 921 922 // 923 // Fill the new histogram: 924 // 925 // 1) P(0) = 1/(N*N) |C(0)|*|C(0)| 926 // 927 // c02 = (fDataF[0]*fDataF[0]); 928 // newarray->AddAt(c02/dim2,0); 929 // 930 // 2) P(k) = 1/(N*N) (|C(k)|*|C(k)|)) 931 // 932 for (Int_t k=1;k<dim05-1;k++) 933 { 934 const Int_t k2 = k+k; 935 ck2 = (fDataF[k2]*fDataF[k2] + fDataF[k2+1]*fDataF[k2+1]); 936 newarray->AddAt(ck2/dim2,k-1); 937 } 938 // 939 // 3) P(N) = 1/(N*N) (|C(n/2)|*|C(n/2)|) 940 // 941 // cn2 = (fDataF[1]*fDataF[1]); 942 // newarray->AddAt(cn2,dim05-1); 943 944 return newarray; 945 } 946 947 // ------------------------------------------------- 948 // 949 // Power Spectrum Density calculation for MArrayD 950 // The difference to the TArrayI versions is that 951 // the resulting array has two entries less, namely 952 // the first and last one are skipped! 953 // 954 MArrayD* MFFT::PowerSpectrumDensity(const MArrayD *array) 955 { 956 957 fDim = array->GetSize(); 958 CheckDim(fDim); 959 960 fDataD.Set(fDim); 961 // 962 // Copy the hist into an array 963 // 964 for (Int_t i=0;i<fDim;i++) 965 fDataD[i] = array->At(i); 966 967 RealFTD(1); 968 969 const Int_t dim2 = fDim*fDim; 970 const Int_t dim05 = fDim/2; 971 Float_t ck2; 972 973 MArrayD *newarray = new MArrayD(dim05-2); 974 975 // 976 // Fill the new histogram: 977 // 978 // 1) P(0) = 1/(N*N) |C(0)|*|C(0)| 979 // 980 // c02 = (fDataD[0]*fDataD[0]); 981 // newarray->AddAt(c02/dim2,0); 982 // 983 // 2) P(k) = 1/(N*N) (|C(k)|*|C(k)|)) 984 // 985 for (Int_t k=1;k<dim05-1;k++) 986 { 987 const Int_t k2 = k+k; 988 ck2 = (fDataD[k2]*fDataD[k2] + fDataD[k2+1]*fDataD[k2+1]); 989 newarray->AddAt(ck2/dim2,k-1); 990 } 991 // 992 // 3) P(N) = 1/(N*N) (|C(n/2)|*|C(n/2)|) 993 // 994 // cn2 = (fDataD[1]*fDataD[1]); 995 // newarray->AddAt(cn2,dim05-1); 996 997 return newarray; 998 } 999 1000 // ----------------------------------------------- 833 1001 // 834 1002 // Power Spectrum Density calculation for TH1 -
trunk/MagicSoft/Mars/mtools/MFFT.h
r3125 r4958 22 22 #endif 23 23 24 class MArrayI; 25 class MArrayD; 26 class MArrayF; 24 27 class MFFT : public TObject 25 28 { … … 78 81 TArrayD* PowerSpectrumDensity(const TArrayD *array); 79 82 83 MArrayF* PowerSpectrumDensity(const MArrayI *array); 84 MArrayF* PowerSpectrumDensity(const MArrayF *array); 85 MArrayD* PowerSpectrumDensity(const MArrayD *array); 86 80 87 TArrayF* RealFunctionSpectrum(const TArrayF *data); 81 88
Note:
See TracChangeset
for help on using the changeset viewer.