Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 3183)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 3184)
@@ -59,4 +59,12 @@
      - added constant number for max format version - preliminary 
        (should by a static data member)
+
+   * mcalib/MHCalibrationPINDiode.cc:
+     - do not delete pointers in the destructor which are already
+       deleted in the base class
+     - reset histograms in Clear()
+
+   * mcalib/MHCalibrationPixel.cc:
+     - after deletion of instances in Clear() initialize pointer to NULL
 
 
Index: /trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc	(revision 3183)
+++ /trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc	(revision 3184)
@@ -76,42 +76,28 @@
 MHCalibrationPINDiode::~MHCalibrationPINDiode()
 {
-
-  delete fHPINDiodeCharge;
-  delete fHPINDiodeChargevsN;
-
-  if (fChargeGausFit)
-    delete fChargeGausFit;
-  if (fFitLegend)
-    delete fFitLegend;
+    delete fHPINDiodeCharge;
+    delete fHPINDiodeChargevsN;
 }
 
 void MHCalibrationPINDiode::Clear(Option_t *o)
 {
-  
-  fTotalEntries            = 0;
+    fTotalEntries      = 0;
 
-  fChargeFirstHiGain       = -100.5;
-  fChargeLastHiGain        = 1999.5;
+    fChargeFirstHiGain = -100.5;
+    fChargeLastHiGain  = 1999.5;
 
-  fChargeChisquare         = -1.;
-  fChargeProb              = -1.;
-  fChargeNdf               = -1;
+    fChargeChisquare   = -1;
+    fChargeProb        = -1;
+    fChargeNdf         = -1;
 
-  if (fChargeGausFit)
-    delete fChargeGausFit;
-  if (fFitLegend)
-    delete fFitLegend;
-
-  return;
-
+    MHCalibrationPixel::Clear();
 }
 
 void MHCalibrationPINDiode::Reset()
 {
+    Clear();
 
-  Clear();
-
-  fHPINDiodeCharge->Reset();
-  fHPINDiodeChargevsN->Reset();
+    fHPINDiodeCharge->Reset();
+    fHPINDiodeChargevsN->Reset();
 }
 
Index: /trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc	(revision 3183)
+++ /trunk/MagicSoft/Mars/mcalib/MHCalibrationPixel.cc	(revision 3184)
@@ -161,53 +161,77 @@
 void MHCalibrationPixel::Clear(Option_t *o)
 {
-  
-  fTotalEntries            = 0;
-  fCurrentSize             = 1024;
-
-  fChargeFirstHiGain       = -100.5;
-  fChargeLastHiGain        = 1999.5;
-  fChargeFirstLoGain       = -100.5;
-  fChargeLastLoGain        = 9999.5;
-
-  fChargeChisquare         = -1.;
-  fChargeProb              = -1.;
-  fChargeNdf               = -1;
-
-  fAbsTimeFirstHiGain     = -1.;
-  fAbsTimeFirstLoGain     = -1.;
-  fAbsTimeLastHiGain      = -1.;
-  fAbsTimeLastLoGain      = -1.;
-  
-  fAbsTimeMean            = -1.;
-  fAbsTimeMeanErr         = -1.;
-  fAbsTimeRms             = -1.;
-
-  fOffset = 0.;
-  fSlope  = 0.;
-
-  if (fChargeGausFit)
-    delete fChargeGausFit;
-  if (fPSDExpFit)
-    delete fPSDExpFit;
-  if (fHPSD)
-    delete fHPSD;
-  if (fFitLegend)
-    delete fFitLegend;
-  if (fHivsLoGain)
-    delete fHivsLoGain;
-  if (fChargeXaxis)
-    delete fChargeXaxis;
-  if (fPSDXaxis)
-    delete fPSDXaxis;
-  if (fPSDHiGain)
-    delete fPSDHiGain;
-  if (fPSDLoGain)
-    delete fPSDLoGain;
-
-  CLRBIT(fFlags,kUseLoGain);
-  CLRBIT(fFlags,kChargeFitOK);
-  CLRBIT(fFlags,kOscillating);
-
-  return;
+    fTotalEntries       =    0;
+    fCurrentSize        = 1024;
+
+    fChargeFirstHiGain  = -100.5;
+    fChargeLastHiGain   = 1999.5;
+    fChargeFirstLoGain  = -100.5;
+    fChargeLastLoGain   = 9999.5;
+
+    fChargeChisquare    = -1;
+    fChargeProb         = -1;
+    fChargeNdf          = -1;
+
+    fAbsTimeFirstHiGain = -1;
+    fAbsTimeFirstLoGain = -1;
+    fAbsTimeLastHiGain  = -1;
+    fAbsTimeLastLoGain  = -1;
+
+    fAbsTimeMean        = -1;
+    fAbsTimeMeanErr     = -1;
+    fAbsTimeRms         = -1;
+
+    fOffset = 0.;
+    fSlope  = 0.;
+
+    if (fChargeGausFit)
+    {
+        delete fChargeGausFit;
+        fChargeGausFit=0;
+    }
+    if (fPSDExpFit)
+    {
+        delete fPSDExpFit;
+        fPSDExpFit=0;
+    }
+    if (fHPSD)
+    {
+        delete fHPSD;
+        fHPSD=0;
+    }
+    if (fFitLegend)
+    {
+        delete fFitLegend;
+        fFitLegend=0;
+    }
+    if (fHivsLoGain)
+    {
+        delete fHivsLoGain;
+        fHivsLoGain=0;
+    }
+    if (fChargeXaxis)
+    {
+        delete fChargeXaxis;
+        fChargeXaxis=0;
+    }
+    if (fPSDXaxis)
+    {
+        delete fPSDXaxis;
+        fPSDXaxis=0;
+    }
+    if (fPSDHiGain)
+    {
+        delete fPSDHiGain;
+        fPSDHiGain=0;
+    }
+    if (fPSDLoGain)
+    {
+        delete fPSDLoGain;
+        fPSDLoGain=0;
+    }
+
+    CLRBIT(fFlags, kUseLoGain);
+    CLRBIT(fFlags, kChargeFitOK);
+    CLRBIT(fFlags, kOscillating);
 }
 
@@ -215,19 +239,17 @@
 void MHCalibrationPixel::Reset()
 {
-  
-  Clear();
-  
-  fHChargeHiGain->Reset();
-  fHChargeLoGain->Reset();
-
-  fHAbsTimeHiGain->Reset();
-  fHAbsTimeLoGain->Reset();
-
-  fHiGains->Set(1024);
-  fLoGains->Set(1024);
-
-  fHiGains->Reset(0.);
-  fLoGains->Reset(0.);
-
+    Clear();
+  
+    fHChargeHiGain->Reset();
+    fHChargeLoGain->Reset();
+
+    fHAbsTimeHiGain->Reset();
+    fHAbsTimeLoGain->Reset();
+
+    fHiGains->Set(1024);
+    fLoGains->Set(1024);
+
+    fHiGains->Reset(0.);
+    fLoGains->Reset(0.);
 }
 
