Index: branches/Mars_use_drstimefiles/fact/analysis/callisto_drstime.C
===================================================================
--- branches/Mars_use_drstimefiles/fact/analysis/callisto_drstime.C	(revision 17994)
+++ branches/Mars_use_drstimefiles/fact/analysis/callisto_drstime.C	(revision 17996)
@@ -1,54 +1,4 @@
-#include <sstream>
-#include <iostream>
-
 #include "MLog.h"
 #include "MLogManip.h"
-
-#include "TH1F.h"
-#include "TFile.h"
-#include "TStyle.h"
-#include "TGraph.h"
-#include "TLine.h"
-
-#include "DrsCalib.h"
-#include "factfits.h"
-#include "MDrsCalibration.h"
-#include "MExtralgoSpline.h"
-#include "MSequence.h"
-#include "MStatusArray.h"
-#include "MHCamera.h"
-#include "MJob.h"
-#include "MWriteRootFile.h"
-#include "MHCamera.h"
-#include "MBadPixelsCam.h"
-#include "MBadPixelsPix.h"
-#include "MDirIter.h"
-#include "MTaskList.h"
-#include "MFDataPhrase.h"
-#include "MArrayF.h"
-#include "MBadPixelsTreat.h"
-#include "MCalibrateDrsTimes.h"
-#include "MHSectorVsTime.h"
-#include "MHCamEvent.h"
-#include "MExtractFACT.h"
-#include "MFillH.h"
-#include "MDrsCalibApply.h"
-#include "MGeomApply.h"
-#include "MContinue.h"
-#include "MRawFitsRead.h"
-#include "MReadMarsFile.h"
-#include "MEvtLoop.h"
-#include "MParList.h"
-#include "MStatusDisplay.h"
-#include "MDrsCalibrationTime.h"
-#include "MH3.h"
-#include "MGeomCamFACT.h"
-#include "MCalibrateFact.h"
-#include "MParameters.h"
-#include "MWriteAsciiFile.h"
-#include "MFilterData.h"
-#include "MTreatSaturation.h"
-
-using namespace std;
 
 int callisto(
@@ -249,6 +199,4 @@
     // hrate.DefaultLabelY("ERROR");
 
-    MDrsCalibrationTime timecam;
-
     gStyle->SetOptFit(kTRUE);
 
@@ -257,19 +205,5 @@
     gLog << endl;
     gLog.Separator("Reading DRS timing calibration constants");
-    factfits drs_time_file(timfile.Data());
-
-    const int NumberOfChips = drs_time_file.GetInt("NCHIPS");
-    const int NumberOfCells = drs_time_file.GetInt("NCELLS");
-    timecam.fStat.resize(NumberOfChips * NumberOfCells);
-    double *drs_sampling_time_deviations = new double[NumberOfChips * NumberOfCells];
-
-    drs_time_file.SetPtrAddress("SamplingTimeDeviation", drs_sampling_time_deviations);
-    drs_time_file.GetNextRow();
-    for (int i=0; i<NumberOfChips * NumberOfCells; i++){
-        timecam.fStat[i].first = drs_sampling_time_deviations[i];
-    }
-    delete[] drs_sampling_time_deviations;
-    drs_sampling_time_deviations = NULL;
-    drs_time_file.close();
+    MDrsCalibrationTime timecam(timfile.Data());
 
     // ======================================================
Index: branches/Mars_use_drstimefiles/fact/analysis/produce_drs_time_fits_file.C
===================================================================
--- branches/Mars_use_drstimefiles/fact/analysis/produce_drs_time_fits_file.C	(revision 17994)
+++ branches/Mars_use_drstimefiles/fact/analysis/produce_drs_time_fits_file.C	(revision 17996)
@@ -52,9 +52,4 @@
     loop0.SetParList(&plist0);
 
-    factfits drstimeRawFile(drs_time_file);
-    const int NumberOfChips = drstimeRawFile.GetInt("NPIX")/9;  // --> 160 
-    const int NumberOfCells = drstimeRawFile.GetInt("NROI");    // --> 1024
-    drstimeRawFile.close();
-
     MRawFitsRead read0(drs_time_file);
     tlist0.AddToList(&read0);
@@ -75,90 +70,5 @@
     }
 
-    ofits drstimeFile(outfile);
-    drstimeFile.SetDefaultKeys();
-    drstimeFile.AddColumnDouble(  
-        NumberOfChips*NumberOfCells,
-        "SamplingTimeDeviation", "nominal slices",
-        "see following COMMENT."
-    );
-    drstimeFile.SetInt("NCHIPS", NumberOfChips, "number of drs chips");
-    drstimeFile.SetInt("NCELLS", NumberOfCells, "number of cells of each chip");
-    drstimeFile.AddComment(
-"The SamplingTimeDeviation specifies the deviation of the actual ");
-    drstimeFile.AddComment(
-"sampling time of a certain cell, from its nominal sampling time.");
-    drstimeFile.AddComment(
-"It is measured in nominal slices.");
-    drstimeFile.AddComment(
-"In order to convert the sample index into the actual sampling time");
-    drstimeFile.AddComment(
-"just do: ");
-    drstimeFile.AddComment(
-"     cell_index + td(cell_index) - td(stop_cell_index)");
-    drstimeFile.AddComment(
-"where td(i) refers to the SamplingTimeDeviation of cell i of the ");
-    drstimeFile.AddComment(
-"current DRS4 chip.");
-    drstimeFile.AddComment(
-"This gives you the actual sampling time of the cell measured in ");
-    drstimeFile.AddComment(
-"nominal slices [nsl] with respect to the stop cells sampling time.");
-    drstimeFile.AddComment(
-"Convert it to ns, simply by multiplication ");
-    drstimeFile.AddComment(
-"with 0.5 ns/nsl.");
-    drstimeFile.AddComment(
-"");
-
-    drstimeFile.AddComment(
-"In FACT it became common practice to measure un-time-calibrated ");
-    drstimeFile.AddComment(
-" DRS4 data in 'time slices' or simply 'samples', while ");
-    drstimeFile.AddComment(
-" time-calibrated DRS4 data usually measured in ns. Since the method,");
-    drstimeFile.AddComment(
-" that is emplyed to measure the DRS4 time calibration constants has ");
-    drstimeFile.AddComment(
-" no possibility to assert the actual length of a slice is really half");
-    drstimeFile.AddComment(
-" a nanosecond, this practice is not advisable.");
-    drstimeFile.AddComment(
-" I propose instead to call un-time-calibrated data 'samples',");
-    drstimeFile.AddComment(
-" since this is what they are. If one wants to stress the fact,");
-    drstimeFile.AddComment(
-" that no drs time calibration has been applied one should refer to ");
-    drstimeFile.AddComment(
-"'uncalibrated slices'. Since it *should* be common practice to apply");
-    drstimeFile.AddComment(
-" the drs4 time calibration in all cases, I also propose to use the");
-    drstimeFile.AddComment(
-" short term of 'slices' or 'sl'. If one wants to stress, that the");
-    drstimeFile.AddComment(
-" drs4 time calibration has actually been applied to the data,");
-    drstimeFile.AddComment(
-" the term 'calibrated slices' or 'nominal slices' or short 'nsl'.");
-
-    drstimeFile.WriteTableHeader("DRS_CELL_TIMES");
-
-    // By drs_sampling_time_deviations we refer to the deviations (measured in nominal slices) of
-    // the actual sampling time compared to the nominal sampling time of every cell of every chip.
-    double *drs_sampling_time_deviations = new double[ NumberOfChips * NumberOfCells ];
-    for (int chip = 0; chip < NumberOfChips; chip++){
-        for (int cell = 0; cell < NumberOfCells; cell++){
-            // Dominik and Sebastian:
-            // We ended with using DrsCalibrateTime.Sum() in order to retrieve 
-            // the contents DrsCalibrateTime.fStat.
-            // First we wanted to access the member fStat of class DrsCalibrateTime
-            // which is declared public but it did not work out of the box.
-            // drs_sampling_time_deviations[chip*NumberOfCells+cell] = 
-            // timecam.fStat[chip*NumberOfCells+cell].first;
-            drs_sampling_time_deviations[ chip * NumberOfCells + cell ] = 
-                timecam.Sum( chip * NumberOfCells + cell );
-        }
-    }
-
-    drstimeFile.WriteRow(drs_sampling_time_deviations, sizeof(double) * NumberOfChips * NumberOfCells);
-    drstimeFile.close();
+    timecam.WriteToFits(outfile);
 
     return 0;
