Index: trunk/MagicSoft/Mars/mhist/MHWeather.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHWeather.cc	(revision 8907)
+++ trunk/MagicSoft/Mars/mhist/MHWeather.cc	(revision 8934)
@@ -18,5 +18,5 @@
 !   Author(s): Thomas Bretz, 05/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
 !
-!   Copyright: MAGIC Software Development, 2000-2005
+!   Copyright: MAGIC Software Development, 2000-2008
 !
 !
@@ -27,5 +27,12 @@
 // MHWeather
 //
-// Display weather data and the corresponding event rate
+// Display weather and pyrometer data and the corresponding event rate
+//
+// Class Version 2:
+// ----------------
+//  - fSolarRadiation
+//  + fCloudiness
+//  + fTempSky
+//  + fTempAir
 //
 ////////////////////////////////////////////////////////////////////////////
@@ -44,4 +51,5 @@
 #include "MTime.h"
 #include "MReportCC.h"
+#include "MReportPyrometer.h"
 #include "MEventRate.h"
 
@@ -79,4 +87,5 @@
 //
 MHWeather::MHWeather(const char *name, const char *title)
+: fReportCC(0), fReportPyro(0), fRate(0)
 {
     fName  = name  ? name  : "MHWeather";
@@ -86,17 +95,26 @@
 
     fHumidity.SetNameTitle("Humidity", "Humidity");
-    fTemperature.SetNameTitle("Temperature", "Temperature");
-    fSolarRadiation.SetNameTitle("SolarRadiation", "Solar Radiation");
+    fTemperature.SetNameTitle("Temperature", "Temperature (red=weather station, black=pyrometer, blue=sky)");
     fWindSpeed.SetNameTitle("WindSpeed", "Wind Speed");
+
     fEventRate.SetNameTitle("EventRate", "Event Rate at CC-REPORT time");
+
+    fCloudiness.SetNameTitle("Cloudiness", "Cloudiness / Humidity");
+    fTempAir.SetNameTitle("TempAir", "Air temperature from Pyrometer");
+    fTempSky.SetNameTitle("TempSky", "Sky temperature from Pyrometer");
 
     InitGraph(fHumidity);
     InitGraph(fTemperature);
-    InitGraph(fSolarRadiation);
     InitGraph(fWindSpeed);
+
     InitGraph(fEventRate);
+
+    InitGraph(fCloudiness);
+    InitGraph(fTempAir);
+    InitGraph(fTempSky);
 
     fHumidity.SetMarkerColor(kBlue);
     fTemperature.SetMarkerColor(kRed);
+    fTempSky.SetMarkerColor(kBlue);
 }
 
@@ -108,6 +126,7 @@
 Bool_t MHWeather::SetupFill(const MParList *plist)
 {
-    fReport = (MReportCC*)plist->FindObject("MReportCC");
-    if (!fReport)
+    // Remark: This is called twice in the star-eventloop!
+    fReportCC = (MReportCC*)plist->FindObject("MReportCC");
+    if (!fReportCC)
     {
         *fLog << warn << "MReportCC not found... abort." << endl;
@@ -120,11 +139,17 @@
         return kFALSE;
     }
+
+    fReportPyro = (MReportPyrometer*)plist->FindObject("MReportPyrometer");
+    if (!fReportPyro)
+        *fLog << warn << "MReportPyrometer not found..." << endl;
 
     // Reset Graphs
     ResetGraph(fHumidity);
     ResetGraph(fTemperature);
-    ResetGraph(fSolarRadiation);
     ResetGraph(fWindSpeed);
     ResetGraph(fEventRate);
+    ResetGraph(fCloudiness);
+    ResetGraph(fTempAir);
+    ResetGraph(fTempSky);
 
     return kTRUE;
@@ -147,9 +172,19 @@
     const Double_t tm = t->GetAxisTime();
 
-    AddPoint(fTemperature,    tm, fReport->GetTemperature());
-    AddPoint(fHumidity,       tm, fReport->GetHumidity());
-    AddPoint(fSolarRadiation, tm, fReport->GetSolarRadiation());
-    AddPoint(fWindSpeed,      tm, fReport->GetWindSpeed());
-    AddPoint(fEventRate,      tm, fRate->GetRate());
+    AddPoint(fEventRate, tm, fRate->GetRate());
+
+    if (TString(t->GetName())=="MTimeCC")
+    {
+        AddPoint(fTemperature, tm, fReportCC->GetTemperature());
+        AddPoint(fHumidity,    tm, fReportCC->GetHumidity());
+        AddPoint(fWindSpeed,   tm, fReportCC->GetWindSpeed());
+    }
+
+    if (TString(t->GetName())=="MTimePyrometer" && fReportPyro)
+    {
+        AddPoint(fCloudiness, tm, fReportPyro->GetCloudiness());
+        AddPoint(fTempAir,    tm, fReportPyro->GetTempAir());
+        AddPoint(fTempSky,    tm, fReportPyro->GetTempSky()-200);
+    }
 
     return kTRUE;
@@ -204,13 +239,14 @@
 // Draw an axis on the right side of the histogram
 //
-void MHWeather::DrawRightAxis(const char *title) const
+void MHWeather::DrawRightAxis(const char *title, Int_t col) const
 {
     TGaxis *axis = new TGaxis(gPad->GetUxmax(), gPad->GetUymin(),
                               gPad->GetUxmax(), gPad->GetUymax(),
                               0, 1, 510, "+L");
+    axis->SetBit(TAxis::kRotateTitle);
     axis->SetName("RightAxis");
     axis->SetTitle(title);
-    axis->SetTitleOffset(0.9);
-    axis->SetTextColor(kRed);
+    axis->SetTitleOffset(1.2);
+    axis->SetTextColor(col);
     axis->SetBit(kCanDelete);
     axis->Draw();
@@ -236,7 +272,8 @@
     gPad->SetGridx();
     gPad->SetGridy();
-    fHumidity.Draw("AP");
-    fTemperature.Draw("P");
-    DrawRightAxis("T [\\circ C]");
+    fTemperature.Draw("AP");
+    fTempAir.Draw("P");
+    fTempSky.Draw("P");
+    DrawRightAxis("T_{sky}-200 [K]", kBlue);
 
     pad->cd(2);
@@ -244,5 +281,7 @@
     gPad->SetGridx();
     gPad->SetGridy();
-    fSolarRadiation.Draw("AP");
+    fHumidity.Draw("AP");
+    fCloudiness.Draw("P");
+    DrawRightAxis("Cloudiness [%]");
 
     pad->cd(3);
@@ -250,5 +289,5 @@
     gPad->SetGridx();
     gPad->SetGridy();
-    fEventRate.Draw("AP");
+    fWindSpeed.Draw("AP");
 
     pad->cd(4);
@@ -256,5 +295,5 @@
     gPad->SetGridx();
     gPad->SetGridy();
-    fWindSpeed.Draw("AP");
+    fEventRate.Draw("AP");
 }
 
@@ -267,28 +306,49 @@
         fHumidity.SetMaximum(100);
     }
+    if (fCloudiness.GetN()>0)
+    {
+        fCloudiness.SetMinimum(0);
+        fCloudiness.SetMaximum(100);
+    }
+
     if (fTemperature.GetN()>0)
     {
-        fTemperature.SetMinimum(-25);
-        fTemperature.SetMaximum(45);
+        fTemperature.SetMinimum(-2.5);
+        fTemperature.SetMaximum(27.5);
+    }
+    if (fTempSky.GetN()>0)
+    {
+        fTempSky.SetMinimum(-2.5);
+        fTempSky.SetMaximum(27.5);
     }
     if (fWindSpeed.GetN()>0)
         fWindSpeed.SetMinimum(0);
-    if (fSolarRadiation.GetN()>0)
-        fSolarRadiation.SetMinimum(0);
     if (fEventRate.GetN()>0)
         fEventRate.SetMinimum(0);
 
-    DrawGraph(fHumidity,       "H [%]");
-    DrawGraph(fSolarRadiation, "R [W/m^{2}]");
-    DrawGraph(fTemperature,    "T [\\circ C]");
-    DrawGraph(fWindSpeed,      "km/h");
-    DrawGraph(fEventRate,      "f [Hz]");
-
-    gPad->cd(1);
-
+    DrawGraph(fHumidity,    "Humidity [%]");
+    DrawGraph(fTemperature, "T [\\circ C]");
+    DrawGraph(fWindSpeed,   "km/h");
+    DrawGraph(fEventRate,   "f [Hz]");
+    DrawGraph(fCloudiness,  "Cloudiness [%]");
+    DrawGraph(fTempAir,     "T [\\circ C]");
+    DrawGraph(fTempSky,     "T_{sky}-200 [K]");
+
+    TVirtualPad *p = gPad;
+
+    p->cd(1);
     if (gPad)
     {
+        fTemperature.GetHistogram()->GetYaxis()->SetTitleColor(kRed);
+        //fTempSky.GetHistogram()->GetYaxis()->SetTitleColor(kBlue);
+        UpdateRightAxis(fTemperature); // Primary axis
+    }
+
+    p->cd(2);
+    if (gPad)
+    {
         fHumidity.GetHistogram()->GetYaxis()->SetTitleColor(kBlue);
-        UpdateRightAxis(fTemperature);
-    }
-}
+        fHumidity.GetHistogram()->GetYaxis()->SetTitleOffset(1.2);
+        UpdateRightAxis(fHumidity);    // Primary axis
+    }
+}
