Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 3253)
+++ trunk/MagicSoft/Mars/Changelog	(revision 3254)
@@ -29,4 +29,5 @@
    * mcalib/MCalibrateData.[h,cc]
    * mcalib/MMcCalibrationCalc.[h,cc]
+   * manalysis/MMcCalibrationUpdate.[h,cc]
    * mjobs/MJCalibration.[h,cc]
    * mjobs/MJExtractSignal.[h,cc]
Index: trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h
===================================================================
--- trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h	(revision 3253)
+++ trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.h	(revision 3254)
@@ -6,5 +6,5 @@
 #endif
 
-class MCalibrationCam;
+class MCalibrationChargeCam;
 class MPedPhotCam;
 class MGeomCam;
@@ -20,9 +20,9 @@
     Bool_t ReInit(MParList *pList);
 
-    MCalibrationCam     *fCalCam;
-    MPedPhotCam         *fPedPhotCam;
-    MGeomCam            *fGeom;
-    MMcFadcHeader       *fHeaderFadc;
-    MExtractedSignalCam *fSignalCam;
+    MCalibrationChargeCam *fCalCam;
+    MPedPhotCam           *fPedPhotCam;
+    MGeomCam              *fGeom;
+    MMcFadcHeader         *fHeaderFadc;
+    MExtractedSignalCam   *fSignalCam;
 
     Float_t fADC2PhInner; // Conversion factor from ADC counts to photons
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc	(revision 3253)
+++ 	(revision )
@@ -1,629 +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
-//
-//   Task to calculate the calibration conversion factors from the FADC
-//   time slices. The integrated time slices have to be delivered by an 
-//   MExtractedSignalCam. The pedestals by an MPedestalCam.
-//
-//   The output container MCalibrationCam holds one entry of type MCalibrationPix 
-//   for every pixel. It is filled in the following way:
-//
-//   ProProcess: Search for MPedestalCam, MExtractedSignalCam and MExtractedSignalBlindPixel
-//               Initialize MCalibrationCam
-//               Initialize pulser light wavelength
-//               
-//   ReInit:     MCalibrationCam::InitSize(NumPixels) is called which allocates
-//               memory in a TClonesArray of type MCalibrationPix
-//               Initialize number of used FADC slices
-//               Optionally exclude pixels from calibration               
-//
-//   Process:    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 histograms of the PIN Diode are fitted to Gaussians
-//
-//                Fits can be excluded via the commands:
-//                MalibrationCam::SkipBlindPixelFits()  (skip all blind
-//                pixel fits)
-//
-//                Hi-Gain vs. Lo-Gain Calibration (very memory-intensive)
-//                can be skipped with the command:
-//                MalibrationCam::SkipHiLoGainCalibration()
-//
-//  Input Containers:
-//   MRawEvtData
-//   MPedestalCam
-//   MExtractedSignalCam
-//   MExtractedSignalBlindPixel
-//
-//  Output Containers:
-//   MCalibrationCam
-//
-//////////////////////////////////////////////////////////////////////////////
-#include "MCalibrationCalc.h"
-
-// FXIME: Usage of fstream is a preliminary workaround!
-#include <fstream>
-
-#include <TSystem.h>
-#include <TH1.h>
-
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-
-#include "MGeomCam.h"
-#include "MRawRunHeader.h"
-#include "MRawEvtPixelIter.h"
-
-#include "MPedestalCam.h"
-#include "MPedestalPix.h"
-
-#include "MCalibrationCam.h"
-#include "MCalibrationPix.h"
-
-#include "MExtractedSignalCam.h"
-#include "MExtractedSignalPix.h"
-#include "MExtractedSignalBlindPixel.h"
-
-#include "MCalibrationBlindPix.h"
-
-ClassImp(MCalibrationCalc);
-
-using namespace std;
-
-const UInt_t MCalibrationCalc::fgBlindPixelIdx   = 559;
-const UInt_t MCalibrationCalc::fgPINDiodeIdx     = 9999;
-const UInt_t MCalibrationCalc::fgBlindPixelSinglePheCut = 400;
-
-// --------------------------------------------------------------------------
-//
-// Default constructor. 
-//
-MCalibrationCalc::MCalibrationCalc(const char *name, const char *title)
-    : fPedestals(NULL), fCalibrations(NULL), fSignals(NULL),
-      fRawEvt(NULL), fRunHeader(NULL), fEvtTime(NULL)
-{
-
-    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");
-
-    Clear();
-    SetBlindPixelIdx();
-    SetPINDiodeIdx();
-}
-
-void MCalibrationCalc::Clear(const Option_t *o)
-{
-  
-    SETBIT(fFlags, kUseBlindPixelFit);
-    SETBIT(fFlags, kUseQualityChecks);
-    SETBIT(fFlags, kHiLoGainCalibration);
-
-    CLRBIT(fFlags, kHiGainOverFlow);
-    CLRBIT(fFlags, kLoGainOverFlow);
-
-    fNumBlindPixelSinglePhe = 0;
-    fNumBlindPixelPedestal  = 0;  
-
-    fNumHiGainSamples  = 0;
-    fNumLoGainSamples  = 0;
-    fConversionHiLo    = 0;
-    fNumExcludedPixels = 0;
-
-    fColor = kECT1;
-}
-
-
-MCalibrationBlindPix *MCalibrationCalc::GetBlindPixel() const
-{
-    return fCalibrations->GetBlindPixel();
-}
-
-// --------------------------------------------------------------------------
-//
-// 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
-//
-// The following output containers are only searched, but not created
-//
-//  - MTime
-//
-Int_t MCalibrationCalc::PreProcess(MParList *pList)
-{
-
-    fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
-    if (!fRawEvt)
-    {
-      *fLog << err << 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;
-      }
-
-    fEvtTime      = (MTime*)pList->FindObject("MTime");
-
-    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;
-      }
-
-    fBlindPixel = (MExtractedSignalBlindPixel*)pList->FindObject("MExtractedSignalBlindPixel");
-    if (!fBlindPixel)
-      {
-        *fLog << err << dbginf << "Cannot find MExtractedSignalBlindPixel ... 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 << err << 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;
-    }
-
-
-    fCalibrations->SetGeomCam(cam);
-
-    fNumHiGainSamples =  fSignals->GetNumUsedHiGainFADCSlices();
-    fNumLoGainSamples =  fSignals->GetNumUsedLoGainFADCSlices();
-    fSqrtHiGainSamples = TMath::Sqrt((Float_t)fNumHiGainSamples);
-
-    UInt_t npixels = cam->GetNumPixels();
-
-    for (UInt_t i=0; i<npixels; i++)
-      {
-        
-        MCalibrationPix &pix = (*fCalibrations)[i];
-        pix.DefinePixId(i);
-
-        pix.SetAbsTimeBordersHiGain(fSignals->GetFirstUsedSliceHiGain(),
-                                    fSignals->GetLastUsedSliceHiGain());
-        pix.SetAbsTimeBordersLoGain(fSignals->GetFirstUsedSliceLoGain(),
-                                    fSignals->GetLastUsedSliceLoGain());
-        
-        if (!TESTBIT(fFlags,kUseQualityChecks))
-          pix.SetExcludeQualityCheck();
-
-        // Exclude the blind pixel and the PIN Diode from normal pixel calibration:
-        if (i == fBlindPixelIdx)
-          pix.SetExcluded();
-
-        if (i == fPINDiodeIdx)
-          pix.SetExcluded();
-
-     }
-    
-    //
-    // Look for file to exclude pixels from analysis
-    //
-    if (!fExcludedPixelsFile.IsNull())
-      {
-        
-        fExcludedPixelsFile = gSystem->ExpandPathName(fExcludedPixelsFile.Data());
-        
-        //
-        // Initialize reading the file
-        //
-        ifstream in(fExcludedPixelsFile.Data(),ios::in);
-
-        if (in)
-          {
-            *fLog << inf << "Use excluded pixels from file: '" << fExcludedPixelsFile.Data() << "'" << endl;
-            //
-            // Read the file and count the number of entries
-            //
-            UInt_t pixel = 0;
-            
-            while (++fNumExcludedPixels)
-              {
-                
-                in >> pixel;
-
-                if (!in.good())
-                  break;
-                //
-                // Check for out of range
-                //
-                if (pixel > npixels)
-                  {
-                    *fLog << warn << "WARNING: To be excluded pixel: " << pixel 
-                          << " is out of range " << endl;
-                    continue;
-                  }
-                //
-                // Exclude pixel
-                //
-                MCalibrationPix &pix = (*fCalibrations)[pixel];
-                pix.SetExcluded();
-                
-                *fLog << GetDescriptor() << inf << ": Exclude Pixel: " << pixel << endl;
-                
-              }
-            
-            if (--fNumExcludedPixels == 0)
-              *fLog << warn << "WARNING: File '" << fExcludedPixelsFile.Data() 
-                    << "'" << " is empty " << endl;
-            else
-              fCalibrations->SetNumPixelsExcluded(fNumExcludedPixels);
-            
-          }
-        else
-          *fLog << warn << dbginf << "Cannot open file '" << fExcludedPixelsFile.Data() << "'" << endl;
-      }
-    
-    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()
-{
-
-  
-  MRawEvtPixelIter pixel(fRawEvt);
-  
-  //
-  // Create a loop to fill the calibration histograms
-  // Search for: a signal in MExtractedSignalCam 
-  // Search for: a signal in MExtractedSignalBlindPixel
-  // Fill histograms with:
-  //             charge
-  //             charge vs. event nr.
-  //
-  //
-  // Initialize pointers to blind pixel and individual pixels
-  //
-  // FIXME: filling the bind pixel histograms in this class is preliminary 
-  //        and will be replaced soon to fill them with MFillH
-  //
-  MCalibrationBlindPix       &blindpixel = *(fCalibrations->GetBlindPixel());
-  MExtractedSignalBlindPixel &blindsig   = (*fBlindPixel);
-
-  const UInt_t signal = blindsig.GetExtractedSignal();
-  
-  if (!blindpixel.FillCharge(signal)) 
-    *fLog << warn << 
-      "Overflow or Underflow occurred filling Blind Pixel sum = " << signal << endl;
-
-  blindpixel.FillGraphs(signal,0);
-  
-  TH1I *hist;
-  
-  if (signal > fBlindPixelSinglePheCut)
-    {
-      hist = (blindpixel.GetHist())->GetHSinglePheFADCSlices();
-      fNumBlindPixelSinglePhe++;
-    }
-  else
-    {
-      hist = (blindpixel.GetHist())->GetHPedestalFADCSlices();
-      fNumBlindPixelPedestal++;
-    }
-
-  pixel.Jump(fBlindPixelIdx);
-  
-  const Byte_t *ptr = pixel.GetHiGainSamples();
-
-  for (Int_t i=1;i<16;i++)
-    hist->Fill(i,*ptr++);
-  
-  ptr = pixel.GetLoGainSamples();
-  for (Int_t i=16;i<31;i++)
-    hist->Fill(i,*ptr++);
-
-  pixel.Reset();
-  
-  while (pixel.Next())
-    {
-      
-      const UInt_t pixid = pixel.GetPixelId();
-      
-      MCalibrationPix            &pix   =  (*fCalibrations)[pixid];
-      MExtractedSignalPix        &sig   =  (*fSignals)     [pixid];
-      
-      const Float_t sumhi  = sig.GetExtractedSignalHiGain();
-      const Float_t sumlo  = sig.GetExtractedSignalLoGain();
-
-      Float_t abstime = 0.;
-
-      if (sig.IsLoGainUsed())
-        abstime = (Float_t)pixel.GetIdxMaxLoGainSample();
-      else
-        abstime = (Float_t)pixel.GetIdxMaxHiGainSample();
-
-      if (pix.IsExcluded())
-        continue;
-      
-      pix.FillGraphs(sumhi,sumlo);
-
-      if (sig.IsLoGainUsed())
-        {
-          
-          if (!pix.FillChargeLoGain(sumlo))
-            *fLog << warn << "Could not fill Lo Gain Charge of pixel: " << pixid 
-                  << " signal = " << sumlo << endl;
-          
-          if (!pix.FillAbsTimeLoGain(abstime)) 
-            *fLog << warn << "Could not fill Lo Gain Abs. Time of pixel: " 
-                  << pixid << " time = " << abstime << endl;
-        }
-      else
-        {
-          if (!pix.FillChargeHiGain(sumhi))
-            *fLog << warn << "Could not fill Hi Gain Charge of pixel: " << pixid 
-                  << " signal = " << sumhi << endl;
-          
-          if (!pix.FillAbsTimeHiGain(abstime))
-            *fLog << warn << "Could not fill Hi Gain Abs. Time of pixel: " 
-                  << pixid << " time = " << abstime << endl;
-        }
-      
-    } /* while (pixel.Next()) */
-
-  return kTRUE;
-}
-
-Int_t MCalibrationCalc::PostProcess()
-{
-  *fLog << inf << GetDescriptor() << ": Cut Histogram Edges" << endl;
-
-  //
-  // Cut edges to make fits and viewing of the hists easier  
-  //
-  fCalibrations->CutEdges();
-
-  // 
-  // Fit the blind pixel
-  //
-  if (TESTBIT(fFlags,kUseBlindPixelFit))
-  {
-      //
-      // Get pointer to blind pixel
-      //
-      MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
-      
-      *fLog << inf << GetDescriptor() << ": Fitting the Blind Pixel" << endl;
-
-      //
-      // retrieve the histogram containers
-      //
-      MHCalibrationBlindPixel *hist = blindpixel.GetHist();
-          
-      //
-      // retrieve mean and sigma of the blind pixel pedestal, 
-      // so that we can use it for the fit
-      //
-      const UInt_t nentries    = fPedestals->GetTotalEntries();
-      const UInt_t nslices     = 12;
-      const Float_t sqrslice   = TMath::Sqrt((Float_t)nslices);
-
-      MPedestalPix &pedpix  = (*fPedestals)[fBlindPixelIdx];
-      if (&pedpix)
-        {
-          const Float_t pedestal    = pedpix.GetPedestal()*nslices;
-          const Float_t pederr      = pedpix.GetPedestalRms()*nslices/nentries;
-          const Float_t pedsigma    = pedpix.GetPedestalRms()*sqrslice;
-          const Float_t pedsigmaerr = pederr/2.;
-          
-          hist->SetMeanPedestal(pedestal);
-          hist->SetMeanPedestalErr(pederr);
-          hist->SetSigmaPedestal(pedsigma);
-          hist->SetSigmaPedestalErr(pedsigmaerr);
-        }
-      
-      if (!blindpixel.FitCharge())
-        {
-          *fLog << warn << "Could not fit the blind pixel! " << endl;
-          *fLog << warn << "Setting bit kBlindPixelMethodValid to FALSE in MCalibrationCam" << endl;
-          fCalibrations->SetBlindPixelMethodValid(kFALSE);
-        }
-      else
-        fCalibrations->SetBlindPixelMethodValid(kTRUE);
-      
-      if (blindpixel.CheckOscillations())
-        fCalibrations->SetBlindPixelMethodValid(kFALSE);
-
-      TH1I *sphehist = hist->GetHSinglePheFADCSlices();
-      TH1I *pedhist  = hist->GetHPedestalFADCSlices();
-
-      if (fNumBlindPixelSinglePhe > 1)
-        sphehist->Scale(1./fNumBlindPixelSinglePhe);
-      if (fNumBlindPixelPedestal > 1)
-        pedhist->Scale(1./fNumBlindPixelPedestal);
-      
-      blindpixel.DrawClone();
-  }
-  else 
-      *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Fit " << endl;
-
-  *fLog << inf << "total: " << GetNumExecutions() << " sphe: " << fNumBlindPixelSinglePhe << " ped: " << fNumBlindPixelPedestal << endl;
-
-  
-  *fLog << inf << 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];
-
-      //
-      // Check if the pixel has been excluded from the fits
-      //
-      if (pix.IsExcluded())
-        continue;
-
-      //
-      // get the pedestals
-      //
-      const Float_t ped    = (*fPedestals)[pixid].GetPedestal();
-      const Float_t prms   = (*fPedestals)[pixid].GetPedestalRms();
-
-      //
-      // set them in the calibration camera
-      //
-      pix.SetPedestal(ped,prms,(Float_t)fNumHiGainSamples,(Float_t)fNumLoGainSamples);
-
-      //
-      // perform the Gauss fits to the charges
-      //
-      pix.FitCharge();
-
-      //
-      // check also for oscillations
-      // 
-      pix.CheckOscillations();
-      
-    //
-      // calculate the F-Factor method
-      //
-      pix.CalcFFactorMethod();
-
-    }
-
-  if (TESTBIT(fFlags,kUseBlindPixelFit) && fCalibrations->IsBlindPixelMethodValid())
-  {
-      if (!fCalibrations->CalcFluxInsidePlexiglass())
-      {
-          *fLog << warn << "Could not calculate the number of photons from the blind pixel " << endl;
-          *fLog << "You can try to calibrate using the MCalibrationCalc::SkipBlindPixelFit()" << endl;
-        fCalibrations->SetBlindPixelMethodValid(kFALSE);          
-      }
-  }
-  else
-    *fLog << inf << GetDescriptor() << ": Skipping Blind Pixel Calibration! " << endl;
-
-
-  if (fCalibrations->IsPINDiodeMethodValid())
-  {
-      if (!fCalibrations->CalcFluxOutsidePlexiglass())
-      {
-          *fLog << warn << "Could not calculate the number of photons from the PIN Diode " << endl;
-          fCalibrations->SetPINDiodeMethodValid(kFALSE);
-      }
-  }
-  else
-      *fLog << inf << GetDescriptor() << ": Skipping PIN Diode Calibration! " << endl;
-
-  fCalibrations->SetReadyToSave();
-  
-  return kTRUE;
-}
-
-
Index: trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h
===================================================================
--- trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h	(revision 3253)
+++ 	(revision )
@@ -1,126 +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
-
-#ifndef ROOT_TArrayI
-#include "TArrayI.h"
-#endif
-
-#ifndef MARS_MCalibrationCam
-#include "MCalibrationCam.h"
-#endif
-
-#include "TString.h"
-
-class MRawEvtData;
-class MRawRunHeader;
-
-class MPedestalCam;
-class MCalibrationCam;
-class MExtractedSignalCam;
-class MExtractedSignalBlindPixel;
-
-class MTime;
-
-class MCalibrationCalc : public MTask
-{
-private:
-
-  static const UInt_t fgBlindPixelIdx;          // ID of the blind pixel
-  static const UInt_t fgPINDiodeIdx;            // ID of the PIN Diode
-  static const UInt_t fgBlindPixelSinglePheCut; // FADC sum from which on an event is considered as a S.ph. one.
-  
-  MPedestalCam               *fPedestals;         // Pedestals of all pixels in the camera
-  MCalibrationCam            *fCalibrations;      // Calibration events of all pixels in the camera
-  MExtractedSignalCam        *fSignals;           // Extracted signal of all pixels in the camera
-  MExtractedSignalBlindPixel *fBlindPixel;        // Extracted signal of the blind pixel  
-
-  MRawEvtData              *fRawEvt;            // raw event data (time slices)
-  MRawRunHeader            *fRunHeader;         // RunHeader information
-
-  MTime                    *fEvtTime;           // Time of the event
-
-  UInt_t fBlindPixelIdx;  
-  UInt_t fPINDiodeIdx;      
-  
-  Byte_t  fNumHiGainSamples; 
-  Byte_t  fNumLoGainSamples; 
-  Float_t fSqrtHiGainSamples; 
-  
-  UInt_t  fBlindPixelSinglePheCut;
-
-  Int_t   fNumBlindPixelSinglePhe;
-  Int_t   fNumBlindPixelPedestal;  
-  
-  Float_t fConversionHiLo;
-  Int_t   fFlags;                                // Flag for the fits used
-
-  TString fExcludedPixelsFile;
-  UInt_t  fNumExcludedPixels;
-
-  enum  { kUseBlindPixelFit, 
-          kUseQualityChecks,
-          kHiLoGainCalibration,
-          kHiGainOverFlow, 
-          kLoGainOverFlow  };
-  
-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 Clear(const Option_t *o="");
-  
-  void SkipBlindPixelFit(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseBlindPixelFit)    : SETBIT(fFlags, kUseBlindPixelFit);}
-  void SkipQualityChecks(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kUseQualityChecks)    : SETBIT(fFlags, kUseQualityChecks);}
-  void SkipHiLoGainCalibration(Bool_t b=kTRUE)
-      {b ? CLRBIT(fFlags, kHiLoGainCalibration) : SETBIT(fFlags, kHiLoGainCalibration);}
-
-
-  // Setters 
-  void SetPulserColor(PulserColor_t color)     { fColor          = color; }
-  void SetConversionHiLo(Float_t conv)         { fConversionHiLo = conv; }
-
-  void SetBlindPixelSinglePheCut(const Int_t cut=fgBlindPixelSinglePheCut)    
-                                               { fBlindPixelSinglePheCut = cut;  }
-
-  void SetPINDiodeIdx(const UInt_t idx=fgPINDiodeIdx)     {   fPINDiodeIdx   = idx; }
-  void SetBlindPixelIdx(const UInt_t idx=fgBlindPixelIdx)  {   fBlindPixelIdx = idx; }
-
-  // Getters
-  MCalibrationBlindPix *GetBlindPixel() const;
-
-  // Exclude pixels from configuration file
-  void ExcludePixelsFromAsciiFile(const char *file) { fExcludedPixelsFile = file;  }
-  
-  ClassDef(MCalibrationCalc, 1)   // Task to fill the Calibration Containers from raw data
-};
-
-#endif
Index: trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc	(revision 3253)
+++ trunk/MagicSoft/Mars/mjobs/MJExtractSignal.cc	(revision 3254)
@@ -46,5 +46,5 @@
 
 #include "MPedestalCam.h"
-#include "MCalibrationCam.h"
+#include "MCalibrationChargeCam.h"
 #include "MHCamEvent.h"
 
@@ -401,5 +401,5 @@
 }
 
-Bool_t MJExtractSignal::ProcessP(MPedestalCam &pedcam, MCalibrationCam &calcam)
+Bool_t MJExtractSignal::ProcessP(MPedestalCam &pedcam, MCalibrationChargeCam &calcam)
 {
     if (!ReadPedPhotCam())
@@ -409,5 +409,5 @@
 }
 
-Bool_t MJExtractSignal::ProcessFileP(MPedestalCam &pedcam, MCalibrationCam &calcam)
+Bool_t MJExtractSignal::ProcessFileP(MPedestalCam &pedcam, MCalibrationChargeCam &calcam)
 {
     if (!fRuns)
@@ -491,5 +491,5 @@
 
 /*
-Bool_t MJExtractSignal::ProcessFile(MPedestalCam *pedcam, MCalibrationCam *calcam)
+Bool_t MJExtractSignal::ProcessFile(MPedestalCam *pedcam, MCalibrationChargeCam *calcam)
 {
     if (!fRuns)
