Changeset 8934 for trunk


Ignore:
Timestamp:
06/10/08 16:50:49 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/macros/fillstar.C

    r8931 r8934  
    183183        return 2;
    184184    }
    185 
    186     Double_t max = TMath::MaxElement(g->GetN(), g->GetY());
    187     TString maxhum = Form("%5.1f", max);
     185    TString maxhum = Form("%5.1f", TMath::MaxElement(g->GetN(), g->GetY()));
     186    TString avghum = Form("%5.1f", g->GetMean(2));
    188187
    189188    g = (TGraph*)arr.FindObjectInCanvas("Temperature", "TGraph", "MHWeather");
     
    193192        return 2;
    194193    }
    195 
    196     Double_t temp = g->GetMean(2);
    197     TString avgtemp = Form("%5.1f", temp);
     194    TString avgtemp = Form("%5.1f", g->GetMean(2));
    198195
    199196    g = (TGraph*)arr.FindObjectInCanvas("WindSpeed", "TGraph", "MHWeather");
     
    203200        return 2;
    204201    }
    205 
    206     Double_t wind = g->GetMean(2);
    207     TString avgwind = Form("%5.1f", wind);
     202    TString avgwind = Form("%5.1f", g->GetMean(2));
     203
     204    g = (TGraph*)arr.FindObjectInCanvas("Cloudiness", "TGraph", "MHWeather");
     205    if (!g)
     206        cout << "WARNING - Reading of Cloudiness failed." << endl;
     207    TString avgclouds = g ? Form("%5.1f", g->GetMean(2)) : 0;
     208    TString rmsclouds = g ? Form("%5.1f", g->GetRMS(2))  : 0;
     209
     210    g = (TGraph*)arr.FindObjectInCanvas("TempSky", "TGraph", "MHWeather");
     211    if (!g)
     212        cout << "WARNING - Reading of TempSky failed." << endl;
     213    TString avgsky = g ? Form("%5.1f", g->GetMean(2)+200) : 0;
    208214
    209215
    210216    g = (TGraph*)arr.FindObjectInCanvas("NumStars", "TGraph", "MHPointing");
    211217    if (!g)
    212     {
    213218        cout << "WARNING - Reading of NumStars failed." << endl;
    214 //        return 2;
    215     }
    216219
    217220    Double_t numstarmed = g ? TMath::Median(g->GetN(), g->GetY()) : -1;
     
    227230    }
    228231
    229     Double_t numcormed = g ? TMath::Median(g->GetN(), g->GetY()) : -1;
    230     TString numcorsmed = Form("%5.1f", numcormed);
    231     Double_t numcorrms = g ? g->GetRMS(2) : -1;
    232     TString numcorsrms = Form("%5.1f", numcorrms);
     232    TString numcorsmed = Form("%5.1f", g ? TMath::Median(g->GetN(), g->GetY()) : -1);
     233    TString numcorsrms = Form("%5.1f", g ? g->GetRMS(2) : -1);
    233234
    234235    g = (TGraph*)arr.FindObjectInCanvas("Brightness", "TGraph", "MHPointing");
     
    239240    }
    240241
    241     Double_t brightnessmed = g ? TMath::Median(g->GetN(), g->GetY()) : -1;
    242     TString skybrightnessmed = Form("%5.1f", brightnessmed);
    243     Double_t brightnessrms = g ? g->GetRMS(2) : -1;
    244     TString skybrightnessrms = Form("%5.1f", brightnessrms);
     242    TString skybrightnessmed = Form("%5.1f", g ? TMath::Median(g->GetN(), g->GetY()) : -1);
     243    TString skybrightnessrms = Form("%5.1f", g ? g->GetRMS(2) : -1);
    245244
    246245
     
    267266    cout << "  Rate of sparks [Hz]      " << sparkrate << endl;
    268267    cout << "  Maximum Humidity [%]     " << maxhum    << endl;
     268    cout << "  Average Humidity [%]     " << avghum    << endl;
     269    cout << "  Average WindSpeed [km/h] " << avgwind   << endl;
    269270    cout << "  Average Temp [°C]        " << avgtemp   << endl;
    270     cout << "  Average WindSpeed [km/h] " << avgwind   << endl;
    271     cout << "  Number of Stars          " << numstarsmed      << " +/- " << numstarsrms       << endl;
    272     cout << "  Number of cor. Stars     " << numcormed        << " +/- " << numcorrms         << endl;
    273     cout << "  Skybrightness            " << skybrightnessmed << " +/- " << skybrightnessrms  << endl;
     271    cout << "  Average Sky Temp [K]     " << avgsky    << endl;
     272    cout << "  Cloundiness [%]          " << avgclouds        << " +/- " << rmsclouds        << endl;
     273    cout << "  Number of Stars          " << numstarsmed      << " +/- " << numstarsrms      << endl;
     274    cout << "  Number of cor. Stars     " << numcorsmed       << " +/- " << numcorsrms       << endl;
     275    cout << "  Skybrightness            " << skybrightnessmed << " +/- " << skybrightnessrms << endl;
    274276
    275277    TString vars = Form(" fMeanNumberIslands=%s,"
     
    282284                        " fSparkRate=%s,"
    283285                        " fMaxHumidity=%s,"
     286                        " fAvgHumidity=%s, "
    284287                        " fAvgTemperature=%s,"
    285288                        " fAvgWindSpeed=%s,"
     289                        " fAvgTempSky=%s,"
     290                        " fAvgCloudiness=%s, "
     291                        " fRmsCloudiness=%s, "
    286292                        " fNumStarsMed=%s,"
    287293                        " fNumStarsRMS=%s,"
     
    295301                        muonrate.Data(), PSF.Data(),
    296302                        datarate, sparkrate.Data(), maxhum.Data(),
    297                         avgtemp.Data(), avgwind.Data(),
     303                        avghum.Data(), avgtemp.Data(), avgwind.Data(),
     304                        avgsky.Data(), avgclouds.Data(), rmsclouds.Data(),
    298305                        numstarsmed.Data(), numstarsrms.Data(),
    299306                        numcorsmed.Data(), numcorsrms.Data(),
  • trunk/MagicSoft/Mars/mhist/MHWeather.cc

    r8907 r8934  
    1818!   Author(s): Thomas Bretz, 05/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2005
     20!   Copyright: MAGIC Software Development, 2000-2008
    2121!
    2222!
     
    2727// MHWeather
    2828//
    29 // Display weather data and the corresponding event rate
     29// Display weather and pyrometer data and the corresponding event rate
     30//
     31// Class Version 2:
     32// ----------------
     33//  - fSolarRadiation
     34//  + fCloudiness
     35//  + fTempSky
     36//  + fTempAir
    3037//
    3138////////////////////////////////////////////////////////////////////////////
     
    4451#include "MTime.h"
    4552#include "MReportCC.h"
     53#include "MReportPyrometer.h"
    4654#include "MEventRate.h"
    4755
     
    7987//
    8088MHWeather::MHWeather(const char *name, const char *title)
     89: fReportCC(0), fReportPyro(0), fRate(0)
    8190{
    8291    fName  = name  ? name  : "MHWeather";
     
    8695
    8796    fHumidity.SetNameTitle("Humidity", "Humidity");
    88     fTemperature.SetNameTitle("Temperature", "Temperature");
    89     fSolarRadiation.SetNameTitle("SolarRadiation", "Solar Radiation");
     97    fTemperature.SetNameTitle("Temperature", "Temperature (red=weather station, black=pyrometer, blue=sky)");
    9098    fWindSpeed.SetNameTitle("WindSpeed", "Wind Speed");
     99
    91100    fEventRate.SetNameTitle("EventRate", "Event Rate at CC-REPORT time");
     101
     102    fCloudiness.SetNameTitle("Cloudiness", "Cloudiness / Humidity");
     103    fTempAir.SetNameTitle("TempAir", "Air temperature from Pyrometer");
     104    fTempSky.SetNameTitle("TempSky", "Sky temperature from Pyrometer");
    92105
    93106    InitGraph(fHumidity);
    94107    InitGraph(fTemperature);
    95     InitGraph(fSolarRadiation);
    96108    InitGraph(fWindSpeed);
     109
    97110    InitGraph(fEventRate);
     111
     112    InitGraph(fCloudiness);
     113    InitGraph(fTempAir);
     114    InitGraph(fTempSky);
    98115
    99116    fHumidity.SetMarkerColor(kBlue);
    100117    fTemperature.SetMarkerColor(kRed);
     118    fTempSky.SetMarkerColor(kBlue);
    101119}
    102120
     
    108126Bool_t MHWeather::SetupFill(const MParList *plist)
    109127{
    110     fReport = (MReportCC*)plist->FindObject("MReportCC");
    111     if (!fReport)
     128    // Remark: This is called twice in the star-eventloop!
     129    fReportCC = (MReportCC*)plist->FindObject("MReportCC");
     130    if (!fReportCC)
    112131    {
    113132        *fLog << warn << "MReportCC not found... abort." << endl;
     
    120139        return kFALSE;
    121140    }
     141
     142    fReportPyro = (MReportPyrometer*)plist->FindObject("MReportPyrometer");
     143    if (!fReportPyro)
     144        *fLog << warn << "MReportPyrometer not found..." << endl;
    122145
    123146    // Reset Graphs
    124147    ResetGraph(fHumidity);
    125148    ResetGraph(fTemperature);
    126     ResetGraph(fSolarRadiation);
    127149    ResetGraph(fWindSpeed);
    128150    ResetGraph(fEventRate);
     151    ResetGraph(fCloudiness);
     152    ResetGraph(fTempAir);
     153    ResetGraph(fTempSky);
    129154
    130155    return kTRUE;
     
    147172    const Double_t tm = t->GetAxisTime();
    148173
    149     AddPoint(fTemperature,    tm, fReport->GetTemperature());
    150     AddPoint(fHumidity,       tm, fReport->GetHumidity());
    151     AddPoint(fSolarRadiation, tm, fReport->GetSolarRadiation());
    152     AddPoint(fWindSpeed,      tm, fReport->GetWindSpeed());
    153     AddPoint(fEventRate,      tm, fRate->GetRate());
     174    AddPoint(fEventRate, tm, fRate->GetRate());
     175
     176    if (TString(t->GetName())=="MTimeCC")
     177    {
     178        AddPoint(fTemperature, tm, fReportCC->GetTemperature());
     179        AddPoint(fHumidity,    tm, fReportCC->GetHumidity());
     180        AddPoint(fWindSpeed,   tm, fReportCC->GetWindSpeed());
     181    }
     182
     183    if (TString(t->GetName())=="MTimePyrometer" && fReportPyro)
     184    {
     185        AddPoint(fCloudiness, tm, fReportPyro->GetCloudiness());
     186        AddPoint(fTempAir,    tm, fReportPyro->GetTempAir());
     187        AddPoint(fTempSky,    tm, fReportPyro->GetTempSky()-200);
     188    }
    154189
    155190    return kTRUE;
     
    204239// Draw an axis on the right side of the histogram
    205240//
    206 void MHWeather::DrawRightAxis(const char *title) const
     241void MHWeather::DrawRightAxis(const char *title, Int_t col) const
    207242{
    208243    TGaxis *axis = new TGaxis(gPad->GetUxmax(), gPad->GetUymin(),
    209244                              gPad->GetUxmax(), gPad->GetUymax(),
    210245                              0, 1, 510, "+L");
     246    axis->SetBit(TAxis::kRotateTitle);
    211247    axis->SetName("RightAxis");
    212248    axis->SetTitle(title);
    213     axis->SetTitleOffset(0.9);
    214     axis->SetTextColor(kRed);
     249    axis->SetTitleOffset(1.2);
     250    axis->SetTextColor(col);
    215251    axis->SetBit(kCanDelete);
    216252    axis->Draw();
     
    236272    gPad->SetGridx();
    237273    gPad->SetGridy();
    238     fHumidity.Draw("AP");
    239     fTemperature.Draw("P");
    240     DrawRightAxis("T [\\circ C]");
     274    fTemperature.Draw("AP");
     275    fTempAir.Draw("P");
     276    fTempSky.Draw("P");
     277    DrawRightAxis("T_{sky}-200 [K]", kBlue);
    241278
    242279    pad->cd(2);
     
    244281    gPad->SetGridx();
    245282    gPad->SetGridy();
    246     fSolarRadiation.Draw("AP");
     283    fHumidity.Draw("AP");
     284    fCloudiness.Draw("P");
     285    DrawRightAxis("Cloudiness [%]");
    247286
    248287    pad->cd(3);
     
    250289    gPad->SetGridx();
    251290    gPad->SetGridy();
    252     fEventRate.Draw("AP");
     291    fWindSpeed.Draw("AP");
    253292
    254293    pad->cd(4);
     
    256295    gPad->SetGridx();
    257296    gPad->SetGridy();
    258     fWindSpeed.Draw("AP");
     297    fEventRate.Draw("AP");
    259298}
    260299
     
    267306        fHumidity.SetMaximum(100);
    268307    }
     308    if (fCloudiness.GetN()>0)
     309    {
     310        fCloudiness.SetMinimum(0);
     311        fCloudiness.SetMaximum(100);
     312    }
     313
    269314    if (fTemperature.GetN()>0)
    270315    {
    271         fTemperature.SetMinimum(-25);
    272         fTemperature.SetMaximum(45);
     316        fTemperature.SetMinimum(-2.5);
     317        fTemperature.SetMaximum(27.5);
     318    }
     319    if (fTempSky.GetN()>0)
     320    {
     321        fTempSky.SetMinimum(-2.5);
     322        fTempSky.SetMaximum(27.5);
    273323    }
    274324    if (fWindSpeed.GetN()>0)
    275325        fWindSpeed.SetMinimum(0);
    276     if (fSolarRadiation.GetN()>0)
    277         fSolarRadiation.SetMinimum(0);
    278326    if (fEventRate.GetN()>0)
    279327        fEventRate.SetMinimum(0);
    280328
    281     DrawGraph(fHumidity,       "H [%]");
    282     DrawGraph(fSolarRadiation, "R [W/m^{2}]");
    283     DrawGraph(fTemperature,    "T [\\circ C]");
    284     DrawGraph(fWindSpeed,      "km/h");
    285     DrawGraph(fEventRate,      "f [Hz]");
    286 
    287     gPad->cd(1);
    288 
     329    DrawGraph(fHumidity,    "Humidity [%]");
     330    DrawGraph(fTemperature, "T [\\circ C]");
     331    DrawGraph(fWindSpeed,   "km/h");
     332    DrawGraph(fEventRate,   "f [Hz]");
     333    DrawGraph(fCloudiness,  "Cloudiness [%]");
     334    DrawGraph(fTempAir,     "T [\\circ C]");
     335    DrawGraph(fTempSky,     "T_{sky}-200 [K]");
     336
     337    TVirtualPad *p = gPad;
     338
     339    p->cd(1);
    289340    if (gPad)
    290341    {
     342        fTemperature.GetHistogram()->GetYaxis()->SetTitleColor(kRed);
     343        //fTempSky.GetHistogram()->GetYaxis()->SetTitleColor(kBlue);
     344        UpdateRightAxis(fTemperature); // Primary axis
     345    }
     346
     347    p->cd(2);
     348    if (gPad)
     349    {
    291350        fHumidity.GetHistogram()->GetYaxis()->SetTitleColor(kBlue);
    292         UpdateRightAxis(fTemperature);
    293     }
    294 }
     351        fHumidity.GetHistogram()->GetYaxis()->SetTitleOffset(1.2);
     352        UpdateRightAxis(fHumidity);    // Primary axis
     353    }
     354}
  • trunk/MagicSoft/Mars/mhist/MHWeather.h

    r7035 r8934  
    1010
    1111class MReportCC;
     12class MReportPyrometer;
    1213class MEventRate;
    1314
     
    1516{
    1617private:
    17     TGraph fHumidity;        //
    18     TGraph fTemperature;     //
    19     TGraph fWindSpeed;       //
    20     TGraph fSolarRadiation;  //
    21     TGraph fEventRate;       //
     18    TGraph fHumidity;        // Humidity from weather station
     19    TGraph fTemperature;     // Temperature from weather station
     20    TGraph fWindSpeed;       // Wind Speed from weather station
    2221
    23     MReportCC  *fReport;     //!
    24     MEventRate *fRate;       //!
     22    TGraph fEventRate;       // Event rate from event times
     23
     24    TGraph fCloudiness;      // Cloudiness from Pyrometer
     25    TGraph fTempAir;         // Temperature of the air from Pyrometer
     26    TGraph fTempSky;         // Temperature of the sky from Pyrometer
     27
     28    MReportCC        *fReportCC;    //! CC report with data from weather station
     29    MReportPyrometer *fReportPyro;  //! Pyrometer report
     30    MEventRate       *fRate;        //! Event rate
    2531
    2632    void ResetGraph(TGraph &g) const;
     
    2935    void DrawGraph(TGraph &g, const char *y=0) const;
    3036    void UpdateRightAxis(TGraph &g) const;
    31     void DrawRightAxis(const char *title) const;
     37    void DrawRightAxis(const char *title, Int_t col=kBlack) const;
    3238
    3339public:
     
    3743    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
    3844
     45    // If this is needed be aware that it would be called twice in star
     46    // Bool_t Finalize()
     47
    3948    void Draw(Option_t *opt="");
    4049    void Paint(Option_t *opt="");
    4150
    42     ClassDef(MHWeather, 1) // Histogram to display weather data
     51    ClassDef(MHWeather, 2) // Histogram to display weather and pyrometer data
    4352};
    4453
  • trunk/MagicSoft/Mars/mjobs/MJStar.cc

    r8933 r8934  
    338338        write.AddTree("Starguider", kFALSE);
    339339        write.AddTree("Pyrometer",  kFALSE);
    340         writet.AddTree("EffectiveOnTime");
     340        writet.AddContainer("MEffectiveOnTime",     "EffectiveOnTime");
     341        writet.AddContainer("MTimeEffectiveOnTime", "EffectiveOnTime");
    341342    }
    342343
     
    474475    //filltst.SetNameTab("Test");
    475476
    476     MFillH fillw("MHWeather", "MTimeCC", "FillWeather");
     477    MFillH fillw1("MHWeather", "MTimeCC",        "FillWeather");
     478    MFillH fillw2("MHWeather", "MTimePyrometer", "FillPyrometer");
     479    fillw2.SetBit(MFillH::kDoNotDisplay);
    477480
    478481    // instantiate camera histogram containers
     
    504507    {
    505508        // initiate task list
    506         tlist.AddToList(&fillw,   "CC");
     509        tlist.AddToList(&fillw1,  "CC");
     510        tlist.AddToList(&fillw2,  "Pyrometer");
    507511        tlist.AddToList(&fillp1,  "Drive");
    508512        tlist.AddToList(&fillp2,  "Starguider");
  • trunk/MagicSoft/Mars/mreport/MReportPyrometer.cc

    r8933 r8934  
    4343// is expected.
    4444//
    45 MReportPyrometer::MReportPyrometer() : MReport("PYRO-REPORT", kFALSE),
     45MReportPyrometer::MReportPyrometer() : MReport("PYRO-REPORT"),
    4646    fTempSky(-1), fTempAir(-1), fCloudiness(-1), fLidOpen(kFALSE)
    4747
     
    7272
    7373    str.Remove(0, len);
     74    str = str.Strip(TString::kBoth);
    7475
    75     return str.Strip(TString::kBoth).IsNull() ? kTRUE : kCONTINUE;
     76    return str=="OVER" ? kTRUE : kCONTINUE;
    7677}
Note: See TracChangeset for help on using the changeset viewer.