Index: /trunk/MagicSoft/Cosy/tpoint/tpoint0511.txt
===================================================================
--- /trunk/MagicSoft/Cosy/tpoint/tpoint0511.txt	(revision 7429)
+++ /trunk/MagicSoft/Cosy/tpoint/tpoint0511.txt	(revision 7430)
@@ -231,16 +231,8 @@
 68.12716 80.59168 210.4925 71.54071 7.576667 31.88833 -0.03744638 -0.07208734 53693.175008 209.8 2.599
 
-
-Star             Mag    Zd    Az
------------------------------------
-
-
-A couple of times we have had the LED's out of control
-One time we have had one missidentified LED, we have increased the
-power but we do not know if that might have affected some of the
-TPoints.
-
-
-
+#A couple of times we have had the LED's out of control
+#One time we have had one missidentified LED, we have increased the
+#power but we do not know if that might have affected some of the
+#TPoints.
 
 # --- 19.11.2005 --- 04:20:24.958
@@ -352,2 +344,71 @@
 # Procyon          0.38   31   224
 -136.0317 59.25554 6.466056 50.37589 7.655 5.225 -0.019558 -0.0500969 53695.259343 218.4 2.559
+
+# --- 22.11.2005 --- 01:11:49.152
+# Aldebaran    0.99    14   148
+147.6424 75.77395 290.0378 66.77682 4.598611 16.50917 0.00772435 -0.03733079 53696.049874 196 2.609
+# Bellatrix    1.64    28   139  
+138.5034 61.59108 280.9654 52.6034 5.418889 6.349722 0.002053421 -0.003312232 53696.054524 211.2 2.743
+# Betelgeuse   0.57    31   128
+# (after pressing TPoint button program hangs, restart procedure)
+128.0873 58.6125 270.5768 49.63084 5.919444 7.406944 0.0069852 -0.01660267 53696.058931 202.4 2.628
+# Alnilam      1.72    34   148
+146.5996 55.32778 289.1033 46.34662 5.603611 -1.201944 0.00304804 -0.02654928 53696.062883 201 3.394
+
+# --- 22.11.2005 --- 01:32:47.983
+147.4849 55.59662 289.9805 46.61629 5.603611 -1.201944 0.002805165 -0.01497349 53696.064444 209.8 2.935
+# Rigel        0.28    38   163
+162.7226 51.63319 305.2246 42.65702 5.242222 -8.201667 0.005640842 -0.0245142 53696.068699 207.5 2.966
+# Alcyone      2.87    14   254
+-106.3161 76.22057 36.04596 67.34977 3.791389 24.105 0.009521167 -0.01326672 53696.078325 194.3 3.465
+# Capella      0.08    18    12
+12.7777 72.215 155.2268 63.20979 5.278056 45.99806 -0.005510584 -0.01390653 53696.084507 216.1 2.929
+# Alnilam      1.72    30   168
+167.7003 59.4683 310.1681 50.48085 5.603611 -1.201944 -0.001850105 -0.001900823 53696.096206 202.9 3.373
+# Alnath       1.68     2    95
+##95.06102 88.36566 235.4655 79.33203 5.438056 28.6075 -0.008179862 0.372401 53696.101428 218.5 3.557
+# Sirius      -1.46    49	  157
+157.0307 41.40663 299.5379 32.41457 6.7525 -16.71611 -0.01364341 -0.01041002 53696.111838 215.7 2.81
+# Mirzam       1.98    48	  166
+166.1499 42.1728 308.6504 33.18098 6.378333 -17.95583 -0.01317884 -0.005149653 53696.115809 216.4 3.712
+# Betelgeuse   0.50    21	  175	     
+174.0767 68.58123 316.519 59.56209 5.919444 7.406944 -0.02401434 -0.02888986 53696.120548 206.7 2.568
+# Rigel        0.12    38	  197
+-163.4645 51.74076 339.0207 42.89641 5.242222 -8.201667 0.01406841 -0.0149119 53696.126832 211.7 2.607
+# Arneb        2.58    47	  190
+-170.2435 42.86948 332.2526 34.02421 5.545556 -17.82222 0.00983937 -0.009990318 53696.131773 215.1 3.243
+# Menkar       2.53    51	  250
+-109.8901 39.04712 32.61235 30.22638 3.038056 4.089722 0.03597402 -0.009545012 53696.137186 215 3.151
+# Zaurak       2.95    54	  223
+-136.7924 36.05695 5.714952 27.22074 3.967222 -13.50861 0.01669919 -0.0167933 53696.141561 221.1 3.51
+# Bellatrix    1.64    27	  215	     
+-144.9439 63.52904 357.5219 54.65627 5.418889 6.349722 -0.005499875 -0.02010735 53696.147154 212 2.666
+# Alnilam      1.70    33	  207
+-153.7852 57.2557 348.6835 48.39122 5.603611 -1.201944 -0.001947268 -0.00500495 53696.151745 215.3 2.714
+# Mebsuta      2.98     4	  166
+164.7775 86.24204 306.5991 77.21874 6.732222 25.13111 -0.002773079 -0.05177016 53696.157353 201.4 3.327
+# Calx         2.88     8	  221
+-139.4591 81.94122 2.701414 73.04546 6.382778 22.51361 -0.005572471 0.02885225 53696.161526 216.1 3.229
+# Adhara       1.50    58	  179
+##178.717 32.15044 321.2284 23.29679 6.976944 -28.97222 0.1252073 -0.01353253 53696.167041 223.5 3.233
+177.5345 34.81027 320.0374 25.84212 7.14 -26.39333 0.0100337 -0.004259739 53696.170971 205.9 4.001
+# Menkalinan   1.90    22   323	     
+-37.02937 68.23066 105.4265 59.35999 5.992222 44.9475 0.0001547855 -0.006749828 53696.180633 214.8 2.945
+
+
+# ********** NEW Pointing model installed **********
+
+# --- 24.11.2005 --- 04:26:17.324
+# Castor		1.58     3    22
+26.27928 86.52456 168.2752 77.48686 7.576667 31.88833 -0.01672364 -0.1968919 53698.184923 195 2.635
+# Pollux		1.22     2   107
+105.7607 87.41624 247.506 78.37515 7.755278 28.02611 -0.01717839 -0.2953504 53698.189567 201.7 2.57
+# Sirius	       -1.46
+# (no valid because of passing clouds)
+# -156.0455 41.09796 346.4594 32.24075 6.7525 -16.71611 -0.003426398 -0.01840931 53698.207343 197.2 3.353
+# Betelgeuse	0.50	38   243  
+-117.5028 51.90143 24.969 43.0686 5.919444 7.406944 0.02049739 -0.002042256 53698.213876 209.1 3.591
+# Rigel		0.12	58   237
+-122.9476 32.59683 19.56346 23.75063 5.242222 -8.201667 0.007916905 -0.01473896 53698.219268 210.5 2.581
+# Capella		0.08	41   -52
+-51.7696 48.90804 90.75324 40.04845 5.278056 45.99806 -0.005096606 -0.02454738 53698.227554 197.9 2.627
Index: /trunk/MagicSoft/Mars/Changelog
===================================================================
--- /trunk/MagicSoft/Mars/Changelog	(revision 7429)
+++ /trunk/MagicSoft/Mars/Changelog	(revision 7430)
@@ -25,4 +25,52 @@
    * datacenter/macros/plotdb.C:
      - added new tabs for new columns
+
+   * mcamera/CameraLinkDef.h, mcamera/Makefile:
+     - added new classes MCameraTH, MCameraTD and MCameraRecTemp
+
+   * mhcalib/MHCalibrationPulseTimeCam.[h,cc]:
+     - added some const-qualifiers
+
+   * mreport/MReportCC.[h,cc]:
+     - updated to allow reading new CC reports 
+
+   * merpp.cc:
+     - added contentent of new CC report to CC output tree
+
+
+
+ 2005/11/25 Daniel Mazin (2005/11/02)
+
+   * mreflector/MRflEvtHeader.h
+     - added parameters first interaction point, telescope phi and theta,
+       fitted quantities from CORSIKA (number of particles in the shower 
+       maximum, t0, tmax, chi2), fraction of electrons, muons and other 
+       particles. Added getters and setters.
+
+   * mfileio/MReadRflFile.cc
+     - filled in the variables above
+
+
+
+ 2005/11/25 A. Moralejo (2005/10/14)
+
+   * mreflector/MRflEvtHeader.h
+     - added parameters: energy, versor of primary's momentum and core 
+       position on ground. Added getters and setters.
+
+   * mfileio/MReadRflFile.cc
+     - filled in the variables above
+
+
+
+ 2005/11/25 Toni Coarasa (09/09/2005)
+
+  * msignal/MExtractTimeAndChargeDigitalFilter.cc
+    - fix a bug in the calculation of the high-gain times:
+      They were all shifted by the same amount "fHiGainFirst". This
+      caused an offset of usually 3 FADC slices in the times calculated
+      from high-gain and from low-gain. The bug did not have any effect
+      on the calibration runs because there, fHiGainFirst was set to 0.
+      The bug was there since 30.1.2005.
 
 
Index: /trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.cc	(revision 7430)
+++ /trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.cc	(revision 7430)
@@ -0,0 +1,87 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Florian Goebel 11/2005 <mailto:fgoebel@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2005
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MCameraRecTemp (PRELIMINARY)
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MCameraRecTemp.h"
+
+#include <TMath.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MCameraRecTemp);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MCameraRecTemp::MCameraRecTemp(Int_t size, const char *name, const char *title)
+    : fRecTemp(size)
+{
+    fName  = name  ? name  : "MCameraRecTemp";
+    fTitle = title ? title : "Storage container for the receiver board temperatures";
+}
+
+// --------------------------------------------------------------------------
+//
+// Print the dc currents
+//
+void MCameraRecTemp::Print(Option_t *) const
+{
+    *fLog << all << underline << GetDescriptor() << endl;
+    for (int i=0; i<fRecTemp.GetSize(); i++)
+        *fLog << " " << GetRecTemp(i);
+    *fLog << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the minimum receiver board temperature
+//
+Float_t MCameraRecTemp::GetMin() const
+{
+    Float_t val = (UInt_t)-1;
+    for (int i=0; i<fRecTemp.GetSize(); i++)
+        val = TMath::Min(val, GetRecTemp(i));
+    return val;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the maximum receiver board temperature
+//
+Float_t MCameraRecTemp::GetMax() const
+{
+    Float_t val = 0;
+    for (int i=0; i<fRecTemp.GetSize(); i++)
+        val = TMath::Max(val, GetRecTemp(i));
+    return val;
+}
Index: /trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.h
===================================================================
--- /trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.h	(revision 7430)
+++ /trunk/MagicSoft/Mars/mcamera/MCameraRecTemp.h	(revision 7430)
@@ -0,0 +1,34 @@
+#ifndef MARS_MCameraRecTemp
+#define MARS_MCameraRecTemp
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+#ifndef ROOT_TArrayF
+#include <TArrayF.h>
+#endif
+
+class MCameraRecTemp : public MParContainer
+{
+    friend class MReportCC;
+private:
+    TArrayF fRecTemp; // [deg C] receiver board temperatures
+
+public:
+    MCameraRecTemp(Int_t size=76, const char *name=NULL, const char *title=NULL);
+
+    void SetRecTemp(Int_t i, Float_t val) { fRecTemp[i] = (Int_t)val; }
+    Float_t GetRecTemp(Int_t i) const { return (*this)[i]; }
+    Float_t &operator[](Int_t i) { return (Float_t&)fRecTemp[i]; }
+    const Float_t &operator[](Int_t i) const { return (*const_cast<MCameraRecTemp*>(this))[i]; }
+
+    Float_t GetMin() const;
+    Float_t GetMax() const;
+
+    void Print(Option_t *opt=NULL) const;
+
+    ClassDef(MCameraRecTemp, 1) // Storage Container for Receiver Board Temperature
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mcamera/MCameraTD.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcamera/MCameraTD.cc	(revision 7430)
+++ /trunk/MagicSoft/Mars/mcamera/MCameraTD.cc	(revision 7430)
@@ -0,0 +1,87 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Florian Goebel 11/2005 <mailto:fgoebel@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2005
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MCameraTD (PRELIMINARY)
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MCameraTD.h"
+
+#include <TMath.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MCameraTD);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MCameraTD::MCameraTD(Int_t size, const char *name, const char *title)
+    : fTD(size)
+{
+    fName  = name  ? name  : "MCameraTD";
+    fTitle = title ? title : "Storage container for the pixel discriminator delays";
+}
+
+// --------------------------------------------------------------------------
+//
+// Print the dc currents
+//
+void MCameraTD::Print(Option_t *) const
+{
+    *fLog << all << underline << GetDescriptor() << endl;
+    for (int i=0; i<fTD.GetSize(); i++)
+        *fLog << " " << GetDelay(i);
+    *fLog << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the minimum discriminator delays
+//
+Float_t MCameraTD::GetMin() const
+{
+    Float_t val = (UInt_t)-1;
+    for (int i=0; i<fTD.GetSize(); i++)
+        val = TMath::Min(val, GetDelay(i));
+    return val;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the maximum discriminator delays
+//
+Float_t MCameraTD::GetMax() const
+{
+    Float_t val = 0;
+    for (int i=0; i<fTD.GetSize(); i++)
+        val = TMath::Max(val, GetDelay(i));
+    return val;
+}
Index: /trunk/MagicSoft/Mars/mcamera/MCameraTD.h
===================================================================
--- /trunk/MagicSoft/Mars/mcamera/MCameraTD.h	(revision 7430)
+++ /trunk/MagicSoft/Mars/mcamera/MCameraTD.h	(revision 7430)
@@ -0,0 +1,46 @@
+#ifndef MARS_MCameraTD
+#define MARS_MCameraTD
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+
+#ifndef ROOT_TArrayS
+#include <TArrayS.h>
+#endif
+
+class MCameraTD : public MParContainer, public MCamEvent
+{
+    friend class MReportCC;
+private:
+    TArrayS fTD; // [au] discriminator delays
+
+public:
+    MCameraTD(Int_t size=577, const char *name=NULL, const char *title=NULL);
+
+    void SetDelay(Int_t i, Float_t val) { fTD[i] = (Int_t)val; }
+    Float_t GetDelay(Int_t i) const { return (*this)[i]; }
+    Float_t &operator[](Int_t i) { return (Float_t&)fTD[i]; }
+    const Float_t &operator[](Int_t i) const { return (*const_cast<MCameraTD*>(this))[i]; }
+
+    Float_t GetMin() const;
+    Float_t GetMax() const;
+
+    void Print(Option_t *opt=NULL) const;
+
+    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const
+    {
+        val = fTD[idx];
+        return val>0;
+    }
+    void DrawPixelContent(Int_t num) const
+    {
+    }
+
+    ClassDef(MCameraTD, 1) // Storage Container for Discriminator Delays
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/mcamera/MCameraTH.cc
===================================================================
--- /trunk/MagicSoft/Mars/mcamera/MCameraTH.cc	(revision 7430)
+++ /trunk/MagicSoft/Mars/mcamera/MCameraTH.cc	(revision 7430)
@@ -0,0 +1,87 @@
+/* ======================================================================== *\
+!
+! *
+! * 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): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
+!   Author(s): Florian Goebel 11/2005 <mailto:fgoebel@mppmu.mpg.de>
+!
+!   Copyright: MAGIC Software Development, 2000-2005
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MCameraTH (PRELIMINARY)
+//
+/////////////////////////////////////////////////////////////////////////////
+#include "MCameraTH.h"
+
+#include <TMath.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MCameraTH);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Default constructor.
+//
+MCameraTH::MCameraTH(Int_t size, const char *name, const char *title)
+    : fTH(size)
+{
+    fName  = name  ? name  : "MCameraTH";
+    fTitle = title ? title : "Storage container for the pixel discriminator threshold";
+}
+
+// --------------------------------------------------------------------------
+//
+// Print the dc currents
+//
+void MCameraTH::Print(Option_t *) const
+{
+    *fLog << all << underline << GetDescriptor() << endl;
+    for (int i=0; i<fTH.GetSize(); i++)
+        *fLog << " " << GetThreshold(i);
+    *fLog << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the minimum dc current
+//
+Float_t MCameraTH::GetMin() const
+{
+    Float_t val = (UInt_t)-1;
+    for (int i=0; i<fTH.GetSize(); i++)
+        val = TMath::Min(val, GetThreshold(i));
+    return val;
+}
+
+// --------------------------------------------------------------------------
+//
+// Return the maximum dc current
+//
+Float_t MCameraTH::GetMax() const
+{
+    Float_t val = 0;
+    for (int i=0; i<fTH.GetSize(); i++)
+        val = TMath::Max(val, GetThreshold(i));
+    return val;
+}
Index: /trunk/MagicSoft/Mars/mcamera/MCameraTH.h
===================================================================
--- /trunk/MagicSoft/Mars/mcamera/MCameraTH.h	(revision 7430)
+++ /trunk/MagicSoft/Mars/mcamera/MCameraTH.h	(revision 7430)
@@ -0,0 +1,46 @@
+#ifndef MARS_MCameraTH
+#define MARS_MCameraTH
+
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+#ifndef MARS_MCamEvent
+#include "MCamEvent.h"
+#endif
+
+#ifndef ROOT_TArrayS
+#include <TArrayS.h>
+#endif
+
+class MCameraTH : public MParContainer, public MCamEvent
+{
+    friend class MReportCC;
+private:
+    TArrayS fTH; // [au] discriminator thresholds
+
+public:
+    MCameraTH(Int_t size=577, const char *name=NULL, const char *title=NULL);
+
+    void SetThreshold(Int_t i, Float_t val) { fTH[i] = (Int_t)val; }
+    Float_t GetThreshold(Int_t i) const { return (*this)[i]; }
+    Float_t &operator[](Int_t i) { return (Float_t&)fTH[i]; }
+    const Float_t &operator[](Int_t i) const { return (*const_cast<MCameraTH*>(this))[i]; }
+
+    Float_t GetMin() const;
+    Float_t GetMax() const;
+
+    void Print(Option_t *opt=NULL) const;
+
+    Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const
+    {
+        val = fTH[idx];
+        return val>0;
+    }
+    void DrawPixelContent(Int_t num) const
+    {
+    }
+
+    ClassDef(MCameraTH, 1) // Storage Container for the discriminator thresholds
+};
+
+#endif
Index: /trunk/MagicSoft/Mars/merpp.cc
===================================================================
--- /trunk/MagicSoft/Mars/merpp.cc	(revision 7429)
+++ /trunk/MagicSoft/Mars/merpp.cc	(revision 7430)
@@ -346,4 +346,7 @@
             w->AddContainer("MTimeDrive",         "Drive");
             w->AddContainer("MReportCC",          "CC");
+            w->AddContainer("MCameraTH",          "CC");
+            w->AddContainer("MCameraTD",          "CC");
+            w->AddContainer("MCameraRecTemp",     "CC");
             w->AddContainer("MTimeCC",            "CC");
             w->AddContainer("MReportStarguider",  "Starguider");
Index: /trunk/MagicSoft/Mars/mfileio/MReadRflFile.cc
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MReadRflFile.cc	(revision 7429)
+++ /trunk/MagicSoft/Mars/mfileio/MReadRflFile.cc	(revision 7430)
@@ -76,8 +76,4 @@
         fIn->read((char*)&revth, sizeof(RflEventHeader_old));
         fEvtHeader->SetEvtNumber((int)revth.EvtNumber);
-//        *fLog << "Event Number: " << revth.EvtNumber;
-//        *fLog << "  Primary ID: " << revth.PrimaryID;
-//        *fLog << "  Run Number: " << revth.RunNumber << endl;
-        return (bool)*fIn;
     }
     else
@@ -86,21 +82,25 @@
         fIn->read((char*)&revth, sizeof(RflEventHeader));
         fEvtHeader->SetEvtNumber((int)revth.EvtNumber);
-//        *fLog << "Event Number: " << revth.EvtNumber;
-//        *fLog << "  Primary ID: " << revth.PrimaryID;
-//        *fLog << "  Run Number: " << revth.RunNumber << endl;
-        return (bool)*fIn;
-    }
-}
-
-enum {
-    kError,
-    kEndOfFile,
-    kStartOfRun,
-    kEndOfRun,
-    kStartOfEvtData,
-    kEndOfEvtData,
-    kUndefined
-};
-
+        fEvtHeader->SetEnergy((int)revth.Etotal);
+        fEvtHeader->SetMomentum(revth.p[0], revth.p[1], revth.p[2]);
+        fEvtHeader->SetCorePosition(revth.CorePos[0][0], revth.CorePos[1][0]);
+        
+        fEvtHeader->SetHeightFirstInt((Float_t)revth.zFirstInt);
+
+        fEvtHeader->SetPhi((Float_t)revth.telescopePhi);
+        fEvtHeader->SetTheta((Float_t)revth.telescopeTheta);
+
+        fEvtHeader->SetNmax((Float_t)revth.longi_Nmax);
+        fEvtHeader->SetT0((Float_t)revth.longi_t0);
+        fEvtHeader->SetTmax((Float_t)revth.longi_tmax);
+        fEvtHeader->SetChi2((Float_t)revth.longi_chi2);
+
+        fEvtHeader->SetEFraction((Float_t)revth.elec_cph_fraction);
+        fEvtHeader->SetMFraction((Float_t)revth.muon_cph_fraction);
+        fEvtHeader->SetOFraction((Float_t)revth.other_cph_fraction);
+    }
+
+    return (bool)*fIn;
+}
 
 int MReadRflFile::ReadFlag()
@@ -111,6 +111,4 @@
     if (!fIn)
         return kError;
-
-    //*fLog << "<" << TString(&flag[1], 11)  << ">" <<endl;
 
     if (FlagIsA(flag, FLAG_END_OF_FILE))
Index: /trunk/MagicSoft/Mars/mfileio/MReadRflFile.h
===================================================================
--- /trunk/MagicSoft/Mars/mfileio/MReadRflFile.h	(revision 7429)
+++ /trunk/MagicSoft/Mars/mfileio/MReadRflFile.h	(revision 7430)
@@ -18,16 +18,26 @@
 {
 private:
-    ifstream *fIn;          // the inputfile
-    TList    *fFileNames;   // Array which stores the \0-terminated filenames
+    enum {
+        kError,
+        kEndOfFile,
+        kStartOfRun,
+        kEndOfRun,
+        kStartOfEvtData,
+        kEndOfEvtData,
+        kUndefined
+    };
 
-    MRflEvtData *fEvtData;        //!
-    MRflEvtHeader *fEvtHeader;
-    MRflRunHeader *fRunHeader;
+    ifstream *fIn;              // the inputfile
+    TList    *fFileNames;       // Array which stores the \0-terminated filenames
 
-    UInt_t fNumFile;
-    UInt_t fEntries; // TO BE IMPLEMENTED
+    MRflEvtData   *fEvtData;    //!
+    MRflEvtHeader *fEvtHeader;  //!
+    MRflRunHeader *fRunHeader;  //!
+
+    UInt_t  fNumFile;
+    UInt_t  fEntries;           // TO BE IMPLEMENTED
     TString fFileName;
 
-    Float_t fCurrentVersion; //! Version of currently open rfl file
+    Float_t fCurrentVersion;    //! Version of currently open rfl file
 
     float  ReadVersion();
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 7429)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc	(revision 7430)
@@ -102,32 +102,4 @@
 #include "MHCalibrationCam.h"
 
-#include "MLog.h"
-#include "MLogManip.h"
-
-#include "MParList.h"
-
-#include "MHCalibrationPix.h"
-
-#include "MCalibrationIntensityCam.h"
-#include "MCalibrationChargeCam.h"
-#include "MCalibrationChargePix.h"
-
-#include "MGeomCam.h"
-#include "MGeomPix.h"
-
-#include "MBadPixelsIntensityCam.h"
-#include "MBadPixelsCam.h"
-#include "MBadPixelsPix.h"
-
-#include "MRawEvtData.h"
-#include "MRawRunHeader.h"
-#include "MRawEvtPixelIter.h"
-
-#include "MExtractedSignalCam.h"
-#include "MExtractedSignalPix.h"
-
-#include "MArrayI.h"
-#include "MArrayD.h"
-
 #include <TOrdCollection.h>
 #include <TPad.h>
@@ -140,4 +112,32 @@
 #include <TGraph.h>
 #include <TEnv.h>
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+#include "MParList.h"
+
+#include "MHCalibrationPix.h"
+
+#include "MCalibrationIntensityCam.h"
+#include "MCalibrationChargeCam.h"
+#include "MCalibrationChargePix.h"
+
+#include "MGeomCam.h"
+#include "MGeomPix.h"
+
+#include "MBadPixelsIntensityCam.h"
+#include "MBadPixelsCam.h"
+#include "MBadPixelsPix.h"
+
+#include "MRawEvtData.h"
+#include "MRawRunHeader.h"
+#include "MRawEvtPixelIter.h"
+
+#include "MExtractedSignalCam.h"
+#include "MExtractedSignalPix.h"
+
+#include "MArrayI.h"
+#include "MArrayD.h"
 
 ClassImp(MHCalibrationPulseTimeCam);
@@ -512,5 +512,5 @@
   *fLog << endl;
 
-  MCalibrationCam *calcam  = fIntensCam ? fIntensCam->GetCam() : fCam;
+  MCalibrationCam &calcam  = *(fIntensCam ? fIntensCam->GetCam() : fCam);
   //
   // Perform the fitting for the High Gain (done in MHCalibrationCam)
@@ -524,5 +524,5 @@
         continue;
       
-      MCalibrationPix &pix    = (*calcam)[i];
+      MCalibrationPix &pix    = calcam[i];
       CalcHists(hist,pix);
     }
@@ -534,6 +534,6 @@
     {
       
-      MHCalibrationPix &hist = GetAverageHiGainArea(j);      
-      MCalibrationPix  &pix  = calcam->GetAverageArea(j);
+      MHCalibrationPix &hist = GetAverageHiGainArea(j);
+      MCalibrationPix  &pix  = calcam.GetAverageArea(j);
       CalcHists(hist,pix);
   }
@@ -541,6 +541,6 @@
   for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
     {
-      MHCalibrationPix &hist = GetAverageHiGainSector(j);      
-      MCalibrationPix  &pix  = calcam->GetAverageSector(j);
+      MHCalibrationPix &hist = GetAverageHiGainSector(j);
+      MCalibrationPix  &pix  = calcam.GetAverageSector(j);
       CalcHists(hist,pix);
     }
@@ -549,5 +549,5 @@
 }
 
-void MHCalibrationPulseTimeCam::CalcHists(MHCalibrationPix &hist, MCalibrationPix &pix)
+void MHCalibrationPulseTimeCam::CalcHists(MHCalibrationPix &hist, MCalibrationPix &pix) const
 {
 
Index: /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.h
===================================================================
--- /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.h	(revision 7429)
+++ /trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.h	(revision 7430)
@@ -61,5 +61,5 @@
   void   DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline);
   void   DisplayRefLines   ( const TH1F *hist,           const Float_t refline) const;
-  void   CalcHists         (MHCalibrationPix &hist, MCalibrationPix &pix);
+  void   CalcHists         (MHCalibrationPix &hist, MCalibrationPix &pix) const;
 
   Int_t ReadEnv        ( const TEnv &env, TString prefix, Bool_t print);
Index: /trunk/MagicSoft/Mars/mreflector/MRflEvtHeader.cc
===================================================================
--- /trunk/MagicSoft/Mars/mreflector/MRflEvtHeader.cc	(revision 7429)
+++ /trunk/MagicSoft/Mars/mreflector/MRflEvtHeader.cc	(revision 7430)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 5/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2003
+!   Copyright: MAGIC Software Development, 2000-2005
 !
 !
Index: /trunk/MagicSoft/Mars/mreflector/MRflEvtHeader.h
===================================================================
--- /trunk/MagicSoft/Mars/mreflector/MRflEvtHeader.h	(revision 7429)
+++ /trunk/MagicSoft/Mars/mreflector/MRflEvtHeader.h	(revision 7430)
@@ -6,15 +6,81 @@
 #endif
 
+#ifndef ROOT_TVector3
+#include <TVector3.h>
+#endif
+
 class MRflEvtHeader : public MParContainer
 {
     Int_t fEvtNumber;
 
+    Float_t fEnergy;         // [GeV] of primary
+
+    TVector3 fMomentum;      // versor of momentum of primary
+    TVector2 fCorePosition;  // shower core position on ground
+
+    Float_t fHeightFirstInt; // [cm] z coordinate (height) of first interaction
+
+    Float_t fPhi;            // Phi of the telescope
+    Float_t fTheta;          // Theta of the telescope [rad]
+
+    Float_t fNmax;           // number of particles in shower maximum fitted by CORSIKA
+    Float_t fT0;             // depth of first interaction point fitted by CORSIKA
+    Float_t fTmax;           // depth of the shower maximum fitted by CORSIKA
+    Float_t fChi2;           // quality of the fit to longit shower development
+
+    /* Now follow the fraction of photons reaching the camera produced by  *
+     * electrons, muons and other particles respectively:                  */
+    Float_t fEFraction;      // elec_cph_fraction
+    Float_t fMFraction;      // muon_cph_fraction
+    Float_t fOFraction;      // other_cph_fraction
+
 public:
     MRflEvtHeader(const char *name=NULL, const char *title=NULL);
 
+    // Getter
     Int_t GetEvtNumber() const { return fEvtNumber; }
+
+    Float_t GetEnergy() const { return fEnergy; }
+
+    const TVector3 &GetMomentum() const { return fMomentum; }
+    const TVector2 &GetCorePosition() const { return fCorePosition; }
+
+    Float_t GetHeightFirstInt() const { return fHeightFirstInt; }
+
+    Float_t GetPhi() const   { return fPhi; }
+    Float_t GetTheta() const { return fTheta; }
+
+    Float_t GetNmax() const  { return fNmax; }
+    Float_t GetT0() const    { return fT0; }
+    Float_t GetTmax() const  { return fTmax; }
+    Float_t GetChi2() const  { return fChi2; }
+
+    Float_t GetEFraction() const { return fEFraction; }
+    Float_t GetMFraction() const { return fMFraction; }
+    Float_t GetOFraction() const { return fOFraction; }
+
+    // Setter
     void SetEvtNumber(Int_t n) { fEvtNumber = n; }
+    void SetEnergy(Float_t x) { fEnergy = x; }
+    void SetMomentum(const TVector3 &v) { fMomentum = v; }
+    void SetCorePosition(const TVector2 &v) { fCorePosition = v; }
 
-    ClassDef(MRflEvtHeader, 0) // Header of an event from the reflector program
+    void SetMomentum(Float_t px, Float_t py, Float_t pz) { fMomentum = TVector3(px, py, pz); }
+    void SetCorePosition(Float_t cx, Float_t cy) { fCorePosition = TVector2(cx, cy); }
+    void SetHeightFirstInt(Float_t x) { fHeightFirstInt = x; }
+
+    void SetPhi(Float_t x)   { fPhi = x; }
+    void SetTheta(Float_t x) { fTheta = x; }
+     
+    void SetNmax(Float_t x)  { fNmax = x ; }
+    void SetT0(Float_t x)    { fT0 = x; }
+    void SetTmax(Float_t x)  { fTmax = x ; }
+    void SetChi2(Float_t x)  { fChi2 = x ; }
+     
+    void SetEFraction(Float_t x) { fEFraction = x ; }
+    void SetMFraction(Float_t x) { fMFraction = x ; }
+    void SetOFraction(Float_t x) { fOFraction = x ; }
+     
+    ClassDef(MRflEvtHeader, 1) // Header of an event from the reflector program
 };
 
Index: /trunk/MagicSoft/Mars/mreport/MReportCC.cc
===================================================================
--- /trunk/MagicSoft/Mars/mreport/MReportCC.cc	(revision 7429)
+++ /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 7429)
+++ /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);
 
Index: /trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc
===================================================================
--- /trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc	(revision 7429)
+++ /trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeDigitalFilter.cc	(revision 7430)
@@ -232,5 +232,10 @@
     }
 
-    // New weights set
+    //
+    // shift the times back to the right reference (start counting from 0)
+    //
+    // The high-gain has the extraction offset (fHiGainFirst) already included
+    // here for speed reason. The low-gain has a changing extraction offset,
+    // so it will be added at every event (in FindTimeAndChargeLoGain)
     fTimeShiftHiGain = 0.5 + 1./fBinningResolutionHiGain + fHiGainFirst;
     fTimeShiftLoGain = 0.5 + 1./fBinningResolutionLoGain;
@@ -474,6 +479,6 @@
       return;
 
-  time = max_p + fTimeShiftHiGain + (Float_t)fHiGainFirst /* this shifts the time to the start of the rising edge */
-      - ((Float_t)t_iter)/fBinningResolutionHiGain;
+  // here, the first high-gain slice is already included in the fTimeShiftHiGain
+  time = fTimeShiftHiGain + max_p - Float_t(t_iter)/fBinningResolutionHiGain;
 
   const Float_t timefineadjust = time_sum/sum;
