Index: trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc	(revision 1999)
+++ trunk/MagicSoft/Mars/manalysis/MPadSchweizer.cc	(revision 2001)
@@ -17,5 +17,5 @@
 !
 !   Author(s): Robert Wagner   <mailto:magicsoft@rwagner.de> 10/2002
-!              Wolfgang Wittek <mailto:wittek@mppmu.mpg.de>  02/2003
+!   Author(s): Wolfgang Wittek <mailto:wittek@mppmu.mpg.de>  02/2003
 !
 !   Copyright: MAGIC Software Development, 2000-2003
@@ -25,40 +25,41 @@
 
 /////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-//  MPadSchweizer                                                          //
-//                                                                         //
-//  This task applies padding such that for a given pixel and for a given  //
-//  Theta bin the resulting distribution of the pedestal sigma is identical//
-//  to the distributions given by fHSigmaPixTheta and fHDiffPixTheta.      //
-//                                                                         //
-//  The number of photons, its error and the pedestal sigmas are altered.  //
-//  On average, the number of photons added is zero.                       //
-//                                                                         //
-//  The formulas used can be found in Thomas Schweizer's Thesis,           //
-//                                    Section 2.2.1                        //
-//                                                                         //
-//  There are 2 options for the padding :                                  //
-//                                                                         //
-//  1) fPadFlag = 1 :                                                      //
-//     Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta //
-//     (fHSigmaTheta). Then generate a pedestal sigma for each pixel using //
-//     the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2               //
-//     (fHDiffPixTheta).                                                   //
-//                                                                         //
-//     This is the preferred option as it takes into account the           //
-//     correlations between the Sigma of a pixel and Sigmabar.             //
-//                                                                         //
-//  2) fPadFlag = 2 :                                                      //
-//     Generate a pedestal sigma for each pixel using the 3D-histogram     //
-//     Theta, pixel no., Sigma (fHSigmaPixTheta).                          //
-//                                                                         //
-//                                                                         //
-//  The padding has to be done before the image cleaning because the       //
-//  image cleaning depends on the pedestal sigmas.                         //
-//                                                                         //
-//                                                                         //
-//  This implementation has been tested for CT1 data. For MAGIC some       //
-//  modifications are necessary.                                           //
-//                                                                         //
+//
+//  MPadSchweizer
+//
+//  This task applies padding such that for a given pixel and for a given
+//  Theta bin the resulting distribution of the pedestal sigma is identical
+//  to the distributions given by fHSigmaPixTheta and fHDiffPixTheta.
+//
+//  The number of photons, its error and the pedestal sigmas are altered.
+//  On average, the number of photons added is zero.
+//
+//  The formulas used can be found in Thomas Schweizer's Thesis,
+//                                    Section 2.2.1
+//
+//  There are 2 options for the padding :
+//
+//  1) fPadFlag = 1 :
+//     Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta
+//     (fHSigmaTheta). Then generate a pedestal sigma for each pixel using
+//     the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2
+//     (fHDiffPixTheta).
+//
+//     This is the preferred option as it takes into account the
+//     correlations between the Sigma of a pixel and Sigmabar.
+//
+//  2) fPadFlag = 2 :
+//     Generate a pedestal sigma for each pixel using the 3D-histogram
+//     Theta, pixel no., Sigma (fHSigmaPixTheta).
+//
+//
+//  The padding has to be done before the image cleaning because the
+//  image cleaning depends on the pedestal sigmas.
+//
+//  For random numbers gRandom is used.
+//
+//  This implementation has been tested for CT1 data. For MAGIC some
+//  modifications are necessary.
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MPadSchweizer.h"
@@ -66,9 +67,9 @@
 #include <stdio.h>
 
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-#include "TRandom.h"
-#include "TCanvas.h"
+#include <TH1.h>
+#include <TH2.h>
+#include <TH3.h>
+#include <TRandom.h>
+#include <TCanvas.h>
 
 #include "MBinning.h"
@@ -96,23 +97,13 @@
   fName  = name  ? name  : "MPadSchweizer";
   fTitle = title ? title : "Task for the padding (Schweizer)";
-
-  //fHSigmaTheta    = fHist2;
-  //fHSigmaPixTheta = fHist3;
-  //fHDiffPixTheta  = fHist3Diff;
-
-  //fHSigmaTheta->SetDirectory(NULL);
-  //fHSigmaPixTheta->SetDirectory(NULL);
-  //fHDiffPixTheta->SetDirectory(NULL);
-
-  //Print();
 }
 
 // --------------------------------------------------------------------------
 //
-// Destructor. 
+// Destructor. STLL DOESN'T DESTRUCT EVERYTHING
 //
 MPadSchweizer::~MPadSchweizer()
 {
-  //nothing yet
+    *fLog << all << "WARNING: ~MPadSchweizer called: Potential Memory Leak" << endl;
 }
 
@@ -120,38 +111,38 @@
 //
 // Set the references to the histograms to be used in the padding
-//
-//
-void MPadSchweizer::SetHistograms(TH2D *fHist2, TH3D *fHist3, TH3D *fHist3Diff)
+// DOCUMENTATION of the arguments MISSING
+//
+void MPadSchweizer::SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff)
 {
-  fHSigmaTheta    = fHist2;
-  fHSigmaPixTheta = fHist3;
-  fHDiffPixTheta  = fHist3Diff;
-
-  fHSigmaTheta->SetDirectory(NULL);
-  fHSigmaPixTheta->SetDirectory(NULL);
-  fHDiffPixTheta->SetDirectory(NULL);
-
-  Print();
+    fHSigmaTheta    = hist2;
+    fHSigmaPixTheta = hist3;
+    fHDiffPixTheta  = hist3Diff;
+
+    fHSigmaTheta->SetDirectory(NULL);
+    fHSigmaPixTheta->SetDirectory(NULL);
+    fHDiffPixTheta->SetDirectory(NULL);
+
+    Print();
 }
 
 // --------------------------------------------------------------------------
 //
-// Set the option for the padding 
-//
-//  There are 2 options for the padding :                                  //
-//                                                                         //
-//  1) fPadFlag = 1 :                                                      //
-//     Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta //
-//     (fHSigmaTheta). Then generate a pedestal sigma for each pixel using //
-//     the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2               //
-//     (fHDiffPixTheta).                                                   //
-//                                                                         //
-//     This is the preferred option as it takes into account the           //
-//     correlations between the Sigma of a pixel and Sigmabar.             //
-//                                                                         //
-//  2) fPadFlag = 2 :                                                      //
-//     Generate a pedestal sigma for each pixel using the 3D-histogram     //
-//     Theta, pixel no., Sigma (fHSigmaPixTheta).                          //
-//                                                                         //
+// Set the option for the padding
+//
+//  There are 2 options for the padding :
+//
+//  1) fPadFlag = 1 :
+//     Generate first a Sigmabar using the 2D-histogram Sigmabar vs. Theta
+//     (fHSigmaTheta). Then generate a pedestal sigma for each pixel using
+//     the 3D-histogram Theta, pixel no., Sigma^2-Sigmabar^2
+//     (fHDiffPixTheta).
+//
+//     This is the preferred option as it takes into account the
+//     correlations between the Sigma of a pixel and Sigmabar.
+//
+//  2) fPadFlag = 2 :
+//     Generate a pedestal sigma for each pixel using the 3D-histogram
+//     Theta, pixel no., Sigma (fHSigmaPixTheta).
+//
 void MPadSchweizer::SetPadFlag(Int_t padflag)
 {
@@ -166,6 +157,4 @@
 Bool_t MPadSchweizer::PreProcess(MParList *pList)
 {
-  fRnd = new TRandom3(0);
-
   fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt");
   if (!fMcEvt)
@@ -573,5 +562,5 @@
     // throw actual number of additional NSB photons (NSB)
     //       and its RMS (sigmaNSB) 
-    Double_t NSB0 = fRnd->Poisson(lambdabar*Area);
+    Double_t NSB0 = gRandom->Poisson(lambdabar*Area);
     Double_t arg  = NSB0*(F2excess-1.0) + elNoise2Pix;
     Double_t sigmaNSB0;
@@ -592,5 +581,5 @@
     // smear NSB0 according to sigmaNSB0
     // and subtract lambdabar because of AC coupling
-    Double_t NSB = fRnd->Gaus(NSB0, sigmaNSB0) - lambdabar*Area;
+    Double_t NSB = gRandom->Gaus(NSB0, sigmaNSB0) - lambdabar*Area;
 
     //---------------------------------
Index: trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h	(revision 1999)
+++ trunk/MagicSoft/Mars/manalysis/MPadSchweizer.h	(revision 2001)
@@ -10,9 +10,7 @@
 #endif
 
-#include "TRandom3.h"
-#include "TH1.h"
-#include "TH2.h"
-#include "TH3.h"
-
+class TH1D;
+class TH2D;
+class TH3D;
 
 class MGeomCam;
@@ -26,11 +24,9 @@
 {
 private:
-    MGeomCam *fCam; 
+    MGeomCam       *fCam;
     MCerPhotEvt    *fEvt; 
     MSigmabar      *fSigmabar;
     MMcEvt         *fMcEvt;
     MPedestalCam   *fPed;
-
-    TRandom3       *fRnd;
 
     Int_t          fPadFlag;
@@ -64,6 +60,5 @@
     ~MPadSchweizer();
 
-    void SetHistograms(TH2D     *fHist2=NULL, TH3D *fHist3=NULL, 
-                       TH3D *fHist3Diff=NULL);
+    void SetHistograms(TH2D *hist2, TH3D *hist3, TH3D *hist3Diff);
 
     Bool_t PreProcess(MParList *pList);
Index: trunk/MagicSoft/Mars/manalysis/MSigmabarParam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MSigmabarParam.h	(revision 1999)
+++ trunk/MagicSoft/Mars/manalysis/MSigmabarParam.h	(revision 2001)
@@ -28,8 +28,8 @@
   void SetParams(Int_t r, Double_t si, Double_t sx, Double_t ti, Double_t tx, Double_t mi=0, Double_t mx=0);
 
-  Double_t GetSigmabarMin() { return fSigmabarMin; }
-  Double_t GetSigmabarMax() { return fSigmabarMax; }
-  Double_t GetThetaMin() { return fThetaMin; }
-  Double_t GetThetaMax() { return fThetaMax; }
+  Double_t GetSigmabarMin() const { return fSigmabarMin; }
+  Double_t GetSigmabarMax() const { return fSigmabarMax; }
+  Double_t GetThetaMin() const { return fThetaMin; }
+  Double_t GetThetaMax() const { return fThetaMax; }
 
   void Print();
