Ignore:
Timestamp:
07/22/05 13:18:44 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhvstime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc

    r6977 r7210  
    3838//    YOU HAVE TWO SEMICOLON!)
    3939//
     40// Example:
     41// --------
     42//     // Initialize histogram
     43//     MHSectorVsTime hist1;
     44//     hist1.SetNameTime("MTimeCurrents");
     45//     hist1.SetTitle("Title for your Graph;;Q [phe]");
     46//
     47//     // Define sectors you want to display the mean from
     48//     TArrayI s0(3);
     49//     s0[0] = 6;
     50//     s0[1] = 1;
     51//     s0[2] = 2;
     52//
     53//     // Define area index [0=inner, 1=outer]
     54//     TArrayI inner(1);
     55//     inner[0] = 0;
     56//
     57//     // Don't call this if you want to have all sectors
     58//     hist1.SetSectors(s0);
     59//
     60//     // Don't call this if you want to have all area indices
     61//     hist1.SetAreaIndex(inner);
     62//
     63//     // Task to fill the histogram
     64//     MFillH fill1(&hist1, "MCameraDC");
     65//
     66//
    4067/////////////////////////////////////////////////////////////////////////////
    4168#include "MHSectorVsTime.h"
     
    93120void MHSectorVsTime::SetName(const char *name)
    94121{
    95     fGraph->SetName(name);
     122    if (fGraph)
     123        fGraph->SetName(name);
    96124    MParContainer::SetName(name);
    97125}
     
    103131void MHSectorVsTime::SetTitle(const char *title)
    104132{
    105     fGraph->SetTitle(title);
     133    if (fGraph)
     134        fGraph->SetTitle(title);
    106135    MParContainer::SetTitle(title);
    107136}
     
    160189    fGraph->SetName(fEvt ? dynamic_cast<TObject*>(fEvt)->GetName() : "MCamEvent");
    161190    fGraph->SetTitle(fTitle==gsDefTitle?"Camera":fTitle.Data());
     191    fGraph->SetMarkerStyle(kFullDotMedium);
    162192
    163193    fMin =  FLT_MAX;
     
    191221    const Double_t val0 = fHCamera.GetMeanSectors(fSectors, fAreaIndex);
    192222
    193     if (TMath::IsNaN(val0)/* || TMath::IsNaN(rms0)*/)
    194         return kCONTINUE;
     223    if (TMath::IsNaN(val0))
     224        return kTRUE;
    195225
    196226    fGraph->SetPoint(fGraph->GetN(), t, val0);
     
    200230        const Double_t rms0 = fHCamera.GetRmsSectors(fSectors, fAreaIndex);
    201231        if (TMath::IsNaN(rms0))
    202             return kCONTINUE;
     232            return kTRUE;
    203233        ((TGraphErrors*)fGraph)->SetPointError(fGraph->GetN()-1, 0, rms0);
    204234    }
     
    221251    fGraph->SetMaximum(fMax+add);
    222252
    223     *fLog << dbg << "Min=" << fMin << " " << fMin-add << endl;
    224     *fLog << dbg << "Max=" << fMax << " " << fMax+add << endl;
    225 
    226253    return kTRUE;
    227254}
     
    236263}
    237264
    238 void MHSectorVsTime::Draw(Option_t *opt)
     265void MHSectorVsTime::Paint(Option_t *opt)
    239266{
    240267    if (!fGraph)
     
    244271        return;
    245272
    246     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    247     pad->SetBorderMode(0);
    248 
    249     AppendPad("");
    250 
    251273    TString str(opt);
    252 
    253274    if (!str.Contains("A"))
    254275        str += "A";
    255     if (!str.Contains("L"))
    256         str += "L";
    257 
     276    if (!str.Contains("P"))
     277        str += "P";
    258278    if (str.Contains("same", TString::kIgnoreCase))
    259279    {
     
    269289    {
    270290        TAxis *axe = h->GetXaxis();
    271         axe->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00 GMT");
     291        axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
    272292        axe->SetTimeDisplay(1);
    273         axe->SetLabelSize(0.025);
    274     }
    275 
    276     fGraph->Draw(str);
    277 }
     293        axe->SetLabelSize(0.033);
     294        h->GetYaxis()->SetTitleOffset(1.15);
     295    }
     296
     297    // This is a workaround if the TGraph has only one point.
     298    // Otherwise MStatusDisplay::Update hangs.
     299    gPad->GetListOfPrimitives()->Remove(fGraph);
     300    fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
     301}
     302
     303// --------------------------------------------------------------------------
     304//
     305// This displays the TGraph like you expect it to be (eg. time on the axis)
     306// It should also make sure, that the displayed time always is UTC and
     307// not local time...
     308//
     309void MHSectorVsTime::Draw(Option_t *opt)
     310{
     311    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
     312    pad->SetBorderMode(0);
     313    AppendPad(opt);
     314}
  • trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h

    r6977 r7210  
    4747    TArrayI fAreaIndex;
    4848
     49    // MH
    4950    Bool_t SetupFill(const MParList *pList);
    5051    Bool_t Fill(const MParContainer *par, const Stat_t w=1);
     
    5556    ~MHSectorVsTime();
    5657
    57     void SetName(const char *name);
    58     void SetTitle(const char *title);
    59 
     58    // Setter
    6059    void SetNameEvt(const TString name)  { fNameEvt = name; }
    6160    void SetNameTime(const TString name) { fNameTime = name; }
     
    6463    void SetAreaIndex(const TArrayI &a)  { fAreaIndex=a; }
    6564
     65    // Getter
    6666    TH1 *GetHistByName(const TString name="") const;
    6767    //TGraph *GetGraph() { return fGraph; }
    6868
     69    // TObject
     70    void SetName(const char *name);
     71    void SetTitle(const char *title);
     72
    6973    void Draw(Option_t *o=NULL);
     74    void Paint(Option_t *o=NULL);
    7075
    7176    ClassDef(MHSectorVsTime, 1) // Histogram to sum camera events
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc

    r7033 r7210  
    291291        fGraph->GetHistogram()->SetXTitle("Time");
    292292        fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
    293         fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00 GMT");
     293        fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
    294294        fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
    295295    }
Note: See TracChangeset for help on using the changeset viewer.