Index: trunk/MagicSoft/Mars/mreport/MReportCC.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCC.cc	(revision 7388)
+++ trunk/MagicSoft/Mars/mreport/MReportCC.cc	(revision 7430)
@@ -43,5 +43,9 @@
 #include "MLogManip.h"
 
-#include "MAstro.h"
+#include "MParList.h"
+
+#include "MCameraTH.h"
+#include "MCameraTD.h"
+#include "MCameraRecTemp.h"
 
 ClassImp(MReportCC);
@@ -62,17 +66,51 @@
 // --------------------------------------------------------------------------
 //
+// FindCreate the following objects:
+//  - MCameraTH
+//
+Bool_t MReportCC::SetupReading(MParList &plist)
+{
+    fTH = (MCameraTH*)plist.FindCreateObj("MCameraTH");
+    if (!fTH)
+        return kFALSE;
+
+    fTD = (MCameraTD*)plist.FindCreateObj("MCameraTD");
+    if (!fTD)
+        return kFALSE;
+
+    fRecTemp = (MCameraRecTemp*)plist.FindCreateObj("MCameraRecTemp");
+    if (!fRecTemp)
+        return kFALSE;
+
+    return MReport::SetupReading(plist);
+}
+
+// --------------------------------------------------------------------------
+//
+// Check whether the given TString begins with the given tag. Remove
+// the tag from the string.
+//
+Bool_t MReportCC::CheckTag(TString &str, const char *tag) const
+{
+    if (!str.BeginsWith(tag))
+    {
+        *fLog << warn << "WARNING - '" << tag << "' tag not found." << endl;
+        return kFALSE;
+    }
+    str.Remove(0, strlen(tag)); // Remove Tag
+    return kTRUE;
+}
+
+
+// --------------------------------------------------------------------------
+//
 // Interprete the body of the CC-REPORT string
 //
-Int_t MReportCC::InterpreteBody(TString &str, Int_t ver)
-{
-    if (ver<200404070)
-    {
-        *fLog << err << "ERROR - MReportCC::InterpreteBody not prepared for ";
-        *fLog << " report-files with version<200404070" << endl;
-        return kFALSE;
-    }
-
+Bool_t MReportCC::InterpreteCC(TString &str, Int_t ver)
+{
     const Int_t skip = ver<200407270 ? 30 : 31;
 
+    // Remove the 30/31 tokens of the subsystem status
+    //  table 12.1 p59
     for (int i=0; i<skip; i++)
         str.Remove(0, str.First(' ')+1);
@@ -86,15 +124,131 @@
     {
         *fLog << warn << "WARNING - Wrong number of arguments." << endl;
-        return kCONTINUE;
+        return kFALSE;
     }
 
     str.Remove(0, len);
 
-    for (int i=0; i<4; i++)  // 2*UPS, TH, 577%x, TD, 577%x
-        str.Remove(0, str.First(' ')+1);
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Interprete the TH (discriminator thresholds) part of the report
+//
+Bool_t MReportCC::InterpreteTH(TString &str)
+{
+    if (!CheckTag(str, "TH "))
+        return kFALSE;
+
+    const char *pos = str.Data();
+    const char *end = str.Data()+577*2;
+
+    Int_t i=0;
+    while (pos<end)
+    {
+        const Char_t hex[2] = { pos[0], pos[1] };
+        pos += 2;
+
+        const Int_t n=sscanf(hex, "%2hx", &fTH->fTH[i++]);
+        if (n==1)
+            continue;
+
+        *fLog << warn << "WARNING - Reading hexadecimal TH information." << endl;
+        return kFALSE;
+    }
+
+    str.Remove(0, end-str.Data()); // Remove TH
+    str=str.Strip(TString::kLeading);
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Interprete the TD (discriminator delays) part of the report
+//
+Bool_t MReportCC::InterpreteTD(TString &str, Int_t ver)
+{
+    if (!CheckTag(str, "TD "))
+        return kFALSE;
+
+    const Int_t numpix = ver<200510250 ? 500 : 577;
+
+    const char *pos = str.Data();
+    const char *end = str.Data()+numpix*2;
+
+    Int_t i=0;
+    while (pos<end)
+    {
+        const Char_t hex[3] = { pos[0], pos[1], 0 };
+        pos += 2;
+
+        const Int_t n=sscanf(hex, "%2hx", &fTD->fTD[i++]);
+        if (n==1)
+            continue;
+
+        *fLog << warn << "WARNING - Reading hexadecimal TD information." << endl;
+        return kFALSE;
+    }
+
+    str.Remove(0, end-str.Data()); // Remove TD
+    str=str.Strip(TString::kLeading);
+    return kTRUE;
+}
+
+
+// --------------------------------------------------------------------------
+//
+// Interprete the receiver board temperature part of the report
+//
+Bool_t MReportCC::InterpreteRecTemp(TString &str)
+{
+    if (!CheckTag(str, "RECTEMP "))
+        return kFALSE;
+
+    Int_t len;
+    for (Int_t i=0; i<76; i++)
+    {
+        const Int_t n=sscanf(str.Data(), "%f %n", &fRecTemp->fRecTemp[i], &len);
+        str.Remove(0, len);
+
+        if (n==1)
+            continue;
+
+        *fLog << warn << "WARNING - Reading Receiver Board Temperature information." << endl;
+        return kFALSE;
+    }
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Interprete the body of the CC-REPORT string
+//
+Int_t MReportCC::InterpreteBody(TString &str, Int_t ver)
+{
+    if (ver<200404070)
+    {
+        *fLog << err << "ERROR - MReportCC::InterpreteBody not prepared for ";
+        *fLog << " report-files with version<200404070" << endl;
+        return kFALSE;
+    }
+
+    if (!InterpreteCC(str, ver))
+        return kCONTINUE;
+
+    if (!InterpreteTH(str))
+        return kCONTINUE;
+
+    if (!InterpreteTD(str, ver))
+        return kCONTINUE;
+
+    if (ver>200510250)
+        if (!InterpreteRecTemp(str))
+            return kCONTINUE;
 
     if (str.Strip(TString::kBoth)!=(TString)"OVER")
     {
-        *fLog << err << "ERROR - Termination (OVER) too far away." << endl;
+        *fLog << warn << "WARNING - 'OVER' tag not found." << endl;
         return kCONTINUE;
     }
Index: trunk/MagicSoft/Mars/mreport/MReportCC.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCC.h	(revision 7388)
+++ trunk/MagicSoft/Mars/mreport/MReportCC.h	(revision 7430)
@@ -6,15 +6,33 @@
 #endif
 
+class MCameraTH;
+class MCameraTD;
+class MCameraRecTemp;
+
 class MReportCC : public MReport
 {
 private:
-    Float_t fHumidity;       // [%]
-    Float_t fTemperature;    // [deg] celsius
-    Float_t fWindSpeed;      // [km/h]
-    Float_t fSolarRadiation; // [W/m^2] IR-Radiation
+    Float_t fHumidity;        // [%]
+    Float_t fTemperature;     // [deg] celsius
+    Float_t fWindSpeed;       // [km/h]
+    Float_t fSolarRadiation;  // [W/m^2] IR-Radiation
 
-    Float_t fUPSStatus;      // arbitrary units (still not properly defined)
-    Float_t fDifRubGPS;      // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver
+    Float_t fUPSStatus;       // arbitrary units (still not properly defined)
+    Float_t fDifRubGPS;       // [us] Difference between the Rubidium clock time and the time provided by the GPS receiver
 
+    MCameraTH      *fTH;      //! Discriminator thresholds
+    MCameraTD      *fTD;      //! Discriminator delays
+    MCameraRecTemp *fRecTemp; //! Receiver Board temperatures
+
+    // Internal
+    Bool_t SetupReading(MParList &plist);
+    Bool_t CheckTag(TString &str, const char *tag) const;
+
+    Bool_t InterpreteCC(TString &str, Int_t ver);
+    Bool_t InterpreteTH(TString &str);
+    Bool_t InterpreteTD(TString &str, Int_t ver);
+    Bool_t InterpreteRecTemp(TString &str);
+
+    // MReport
     Int_t InterpreteBody(TString &str, Int_t ver);
 
