Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MCalibrateDC.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MCalibrateDC.cc	(revision 4072)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MCalibrateDC.cc	(revision 4073)
@@ -42,4 +42,9 @@
 
 #include "MParList.h"
+#include "MTaskList.h"
+#include "MEvtLoop.h"
+
+#include "MReadReports.h"
+#include "MGeomApply.h"
 
 ClassImp(MCalibrateDC);
@@ -82,4 +87,8 @@
     }
 
+    // Initialization of objects that need the information from MGeomCam
+    fDisplay.SetGeometry(*fGeomCam);
+    fNumPixels = fGeomCam->GetNumPixels();
+
     fCurr = (MCameraDC*)pList->FindObject(AddSerialNumber("MCameraDC"));
 
@@ -99,5 +108,4 @@
 
     // Run over the continuos light run to get the DC intercalibration factors
-    fNumPixels = fGeomCam->GetNumPixels();
     fDCCalibrationFactor.Set(fNumPixels);
     fDCCalibrationFactor.Reset(1.);
@@ -105,5 +113,5 @@
     if ( fFileName != "" )
       {
-        // FIXME::Here it should be done the loop over the continuos light run
+        ProcessFile();
         DCCalibrationCalc();
  
@@ -136,4 +144,60 @@
 	  
   return kTRUE;
+}
+
+Bool_t MCalibrateDC::ProcessFile()
+{
+
+    MParList plist;
+    MTaskList tlist;
+    plist.AddToList(&tlist);
+
+    MCameraDC     dccam;
+    plist.AddToList(&dccam);
+
+    // Reads the trees of the root file and the analysed branches
+    MReadReports read;
+    read.AddTree("Currents"); 
+    read.AddFile(fFileName);     // after the reading of the trees!!!
+    read.AddToBranchList("MReportCurrents.*");
+    
+    MGeomApply geomapl;
+
+    tlist.AddToList(&geomapl);
+    tlist.AddToList(&read);
+
+    // Enable logging to file
+    //*fLog.SetOutputFile(lname, kTRUE);
+
+    //
+    // Execute the eventloop
+    //
+    MEvtLoop evtloop(fName);
+    evtloop.SetParList(&plist);
+    evtloop.SetLogStream(fLog);
+
+    // Execute first analysis
+      if (!evtloop.PreProcess())
+        {
+          *fLog << err << GetDescriptor() << ": Failed." << endl;
+	  return kFALSE;
+        }
+        
+      while (tlist.Process())
+        fDisplay.AddCamContent(dccam);
+        
+      evtloop.PostProcess();
+
+    tlist.PrintStatistics();
+
+    UInt_t numexecutions = read.GetNumExecutions();
+    UInt_t numPixels = fDisplay.GetNumPixels();
+    for (UInt_t pix = 1; pix < numPixels; pix++)
+      fDisplay[pix] /= numexecutions;
+    
+
+    *fLog << inf << GetDescriptor() << ": Done." << endl;
+
+    return kTRUE;
 }
 
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MCalibrateDC.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MCalibrateDC.h	(revision 4072)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MCalibrateDC.h	(revision 4073)
@@ -2,6 +2,6 @@
 #define MARS_MCalibrateDC
 
-#ifndef ROOT_TArrayF
-#include <TArrayF.h>
+#ifndef ROOT_TArrayD
+#include <TArrayD.h>
 #endif
 
@@ -44,10 +44,11 @@
 
     UInt_t fNumPixels ;
-    TArrayF fDCCalibrationFactor;
-    Float_t fDCMissCalibrationFactor;
+    TArrayD fDCCalibrationFactor;
+    Double_t fDCMissCalibrationFactor;
     
-    Float_t fDCCalibration; //[uA]
-    Float_t fDCCalibrationRMS; //[uA]
+    Double_t fDCCalibration; //[uA]
+    Double_t fDCCalibrationRMS; //[uA]
     
+    Bool_t ProcessFile();
     Bool_t DCCalibrationCalc();
     
@@ -63,5 +64,9 @@
     void SetFileName(TString filename="") {fFileName=filename;}
     
-  ClassDef(MCalibrateDC, 0) // Taks to intercalibrate the DC of all pmts from a continuos light run
+    //Getters
+    MHCamera& GetDisplay() { return fDisplay; }
+    TArrayD&  GetDCCalibrationFactor() { return fDCCalibrationFactor; }
+
+    ClassDef(MCalibrateDC, 0) // Taks to intercalibrate the DC of all pmts from a continuos light run
 };
 
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C	(revision 4072)
+++ trunk/MagicSoft/Mars/mtemp/mifae/macros/findstars.C	(revision 4073)
@@ -47,5 +47,5 @@
 
 
-void findstars(const TString filename="dc_2004_03_18_20_37_19_20663_CrabNebula.root", const TString directory="/nfs/magic/CaCodata/rootdata/CrabNebula/Period015/2004_03_19/", const UInt_t numEvents = 11)
+void findstars(const TString filename="dc_2004_03_19_00_36_50_20781_Mrk421.root", const TString directory="/nfs/magic/CaCodata/rootdata/Mrk421/Period015/2004_03_19/", const UInt_t numEvents = 0)
 {
 
@@ -80,12 +80,23 @@
 
   MGeomApply geomapl;
-
-//   const Int_t numrings = 3;
-  const Int_t numblind = 5;
-  const Short_t x[numblind] = {  8,  27, 224, 279, 339};
+  TString continuoslightfile = 
+    "/nfs/magic/CaCodata/rootdata/Miscellaneous/Period016/2004_04_16/dc_2004_04_16_04_46_18_22368_Off3c279-2CL100.root";
+  MCalibrateDC dccal;
+  dccal.SetFileName(continuoslightfile);
+  
+  const Int_t numblind = 12;
+  const Short_t x[numblind] = {  8,  27,
+                               507, 508, 509, 510, 511,
+                               543, 559, 560, 561, 567};
   const TArrayS blindpixels(numblind,(Short_t*)x);
   MFindStars findstars;
-//   findstars.SetNumRings(numrings);
-//   findstars.SetBlindPixels(blindpixels);
+  findstars.SetBlindPixels(blindpixels);
+  Float_t ringinterest = 100; //[mm]
+  Float_t tailcut = 3.5;
+  UInt_t integratedevents = 10;
+  findstars.SetRingInterest(ringinterest);
+  findstars.SetDCTailCut(tailcut);
+  findstars.SetNumIntegratedEvents(integratedevents);
+  findstars.SetMinuitPrintOutLevel(0);
 
   // prints
@@ -95,4 +106,5 @@
   tlist.AddToList(&geomapl);
   tlist.AddToList(&read);
+  tlist.AddToList(&dccal);
   //  tlist.AddToList(&pdc, "Currents");
   tlist.AddToList(&findstars, "Currents");
@@ -119,20 +131,40 @@
 	  return;
       
+       MHCamera display0(geomcam);
+       display0.SetPrettyPalette();
+       display0.Draw();
+//        display0.SetCamContent(dccal.GetDisplay());
+       display0.SetCamContent(dccal.GetDCCalibrationFactor());
+       gPad->Modified();
+       gPad->Update();
+
+       // Remove the comments if you want to go through the file
+       // event-by-event:
+       if (!HandleInput())
+         break;
+
        MHCamera display(geomcam);
        display.SetPrettyPalette();
        display.Draw();
        gPad->cd(1);
-//       starscam.Draw();
+       starcam.Draw();
       
-      while (tlist.Process())
-      {
-	  display.SetCamContent(dccam);
-	  gPad->Modified();
-	  gPad->Update();
-          starcam.Print();
-	  // Remove the comments if you want to go through the file
-	  // event-by-event:
-	  if (!HandleInput())
-	      break;
+       UInt_t numevents=0;
+       
+       while (tlist.Process())
+         {
+           numevents++;
+           if (numevents%integratedevents==0)
+             {
+               //               display.SetCamContent(dccam);
+               display.SetCamContent(findstars.GetDisplay());
+               gPad->Modified();
+               gPad->Update();
+               starcam.Print("maxpossizechi");
+               // Remove the comments if you want to go through the file
+               // event-by-event:
+               if (!HandleInput())
+                 break;
+             }
       } 
 
Index: trunk/MagicSoft/Mars/mtemp/mifae/macros/psffit.C
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/macros/psffit.C	(revision 4072)
+++ trunk/MagicSoft/Mars/mtemp/mifae/macros/psffit.C	(revision 4073)
@@ -47,5 +47,5 @@
 
 
-void psffit(const TString filename="dc_2004_02_15_01_51_22_17286_Mrk421.root", const TString directory="/nfs/magic/CaCodata/2004_02_15/", const UInt_t numEvents = 100000)
+void psffit(const TString filename="dc_2004_03_19_00_36_50_20781_Mrk421.root", const TString directory="/nfs/magic/CaCodata/rootdata/Mrk421/Period015/2004_03_19/", const UInt_t numEvents = 0)
 {
 
@@ -130,4 +130,5 @@
 	  gPad->Modified();
 	  gPad->Update();
+          psffit.Print();
 	  // Remove the comments if you want to go through the file
 	  // event-by-event:
