Index: trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 2733)
+++ trunk/MagicSoft/Mars/manalysis/AnalysisLinkDef.h	(revision 2734)
@@ -10,6 +10,4 @@
 #pragma link C++ class MCerPhotAnal2+;
 #pragma link C++ class MCerPhotCalc+;
-
-#pragma link C++ class MCalibrate+;
 
 #pragma link C++ class MCameraData+;
@@ -69,10 +67,4 @@
 #pragma link C++ class MFiltercutsCalc+;
 
-#pragma link C++ class MCalibrationPix+;
-#pragma link C++ class MCalibrationBlindPix+;
-#pragma link C++ class MCalibrationPINDiode+;
-#pragma link C++ class MCalibrationCam+;
-#pragma link C++ class MCalibrationCalc+;
-
 #pragma link C++ class MPedestalWorkaround+;
 
Index: trunk/MagicSoft/Mars/manalysis/MCalibrate.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrate.cc	(revision 2733)
+++ 	(revision )
@@ -1,171 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Javier Lopez 12/2003 <mailto:jlopez@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//
-//   MCalibrate
-//
-//   This task takes the integrated charge from MExtractedSignal and apply
-//   the calibration constants from MCalibraitionCam to the charge. Then
-//   stores number of photons obtained in MCerPhotEvt.
-//
-//   Input Containers:
-//    MExtractedSingal
-//    MCalibrationCam
-//
-//   Output Containers:
-//    MCerPhotEvt
-//
-//////////////////////////////////////////////////////////////////////////////
-#include "MCalibrate.h"
-#include "MCalibrationConfig.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-#include "MH.h"
-
-#include "MGeomCam.h"
-
-#include "MCalibrationCam.h"
-#include "MCalibrationPix.h"
-
-#include "MExtractedSignalCam.h"
-#include "MExtractedSignalPix.h"
-
-#include "MCerPhotEvt.h"
-
-#include "MTime.h"
-#include "TMath.h"
-
-ClassImp(MCalibrate);
-
-using namespace std;
-// --------------------------------------------------------------------------
-//
-// Default constructor. 
-//
-MCalibrate::MCalibrate(const char *name, const char *title)
-{
-    fName  = name  ? name  : "MCalibrate";
-    fTitle = title ? title : "Task to calculate the number of photons in one event";
-}
-
-// --------------------------------------------------------------------------
-//
-// The PreProcess searches for the following input containers:
-//  - MGeomCam
-//  - MCalibrationCam
-//  - MExtractedSignalCam
-//
-// The following output containers are also searched and created if
-// they were not found:
-//
-//  - MCerPhotEvt
-//
-Int_t MCalibrate::PreProcess(MParList *pList)
-{
-    fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
-    if (!fSignals)
-    {
-        *fLog << err << "MExtractedSignalCam not found ... aborting" << endl;
-        return kFALSE;
-    }
-
-    fCalibrations = (MCalibrationCam*)pList->FindObject("MCalibrationCam");
-    if (!fCalibrations)
-    {
-        *fLog << err << "MCalibrationCam not found ... aborting." << endl;
-        return kFALSE;
-    }
-
-    fCerPhotEvt = (MCerPhotEvt*)pList->FindCreateObj("MCerPhotEvt");
-    if (!fCerPhotEvt)
-        return kFALSE;
-    
-    return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-//
-Int_t MCalibrate::Process()
-{
-  /*
-    if (fCalibrations->GetNumPixels() != (UInt_t)fSignals->GetSize())
-    {
-        // FIXME: MExtractedSignal must be of variable size -
-        //        like MCerPhotEvt - because we must be able
-        //        to reduce size by zero supression
-        //        For the moment this check could be done in ReInit...
-        *fLog << err << "MExtractedSignal and MCalibrationCam have different sizes... abort." << endl;
-        return kFALSE;
-    }
-  */
-
-    const UInt_t imaxnumpix = fSignals->GetSize();
-    
-    for (UInt_t pixidx=0; pixidx<imaxnumpix; pixidx++)
-    {
-	const MCalibrationPix &pix = (*fCalibrations)[pixidx];
-
-        if (!pix.IsBlindPixelMethodValid())
-            continue;
-
-        MExtractedSignalPix &sig =  (*fSignals)[pixidx];
-
-        Float_t signal;
-        Float_t signalErr = 0.;
-
-        if (sig.IsLoGainUsed())
-        {
-            signal    = sig.GetExtractedSignalLoGain()*pix.GetConversionHiLo();
-            signalErr = signal*pix.GetConversionHiLoError();
-        }
-        else
-        {
-            signal = sig.GetExtractedSignalHiGain();
-        }
-
-        //      Float_t calibrationConversionFactor = pix.GetMeanConversionFFactorMethod();
-        const Float_t calibrationConversionFactor      = pix.GetMeanConversionBlindPixelMethod();
-        const Float_t calibrationConversionFactorError = pix.GetErrorConversionBlindPixelMethod();
-
-        const Float_t nphot = signal*calibrationConversionFactor;
-        Float_t nphotErr    = signal*calibrationConversionFactorError
-                             *signal*calibrationConversionFactorError;
-        nphotErr += signalErr*calibrationConversionFactor
-                   *signalErr*calibrationConversionFactor;
-
-        nphotErr  = TMath::Sqrt(nphotErr);
-
-        fCerPhotEvt->AddPixel(pixidx, nphot, nphotErr);
-    }
-
-    fCerPhotEvt->FixSize();
-    fCerPhotEvt->SetReadyToSave();
-
-    return kTRUE;
-}
Index: trunk/MagicSoft/Mars/manalysis/MCalibrate.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrate.h	(revision 2733)
+++ 	(revision )
@@ -1,47 +1,0 @@
-#ifndef MARS_MCalibrate
-#define MARS_MCalibrate
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrate                                                              //
-//                                                                         //
-// Integrates the desired ADC time slices of one pixel and apply           //
-// calibration constants                                                   //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#ifndef ROOT_TArrayF
-#include <TArrayF.h>
-#endif
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MGeomCam;
-class MCalibrationCam;
-class MExtractedSignalCam;
-class MCerPhotEvt;
-
-class MCalibrate : public MTask
-{
-private:
-    MCalibrationCam     *fCalibrations; // Calibration constants 
-    MExtractedSignalCam *fSignals;      // Integrated charge in FADCs counts
-    MCerPhotEvt         *fCerPhotEvt; // Cerenkov Photon Event used for calculation
-
-    Float_t fConversionHiLo;
-    
-    Int_t PreProcess(MParList *pList);
-    Int_t Process();
-
-public:
-
-    MCalibrate(const char *name=NULL, const char *title=NULL);
-
-    void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; }
-    
-    ClassDef(MCalibrate, 0)   // Task to calculate cerenkov photons using calibration constants
-};
- 
-
-#endif
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.cc	(revision 2733)
+++ 	(revision )
@@ -1,124 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Markus Gaug   11/2003 <mailto:markus@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrationBlindPix                                                    //
-//                                                                         //
-// This is the storage container to hold informations about the calibration//
-// blind pixel                                                             //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MCalibrationBlindPix.h"
-#include "MHCalibrationBlindPixel.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MCalibrationBlindPix);
-
-using namespace std;
-// --------------------------------------------------------------------------
-//
-// Default Constructor. 
-//
-MCalibrationBlindPix::MCalibrationBlindPix(const char *name, const char *title)
-    : fHist(NULL),
-      fLambda(-1.),
-      fMu0   (-1.),
-      fMu1   (-1.),
-      fSigma0(-1.),
-      fSigma1(-1.),
-      fErrLambda(-1.),
-      fErrMu0   (-1.),
-      fErrMu1   (-1.),
-      fErrSigma0(-1.),
-      fErrSigma1(-1.),
-      fTime     (-1.),
-      fErrTime  (-1.)
-{
-
-  fName  = name  ? name  : "MCalibrationBlindPix";
-  fTitle = title ? title : "Container of the MHCalibrationBlindPixel and the fit results";
-
-  fHist = new MHCalibrationBlindPixel();
-  
-  if (!fHist)
-    *fLog << err << dbginf << "Could not create MHCalibrationBlindPixel " << endl;
-
-  fLambda    = fMu0    = fMu1    = fSigma0    = fSigma1    = 0;
-  fErrLambda = fErrMu0 = fErrMu1 = fErrSigma0 = fErrSigma1 = 0;
-  
-  fTime = fErrTime = 0;
-}
-
-MCalibrationBlindPix::~MCalibrationBlindPix() 
-{
-  delete fHist;
-}
-
-// ------------------------------------------------------------------------
-//
-// Invalidate values
-//
-void MCalibrationBlindPix::Clear(Option_t *o)
-{
-  fHist->Reset();
-}
-
-Bool_t MCalibrationBlindPix::FitCharge() 
-{
-
-  if (!fHist->FitSinglePhe())
-    return kFALSE;
-  
-  fLambda = fHist->GetLambda();
-  fMu0    = fHist->GetMu0();
-  fMu1    = fHist->GetMu1();
-  fSigma0 = fHist->GetSigma0();
-  fSigma1 = fHist->GetSigma1();
-
-  fErrLambda = fHist->GetLambdaErr();
-  fErrMu0    = fHist->GetMu0Err();
-  fErrMu1    = fHist->GetMu1Err();
-  fErrSigma0 = fHist->GetSigma0Err();
-  fErrSigma1 = fHist->GetSigma1Err();
-
-  return kTRUE;
-}
-
-
-
-Bool_t MCalibrationBlindPix::FitTime() 
-{
-
-  if(!fHist->FitTime())
-    return kFALSE;
-
-  fTime    = fHist->GetMeanTime();
-  fErrTime = fHist->GetMeanTimeErr();
-  
-  return kTRUE;
-
-}
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationBlindPix.h	(revision 2733)
+++ 	(revision )
@@ -1,69 +1,0 @@
-#ifndef MARS_MCalibrationBlindPix
-#define MARS_MCalibrationBlindPix
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-#include "MHCalibrationBlindPixel.h"
-
-class MCalibrationBlindPix : public MParContainer
-{
-private:
-
-  Float_t fLambda;           // The mean charge after the fit
-  Float_t fMu0;              // The position of the pedestal-peak
-  Float_t fMu1;              // The position of the first phe-peak
-  Float_t fSigma0;           // The width of the pedestal-peak
-  Float_t fSigma1;           // The width of the first phe-peak  
-
-  Float_t fErrLambda;        // The error of the mean charge after the fit
-  Float_t fErrMu0;           // The error of the position of the pedestal-peak
-  Float_t fErrMu1;           // The error of the position of the first phe-peak
-  Float_t fErrSigma0;        // The error of the width of the pedestal-peak
-  Float_t fErrSigma1;        // The error of the width of the first phe-peak  
-  
-  Float_t fTime;                // The mean arrival time after the fit  
-  Float_t fErrTime;             // The error of the mean arrival time after the fit
-  
-  MHCalibrationBlindPixel *fHist; // Pointer to the histograms performing the fits, etc.  
-  
-public:
-
-  MCalibrationBlindPix(const char *name=NULL, const char *title=NULL);
-  ~MCalibrationBlindPix();
-  
-  void Clear(Option_t *o="");
-  
-  Float_t GetLambda()    const    { return fLambda;  }
-  Float_t GetMu0()       const    { return fMu0;  }
-  Float_t GetMu1()       const    { return fMu1;  }
-  Float_t GetSigma0()    const    { return fSigma0;  }
-  Float_t GetSigma1()    const    { return fSigma1;  }
-
-  Float_t GetErrLambda() const    { return fErrLambda;  }
-  Float_t GetErrMu0()    const    { return fErrMu0;  }
-  Float_t GetErrMu1()    const    { return fErrMu1;  }
-  Float_t GetErrSigma0() const    { return fErrSigma0;  }
-  Float_t GetErrSigma1() const    { return fErrSigma1;  }
-
-  Float_t GetTime()      const    { return fTime;         }
-  Float_t GetErrTime()   const    { return fErrTime;      }
-  
-  Bool_t FillCharge(Float_t q)    { return fHist->FillBlindPixelCharge(q); }
-  Bool_t FillTime(Int_t t)        { return fHist->FillBlindPixelTime(t); }  
-  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillBlindPixelChargevsN(rq,t); }    
-  
-  Bool_t IsFitOK()                              { return fHist->IsFitOK(); }
-  
-  Bool_t FitCharge();
-  Bool_t FitTime();
-  
-  virtual void Draw(Option_t *opt="")         { fHist->Draw(opt); }
-  MHCalibrationBlindPixel *GetHist()  const  { return fHist;  }
-  
-  ClassDef(MCalibrationBlindPix, 1)	// Storage Container for Calibration information of one pixel
-};
-
-#endif
-
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.cc	(revision 2733)
+++ 	(revision )
@@ -1,453 +1,0 @@
- /* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Markus Gaug  09/2003 <mailto:markus@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-//////////////////////////////////////////////////////////////////////////////
-//                                                                          //
-//   MCalibrationCalc                                                       //
-//                                                                          //
-//   This is a task which calculates the number of photons from the FADC    //
-//   time slices. At the moment it integrates simply the FADC values.       //
-//                                                                          //
-//  Input Containers:                                                       //
-//   MRawEvtData                                                            //
-//                                                                          //
-//  Output Containers:                                                      //
-//   MCalibrationCam                                                        //
-//                                                                          //
-//                                                                          //
-//  The class MCalibrationCam hold one entry of type MCalibrationPix for    //
-//  every pixel. It is filled in the following way:                         //
-//  PreParocess: MalibrationCam::InitSize(577) is called which allocates    //
-//               memory in an TClonesArray of type MCalibrationPix and      //
-//               all pointers to NULL.                                      //
-//                                                                          //
-//  Process:     The NULL pointer is tested on every pixel via              //
-//               MalibrationCam::IsPixelUsed(npix).                         //
-//                                                                          //
-//               In case, IsPixelUsed returns NULL,                         //
-//               MalibrationCam::AddPixel(npix) is invoked which creates a  //
-//               new MCalibrationPix(npix) in the npix's entry              //
-//               of the TClonesArray.                                       //
-//                                                                          //
-//               Every MCalibrationPix holds a histogram class,             //
-//               MHCalibrationPixel which itself hold histograms of type:   //
-//               HCharge(npix) (distribution of summed FADC time slice entries) 
-//               HTime(npix) (distribution of position of maximum)              
-//               HChargevsN(npix) (distribution of charges vs. event number.
-//                                                                          
-// PostProcess:  All histograms HCharge(npix) are fitted to a Gaussian      
-//               All histograms HTime(npix) are fitted to a Gaussian        
-//               The histogram HBlindPixelCharge (blind pixel) is fitted to a single     
-//                   PhE fit                                                
-//               The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian   
-//               The histograms of the PIN Diode are fitted to Gaussians    
-//                                                                          
-//               Fits can be excluded via the commands:                     
-//               MalibrationCam::SetSkipTimeFits()   (skip all time fits)   
-//               MalibrationCam::SetSkipBlindPixelFits()  (skip all blind pixel fits) 
-//               MalibrationCam::SetSkipPinDiodeFits()  (skip all PIN Diode fits) 
-//                                                                          
-//////////////////////////////////////////////////////////////////////////////
-
-#include "MCalibrationCalc.h"
-#include "MCalibrationConfig.h"
-#include "MCalibrationFits.h"
-
-#include "MCalibrationCam.h"
-#include "MCalibrationPix.h"
-#include "MCalibrationBlindPix.h"
-#include "MCalibrationPINDiode.h"
-
-#include "MPedestalCam.h"
-#include "MPedestalPix.h"
-
-#include "MGeomCam.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-#include "MH.h"
-
-#include "MRawRunHeader.h"
-#include "MRawEvtData.h"       // MRawEvtData::GetNumPixels
-#include "MRawEvtPixelIter.h"
-
-#include "MExtractedSignalCam.h"
-#include "MExtractedSignalPix.h"
-
-#include "MTime.h"
-#include "TMath.h"
-
-ClassImp(MCalibrationCalc);
-
-using namespace std;
-// --------------------------------------------------------------------------
-//
-// Default constructor. b is the number of slices before the maximum slice,
-// a the number of slices behind the maximum slice which is taken as signal.
-//
-MCalibrationCalc::MCalibrationCalc(const char *name, const char *title)
-    : fColor(kEBlue)
-{
-
-    fName  = name  ? name  : "MCalibrationCalc";
-    fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam ";
-
-    AddToBranchList("MRawEvtData.fHiGainPixId");
-    AddToBranchList("MRawEvtData.fLoGainPixId");
-    AddToBranchList("MRawEvtData.fHiGainFadcSamples");
-    AddToBranchList("MRawEvtData.fLoGainFadcSamples");
-
-    SETBIT(fFlags, kUseTimeFits);
-    SETBIT(fFlags, kUseBlindPixelFit);
-    SETBIT(fFlags, kUsePinDiodeFit);
-
-}
-
-// --------------------------------------------------------------------------
-//
-// The PreProcess searches for the following input containers:
-//  - MRawEvtData
-//  - MPedestalCam
-//
-// The following output containers are also searched and created if
-// they were not found:
-//
-//  - MHCalibrationBlindPixel
-//  - MCalibrationCam
-//  - MTime
-//
-Int_t MCalibrationCalc::PreProcess(MParList *pList)
-{
-
-    fHistOverFlow = 0;
-    fEvents       = 0;
-    fCosmics      = 0;
-
-    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
-    if (!fRawEvt)
-    {
-        *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
-        return kFALSE;
-    }
-
-    const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!runheader)
-        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
-    else
-        if (runheader->GetRunType() == kRTMonteCarlo)
-        {
-            return kTRUE;
-        }
-
-    fCalibrations = (MCalibrationCam*)pList->FindCreateObj("MCalibrationCam");
-    if (!fCalibrations)
-      {
-        *fLog << err << dbginf << "MCalibrationCam could not be created ... aborting." << endl;        
-        return kFALSE;
-      }
-
-
-    switch (fColor)
-      {
-      case kEBlue:
-        fCalibrations->SetColor(MCalibrationCam::kECBlue);
-	break;        
-      case kEGreen:
-        fCalibrations->SetColor(MCalibrationCam::kECGreen);      
-	break;
-      case kEUV:
-        fCalibrations->SetColor(MCalibrationCam::kECUV);            
-	break;
-      case kECT1:
-        fCalibrations->SetColor(MCalibrationCam::kECCT1);            
-	break;
-      default:
-        fCalibrations->SetColor(MCalibrationCam::kECCT1); 
-      }
-
-    fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
-    if (!fPedestals)
-      {
-        *fLog << err << dbginf << "Cannot find MPedestalCam ... aborting" << endl;
-        return kFALSE;
-      }
-
-
-    fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
-    if (!fSignals)
-      {
-        *fLog << err << dbginf << "Cannot find MExtractedSignalCam ... aborting" << endl;
-        return kFALSE;
-      }
-    
-    return kTRUE;
-}
-
-
-// --------------------------------------------------------------------------
-//
-// The ReInit searches for the following input containers:
-//  - MRawRunHeader
-//
-Bool_t MCalibrationCalc::ReInit(MParList *pList )
-{
- 
-    fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
-    if (!fRunHeader)
-    {
-        *fLog << dbginf << "MRawRunHeader not found... aborting." << endl;
-        return kFALSE;
-    }
-
-
-    MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam");
-    if (!cam)
-    {
-        *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl;
-        return kFALSE;
-    }
-
-
-    fNumHiGainSamples =  fSignals->GetNumUsedHiGainFADCSlices();
-    fNumLoGainSamples =  fSignals->GetNumUsedLoGainFADCSlices();
-
-    fCalibrations->InitSize(cam->GetNumPixels());    
-
-    for (UInt_t i=0;i<cam->GetNumPixels();i++)
-      {
-        MCalibrationPix &pix = (*fCalibrations)[i];
-        pix.DefinePixId(i);
-      }
-    
-    return kTRUE;
- 
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Calculate the integral of the FADC time slices and store them as a new
-// pixel in the MCerPhotEvt container.
-//
-Int_t MCalibrationCalc::Process()
-{
-
-    Int_t cosmicpix = 0;
-
-    MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
-    MCalibrationPINDiode &pindiode   = *(fCalibrations->GetPINDiode());
-
-    MRawEvtPixelIter pixel(fRawEvt);
-
-    //
-    // Create a first loop to sort out the cosmics ...
-    // 
-    // This is a very primitive check for the number of cosmicpixs
-    // The cut will be applied in the fit, but for the blind pixel,
-    // we need to remove this event
-    //
-    // FIXME: In the future need a much more sophisticated one!!!
-    //
-
-    while (pixel.Next())
-      {
-	
-	const UInt_t pixid = pixel.GetPixelId();
-	
-	MExtractedSignalPix &sig =  (*fSignals)[pixid];
-        MPedestalPix        &ped =  (*fPedestals)[pixid];
-        Float_t pedrms     = ped.GetPedestalRms();
-	Float_t sumhi      = sig.GetExtractedSignalHiGain();
-        
-	if (sumhi < 15.*pedrms )   // cut at 3.5 sigma
-	  cosmicpix++;
-     }
-
-    if (cosmicpix > 100.)
-      {
-	fCosmics++;
-	return kCONTINUE;
-      }
-
-    pixel.Reset();
-    fEvents++;
-
-    //
-    // Create a second loop to do fill the calibration histograms
-    // 
-
-    while (pixel.Next())
-      {
-
-	const UInt_t pixid = pixel.GetPixelId();
-	
-	MExtractedSignalPix &sig =  (*fSignals)[pixid];
-        
-	Float_t sumhi  = sig.GetExtractedSignalHiGain();
-	Float_t sumlo  = sig.GetExtractedSignalLoGain();
-	Float_t mtime  = sig.GetMeanArrivalTime();
-
-	MCalibrationPix &pix = (*fCalibrations)[pixid];
-
-        switch(pixid)
-          {
-            
-          case gkCalibrationBlindPixelId:
-
-	    if (!blindpixel.FillCharge(sumhi)) 
-	      *fLog << err << 
-		"Overflow or Underflow occurred filling Blind Pixel sum = " << sumhi << endl;
-
-	    if (!blindpixel.FillTime((int)mtime)) 
-	      *fLog << err << 
-		"Overflow or Underflow occurred filling Blind Pixel time = " << mtime << endl;
-	    
-	    if (!blindpixel.FillRChargevsTime(sumhi,fEvents))
-	      *fLog << warn << 
-		"Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
-            
-          case gkCalibrationPINDiodeId:
-            if (!pindiode.FillCharge(sumhi)) 
-              *fLog << warn << 
-                "Overflow or Underflow occurred filling HCharge: means = " << sumhi << endl;
-            if (!pindiode.FillTime((int)mtime)) 
-              *fLog << warn << 
-                "Overflow or Underflow occurred filling HTime: time = " << mtime << endl;
-            if (!pindiode.FillRChargevsTime(sumhi,fEvents))
-              *fLog << warn << 
-                "Overflow or Underflow occurred filling HChargevsN: eventnr = " << fEvents << endl;
-	    break;
-
-          default:
-
-	    pix.SetChargesInGraph(sumhi,sumlo);
-
-	    if (!pix.FillRChargevsTimeLoGain(sumlo,fEvents))
-	      *fLog << warn << "Could not fill Lo Gain Charge vs. EvtNr of pixel: " 
-		    << pixid << " signal = " << sumlo  << " event Nr: " << fEvents << endl;
-		
-	    if (!pix.FillRChargevsTimeHiGain(sumhi,fEvents))
-	      *fLog << warn << "Could not fill Hi Gain Charge vs. EvtNr of pixel: " 
-		    << pixid << " signal = " << sumhi  << " event Nr: " << fEvents << endl;
-
-	    if (sig.IsLoGainUsed())
-	      {
-		
-		if (!pix.FillChargeLoGain(sumlo))
-		  *fLog << warn << "Could not fill Lo Gain Charge of pixel: " << pixid 
-			<< " signal = " << sumlo << endl;
-
-		if (!pix.FillTimeLoGain((int)mtime)) 
-		  *fLog << warn << "Could not fill Lo Gain Time of pixel: " 
-			<< pixid << " time = " << mtime << endl;
-		
-	      }
-	    else
-	      {
-		if (!pix.FillChargeHiGain(sumhi))
-		  *fLog << warn << "Could not fill Hi Gain Charge of pixel: " << pixid 
-			<< " signal = " << sumhi << endl;
-		
-		if (!pix.FillTimeHiGain((int)mtime)) 
-		  *fLog << warn << "Could not fill Hi Gain Time of pixel: " 
-			<< pixid << " time = " << mtime << endl;
-		
-	      }
-	    break;
-	    
-          } /* switch(pixid) */
-
-      } /* while (pixel.Next()) */
-
-    return kTRUE;
-}
-
-Int_t MCalibrationCalc::PostProcess()
-{
-
-
-  *fLog << inf << endl;
-  *fLog << GetDescriptor() << " Cut Histogram Edges" << endl;
-
-  //
-  // Cut edges to make fits and viewing of the hists easier  
-  //
-  fCalibrations->CutEdges();
-
-  //
-  // Get pointer to blind pixel
-  //
-  MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
-
-  *fLog << GetDescriptor() << " Fitting the Blind Pixel" << endl;
-
-  // 
-  // Fit the blind pixel
-  //
-  if (TESTBIT(fFlags,kUseBlindPixelFit))
-    {
-
-      if (!blindpixel.FitCharge())
-        *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
-
-      blindpixel.Draw();
-    }
-  
-  *fLog << GetDescriptor() << " Fitting the Normal Pixels" << endl;
-
-  //
-  // loop over the pedestal events and check if we have calibration
-  //
-  for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++)
-    {
-
-      MCalibrationPix &pix = (*fCalibrations)[pixid];
-
-      const Float_t ped    = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples;
-      const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms() * TMath::Sqrt((float)fNumHiGainSamples);
-
-      pix.SetPedestal(ped,prms);
-
-      pix.FitCharge();
-
-      if (TESTBIT(fFlags,kUseTimeFits))
-        pix.FitTime();
-      
-    }
-
-  if (!fCalibrations->CalcNumPhotInsidePlexiglass())
-    *fLog << err << dbginf << "Could not calculate the number of photons from the blind pixel " << endl;
-
-  fCalibrations->SetReadyToSave();
-  
-  if (GetNumExecutions()==0)
-    return kTRUE;
-  
-  *fLog << endl;
-  *fLog << dec << setfill(' ') << fCosmics << " Events presumably cosmics" << endl;
-
-  return kTRUE;
-}
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCalc.h	(revision 2733)
+++ 	(revision )
@@ -1,83 +1,0 @@
-#ifndef MARS_MCalibrationCalc
-#define MARS_MCalibrationCalc
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrationCalc                                                   //
-//                                                                         //
-// Integrates the time slices of the all pixels of a calibration event     //
-// and substract the pedestal value                                        //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef MARS_MTask
-#include "MTask.h"
-#endif
-
-class MRawEvtData;
-class MRawRunHeader;
-
-class MPedestalCam;
-class MCalibrationCam;
-class MExtractedSignalCam;
-
-class MTime;
-
-class MCalibrationCalc : public MTask
-{
-private:
-
-  MPedestalCam             *fPedestals;    // Pedestals of all pixels in the camera
-  MCalibrationCam          *fCalibrations; // Calibration events of all pixels in the camera
-  MExtractedSignalCam      *fSignals;      // Calibration events of all pixels in the camera
-
-  MRawEvtData              *fRawEvt;       // raw event data (time slices)
-  MRawRunHeader            *fRunHeader;    // RunHeader information
-
-  MTime                    *fEvtTime;      // Time of the event
-
-  Int_t fEvents;                           // Number of events  
-  Int_t fHistOverFlow;                     // Number of events with saturated Low Gain
-  Int_t fCosmics;                          // Number of events due to supposed cosmics
-
-  Byte_t fNumHiGainSamples; 
-  Byte_t fNumLoGainSamples; 
-
-  Byte_t fFlags;                           // Flag for the fits used
-   
-  Float_t fConversionHiLo;
-  
-  enum  { kUseTimeFits, kUseBlindPixelFit, kUsePinDiodeFit };
-
-public:
-  
-  enum PulserColor_t  { kEGreen, kEBlue, kEUV, kECT1 };
-
-private:
-
-  PulserColor_t  fColor;
-  
-  Bool_t ReInit(MParList *pList); 
-  Int_t PreProcess(MParList *pList);
-  Int_t Process();
-  Int_t PostProcess();
-  
-public:
-
-  MCalibrationCalc(const char *name=NULL, const char *title=NULL);
-
-  void SetSkipTimeFits(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseTimeFits) : SETBIT(fFlags, kUseTimeFits);}
-  void SetSkipBlindPixelFit(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseBlindPixelFit) : SETBIT(fFlags, kUseBlindPixelFit);}
-  void SetSkipPinDiodeFit(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUsePinDiodeFit) : SETBIT(fFlags, kUsePinDiodeFit);}
-
-  void SetPulserColor(PulserColor_t color)    { fColor = color; }
-
-  void SetConversionHiLo(Float_t conv)         { fConversionHiLo = conv; }
-  
-  ClassDef(MCalibrationCalc, 1)   // Task to fill the Calibration Containers from raw data
-};
-
-#endif
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCam.cc	(revision 2733)
+++ 	(revision )
@@ -1,625 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-
-! *
-!
-!
-!   Author(s): Markus Gaug   11/2003 <mailto:markus@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                               
-// MCalibrationCam                                               
-//                                                               
-// Hold the whole Calibration results of the camera:
-//                                                               
-// 1) MCalibrationCam initializes a TClonesArray whose elements are 
-//    pointers to MCalibrationPix Containers
-// 2) It initializes a pointer to an MCalibrationBlindPix container
-// 3) It initializes a pointer to an MCalibrationPINDiode container
-//
-// 4)  
-// 
-/////////////////////////////////////////////////////////////////////////////
-#include "MCalibrationCam.h"
-#include "MCalibrationPix.h"
-#include "MHCalibrationPixel.h"
-#include "MCalibrationBlindPix.h"
-#include "MCalibrationConfig.h"
-
-#include <TClonesArray.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "TCanvas.h"
-
-#include "MGeomCam.h"
-
-ClassImp(MCalibrationCam);
-
-using namespace std;
-// --------------------------------------------------------------------------
-//
-// Default constructor. 
-//
-// Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
-// Later, a call to MCalibrationCam::InitSize(Int_t size) has to be performed
-//
-// Creates an MCalibrationBlindPix container 
-// Creates an MCalibrationPINDiode container
-//
-MCalibrationCam::MCalibrationCam(const char *name, const char *title)
-    : fNumPhotInsidePlexiglassAvailable(kFALSE),
-      fMeanPhotInsidePlexiglass(-1.),
-      fMeanPhotErrInsidePlexiglass(-1.),
-      fNumPhotOutsidePlexiglassAvailable(kFALSE),
-      fMeanPhotOutsidePlexiglass(-1.),
-      fMeanPhotErrOutsidePlexiglass(-1.),
-      fOffsets(NULL),
-      fSlopes(NULL),
-      fOffvsSlope(NULL)
-{
-    fName  = name  ? name  : "MCalibrationCam";
-    fTitle = title ? title : "Storage container for the Calibration Information in the camera";
-
-    fPixels     = new TClonesArray("MCalibrationPix",1);
-    fBlindPixel = new MCalibrationBlindPix();
-    fPINDiode   = new MCalibrationPINDiode();
-}
-
-// --------------------------------------------------------------------------
-//
-// Delete the TClonesArray of MCalibrationPix containers
-// Delete the MCalibrationPINDiode and the MCalibrationBlindPix
-//
-// Delete the histograms if they exist
-//
-MCalibrationCam::~MCalibrationCam()
-{
-
-  //
-  // delete fPixels should delete all Objects stored inside
-  // 
-  delete fPixels;
-  delete fBlindPixel;
-  delete fPINDiode;
-
-  if (fOffsets)
-    delete fOffsets;
-  if (fSlopes)
-    delete fSlopes;
-  if (fOffvsSlope)
-    delete fOffvsSlope;
-
-}
-
-// -------------------------------------------------------------------
-//
-// This function simply allocates memory via the ROOT command:
-// (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
-//                                      fSize * sizeof(TObject*));
-// newSize corresponds to size in our case
-// fSize is the old size (in most cases: 1)
-//
-void MCalibrationCam::InitSize(Int_t size)
-{
-  
-  //
-  // check if we have already initialized to size
-  //
-  if (CheckBounds(size))
-    return;
-  
-  fPixels->ExpandCreate(size);
-
-}
-
-// --------------------------------------------------------------------------
-//
-// This function returns the current size of the TClonesArray 
-// independently if the MCalibrationPix is filled with values or not.
-//
-// It is the size of the array fPixels.
-//
-Int_t MCalibrationCam::GetSize() const
-{
-  return fPixels->GetEntriesFast();
-}
-
-// --------------------------------------------------------------------------
-//
-// Check if position i is inside the current bounds of the TClonesArray
-//
-Bool_t MCalibrationCam::CheckBounds(Int_t i) const 
-{
-    return i < fPixels->GetEntriesFast();
-} 
-
-
-// --------------------------------------------------------------------------
-//
-// Get i-th pixel (pixel number)
-//
-MCalibrationPix &MCalibrationCam::operator[](Int_t i)
-{
-
-  if (!CheckBounds(i))
-    return *static_cast<MCalibrationPix*>(NULL);
-
-  return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
-}
-
-// --------------------------------------------------------------------------
-//
-// Get i-th pixel (pixel number)
-//
-MCalibrationPix &MCalibrationCam::operator[](Int_t i) const
-{
-
-  if (!CheckBounds(i))
-    return *static_cast<MCalibrationPix*>(NULL);
-
-  return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Return true if pixel is inside bounds of the TClonesArray fPixels
-//
-Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const 
-{
-  if (!CheckBounds(idx))
-    return kFALSE;
-
-  return kTRUE;
-}
-
-// --------------------------------------------------------------------------
-//
-// Return true if pixel has already been fitted once (independent of the result)
-//
-Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const 
-{
-
-  if (!CheckBounds(idx))
-    return kFALSE;
-
-  return (*this)[idx].IsFitted();
-}
-
-
-// --------------------------------------
-//
-void MCalibrationCam::Clear(Option_t *o)
-{
-    fPixels->ForEach(TObject, Clear)();
-}
-
-// --------------------------------------------------------------------------
-//
-// Sets the user ranges of all histograms such that 
-// empty bins at the edges are not used. Additionally, it rebins the 
-// histograms such that in total, 50 bins are used.
-//
-void MCalibrationCam::CutEdges()
-{
-
-  fBlindPixel->GetHist()->CutAllEdges();
-  fPINDiode->GetHist()->CutAllEdges();
-
-  TIter Next(fPixels);
-  MCalibrationPix *pix;
-  while ((pix=(MCalibrationPix*)Next()))
-    {
-      pix->GetHist()->CutAllEdges();
-    }
-
-  return;
-}
-  
-// --------------------------------------------------------------------------
-//
-// Print first the well fitted pixels 
-// and then the ones which are not FitValid
-//
-void MCalibrationCam::Print(Option_t *o) const
-{
-
-  *fLog << all << GetDescriptor() << ":" << endl;
-  int id = 0;
-  
-  *fLog << "Succesfully calibrated pixels:" << endl;
-  *fLog << endl;
-
-  TIter Next(fPixels);
-  MCalibrationPix *pix;
-  while ((pix=(MCalibrationPix*)Next()))
-    {
-      
-      if (pix->IsFitValid()) 
-	{
-	  *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() 
-		<< " Reduced Charge: " << pix->GetCharge() << " +- " 
-		<< pix->GetSigmaCharge() << " Reduced Sigma: " << TMath::Sqrt(pix->GetRSigmaSquare()) << endl;
-	  id++;
-	}
-    }
-  
-  *fLog << id << " succesful pixels :-))" << endl;
-  id = 0;
-  
-  *fLog << endl;
-  *fLog << "Pixels with errors:" << endl;
-  *fLog << endl;
-  
-  TIter Next2(fPixels);
-    while ((pix=(MCalibrationPix*)Next2()))
-      {
-        
-        if (!pix->IsFitValid())
-          {
-            *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms() 
-                  << " Reduced Charge: " << pix->GetCharge() << " +- " 
-		<< pix->GetSigmaCharge() << " Reduced Sigma: " << TMath::Sqrt(pix->GetRSigmaSquare()) << endl;
-            id++;
-          }
-      }
-    *fLog << id << " pixels with errors :-((" << endl;
-    
-}
-
-// The types are as follows:
-// 
-// 0: Fitted Charge
-// 1: Error of fitted Charge
-// 2: Sigma of fitted Charge
-// 3: Error of Sigma of fitted Charge
-// 4: Returned probability of Gauss fit to Charge distribution
-// 5: Mean arrival time
-// 6: Sigma of the arrival time
-// 7: Chi-square of the Gauss fit to the arrival times
-// 8: Pedestal
-// 9: Pedestal RMS
-// 10: Reduced Sigma Square
-// 11: Number of Photo-electrons after the F-Factor method
-// 12: Error on the Number of Photo-electrons after the F-Factor method
-// 13: Mean conversion factor after the F-Factor method
-// 14: Error on the conversion factor after the F-Factor method
-// 15: Number of Photons after the Blind Pixel method
-// 16: Mean conversion factor after the Blind Pixel method
-//
-Bool_t MCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
-{
-
-  if (idx > GetSize())
-    return kFALSE;
-
-  switch (type)
-    {
-    case 0:
-      val = (*this)[idx].GetCharge();
-      break;
-    case 1:
-      val = (*this)[idx].GetErrCharge();
-      break;
-    case 2:
-      val = (*this)[idx].GetSigmaCharge();
-      break;
-    case 3:
-      val = (*this)[idx].GetErrSigmaCharge();
-      break;
-    case 4:
-      val = (*this)[idx].GetChargeProb();
-      break;
-    case 5:
-      val = (*this)[idx].GetTime();
-      break;
-    case 6:
-      val = (*this)[idx].GetSigmaTime();
-      break;
-    case 7:
-      val = (*this)[idx].GetTimeChiSquare();
-      break;
-    case 8:
-      val = (*this)[idx].GetPed();
-      break;
-    case 9:
-      val = (*this)[idx].GetPedRms();
-      break;
-    case 10:
-      if ((*this)[idx].GetRSigmaSquare() > 0.)
-	val = TMath::Sqrt((*this)[idx].GetRSigmaSquare());
-      else
-	val = -1.;
-      break;
-    case 11:
-      val = (*this)[idx].GetPheFFactorMethod();
-      break;
-    case 12:
-      val = (*this)[idx].GetPheFFactorMethodError();
-      break;
-    case 13:
-      val = (*this)[idx].GetMeanConversionFFactorMethod();
-      break;
-    case 14:
-      val = (*this)[idx].GetErrorConversionFFactorMethod();
-      break;
-    case 15:
-      if (idx < 397)
-	val = (double)fMeanPhotInsidePlexiglass;
-      else
-	val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
-      break;
-    case 16:
-      if (idx < 397)
-        val = (*this)[idx].GetMeanConversionBlindPixelMethod();
-      else 
-        val = (*this)[idx].GetMeanConversionBlindPixelMethod()*gkCalibrationOutervsInnerPixelArea;
-      break;
-    case 17:
-      if ((*this)[idx].GetCharge() != 0.)
-        val = ((*this)[idx].GetSigmaCharge()/(*this)[idx].GetCharge())*
-              ((*this)[idx].GetSigmaCharge()/(*this)[idx].GetCharge());
-      else
-        val = -1.;
-      break;
-    default:
-      return kFALSE;
-    }
-  return val>=0;
-}
-
-// --------------------------------------------------------------------------
-//
-// What MHCamera needs in order to draw an individual pixel in the camera
-//
-void MCalibrationCam::DrawPixelContent(Int_t idx) const
-{
-  (*this)[idx].Draw();
-}
-
-
-// --------------------------------------------------------------------------
-//
-
-//
-Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass()
-{
-
-  if (!fBlindPixel->IsFitOK())
-    return kFALSE;
-  
-  const Float_t mean = fBlindPixel->GetLambda();
-  const Float_t merr = fBlindPixel->GetErrLambda();
-  
-  switch (fColor)
-    {
-    case kECGreen:
-      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEGreen)     // real photons
-                            *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption 
-                            * gkCalibrationInnerPixelArea;                    // correct for area
-      break;
-    case kECBlue:
-      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEBlue )
-                            *TMath::Power(10,gkCalibrationBlindPixelAttBlue)
-                            * gkCalibrationInnerPixelArea;
-      break;
-    case kECUV:
-      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEUV )
-                            *TMath::Power(10,gkCalibrationBlindPixelAttUV)
-                            * gkCalibrationInnerPixelArea;
-      break;
-    case kECCT1:
-    default:
-      fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQECT1 )
-                            *TMath::Power(10,gkCalibrationBlindPixelAttCT1)
-                            * gkCalibrationInnerPixelArea;
-      break;
-    }
-
-  fNumPhotInsidePlexiglassAvailable = kTRUE;
-
-  *fLog << endl;
-  *fLog << mean << " Mean number of Photons for an Inner Pixel: " << fMeanPhotInsidePlexiglass << endl;
-  *fLog << endl;
-
-  TIter Next(fPixels);
-  MCalibrationPix *pix;
-  while ((pix=(MCalibrationPix*)Next()))
-    {
-      if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
-        {
-
-          Float_t conversion      = fMeanPhotInsidePlexiglass/pix->GetCharge();
-          Float_t conversionerr   = 0.;
-          Float_t conversionsigma = 0.;
-          pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma);
-
-          if (conversionerr/conversion < 0.1) 
-            pix->SetBlindPixelMethodValid();
-        }
-    }
-  return kTRUE;
-}
-
-
-Bool_t MCalibrationCam::CalcNumPhotOutsidePlexiglass()
-{
-
-  if (!fPINDiode->IsFitOK())
-    return kFALSE;
-  
-  const Float_t mean = fPINDiode->GetMean();
-  const Float_t merr = fPINDiode->GetMeanError();
-  
-  switch (fColor)
-    {
-    case kECGreen:
-      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEGreen)   // real photons
-                            * gkCalibrationInnerPixelvsPINDiodeArea;        // correct for area
-      break;
-    case kECBlue:
-      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEBlue )
-                            * gkCalibrationInnerPixelvsPINDiodeArea;
-      break;
-    case kECUV:
-      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEUV )
-                            * gkCalibrationInnerPixelvsPINDiodeArea;
-      break;
-    case kECCT1:
-    default:
-      fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQECT1 )
-                            * gkCalibrationInnerPixelvsPINDiodeArea;
-      break;
-    }
-
-  fNumPhotOutsidePlexiglassAvailable = kTRUE;
-
-  TIter Next(fPixels);
-  MCalibrationPix *pix;
-  while ((pix=(MCalibrationPix*)Next()))
-    {
-      
-      if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
-	pix->SetConversionPINDiodeMethod(fMeanPhotOutsidePlexiglass/pix->GetCharge(), 0., 0.);
-    }
-  return kTRUE;
-}
-
-
-
-Bool_t MCalibrationCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-  
-  if (ipx < 0 || !IsPixelFitted(ipx))
-    return kFALSE;
-
-  if (!fNumPhotInsidePlexiglassAvailable)
-    if (!CalcNumPhotInsidePlexiglass())
-      return kFALSE;
-
-  mean  = (*this)[ipx].GetMeanConversionBlindPixelMethod();
-  err   = (*this)[ipx].GetErrorConversionBlindPixelMethod();
-  sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod();
-
-  return kTRUE;
-}
-
-
-Bool_t MCalibrationCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-  
-  if (ipx < 0 || !IsPixelFitted(ipx))
-    return kFALSE;
-
-  Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod();
-
-  if (conv < 0.)
-    return kFALSE;
-
-  mean  = conv;
-  err   = (*this)[ipx].GetErrorConversionFFactorMethod();
-  sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();
-
-  return kTRUE;
-}
-
-
-//-----------------------------------------------------------------------------------
-//
-// Calculates the conversion factor between the integral of FADCs slices 
-// (as defined in the signal extractor MExtractSignal.cc)
-// and the number of photons reaching the plexiglass for one Inner Pixel 
-//
-// FIXME: The PINDiode is still not working and so is the code 
-//
-Bool_t MCalibrationCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-
-  if (ipx < 0 || !IsPixelFitted(ipx))
-    return kFALSE;
-
-  return kFALSE;
-
-}
-
-//-----------------------------------------------------------------------------------
-//
-// Calculates the best combination of the three used methods possible 
-// between the integral of FADCs slices 
-// (as defined in the signal extractor MExtractSignal.cc)
-// and the number of photons reaching one Inner Pixel. 
-// The procedure is not yet defined.
-//
-// FIXME: The PINDiode is still not working and so is the code 
-//
-Bool_t MCalibrationCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
-{
-
-  if (ipx < 0 || !IsPixelFitted(ipx))
-    return kFALSE;
-
-  return kFALSE;
-
-}
-
-
-void MCalibrationCam::DrawHiLoFits()
-{
-
-  if (!fOffsets)
-    fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
-  if (!fSlopes)
-    fSlopes  = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
-  if (!fOffvsSlope)
-    fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
-
-  TIter Next(fPixels);
-  MCalibrationPix *pix;
-  MHCalibrationPixel *hist;
-  while ((pix=(MCalibrationPix*)Next()))
-    {
-      hist = pix->GetHist();
-      hist->FitHiGainvsLoGain();
-      fOffsets->Fill(hist->GetOffset(),1.);
-      fSlopes->Fill(hist->GetSlope(),1.);
-      fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
-    }
-
-   TCanvas *c1 = new TCanvas();
-
-   c1->Divide(1,3);
-   c1->cd(1);
-   fOffsets->Draw();
-   gPad->Modified();
-   gPad->Update();
-
-   c1->cd(2);
-  fSlopes->Draw();
-  gPad->Modified();
-  gPad->Update();
-
-  c1->cd(3);
-  fOffvsSlope->Draw("col1");
-  gPad->Modified();
-  gPad->Update();
-}
-
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationCam.h	(revision 2733)
+++ 	(revision )
@@ -1,135 +1,0 @@
-#ifndef MARS_MCalibrationCam
-#define MARS_MCalibrationCam
-
-#ifndef MARS_MCamEvent
-#include "MCamEvent.h"
-#endif
-
-#ifndef MARS_MCalibrationPix
-#include "MCalibrationPix.h"
-#endif
-
-#ifndef MARS_MCalibrationBlindPix
-#include "MCalibrationBlindPix.h"
-#endif
-
-#ifndef MARS_MCalibrationPINDiode
-#include "MCalibrationPINDiode.h"
-#endif
-
-#ifndef ROOT_TClonesArray
-#include <TClonesArray.h>
-#endif
-
-#ifndef ROOT_TH1F
-#include <TH1F.h>
-#endif
-
-#ifndef ROOT_TH1D
-#include <TH1D.h>
-#endif
-
-#ifndef ROOT_TH2D
-#include <TH2D.h>
-#endif
-
-class MGeomCam;
-class MCalibrationPix;
-class MCalibrationBlindPix;
-class MCalibrationPINDiode;
-
-class MCalibrationCam : public MCamEvent
-{
-private:
-  
-  Int_t fNumPixels;
-  TClonesArray *fPixels;                      // Array of MCalibrationPix with fit results
-  
-  MCalibrationBlindPix *fBlindPixel;          // Pointer to the Blind Pixel with fit results
-  MCalibrationPINDiode *fPINDiode;            // Pointer to the PIN Diode with fit results    
-
-  Bool_t  fNumPhotInsidePlexiglassAvailable;  // TRUE: Blind Pixel could have been fitted well 
-  Float_t fMeanPhotInsidePlexiglass;          //  The mean number of photons in an INNER PIXEL inside the plexiglass
-  Float_t fMeanPhotErrInsidePlexiglass;       //  The uncertainty about the number of photons in an INNER PIXEL  
-
-  Bool_t  fNumPhotOutsidePlexiglassAvailable; // TRUE: PIN Diode could have been fitted well 
-  Float_t fMeanPhotOutsidePlexiglass;         //  The mean number of photons in an INNER PIXEL outside the plexiglass
-  Float_t fMeanPhotErrOutsidePlexiglass;      //  The uncertainty about the number of photons in an INNER PIXEL  
-
-  TH1F* fHChargeAllPixels;                     //! 
-  TH1F* fHChargeErrAllPixels;                  //! 
-  TH1F* fHChargeSigmaAllPixels;                //! 
-  TH1F* fHChargeProbAllPixels;                 //! 
-
-  TH1F* fHTimeAllPixels;                       //! 
-  TH1F* fHTimeSigmaAllPixels;                  //! 
-  TH1F* fHTimeProbAllPixels;                   //! 
-
-  TH1F* fHPedAllPixels;                        //! 
-  TH1F* fHPedRMSAllPixels;                     //! 
-  TH1F* fHSigmaPerChargeAllPixels;             //! 
-  TH1F* fHPhEAllPixels;                        //! 
-
-  TH1F* fHConvPhEperFADCAllPixels;             //! 
-  TH1F* fHConvPhperFADCAllPixels;              //! 
-
-  TH1D* fOffsets;                              //! 
-  TH1D* fSlopes;                               //! 
-  
-  TH2D* fOffvsSlope;                           //! 
-
-public:
-  
-  enum CalibrationColor_t { kECGreen, kECBlue, kECUV, kECCT1 };
-
-private:
-
-  CalibrationColor_t fColor;  
-  
-public:
-
-  MCalibrationCam(const char *name=NULL, const char *title=NULL);
-  ~MCalibrationCam();
-  
-  void Clear(Option_t *o="");
-  
-  void InitSize(const Int_t i);
-  Int_t GetSize() const;
-
-  UInt_t GetNumPixels() const { return fNumPixels; }
-
-  Bool_t IsPixelUsed(Int_t idx)      const;
-  Bool_t IsPixelFitted(Int_t idx)    const;
-  
-  MCalibrationPix &operator[](Int_t i);
-  MCalibrationPix &operator[](Int_t i) const;
-  
-  Bool_t CheckBounds(Int_t i) const;
-
-  void Print(Option_t *o="") const;
-  
-  void CutEdges();
-  
-  Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
-  void   DrawPixelContent(Int_t num) const;    
-  
-  MCalibrationBlindPix *GetBlindPixel()              const { return fBlindPixel;  }
-  MCalibrationPINDiode *GetPINDiode()                const { return fPINDiode;    }
-
-  void SetColor(CalibrationColor_t color)    { fColor = color; }
-
-  Bool_t GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
-  Bool_t GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
-  Bool_t GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
-  Bool_t GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma);
-
-  Bool_t CalcNumPhotInsidePlexiglass();
-  Bool_t CalcNumPhotOutsidePlexiglass();
-
-  void DrawHiLoFits();
-
-  ClassDef(MCalibrationCam, 1)	// Storage Container for all calibration information of the camera
-};
-
-#endif
-
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationConfig.h	(revision 2733)
+++ 	(revision )
@@ -1,96 +1,0 @@
-#ifndef MARS_MCalibrationConfig
-#define MARS_MCalibrationConfig
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         
-// MCalibrationConfig                                                      
-//
-// Contains all configuration data of the Calibration          
-//                                                             
-// This file is only TEMPORARY. It values will go into the DATABASE 
-//
-/////////////////////////////////////////////////////////////////////////////
-
-
-// The highest value of the High Gain in the linear regime
-const Byte_t gkSaturationLimit = 250;
-
-// The conversion factor between High Gain and Low Gain
-const Float_t gkConversionHiLo      = 10.;
-const Float_t gkConversionHiLoError = 2.5;
-
-// The penalty constant to produce overflow in the histogram 
-const ULong_t gkLoGainOverFlow = 99999999;
-
-// ----- BLIND PIXEL ----------------------//
-
-// Pixel ID of the Calibration Blind Pixel
-const UShort_t gkCalibrationBlindPixelId = 559;
-
-// Average QE of Blind Pixel (three colours)
-const Float_t gkCalibrationBlindPixelQEGreen = 0.154;
-const Float_t gkCalibrationBlindPixelQEBlue  = 0.226;
-const Float_t gkCalibrationBlindPixelQEUV    = 0.247;
-const Float_t gkCalibrationBlindPixelQECT1   = 0.247;
-
-// Attenuation factor Blind Pixel (three colours)
-const Float_t gkCalibrationBlindPixelAttGreen = 1.97;
-const Float_t gkCalibrationBlindPixelAttBlue  = 1.96;
-const Float_t gkCalibrationBlindPixelAttUV    = 1.95;
-const Float_t gkCalibrationBlindPixelAttCT1   = 1.95;
-
-//
-// Area of Inner Pixel w.r.t. Blind Pixel (which is 1 sq. cm)
-//
-// Hexagone of diagonal axis b = 3.5 cm
-//             straight axis a = 3.0 cm +- 2% 
-// Area =  sqrt(3)*a*a/2 = 7.79 sq.cm +- 4% = 7.8 +- 0.3 sq.cm
-//
-const Float_t gkCalibrationInnerPixelArea      = 7.8;
-const Float_t gkCalibrationInnerPixelAreaError = 0.3;
-//
-// Area of Outer Pixel w.r.t. Inner Pixel
-//
-// Hexagone of diagonal axis b = 7.0 cm
-//             straight axis a = 6.0 cm +- 1% 
-// Area = sqrt(3)*a*a/2 = 
-//
-const Float_t gkCalibrationOutervsInnerPixelArea      = 4.00;
-const Float_t gkCalibrationOutervsInnerPixelAreaError = 0.00;
-
-// ----- PIN DIODE ------------------------//
-
-// Pixel ID of the Calibration PIN Diode
-const UShort_t gkCalibrationPINDiodeId = 9999;
-
-//
-// Area of Inner Pixel w.r.t. PIN Diode (which is 1 cm²)
-//
-// Hexagone of diagonal axis b = 3.5 cm
-//             straight axis a = 3.0 cm +- 2% 
-// Area =  sqrt(3)*a*a/2 = 7.79 sq.cm +- 4% = 7.8 +- 0.3 sq.cm
-//
-// Distance of PIN Diode to pulser D1:   1.5  +- 0.3 m
-// Distance of Inner Pixel to pulser D2: 18.0 +- 0.5 m
-//
-//
-//                A(Inner Pixel)    D1*D1
-// conversion C = -------------- * ------ = 0.054
-//                A(PIN Diode)      D2*D2
-//
-// Delta C / C  = sqrt((Delta A(IP)/A(IP))² + 4 * ( (Delta D1/D1)² + (Delta D2/D2)² )
-// Delta C / C  = 0.4
-// 
-// C = 0.05 +- 0.02
-//
-const Float_t gkCalibrationInnerPixelvsPINDiodeArea      = 0.05;
-const Float_t gkCalibrationInnerPixelvsPINDiodeAreaError = 0.02;
-
-// Average QE of the PIN Diode
-const Float_t gkCalibrationPINDiodeQEGreen = -1.0;
-const Float_t gkCalibrationPINDiodeQEBlue  = -1.0;
-const Float_t gkCalibrationPINDiodeQEUV    = -1.0;
-const Float_t gkCalibrationPINDiodeQECT1   = -1.0;
-
-
-#endif /* MARS_MCalibrationConfig */
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationFits.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationFits.h	(revision 2733)
+++ 	(revision )
@@ -1,310 +1,0 @@
-#ifndef MARS_MCalibrationFits
-#define MARS_MCalibrationFits
-
-#ifndef ROOT_TMath
-#include <TMath.h>
-#endif
-
-#define GIMMEABREAK     10000000000.0
-
-inline Double_t gfKto5(Double_t *x, Double_t *par)
-{
-
-  Double_t lambda = par[0];  
-  
-  Double_t sum = 0.;
-  Double_t arg = 0.;
-
-  Double_t mu0 = par[1];
-  Double_t mu1 = par[2];
-
-  if (mu1 < mu0)
-    return GIMMEABREAK;
-
-  Double_t sigma0 = par[3];
-  Double_t sigma1 = par[4];
-
-  if (sigma1 < sigma0)
-    return GIMMEABREAK;
-
-
-  Double_t mu2 = (2.*mu1)-mu0;  
-  Double_t mu3 = (3.*mu1)-(2.*mu0);
-  Double_t mu4 = (4.*mu1)-(3.*mu0);
-  Double_t mu5 = (5.*mu1)-(4.*mu0);
-
-  Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0));  
-  Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0));
-  Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0));
-  Double_t sigma5 = TMath::Sqrt((5.*sigma1*sigma1) - (4.*sigma0*sigma0));
-
-  Double_t lambda2 = lambda*lambda;
-  Double_t lambda3 = lambda2*lambda;
-  Double_t lambda4 = lambda3*lambda;
-  Double_t lambda5 = lambda4*lambda;
-
-  // k=0:
-  arg = (x[0] - mu0)/sigma0;
-  sum = TMath::Exp(-0.5*arg*arg)/sigma0;
-  
-  // k=1:
-  arg = (x[0] - mu1)/sigma1;
-  sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1;
-  
-  // k=2:
-  arg = (x[0] - mu2)/sigma2;
-  sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2;
-
-  // k=3:
-  arg = (x[0] - mu3)/sigma3;
-  sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3;
-
-  // k=4:
-  arg = (x[0] - mu4)/sigma4;
-  sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4;
-  
-  // k=5:
-  arg = (x[0] - mu5)/sigma5;
-  sum += 0.008333333333333*lambda5*TMath::Exp(-0.5*arg*arg)/sigma5;
-
-  return par[5]*sum;
-
-};
-
-inline Double_t gfKto6(Double_t *x, Double_t *par)
-{
-
-  Double_t lambda = par[0];  
-  
-  Double_t sum = 0.;
-  Double_t arg = 0.;
-
-  Double_t mu0 = par[1];
-  Double_t mu1 = par[2];
-
-  if (mu1 < mu0)
-    return GIMMEABREAK;
-
-  Double_t sigma0 = par[3];
-  Double_t sigma1 = par[4];
-
-  if (sigma1 < sigma0)
-    return GIMMEABREAK;
-
-
-  Double_t mu2 = (2.*mu1)-mu0;  
-  Double_t mu3 = (3.*mu1)-(2.*mu0);
-  Double_t mu4 = (4.*mu1)-(3.*mu0);
-  Double_t mu5 = (5.*mu1)-(4.*mu0);
-  Double_t mu6 = (6.*mu1)-(5.*mu0);
-
-  Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0));  
-  Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0));
-  Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0));
-  Double_t sigma5 = TMath::Sqrt((5.*sigma1*sigma1) - (4.*sigma0*sigma0));
-  Double_t sigma6 = TMath::Sqrt((6.*sigma1*sigma1) - (5.*sigma0*sigma0));
-
-  Double_t lambda2 = lambda*lambda;
-  Double_t lambda3 = lambda2*lambda;
-  Double_t lambda4 = lambda3*lambda;
-  Double_t lambda5 = lambda4*lambda;
-  Double_t lambda6 = lambda5*lambda;
-  
-  // k=0:
-  arg = (x[0] - mu0)/sigma0;
-  sum = TMath::Exp(-0.5*arg*arg)/sigma0;
-  
-  // k=1:
-  arg = (x[0] - mu1)/sigma1;
-  sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1;
-  
-  // k=2:
-  arg = (x[0] - mu2)/sigma2;
-  sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2;
-
-  // k=3:
-  arg = (x[0] - mu3)/sigma3;
-  sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3;
-
-  // k=4:
-  arg = (x[0] - mu4)/sigma4;
-  sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4;
-  
-  // k=5:
-  arg = (x[0] - mu5)/sigma5;
-  sum += 0.008333333333333*lambda5*TMath::Exp(-0.5*arg*arg)/sigma5;
-
-  // k=6:
-  arg = (x[0] - mu6)/sigma6;
-  sum += 0.001388888888889*lambda6*TMath::Exp(-0.5*arg*arg)/sigma6;
-  
-  return par[5]*sum;
-
-};
-
-inline Double_t gfKto7(Double_t *x, Double_t *par)
-{
-
-  Double_t lambda = par[0];  
-  
-  Double_t sum = 0.;
-  Double_t arg = 0.;
-
-  Double_t mu0 = par[1];
-  Double_t mu1 = par[2];
-
-  if (mu1 < mu0)
-    return GIMMEABREAK;
-
-  Double_t sigma0 = par[3];
-  Double_t sigma1 = par[4];
-
-  if (sigma1 < sigma0)
-    return GIMMEABREAK;
-
-
-  Double_t mu2 = (2.*mu1)-mu0;  
-  Double_t mu3 = (3.*mu1)-(2.*mu0);
-  Double_t mu4 = (4.*mu1)-(3.*mu0);
-  Double_t mu5 = (5.*mu1)-(4.*mu0);
-  Double_t mu6 = (6.*mu1)-(5.*mu0);
-  Double_t mu7 = (7.*mu1)-(6.*mu0);
-  
-  Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0));  
-  Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0));
-  Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0));
-  Double_t sigma5 = TMath::Sqrt((5.*sigma1*sigma1) - (4.*sigma0*sigma0));
-  Double_t sigma6 = TMath::Sqrt((6.*sigma1*sigma1) - (5.*sigma0*sigma0));
-  Double_t sigma7 = TMath::Sqrt((7.*sigma1*sigma1) - (6.*sigma0*sigma0));
-
-  Double_t lambda2 = lambda*lambda;
-  Double_t lambda3 = lambda2*lambda;
-  Double_t lambda4 = lambda3*lambda;
-  Double_t lambda5 = lambda4*lambda;
-  Double_t lambda6 = lambda5*lambda;
-  Double_t lambda7 = lambda6*lambda;
-  
-  // k=0:
-  arg = (x[0] - mu0)/sigma0;
-  sum = TMath::Exp(-0.5*arg*arg)/sigma0;
-  
-  // k=1:
-  arg = (x[0] - mu1)/sigma1;
-  sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1;
-  
-  // k=2:
-  arg = (x[0] - mu2)/sigma2;
-  sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2;
-
-  // k=3:
-  arg = (x[0] - mu3)/sigma3;
-  sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3;
-
-  // k=4:
-  arg = (x[0] - mu4)/sigma4;
-  sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4;
-  
-  // k=5:
-  arg = (x[0] - mu5)/sigma5;
-  sum += 0.008333333333333*lambda5*TMath::Exp(-0.5*arg*arg)/sigma5;
-
-  // k=6:
-  arg = (x[0] - mu6)/sigma6;
-  sum += 0.001388888888889*lambda6*TMath::Exp(-0.5*arg*arg)/sigma6;
-  
-  // k=7:
-  arg = (x[0] - mu7)/sigma7;
-  sum += 0.000198412698413*lambda7*TMath::Exp(-0.5*arg*arg)/sigma7;
-  
-  return par[5]*sum;
-
-};
-
-
-inline Double_t gfKto8(Double_t *x, Double_t *par)
-{
-
-  Double_t lambda = par[0];  
-  
-  Double_t sum = 0.;
-  Double_t arg = 0.;
-
-  Double_t mu0 = par[1];
-  Double_t mu1 = par[2];
-
-  if (mu1 < mu0)
-    return GIMMEABREAK;
-
-  Double_t sigma0 = par[3];
-  Double_t sigma1 = par[4];
-
-  if (sigma1 < sigma0)
-    return GIMMEABREAK;
-
-
-  Double_t mu2 = (2.*mu1)-mu0;  
-  Double_t mu3 = (3.*mu1)-(2.*mu0);
-  Double_t mu4 = (4.*mu1)-(3.*mu0);
-  Double_t mu5 = (5.*mu1)-(4.*mu0);
-  Double_t mu6 = (6.*mu1)-(5.*mu0);
-  Double_t mu7 = (7.*mu1)-(6.*mu0);
-  Double_t mu8 = (8.*mu1)-(7.*mu0);    
-  
-  Double_t sigma2 = TMath::Sqrt((2.*sigma1*sigma1) - (sigma0*sigma0));  
-  Double_t sigma3 = TMath::Sqrt((3.*sigma1*sigma1) - (2.*sigma0*sigma0));
-  Double_t sigma4 = TMath::Sqrt((4.*sigma1*sigma1) - (3.*sigma0*sigma0));
-  Double_t sigma5 = TMath::Sqrt((5.*sigma1*sigma1) - (4.*sigma0*sigma0));
-  Double_t sigma6 = TMath::Sqrt((6.*sigma1*sigma1) - (5.*sigma0*sigma0));
-  Double_t sigma7 = TMath::Sqrt((7.*sigma1*sigma1) - (6.*sigma0*sigma0));
-  Double_t sigma8 = TMath::Sqrt((8.*sigma1*sigma1) - (7.*sigma0*sigma0));          
-
-  Double_t lambda2 = lambda*lambda;
-  Double_t lambda3 = lambda2*lambda;
-  Double_t lambda4 = lambda3*lambda;
-  Double_t lambda5 = lambda4*lambda;
-  Double_t lambda6 = lambda5*lambda;
-  Double_t lambda7 = lambda6*lambda;
-  Double_t lambda8 = lambda7*lambda;
-  
-  // k=0:
-  arg = (x[0] - mu0)/sigma0;
-  sum = TMath::Exp(-0.5*arg*arg)/sigma0;
-  
-  // k=1:
-  arg = (x[0] - mu1)/sigma1;
-  sum += lambda*TMath::Exp(-0.5*arg*arg)/sigma1;
-  
-  // k=2:
-  arg = (x[0] - mu2)/sigma2;
-  sum += 0.5*lambda2*TMath::Exp(-0.5*arg*arg)/sigma2;
-
-  // k=3:
-  arg = (x[0] - mu3)/sigma3;
-  sum += 0.1666666667*lambda3*TMath::Exp(-0.5*arg*arg)/sigma3;
-
-  // k=4:
-  arg = (x[0] - mu4)/sigma4;
-  sum += 0.041666666666667*lambda4*TMath::Exp(-0.5*arg*arg)/sigma4;
-  
-  // k=5:
-  arg = (x[0] - mu5)/sigma5;
-  sum += 0.008333333333333*lambda5*TMath::Exp(-0.5*arg*arg)/sigma5;
-
-  // k=6:
-  arg = (x[0] - mu6)/sigma6;
-  sum += 0.001388888888889*lambda6*TMath::Exp(-0.5*arg*arg)/sigma6;
-  
-  // k=7:
-  arg = (x[0] - mu7)/sigma7;
-  sum += 0.000198412698413*lambda7*TMath::Exp(-0.5*arg*arg)/sigma7;
-  
-  // k=8:
-  arg = (x[0] - mu8)/sigma8;
-  sum += 0.000024801587315*lambda8*TMath::Exp(-0.5*arg*arg)/sigma7;
-  
-  return par[5]*sum;
-
-};
-
-#endif  /* MARS_MCalibrationFits */
-
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.cc	(revision 2733)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Markus Gaug   11/2003 <mailto:markus@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrationPINDiode                                                            //
-//                                                                         //
-// This is the storage container to hold informations about the pedestal   //
-// (offset) value of one Pixel (PMT).                                      //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MCalibrationPINDiode.h"
-
-#include "MLog.h"
-
-ClassImp(MCalibrationPINDiode);
-
-using namespace std;
-// --------------------------------------------------------------------------
-//
-// Default Constructor. 
-//
-MCalibrationPINDiode::MCalibrationPINDiode(const char *name, const char *title)
-  : fHist(NULL),
-    fCharge(-1.),
-    fErrCharge(-1.),
-    fPed(-1.),
-    fPedRms(-1.),
-    fSigmaCharge(-1.),
-    fErrSigmaCharge(-1.),
-    fTime(-1.),
-    fErrTime(-1.)
-{
-
-  fName  = name  ? name  : "MCalibrationPINDiode";
-  fTitle = title ? title : "Container of the MHCalibrationPINDiode and the fit results";
-
-  fHist = new MHCalibrationPINDiode();
-
-}
-
-MCalibrationPINDiode::~MCalibrationPINDiode() 
-{
-  delete fHist;
-}
-
-// ------------------------------------------------------------------------
-//
-// Invalidate values
-//
-void MCalibrationPINDiode::Clear(Option_t *o)
-{
-  fHist->Reset();
-}
-
-Bool_t MCalibrationPINDiode::FitCharge() 
-{
-  if(!fHist->FitChargeHiGain())
-    return kFALSE;
-
-  fCharge         = fHist->GetChargeMean();
-  fErrCharge      = fHist->GetChargeMeanErr(); 
-  fSigmaCharge    = fHist->GetChargeSigma();
-  fErrSigmaCharge = fHist->GetChargeSigmaErr();
-
-  return kTRUE;
-  
-}
-
-Bool_t MCalibrationPINDiode::FitTime() 
-{
-
-  if(!fHist->FitTimeHiGain())
-    return kFALSE;
-
-  fTime    = fHist->GetTime();
-  fErrTime = fHist->GetErrTime();
-  
-  return kTRUE;
-
-}
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPINDiode.h	(revision 2733)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#ifndef MARS_MCalibrationPINDiode
-#define MARS_MCalibrationPINDiode
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-#include "MHCalibrationPINDiode.h"
-
-class MCalibrationPINDiode : public MParContainer
-{
-private:
-
-  MHCalibrationPINDiode *fHist; // Pointer to the histograms performing the fits, etc.  
-  
-  Float_t fCharge;                // The mean charge after the fit
-  Float_t fErrCharge;             // The error of mean charge after the fit
-  Float_t fPed;              // The mean pedestal (from MPedestalPix)
-  Float_t fPedRms;           // The pedestal  RMS (from MPedestalPix)
-  Float_t fSigmaCharge;           // The sigma of the mean charge after the fit
-  Float_t fErrSigmaCharge;        // The error of the sigma of the mean charge after the fit
-  Float_t fTime;                // The mean arrival time after the fit  
-  Float_t fErrTime;             // The error of the mean arrival time after the fit
-  
-public:
-
-  MCalibrationPINDiode(const char *name=NULL, const char *title=NULL);
-  ~MCalibrationPINDiode();
-  
-  void Clear(Option_t *o="");
-  
-  void SetPed(Float_t ped)          { fPed      = ped;      } 
-  void SetPedRms(Float_t pedrms)    { fPedRms   = pedrms; }
-
-  Float_t GetMean()           const { return fCharge; }
-  Float_t GetMeanError()      const { return fErrCharge; }
-
-  Bool_t IsFitOK() const            { return fCharge > 0 && fErrCharge > 0; }
-
-  Bool_t FillCharge(Float_t q)      { return fHist->FillChargeHiGain(q); }
-  Bool_t FillTime(Int_t t)          { return fHist->FillTimeHiGain(t); }  
-  Bool_t FillRChargevsTime(Float_t rq, Int_t t) { return fHist->FillChargevsNHiGain(rq,t); }    
-  
-  Bool_t FitCharge();
-  Bool_t FitTime();
-  
-  MHCalibrationPINDiode *GetHist()  const  { return fHist;  }
-  
-  ClassDef(MCalibrationPINDiode, 1)	// Storage Container for Calibration information of one pixel
-};
-
-#endif   /* MARS_MCalibrationPINDiode */
-
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPix.cc	(revision 2733)
+++ 	(revision )
@@ -1,436 +1,0 @@
-/* ======================================================================== *\
-!
-! *
-! * This file is part of MARS, the MAGIC Analysis and Reconstruction
-! * Software. It is distributed to you in the hope that it can be a useful
-! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
-! * It is distributed WITHOUT ANY WARRANTY.
-! *
-! * Permission to use, copy, modify and distribute this software and its
-! * documentation for any purpose is hereby granted without fee,
-! * provided that the above copyright notice appear in all copies and
-! * that both that copyright notice and this permission notice appear
-! * in supporting documentation. It is provided "as is" without express
-! * or implied warranty.
-! *
-!
-!
-!   Author(s): Markus Gaug   11/2003 <mailto:markus@ifae.es>
-!
-!   Copyright: MAGIC Software Development, 2000-2001
-!
-!
-\* ======================================================================== */
-
-/////////////////////////////////////////////////////////////////////////////
-//                                                                         //
-// MCalibrationPix                                                         //
-//                                                                         //
-// This is the storage container to hold informations about the pedestal   //
-// (offset) value of one Pixel (PMT).                                      //
-//                                                                         //
-/////////////////////////////////////////////////////////////////////////////
-#include "MCalibrationPix.h"
-#include "MCalibrationConfig.h"
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-ClassImp(MCalibrationPix);
-
-using namespace std;
-
-// --------------------------------------------------------------------------
-//
-// Default Constructor. 
-//
-MCalibrationPix::MCalibrationPix(const char *name, const char *title)
-    : fPixId(-1),
-      fCharge(-1.),
-      fErrCharge(-1.),
-      fSigmaCharge(-1.),
-      fErrSigmaCharge(-1.),
-      fRSigmaSquare(-1.),
-      fChargeProb(-1.),
-      fPed(-1.),
-      fPedRms(-1.),
-      fErrPedRms(0.),
-      fElectronicPedRms(1.5),
-      fErrElectronicPedRms(0.3),
-      fTime(-1.),
-      fSigmaTime(-1.),
-      fTimeChiSquare(-1.),
-      fFactor(1.3),
-      fPheFFactorMethod(-1.),
-      fConversionFFactorMethod(-1.),
-      fConversionBlindPixelMethod(-1.),
-      fConversionPINDiodeMethod(-1.),
-      fConversionErrorFFactorMethod(-1.),
-      fConversionErrorBlindPixelMethod(-1.),
-      fConversionErrorPINDiodeMethod(-1.),
-      fConversionSigmaFFactorMethod(-1.),
-      fConversionSigmaBlindPixelMethod(-1.),
-      fConversionSigmaPINDiodeMethod(-1.),
-      fHiGainSaturation(kFALSE),
-      fFitValid(kFALSE),        
-      fFitted(kFALSE), 
-      fBlindPixelMethodValid(kFALSE),
-      fFFactorMethodValid(kFALSE),
-      fPINDiodeMethodValid(kFALSE)
-{
-
-  fName  = name  ? name  : "MCalibrationPixel";
-  fTitle = title ? title : "Container of the MHCalibrationPixels and the fit results";
-
-  //
-  // At the moment, we don't have a database, yet, 
-  // so we get it from the configuration file
-  //
-  fConversionHiLo      = gkConversionHiLo;
-  fConversionHiLoError = gkConversionHiLoError;  
-
-  fHist = new MHCalibrationPixel("MHCalibrationPixel","Calibration Histograms Pixel ");
-
-}
-
-MCalibrationPix::~MCalibrationPix() 
-{
-  delete fHist;
-}
-
-
-void MCalibrationPix::DefinePixId(Int_t i)
-{
-  
-  fPixId = i;
-  fHist->ChangeHistId(i);
-  
-}
-
-
-// ------------------------------------------------------------------------
-//
-// Invalidate values
-//
-void MCalibrationPix::Clear(Option_t *o)
-{
-  fHist->Reset();
-}
-
-
-// --------------------------------------------------------------------------
-//
-// 1) Return if the charge distribution is already succesfully fitted  
-// 2) Set a lower Fit range according to 1.5 Pedestal RMS in order to avoid 
-//    possible remaining cosmics to spoil the fit.
-// 3) Decide if the LoGain Histogram is fitted or the HiGain Histogram
-// 4) Fit the histograms with a Gaussian
-// 5) In case of failure print out the fit results
-// 6) Retrieve the results and store them in this class
-// 7) Calculate the number of photo-electrons after the F-Factor method
-// 8) Calculate the errors of the F-Factor method
-//
-// The fit is declared valid (fFitValid = kTRUE), if:
-//
-// 1) Pixel has a fitted charge greater than 3*PedRMS
-// 2) Pixel has a fit error greater than 0.
-// 3) Pixel has a fit Probability greater than 0.0001 
-// 4) Pixel has a charge sigma bigger than its Pedestal RMS
-// 5) If FitTimes is used, 
-//    the mean arrival time is at least 1.0 slices from the used edge slices 
-// 
-// The conversion factor after the F-Factor method is declared valid, if:
-//
-// 1) fFitValid is kTRUE
-// 2) Conversion Factor is bigger than 0.
-// 3) The error of the conversion factor is smaller than 10%
-//
-Bool_t MCalibrationPix::FitCharge() 
-{
-
-  //
-  // 1) Return if the charge distribution is already succesfully fitted  
-  //
-  if (fHist->IsFitOK())
-    return kTRUE;
-
-  //
-  // 2) Set a lower Fit range according to 1.5 Pedestal RMS in order to avoid 
-  //    possible remaining cosmics to spoil the fit.
-  //
-  if (fPed && fPedRms)
-    fHist->SetLowerFitRange(1.5*fPedRms);
-  else
-    *fLog << warn << "Cannot set lower fit range: Pedestals not available" << endl;
-
-  //
-  // 3) Decide if the LoGain Histogram is fitted or the HiGain Histogram
-  //
-  if (fHist->UseLoGain())
-    {
-
-      SetHiGainSaturation();
-      
-      //
-      // 4) Fit the Lo Gain histograms with a Gaussian
-      //
-      if(!fHist->FitChargeLoGain())
-	{
-	  *fLog << warn << "Could not fit Lo Gain charges of pixel " << fPixId << endl;
-          //          
-          // 5) In case of failure print out the fit results
-          //
-	  fHist->PrintChargeFitResult();
-	}
-    }
-  else 
-    {
-      //
-      // 4) Fit the Hi Gain histograms with a Gaussian
-      //
-      if(!fHist->FitChargeHiGain())
-	{
-	  *fLog << warn << "Could not fit Hi Gain charges of pixel " << fPixId << endl;
-          //          
-          // 5) In case of failure print out the fit results
-          //
-	  fHist->PrintChargeFitResult();
-	}
-    }
-  
-
-  //
-  // 6) Retrieve the results and store them in this class
-  //
-  fCharge         = fHist->GetChargeMean();
-  fErrCharge      = fHist->GetChargeMeanErr(); 
-  fSigmaCharge    = fHist->GetChargeSigma();
-  fErrSigmaCharge = fHist->GetChargeSigmaErr();
-  fChargeProb     = fHist->GetChargeProb();
-
-  if (fCharge <= 0.)
-    {
-      *fLog << warn << "Cannot apply calibration: Mean Fitted Charges are smaller than 0 in pixel " 
-            << fPixId << endl;
-      return kFALSE;
-    }
-
-  if (fErrCharge > 0.) 
-    fFitted = kTRUE;
-
-
-  if (fHiGainSaturation)
-    {
-      if ( (fCharge     > 0.3*GetPedRms()) &&
-          (fErrCharge  > 0.)              &&
-          (fHist->IsFitOK())              &&
-          (fSigmaCharge > fPedRms/fConversionHiLo)   &&
-          (fTime > fHist->GetTimeLowerFitRange()+1.) &&
-          (fTime < fHist->GetTimeUpperFitRange()-1.) )
-        fFitValid =  kTRUE;
-    }
-  else
-    {
-      if ( (fCharge > 3.*GetPedRms()) &&
-           (fErrCharge  > 0.)        &&
-           (fHist->IsFitOK())        &&
-           (fSigmaCharge > fPedRms)  &&
-           (fTime > fHist->GetTimeLowerFitRange()+1.) &&
-           (fTime < fHist->GetTimeUpperFitRange()-1.) )
-        fFitValid =  kTRUE;
-    }
-  
-  //
-  // 7) Calculate the number of photo-electrons after the F-Factor method
-  // 8) Calculate the errors of the F-Factor method
-  //
-  if ((fPed > 0.)  && (fPedRms > 0.))
-    {
-      
-      //
-      // Square all variables in order to avoid applications of square root
-      //
-      // First the relative error squares
-      //
-      const Float_t chargeSquare              =       fCharge*   fCharge;
-      const Float_t chargeSquareRelErrSquare  = 4.*fErrCharge*fErrCharge / chargeSquare;
-
-      const Float_t fFactorRelErrSquare       = fFactorError * fFactorError / (fFactor * fFactor);
-      //
-      // Now the absolute error squares
-      //
-      const Float_t sigmaSquare               =       fSigmaCharge*   fSigmaCharge;
-      const Float_t sigmaSquareErrSquare      = 4.*fErrSigmaCharge*fErrSigmaCharge * sigmaSquare;
-
-      const Float_t elecRmsSquare             =       fElectronicPedRms*   fElectronicPedRms;
-      const Float_t elecRmsSquareErrSquare    = 4.*fErrElectronicPedRms*fErrElectronicPedRms * elecRmsSquare;
-
-      Float_t pedRmsSquare                    =       fPedRms*   fPedRms;
-      Float_t pedRmsSquareErrSquare           = 4.*fErrPedRms*fErrPedRms * pedRmsSquare;
-
-      if (fHiGainSaturation)
-	{
-          
-          //
-          // We do not know the Lo Gain Pedestal RMS, so we have to retrieve it 
-          // from the Hi Gain: 
-          //
-          // We extract the pure NSB contribution:
-          //
-          Float_t nsbSquare             =  pedRmsSquare          - elecRmsSquare;
-          Float_t nsbSquareRelErrSquare = (pedRmsSquareErrSquare + elecRmsSquareErrSquare)
-                                          / (nsbSquare * nsbSquare) ;
-
-	  if (nsbSquare < 0.)
-            nsbSquare = 0.;
-          
-          //
-          // Now, we divide the NSB by the conversion factor and 
-          // add it quadratically to the electronic noise
-          //
-          const Float_t conversionSquare             =    fConversionHiLo     *fConversionHiLo;
-          const Float_t conversionSquareRelErrSquare = 4.*fConversionHiLoError*fConversionHiLoError/conversionSquare;
-
-          //
-          // Calculate the new "Pedestal RMS"
-          //
-          const Float_t convertedNsbSquare          =  nsbSquare             / conversionSquare;
-          const Float_t convertedNsbSquareErrSquare = (nsbSquareRelErrSquare + conversionSquareRelErrSquare)
-                                                      * convertedNsbSquare * convertedNsbSquare;
-
-          pedRmsSquare           = convertedNsbSquare           + elecRmsSquare;
-          pedRmsSquareErrSquare  = convertedNsbSquareErrSquare  + elecRmsSquareErrSquare;
-          
-	}    /* if (fHiGainSaturation) */
-      
-      //
-      // Calculate the reduced sigmas
-      //
-      fRSigmaSquare = sigmaSquare - pedRmsSquare;
-      if (fRSigmaSquare <= 0.)
-        {
-          *fLog << warn << "Cannot apply F-Factor calibration: Reduced Sigma smaller than 0 in pixel " 
-                << fPixId << endl;
-          if (fHiGainSaturation)
-            ApplyLoGainConversion();
-          return kFALSE;
-        }
-
-      const Float_t rSigmaSquareRelErrSquare = (sigmaSquareErrSquare + pedRmsSquareErrSquare)
-        / (fRSigmaSquare * fRSigmaSquare) ;
-  
-      //
-      // Calculate the number of phe's from the F-Factor method
-      // (independent on Hi Gain or Lo Gain)
-      //
-      fPheFFactorMethod = fFactor * chargeSquare / fRSigmaSquare;
-
-      const Float_t pheFFactorRelErrSquare =  fFactorRelErrSquare
-                                            + chargeSquareRelErrSquare
-                                            + rSigmaSquareRelErrSquare ;
-          
-      fPheFFactorMethodError        =  TMath::Sqrt(pheFFactorRelErrSquare) * fPheFFactorMethod;
-
-      //
-      // Calculate the conversion factors 
-      //
-      if (fHiGainSaturation)
-        ApplyLoGainConversion();
-      
-      const Float_t chargeRelErrSquare = fErrCharge*fErrCharge / (fCharge * fCharge);
-      
-      fConversionFFactorMethod        =  fPheFFactorMethod / fCharge ;
-      fConversionErrorFFactorMethod   =  ( pheFFactorRelErrSquare + chargeRelErrSquare )
-                                         * fConversionFFactorMethod * fConversionFFactorMethod;
-      
-      if ( IsFitValid()                     &&
-           (fConversionFFactorMethod > 0.) &&
-           (fConversionErrorFFactorMethod/fConversionFFactorMethod < 0.1) )
-        fFFactorMethodValid = kTRUE;
-      
-      
-    } /*   if ((fPed > 0.)  && (fPedRms > 0.)) */
-
-  return kTRUE;
-  
-}
-
-
-void MCalibrationPix::ApplyLoGainConversion()
-{
-  
-  const Float_t chargeRelErrSquare     =   fErrCharge*fErrCharge
-                                         /(   fCharge *  fCharge);
-  const Float_t sigmaRelErrSquare      =   fErrSigmaCharge*fErrSigmaCharge
-                                         /(   fSigmaCharge *  fSigmaCharge);
-  const Float_t conversionRelErrSquare =   fConversionHiLoError*fConversionHiLoError 
-                                         /(fConversionHiLo    * fConversionHiLo);
-  
-  fCharge         *= fConversionHiLo;
-  fErrCharge       = TMath::Sqrt(chargeRelErrSquare + conversionRelErrSquare) * fCharge;
-  
-  fSigmaCharge    *= fConversionHiLo;
-  fErrSigmaCharge =  TMath::Sqrt(sigmaRelErrSquare + conversionRelErrSquare) * fSigmaCharge;
-  
-}
-
-
-// --------------------------------------------------------------------------
-//
-// Set the pedestals from outside
-//
-void MCalibrationPix::SetPedestal(Float_t ped, Float_t pedrms)
-{
-
-  fPed    = ped;    
-  fPedRms = pedrms;
-  
-}
-
-// --------------------------------------------------------------------------
-//
-// 1) Fit the arrival times
-// 2) Retrieve the results
-// 3) Note that because of the low number of bins, the NDf is sometimes 0, so 
-//    Root does not give a reasonable Probability, the Chisquare is more significant
-//
-// This fit has to be done AFTER the Charges fit, 
-// otherwise only the Hi Gain will be fitted, even if there are no entries
-//
-// 
-Bool_t MCalibrationPix::FitTime() 
-{
-
-  //
-  // Fit the Low Gain
-  //
-  if (fHiGainSaturation)
-    {
-      if(!fHist->FitTimeLoGain())
-	{
-	  *fLog << warn << "Could not fit Lo Gain times of pixel " << fPixId << endl;
-	  fHist->PrintTimeFitResult();
-	  return kFALSE;
-	}
-    }
-
-  //
-  // Fit the High Gain
-  //
-  else
-    {
-      if(!fHist->FitTimeHiGain())
-	{
-	  *fLog << warn << "Could not fit Hi Gain times of pixel " << fPixId << endl;
-	  fHist->PrintTimeFitResult();
-	  return kFALSE;
-	}
-    }
-    
-  fTime          = fHist->GetTimeMean();
-  fSigmaTime     = fHist->GetTimeSigma();
-  fTimeChiSquare = fHist->GetTimeChiSquare();
-
-  return kTRUE;
-}
-
Index: trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MCalibrationPix.h	(revision 2733)
+++ 	(revision )
@@ -1,172 +1,0 @@
-#ifndef MARS_MCalibrationPix
-#define MARS_MCalibrationPix
-
-#ifndef MARS_MParContainer
-#include "MParContainer.h"
-#endif
-
-#include "MHCalibrationPixel.h"
-
-class MCalibrationPix : public MParContainer
-{
-private:
-
-  Int_t   fPixId;                        // the pixel Id
-  
-  Float_t fCharge;                       // The mean reduced charge after the fit
-  Float_t fErrCharge;                    // The error of reduced mean charge after the fit
-  Float_t fSigmaCharge;                  // The sigma of the mean charge after the fit
-  Float_t fErrSigmaCharge;               // The error of the sigma of the mean charge after the fit
-  Float_t fRSigmaSquare;                 // The reduced squares of sigmas after the fit
-  Float_t fChargeProb;                   // The probability of the fit function 
-
-  Float_t fPed;                          // The mean pedestal (from MPedestalPix)
-  Float_t fPedRms;                       // The pedestal  RMS (from MPedestalPix)
-  Float_t fErrPedRms;                    // The error of the pedestal  RMS (from MPedestalPix)  
-  Float_t fElectronicPedRms;             // The pure electronic component of the RMS
-  Float_t fErrElectronicPedRms;          // The error of the pure electronic component of the RMS
-
-  Float_t fTime;                         // The mean arrival time after the fit  
-  Float_t fSigmaTime;                    // The error of the mean arrival time after the fit
-  Float_t fTimeChiSquare;                // The probability of the fit function 
-  
-  Float_t fFactor;                       // The laboratory F-factor
-  Float_t fFactorError;                  // The laboratory F-factor Error
-  Float_t fPheFFactorMethod;             // The number of Phe's calculated (F-factor method)
-  Float_t fPheFFactorMethodError;        // The error on the number of Phe's calculated (F-factor method)
-
-  Float_t fConversionFFactorMethod;      // The conversion factor to Phe's (F-factor method)
-  Float_t fConversionBlindPixelMethod;   // The conversion factor to Ph's (Blind Pixel method)
-  Float_t fConversionPINDiodeMethod;     // The conversion factor to Ph's (PIN Diode method)
-
-  Float_t fConversionErrorFFactorMethod;    // The error of the conversion factor to Phe's (F-factor method)
-  Float_t fConversionErrorBlindPixelMethod; // The error of the conversion factor to Ph's (Blind Pixel method)
-  Float_t fConversionErrorPINDiodeMethod;   // The error of the conversion factor to Ph's (PIN Diode method)
-
-  Float_t fConversionSigmaFFactorMethod;    // The sigma of conversion factor to Ph's (F-factor method)
-  Float_t fConversionSigmaBlindPixelMethod; // The conversion factor to Ph's (Blind Pixel method)
-  Float_t fConversionSigmaPINDiodeMethod;   // The conversion factor to Phd's (PIN Diode method)
-
-  Float_t fConversionHiLo;                  // The conversion factor between Hi Gain and Lo Gain  
-  Float_t fConversionHiLoError;             // The error of the conversion factor between Hi Gain and Lo Gain  
-  
-  Bool_t  fHiGainSaturation;                // Is Lo-Gain used at all?
-
-  Bool_t  fFitValid;        
-  Bool_t  fFitted; 
-  Bool_t  fBlindPixelMethodValid;
-  Bool_t  fFFactorMethodValid;
-  Bool_t  fPINDiodeMethodValid;
-  
-  MHCalibrationPixel *fHist;    //! Pointer to the histograms performing the fits, etc.  
-  
-public:
-
-  MCalibrationPix(const char *name=NULL, const char *title=NULL);
-  ~MCalibrationPix();
-  
-  void Clear(Option_t *o="");
-
-  // Getter
-  Bool_t IsFitValid()              const { return fFitValid;  }
-  Bool_t IsFitted()                const { return fFitted;  }
-  Bool_t IsBlindPixelMethodValid() const { return fBlindPixelMethodValid;  }
-  Bool_t IsFFactorMethodValid()    const { return fFFactorMethodValid;  }
-  Bool_t IsPINDiodeMethodValid()   const { return fPINDiodeMethodValid;  }
-
-  Float_t GetCharge()              const { return fCharge;         }
-  Float_t GetRSigmaSquare()        const { return fRSigmaSquare;   }
-    
-  Float_t GetErrCharge()           const { return fErrCharge;      }
-  Float_t GetChargeProb()          const { return fChargeProb;     }    
-  
-  Float_t GetSigmaCharge()         const { return fSigmaCharge;    }
-  Float_t GetErrSigmaCharge()      const { return fErrSigmaCharge; }
-  Float_t GetTime()                const { return fTime;           }
-  Float_t GetSigmaTime()           const { return fSigmaTime;      }
-  Float_t GetTimeChiSquare()       const { return fTimeChiSquare;  }    
-
-  Float_t GetConversionHiLo()                 const  { return fConversionHiLo;        }
-  Float_t GetConversionHiLoError()            const  { return fConversionHiLoError;   }
-
-  Float_t GetMeanConversionBlindPixelMethod()  const { return fConversionBlindPixelMethod ; }
-  Float_t GetErrorConversionBlindPixelMethod() const { return fConversionErrorBlindPixelMethod ; }
-  Float_t GetSigmaConversionBlindPixelMethod() const { return fConversionSigmaBlindPixelMethod ; }
-
-  Float_t GetMeanConversionFFactorMethod()     const { return fConversionFFactorMethod ;       }
-  Float_t GetErrorConversionFFactorMethod()    const { return fConversionErrorFFactorMethod ;  }
-  Float_t GetSigmaConversionFFactorMethod()    const { return fConversionSigmaFFactorMethod ;  }
-
-  Float_t GetPheFFactorMethod()                const { return fPheFFactorMethod;               }
-  Float_t GetPheFFactorMethodError()           const { return fPheFFactorMethodError;          }
-
-  Float_t GetMeanConversionPINDiodeMethod()    const { return fConversionPINDiodeMethod ;      }
-  Float_t GetErrorConversionPINDiodeMethod()   const { return fConversionErrorPINDiodeMethod ; }
-  Float_t GetSigmaConversionPINDiodeMethod()   const { return fConversionSigmaPINDiodeMethod ; }
-
-  // FIXME: Remove this from stored data members
-  Float_t GetPed()    const { return fPed;    }
-  Float_t GetPedRms() const { return fPedRms; }
-
-  // Setter
-  void SetPedestal(Float_t ped, Float_t pedrms);
-  void SetHiGainSaturation()             { fHiGainSaturation = kTRUE; fHist->SetUseLoGain(); }
-
-  void SetConversionHiLo(Float_t c)      { fConversionHiLo      = c;    }
-  void SetConversionHiLoError(Float_t e) { fConversionHiLoError = e;    }
-
-  void SetConversionFFactorMethod(Float_t c, Float_t err, Float_t sig)
-  {
-      fConversionFFactorMethod = c;
-      fConversionErrorFFactorMethod = err;
-      fConversionSigmaFFactorMethod = sig;
-  }
-  void SetConversionBlindPixelMethod(Float_t c, Float_t err, Float_t sig)
-  {
-      fConversionBlindPixelMethod = c;
-      fConversionErrorBlindPixelMethod = err;
-      fConversionSigmaBlindPixelMethod = sig;
-  }
-
-  void SetConversionPINDiodeMethod(Float_t c, Float_t err, Float_t sig)
-  {
-      fConversionPINDiodeMethod = c ;
-      fConversionErrorPINDiodeMethod = err;
-      fConversionSigmaPINDiodeMethod = sig;
-  }
-
-  void SetFitValid()                            { fFitValid = kTRUE;  }
-  void SetFitted()                              { fFitted = kTRUE;  }
-  void SetBlindPixelMethodValid(Bool_t b=kTRUE) { fBlindPixelMethodValid = b;  }
-  void SetFFactorMethodValid(Bool_t b=kTRUE)    { fFFactorMethodValid = b;  }
-  void SetPINDiodeMethodValid(Bool_t b=kTRUE)   { fPINDiodeMethodValid = b;  }
-
-  // Unknown
-  void   ApplyLoGainConversion();
-
-  void   SetChargesInGraph(Float_t qhi,Float_t qlo) { fHist->SetPointInGraph(qhi,qlo); }
-
-  Bool_t FillChargeHiGain(Float_t q)                   { return fHist->FillChargeHiGain(q); }
-  Bool_t FillTimeHiGain(Int_t t)                       { return fHist->FillTimeHiGain(t); }  
-  Bool_t FillRChargevsTimeHiGain(Float_t rq, Int_t t)  { return fHist->FillChargevsNHiGain(rq,t); }    
-
-  Bool_t FillChargeLoGain(Float_t q)                   { return fHist->FillChargeLoGain(q); }
-  Bool_t FillTimeLoGain(Int_t t)                       { return fHist->FillTimeLoGain(t); }  
-  Bool_t FillRChargevsTimeLoGain(Float_t rq, Int_t t)  { return fHist->FillChargevsNLoGain(rq,t); }    
-  
-  // FIXME: Not necessary -> pixidx (not id anyhow!) == index in array!
-  //        Only needed n histograms which have to move to an MH-class anyhow!
-  Int_t  GetPixId()                              const  { return fPixId;   }
-  void   DefinePixId(Int_t i);
-  
-  Bool_t FitCharge();
-  Bool_t FitTime();
-  
-  MHCalibrationPixel *GetHist() const   { return fHist;     }
-  void Draw(Option_t *opt="")           { fHist->Draw(opt); }
-  
-  ClassDef(MCalibrationPix, 1)	// Storage Container for Calibration information of one pixel
-};
-
-#endif
-
Index: trunk/MagicSoft/Mars/manalysis/Makefile
===================================================================
--- trunk/MagicSoft/Mars/manalysis/Makefile	(revision 2733)
+++ trunk/MagicSoft/Mars/manalysis/Makefile	(revision 2734)
@@ -53,5 +53,4 @@
            MCerPhotAnal2.cc \
 	   MCerPhotCalc.cc \
-	   MCalibrate.cc \
            MBlindPixels.cc \
            MBlindPixelCalc.cc \
@@ -76,9 +75,4 @@
            MCT1PadONOFF.cc  \
            MPadONOFF.cc  \
-           MCalibrationCalc.cc \
-           MCalibrationPix.cc  \
-           MCalibrationBlindPix.cc  \
-           MCalibrationPINDiode.cc  \
-           MCalibrationCam.cc \
            MPedestalWorkaround.cc \
            MExtractedSignalCam.cc \
