Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 3052)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 3053)
@@ -20,4 +20,7 @@
    * manalysis/MHPedestalPixel.cc
      - increased number of bins in for charges plot
+
+   * mtools/MFFT.[h,cc]
+     - possibility to have PSD directly from TArray
 
 
Index: /trunk/MagicSoft/Mars/mtools/MFFT.h
===================================================================
--- /trunk/MagicSoft/Mars/mtools/MFFT.h	(revision 3052)
+++ /trunk/MagicSoft/Mars/mtools/MFFT.h	(revision 3053)
@@ -29,6 +29,6 @@
   void Swap(Double_t &a, Double_t &b)   { Double_t c = a;  a = b;  b = c;  }
 
-  void TransformF(const Int_t isign);
-  void TransformD(const Int_t isign);  
+  void TransformF(const Int_t isign, TArrayF &data);
+  void TransformD(const Int_t isign, TArrayD &data);  
   void RealFTF(const Int_t isign);
   void RealFTD(const Int_t isign);
@@ -36,8 +36,19 @@
   void CheckDim(Int_t a);
   TH1 *CheckHist(const TH1 *hist, const Int_t flag);
+
+  Float_t ApplyWindow(const Int_t j, const Float_t a, const Float_t b) const 
+    {
+
+      return 1.0-TMath::Abs((j-a)*b);      // Bartlett
+      // return 1.0;                        // Square
+      // return 1.0-(((j-a)*b)*((j-a)*b));   // Welch
+      
+    }
   
   Int_t   fDim;
   TArrayF fDataF;
   TArrayD fDataD;  
+  TArrayF fWindowF;
+  TArrayD fWindowD;  
 
 public:
@@ -58,6 +69,13 @@
   Double_t* RealFunctionIFFT(const Int_t n, const Double_t *data);  
   
+  TH1F* PowerSpectrumDensity(const TH1 *hist);
   TH1F* PowerSpectrumDensity(const TH1F *hist);
+  TH1F* PowerSpectrumDensity(const TH1I *hist);  
   TH1D* PowerSpectrumDensity(const TH1D *hist);
+
+  TArrayF* PowerSpectrumDensity(const TArrayF *array);
+  TArrayD* PowerSpectrumDensity(const TArrayD *array);
+  
+  TArrayF*  RealFunctionSpectrum(const TArrayF *data);
   
   ClassDef(MFFT,0)  // Class to perform a Fast Fourier Transform
