Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 7201)
+++ trunk/MagicSoft/Mars/Changelog	(revision 7202)
@@ -20,4 +20,53 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2005/07/21 Thomas Bretz
+
+   * mastro/MAstro.[h,cc]:
+     - added new member function GetDevAbs
+
+   * mcamera/MCameraAUX.[h,cc]:
+     - added new data members for counting house temperatures
+     - increased class version number to 2
+
+   * mcamera/MCameraHV.[h,cc]:
+     - added new data members for HV settings file name
+     - increased class version number to 2
+
+   * mhflux/MHDisp.cc:
+     - fixed handling of non-smearing
+     - fixed calculation of number of entries for the two wobble
+       histograms
+
+   * mjobs/MJStar.cc:
+     - gave a new name to the task writing the Muon-tree
+
+   * mpointing/MHPointing.cc:
+     - do not check the abs deviation but check both deviations
+       independantly whether they make sense.
+     - Plot only hour and minutes
+
+   * mpointing/MPointingPosCalc.h:
+     - fixed wrong #ifndef
+
+   * mpointing/Makefile, mpointing/PointingLinkDef.h:
+     - new class MPointingDev
+     - new class MPointingDevCalc
+
+   * mpointing/PointingIncl.h:
+     - removed TVector2
+
+   * mreport/MReportCamera.[h,cc]:
+     - added interpretation CHTEMP and HVFIl valid since
+       arehcas version 200507190 (incl)
+
+   * mreport/MReportDrive.cc:
+     - moved code from GetErrorAbs to MAstro
+
+   * mreport/MReportStarguider.[h,cc]:
+     - moved code from GetDevAbs to MAstro
+     - added new getter returning a TVector2
+
+
+
  2005/07/19 Thomas Bretz
 
@@ -40,5 +89,4 @@
      - replaced Rate historams by new histogram MHRate
      - added new histogram MHPointing
-     - gave a new name to writem
 
    * mpointing/MSrcPosCorrect.cc:
Index: trunk/MagicSoft/Mars/NEWS
===================================================================
--- trunk/MagicSoft/Mars/NEWS	(revision 7201)
+++ trunk/MagicSoft/Mars/NEWS	(revision 7202)
@@ -30,4 +30,9 @@
 
    - mars: now displays the event time MTime if available
+
+   - merpp: Added support for new arehucas version >= 200507190
+     implementing values for three temperature sensors in the
+     counting house (MCameraAUX) and the name of the HV settings file
+     (MCameraHV).
 
    - callisto: MCalibrationHiLoCam can now be printed from its context
Index: trunk/MagicSoft/Mars/mastro/MAstro.cc
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstro.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mastro/MAstro.cc	(revision 7202)
@@ -601,2 +601,24 @@
     return v1.XYvector(); //TVector2(v1.Y(), -v1.X());//v1.XYvector();
 }
+
+// --------------------------------------------------------------------------
+//
+// Calculate the absolute misspointing from the nominal zenith angle nomzd
+// and the deviations in zd (devzd) and az (devaz).
+// All values given in deg, the return value, too.
+//
+Double_t MAstro::GetDevAbs(Double_t nomzd, Double_t devzd, Double_t devaz)
+{
+    const Double_t pzd = nomzd * TMath::DegToRad();
+    const Double_t azd = devzd * TMath::DegToRad();
+    const Double_t aaz = devaz * TMath::DegToRad();
+
+    const double el = TMath::Pi()/2-pzd;
+
+    const double dphi2 = aaz/2.;
+    const double cos2  = TMath::Cos(dphi2)*TMath::Cos(dphi2);
+    const double sin2  = TMath::Sin(dphi2)*TMath::Sin(dphi2);
+    const double d     = TMath::Cos(azd)*cos2 - TMath::Cos(2*el)*sin2;
+
+    return TMath::ACos(d)*TMath::RadToDeg();
+}
Index: trunk/MagicSoft/Mars/mastro/MAstro.h
===================================================================
--- trunk/MagicSoft/Mars/mastro/MAstro.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mastro/MAstro.h	(revision 7202)
@@ -70,5 +70,9 @@
     static Int_t    GetMagicPeriod(Double_t mjd);
 
+    // Get distance between v1 and v0 in a plain perpendicular to v0 in distance dist
     static TVector2 GetDistOnPlain(const TVector3 &v0, TVector3 v1, Double_t dist=1);
+
+    // Calculate absolute misspointing from error in zd and error in az
+    static Double_t GetDevAbs(Double_t nomzd, Double_t devzd, Double_t devaz);
 
     ClassDef(MAstro, 0)
Index: trunk/MagicSoft/Mars/mcamera/MCameraAUX.cc
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraAUX.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mcamera/MCameraAUX.cc	(revision 7202)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2003
+!   Copyright: MAGIC Software Development, 2000-2005
 !
 !
@@ -27,4 +27,9 @@
 // MCameraAUX
 //
+// Class Version 2:
+//  + Float_t fTempCountingHouse1; // [deg C] Temperature sensor in the counting house 1
+//  + Float_t fTempCountingHouse2; // [deg C] Temperature sensor in the counting house 2
+//  + Float_t fTempCountingHouse3; // [deg C] Temperature sensor in the counting house 3
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MCameraAUX.h"
Index: trunk/MagicSoft/Mars/mcamera/MCameraAUX.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraAUX.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mcamera/MCameraAUX.h	(revision 7202)
@@ -10,8 +10,13 @@
     friend class MReportCamera;
 private:
-    Bool_t fRequestCaosLEDs; // Requested status: o=off, 1=on, bAux_CaOsLEDs_Off/On
-    Bool_t fRequestFansFADC; // Requested status: o=off, 1=on, bAux_FADC_FANs_Off/On
-    Bool_t fStatusCaosLEDs;  // Monitored status: o=off, 1=on, Cam.CaOs.LED_state
-    Bool_t fStatusFansFADC;  // Monitored status: o=off, 1=on, Cam.FADC.Fans_state
+    Bool_t  fRequestCaosLEDs;    // Requested status: o=off, 1=on, bAux_CaOsLEDs_Off/On
+    Bool_t  fRequestFansFADC;    // Requested status: o=off, 1=on, bAux_FADC_FANs_Off/On
+
+    Bool_t  fStatusCaosLEDs;     // Monitored status: o=off, 1=on, Cam.CaOs.LED_state
+    Bool_t  fStatusFansFADC;     // Monitored status: o=off, 1=on, Cam.FADC.Fans_state
+
+    Float_t fTempCountingHouse1; // [deg C] Temperature sensor in the counting house 1
+    Float_t fTempCountingHouse2; // [deg C] Temperature sensor in the counting house 2
+    Float_t fTempCountingHouse3; // [deg C] Temperature sensor in the counting house 3
 
 public:
@@ -22,10 +27,15 @@
     }
 
-    Bool_t GetRequestCaosLEDs() const { return fRequestCaosLEDs; }
-    Bool_t GetRequestFansFADC() const { return fRequestFansFADC; }
-    Bool_t GetStatusCaosLEDs() const  { return fStatusCaosLEDs;  }
-    Bool_t GetStatusFansFADC() const  { return fStatusFansFADC;  }
+    Bool_t  GetRequestCaosLEDs() const    { return fRequestCaosLEDs; }
+    Bool_t  GetRequestFansFADC() const    { return fRequestFansFADC; }
 
-    ClassDef(MCameraAUX, 1) // Container storing information about the Camera auxiliary system
+    Bool_t  GetStatusCaosLEDs() const     { return fStatusCaosLEDs;  }
+    Bool_t  GetStatusFansFADC() const     { return fStatusFansFADC;  }
+
+    Float_t GetTempCountingHouse1() const { return fTempCountingHouse1; }
+    Float_t GetTempCountingHouse2() const { return fTempCountingHouse2; }
+    Float_t GetTempCountingHouse3() const { return fTempCountingHouse3; }
+
+    ClassDef(MCameraAUX, 2) // Container storing information about the Camera auxiliary system
 };
 
Index: trunk/MagicSoft/Mars/mcamera/MCameraHV.cc
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraHV.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mcamera/MCameraHV.cc	(revision 7202)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2003
+!   Copyright: MAGIC Software Development, 2000-2005
 !
 !
@@ -27,4 +27,9 @@
 // MCameraHV
 //
+//
+// Class Version 2:
+//  + TString fFileName; // Filename for the HV settings
+//
+//
 /////////////////////////////////////////////////////////////////////////////
 #include "MCameraHV.h"
Index: trunk/MagicSoft/Mars/mcamera/MCameraHV.h
===================================================================
--- trunk/MagicSoft/Mars/mcamera/MCameraHV.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mcamera/MCameraHV.h	(revision 7202)
@@ -23,8 +23,10 @@
     Short_t fVoltageB;      // [V] Measured voltage of power supply B, hvps2
 
-    Byte_t fCurrentA;       // [mA] Measured current of power supply A, curr1
-    Byte_t fCurrentB;       // [mA] Measured current of power supply B, curr2
+    Byte_t  fCurrentA;      // [mA] Measured current of power supply A, curr1
+    Byte_t  fCurrentB;      // [mA] Measured current of power supply B, curr2
 
     TArrayS fHV;            // [V] Measured high Voltages for all PMTs
+
+    TString fFileName;      // Filename for the HV settings
 
 public:
@@ -58,5 +60,5 @@
     }
 
-    ClassDef(MCameraHV, 1) // Container storing information about the Camera HV
+    ClassDef(MCameraHV, 2) // Container storing information about the Camera HV
 };
 
Index: trunk/MagicSoft/Mars/mhflux/MHDisp.cc
===================================================================
--- trunk/MagicSoft/Mars/mhflux/MHDisp.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mhflux/MHDisp.cc	(revision 7202)
@@ -213,10 +213,4 @@
     }
 
-    if (fSmearing<=0)
-    {
-        fHist.Fill(pos1.X(), pos1.Y(), 0.0, w*w0);
-        return kTRUE;
-    }
-
     // -------------------------------------------------
     //  The following algorithm may look complicated...
@@ -241,5 +235,14 @@
     const Int_t    bz     = fHist.GetZaxis()->FindFixBin(0);
 
-    TH1 &bg = fHalf ? fHistBg1 : fHistBg2;
+    TH2 &bg = fHalf ? fHistBg1 : fHistBg2;
+
+    const Bool_t smear = fSmearing>0;
+    if (!smear)
+    {
+        if (!fHistOff)
+            bg.Fill(pos1.X(), pos1.Y(), w*w0);
+        else
+            fHist.Fill(pos1.X(), pos1.Y(), 0.0, w*w0);
+    }
 
     // To calculate significance map smear with 2*theta-cut and
@@ -254,14 +257,17 @@
             const Double_t cy = axey.GetBinCenter(y);
             const Double_t sp = Sq(px, cy-pos1.Y());
-            const Double_t dp = sp/psf;
-
-            // Values below 1e-3 (>3.5sigma) are not filled into the histogram
-            if (dp<4)
+            if (smear)
             {
-                const Double_t rc = TMath::Exp(-dp)/normg;
-                if (!fHistOff)
-                    bg.AddBinContent(bg.GetBin(x, y), rc);
-                else
-                    fHist.AddBinContent(fHist.GetBin(x, y, bz), rc);
+                const Double_t dp = sp/psf;
+
+                // Values below 1e-3 (>3.5sigma) are not filled into the histogram
+                if (dp<4)
+                {
+                    const Double_t rc = TMath::Exp(-dp)/normg;
+                    if (!fHistOff)
+                        bg.AddBinContent(bg.GetBin(x, y), rc);
+                    else
+                        fHist.AddBinContent(fHist.GetBin(x, y, bz), rc);
+                }
             }
 
@@ -285,8 +291,15 @@
         }
     }
-    fHist.SetEntries(fHist.GetEntries()+1);
+
+    if (fHistOff)
+        fHistBg.SetEntries(fHistBg.GetEntries()+1);
+
+    if (!smear)
+        return kTRUE;
 
     if (!fHistOff)
-        bg.SetEntries(fHistBg1.GetEntries()+1);
+        bg.SetEntries(bg.GetEntries()+1);
+    else
+        fHist.SetEntries(fHist.GetEntries()+1);
 
     return kTRUE;
Index: trunk/MagicSoft/Mars/mjobs/MJStar.cc
===================================================================
--- trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mjobs/MJStar.cc	(revision 7202)
@@ -255,4 +255,5 @@
     MWriteRootFile writet(2, rule, fOverwrite?"RECREATE":"NEW"); // EffectiveOnTime
     MWriteRootFile writem(2, rule, fOverwrite?"RECREATE":"NEW"); // Muons
+    writem.SetName("WriteMuons");
 
     // Data
Index: trunk/MagicSoft/Mars/mpointing/MHPointing.cc
===================================================================
--- trunk/MagicSoft/Mars/mpointing/MHPointing.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mpointing/MHPointing.cc	(revision 7202)
@@ -42,4 +42,5 @@
 
 #include "MTime.h"
+#include "MAstro.h"
 
 #include "MReportDrive.h"
@@ -165,14 +166,19 @@
     if (t->GetName()==(TString)"MTimeStarguider")
     {
-        const Double_t max = 30; // [arcsec] maximum starguider deviation which makes sense
-
         AddPoint(fBrightness, tm, fReportSG->GetSkyBrightness());
         AddPoint(fNumStars,   tm, fReportSG->GetNumIdentifiedStars());
-        if (fReportSG->GetDevAbs()<max)
+
+        const Bool_t zdok     = TMath::Abs(fReportSG->GetDevZd())<30;
+        const Bool_t azok     = TMath::Abs(fReportSG->GetDevAz())<90;
+
+        const Double_t devzd  = fReportSG->GetDevZd();
+        const Double_t devaz  = fReportSG->GetDevAz();
+
+        if (zdok && azok)
             AddPoint(fDevTimeSG, tm, fReportSG->GetDevAbs());
-        if (TMath::Abs(fReportSG->GetDevZd())<max)
-            AddPoint(fDevZd,  tm, fReportSG->GetDevZd());
-        if (TMath::Abs(fReportSG->GetDevAz())<max)
-            AddPoint(fDevAz,  tm, fReportSG->GetDevAz());
+        if (zdok)
+            AddPoint(fDevZd, tm, devzd);
+        if (azok)
+            AddPoint(fDevAz, tm, devaz);
         return kTRUE;
     }
@@ -198,5 +204,5 @@
         TAxis *axe = h->GetXaxis();
         axe->SetLabelSize(0.033);
-        axe->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00 GMT");
+        axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
         axe->SetTimeDisplay(1);
         axe->SetTitle("Time");
Index: trunk/MagicSoft/Mars/mpointing/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mpointing/Makefile	(revision 7201)
+++ trunk/MagicSoft/Mars/mpointing/Makefile	(revision 7202)
@@ -23,4 +23,6 @@
 
 SRCFILES = MPointing.cc \
+	   MPointingDev.cc \
+	   MPointingDevCalc.cc \
 	   MPointingPos.cc \
 	   MPointingPosCalc.cc \
Index: trunk/MagicSoft/Mars/mpointing/PointingIncl.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/PointingIncl.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mpointing/PointingIncl.h	(revision 7202)
@@ -1,5 +1,3 @@
 #ifndef __CINT__
 
-#include <TVector2.h>
-
 #endif // __CINT__
Index: trunk/MagicSoft/Mars/mpointing/PointingLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mpointing/PointingLinkDef.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mpointing/PointingLinkDef.h	(revision 7202)
@@ -6,4 +6,7 @@
 
 #pragma link C++ class MPointing+;
+
+#pragma link C++ class MPointingDev+;
+#pragma link C++ class MPointingDevCalc+;
 
 #pragma link C++ class MPointingPos+;
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.cc	(revision 7202)
@@ -477,4 +477,58 @@
     return kTRUE;
 }
+
+// --------------------------------------------------------------------------
+//
+// Interprete the CHTEMP part
+//
+Bool_t MReportCamera::InterpreteCHTEMP(TString &str)
+{
+    if (!CheckTag(str, "CHTEMP "))
+        return kFALSE;
+
+    Int_t len, temp1, temp2, temp3;
+    Int_t n=sscanf(str.Data(), " %d %d %d %n", &temp1, &temp2, &temp3, &len);
+    if (n!=3)
+    {
+        *fLog << warn << "WARNING - Reading information of 'CHTEMP' section." << endl;
+        return kFALSE;
+    }
+
+    fAUX->fTempCountingHouse1 = temp1*0.01;
+    fAUX->fTempCountingHouse2 = temp2*0.01;
+    fAUX->fTempCountingHouse3 = temp3*0.01;
+
+    str.Remove(0, len);
+    str=str.Strip(TString::kBoth);
+
+    return kTRUE;
+}
+
+// --------------------------------------------------------------------------
+//
+// Interprete the HVFIL part
+//
+Bool_t MReportCamera::InterpreteHVFIL(TString &str)
+{
+    if (!CheckTag(str, "HVFIL "))
+        return kFALSE;
+
+    str=str.Strip(TString::kBoth);
+
+    const Ssiz_t pos = str.First(' ');
+    if (pos<0)
+    {
+        *fLog << warn << "WARNING - Reading information of 'HVFIL' section." << endl;
+        return kFALSE;
+    }
+
+    fHV->fFileName = str(0, pos);
+
+    str.Remove(0, pos);
+    str=str.Strip(TString::kBoth);
+
+    return kTRUE;
+}
+
 // --------------------------------------------------------------------------
 //
@@ -576,4 +630,12 @@
     }
 
+    if (ver >= 200507190)
+    {
+        if (!InterpreteCHTEMP(str))
+            return kCONTINUE;
+        if (!InterpreteHVFIL(str))
+            return kCONTINUE;
+    }
+
     if (str!="OVER")
     {
Index: trunk/MagicSoft/Mars/mreport/MReportCamera.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mreport/MReportCamera.h	(revision 7202)
@@ -48,4 +48,6 @@
     Bool_t InterpreteActiveLoad(TString &str);
     Bool_t InterpreteCentralPix(TString &str);
+    Bool_t InterpreteCHTEMP(TString &str);
+    Bool_t InterpreteHVFIL(TString &str);
 
     Int_t  InterpreteBody(TString &str, Int_t ver);
Index: trunk/MagicSoft/Mars/mreport/MReportDrive.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportDrive.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mreport/MReportDrive.cc	(revision 7202)
@@ -135,4 +135,6 @@
 Double_t MReportDrive::GetAbsError() const
 {
+    return MAstro::GetDevAbs(fNominalZd, fErrorZd, fErrorAz);
+/*
     // For the algorithm see also MReportStarguider
     const Double_t pzd = fNominalZd*TMath::DegToRad();
@@ -158,5 +160,5 @@
     //
 
-    return acos(d)*TMath::RadToDeg();
+    return acos(d)*TMath::RadToDeg();*/
 }
 
Index: trunk/MagicSoft/Mars/mreport/MReportStarguider.cc
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportStarguider.cc	(revision 7201)
+++ trunk/MagicSoft/Mars/mreport/MReportStarguider.cc	(revision 7202)
@@ -32,4 +32,9 @@
 // This is the place to get the azimuth-/zenith mispointing of the telescope
 // given by the starguider-camera.
+//
+//
+// Starguider reports are available since 2004/11/17.
+// The nomnial pointing position is available since 2005/03/22
+// The sky brightness and the number of identified stars since 2005/03/17
 //
 //
@@ -129,17 +134,20 @@
 Double_t MReportStarguider::GetDevAbs() const
 {
-    // For the algorithm see also MReportDrive
-    const Double_t pzd = fNominalZd * TMath::DegToRad();
-    const Double_t azd = fDevZd/60  * TMath::DegToRad();
-    const Double_t aaz = fDevAz/60  * TMath::DegToRad();
+    return MAstro::GetDevAbs(fNominalZd, fDevZd/60, fDevAz/60)*60;
+    /*
+     // For the algorithm see also MReportDrive
+     const Double_t pzd = fNominalZd * TMath::DegToRad();
+     const Double_t azd = fDevZd/60  * TMath::DegToRad();
+     const Double_t aaz = fDevAz/60  * TMath::DegToRad();
 
-    const double el = TMath::Pi()/2-pzd;
+     const double el = TMath::Pi()/2-pzd;
 
-    const double dphi2 = aaz/2.;
-    const double cos2  = cos(dphi2)*cos(dphi2);
-    const double sin2  = sin(dphi2)*sin(dphi2);
-    const double d     = cos(azd)*cos2 - cos(2*el)*sin2;
+     const double dphi2 = aaz/2.;
+     const double cos2  = cos(dphi2)*cos(dphi2);
+     const double sin2  = sin(dphi2)*sin(dphi2);
+     const double d     = cos(azd)*cos2 - cos(2*el)*sin2;
 
-    return acos(d)*TMath::RadToDeg()*60;
+     return acos(d)*TMath::RadToDeg()*60;
+     */
 }
 
Index: trunk/MagicSoft/Mars/mreport/MReportStarguider.h
===================================================================
--- trunk/MagicSoft/Mars/mreport/MReportStarguider.h	(revision 7201)
+++ trunk/MagicSoft/Mars/mreport/MReportStarguider.h	(revision 7202)
@@ -4,4 +4,8 @@
 #ifndef MARS_MReport
 #include "MReport.h"
+#endif
+
+#ifndef ROOT_TVector2
+#include <TVector2.h>
 #endif
 
@@ -31,10 +35,13 @@
     Double_t GetDevZd() const { return fDevZd; }
     Double_t GetDevAbs() const;
+    TVector2 GetDev() const { return TVector2(fDevZd, fDevAz); }
 
     Double_t GetNominalZd() const { return fNominalZd; }
     Double_t GetNominalAz() const { return fNominalAz; }
+    TVector2 GetNominalPos() const { return TVector2(fNominalZd, fNominalAz); }
 
     Float_t  GetCameraCenterX() const { return fCameraCenterX; }
     Float_t  GetCameraCenterY() const { return fCameraCenterY; }
+    TVector2 GetCameraCenter() const { return TVector2(fCameraCenterX, fCameraCenterY); }
 
     UInt_t   GetNumIdentifiedStars() const { return fNumIdentifiedStars; }
