Index: /branches/MarsFixTimeOffsetBranch/ceres.rc
===================================================================
--- /branches/MarsFixTimeOffsetBranch/ceres.rc	(revision 18005)
+++ /branches/MarsFixTimeOffsetBranch/ceres.rc	(revision 18006)
@@ -233,2 +233,7 @@
 # Does not trigger anyway
 ContEmpty3.Condition: MPhotonEvent.GetNumPhotons<10
+
+MFixTimeOffset.FileName: resmc/fact/pixel_delays_ALL_ZERO.csv
+# MFixTimeOffset.FileName: resmc/fact/AllPhidoFiles_delays.csv
+
+# last line comment
Index: /branches/MarsFixTimeOffsetBranch/msimcamera/MSimCamera.cc
===================================================================
--- /branches/MarsFixTimeOffsetBranch/msimcamera/MSimCamera.cc	(revision 18005)
+++ /branches/MarsFixTimeOffsetBranch/msimcamera/MSimCamera.cc	(revision 18006)
@@ -122,4 +122,54 @@
         return kFALSE;
     }
+    // -------------------------------------------------------------------
+    // Dominik Neise and Sebastian Mueller on fix time offsets:
+    // We obtain the fix temporal offsets for the FACT camera pixels out of 
+    // a text file. The textfile must be mentioned in the ceres.rc file.
+    // There are no default offsets on purporse. The filename must be specified
+    // in ceres.rc and the file must be parsed without errors and it must 
+    // provide exactly 1440 floating point numbers.   
+    fFixTimeOffsetsBetweenPixelsInNs = 
+    (MMatrix*)pList->FindObject("MFixTimeOffset");
+    if (!fFixTimeOffsetsBetweenPixelsInNs)
+    {
+        // the key value pair providing the text file is not present in the
+        // environment env.
+        *fLog << err << "In Source: "<< __FILE__ <<" in line: "<< __LINE__;
+        *fLog << " in function: "<< __func__ <<"\n";
+        *fLog << "MFixTimeOffset not found... aborting." << endl;
+        return kFALSE;
+
+    }
+    else if ( fFixTimeOffsetsBetweenPixelsInNs->fM.size() != 1440 )
+    {
+        // The number of time offsets must match the number of pixels in the
+        // FACT camera.
+        *fLog << err << "In Source: "<< __FILE__ <<" in line: "<< __LINE__;
+        *fLog << " in function: "<< __func__ <<"\n";
+        *fLog << "MFixTimeOffset has the wrong dimension! ";
+        *fLog << "There should be "<< 1440 <<" time offsets ";
+        *fLog << "(one for each pixel in FACT) but there are: ";
+        *fLog << fFixTimeOffsetsBetweenPixelsInNs->fM.size() << "! ";
+        *fLog << "... aborting." << endl;
+        return kFALSE;
+    }
+    // Check all entries for inf and nan. Those are not accepted here.
+    for( std::vector< double > row : fFixTimeOffsetsBetweenPixelsInNs->fM ){
+        for( double number : row){
+
+            if( std::isnan(number) || std::isinf(number) ){
+
+                *fLog << err << "In Source: "<< __FILE__ <<" in line: ";
+                *fLog << __LINE__;
+                *fLog << " in function: "<< __func__ <<"\n";
+                *fLog << "There is a non normal number in the fix temporal ";
+                *fLog << "pixel offsets. This is at least one number is ";
+                *fLog << "NaN or Inf. This here is >"<< number;
+                *fLog << "<... aborting." << endl;               
+                return kFALSE;
+            }
+        }
+    }
+    // -------------------------------------------------------------------
 /*
     fPulsePos = (MParameterD*)pList->FindObject("IntendedPulsePos", "MParameterD");
@@ -353,4 +403,6 @@
     }
 
+    //--------------------------------------------------------------------------
+
     // Simulate pulses
     for (Int_t i=0; i<num; i++)
@@ -359,5 +411,12 @@
 
         const UInt_t   idx = ph.GetTag();
-        const Double_t t   = (ph.GetTime()-fStat->GetTimeFirst())*freq+rndm;// - fSpline->GetXmin();
+        Double_t t   = (ph.GetTime()-fStat->GetTimeFirst())*freq+rndm;// - fSpline->GetXmin();
+
+        // Sebastian Mueller and Dominik Neise on fix time offsets:
+        // We add a fix temporal offset to the relative arrival time of the 
+        // individual pixel. The offsets are stored in the
+        // fFixTimeOffsetsBetweenPixelsInNs -> fM matrix. We identify the first
+        // column to hold the offsets in ns.
+        t = t + freq*fFixTimeOffsetsBetweenPixelsInNs->fM[idx][0];
 
         // FIXME: Time jitter?
Index: /branches/MarsFixTimeOffsetBranch/msimcamera/MSimCamera.h
===================================================================
--- /branches/MarsFixTimeOffsetBranch/msimcamera/MSimCamera.h	(revision 18005)
+++ /branches/MarsFixTimeOffsetBranch/msimcamera/MSimCamera.h	(revision 18006)
@@ -7,4 +7,5 @@
 
 #include "MArrayF.h"
+#include "MMatrix.h"
 
 class MMcEvt;
@@ -35,4 +36,7 @@
 
     MParameterD       *fCrosstalkCoeffParam;
+
+    MMatrix *fFixTimeOffsetsBetweenPixelsInNs; //! Container to store the fix temporal offsets for each pixel in ns
+
     MTruePhotonsPerPixelCont    *fTruePhotons;  //! Container to store the number of photons per pixel
 
