Changeset 12880 for trunk/Mars


Ignore:
Timestamp:
02/09/12 11:04:57 (13 years ago)
Author:
tbretz
Message:
Removed some old workarounds hopefully not necessary anymor with newer root version -- tested with 5.32.00 so far.
Location:
trunk/Mars/mhvstime
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mhvstime/MHPixVsTime.cc

    r9153 r12880  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2004
     18!   Author(s): Thomas Bretz, 12/2002 <mailto:thomas.bretz@epfl.ch>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2012
    2121!
    2222!
     
    214214void MHPixVsTime::Draw(Option_t *opt)
    215215{
    216 
    217     if (fGraph->GetN()==0)
    218         return;
    219 
    220216    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
    221217    pad->SetBorderMode(0);
     218    pad->SetGrid();
    222219
    223220    AppendPad("");
    224 
    225     TString str(opt);
    226221
    227222    // This is not done automatically anymore since root 5.12/00
    228223    // and it is necessary to force a proper update of the axis.
    229224    TH1 *h = fGraph->GetHistogram();
    230     if (h)
    231     {
    232         delete h;
    233         fGraph->SetHistogram(0);
    234         h = fGraph->GetHistogram();
    235     }
    236225
    237226    h->SetXTitle("Time");
     227
    238228    if (!fNameTime.IsNull())
    239229    {
     
    244234    }
    245235
    246 
     236    TString str(opt);
    247237    if (!str.Contains("A"))
    248238        str += "A";
     
    257247
    258248    fGraph->Draw(str);
    259 
    260     pad->Modified();
    261     pad->Update();
    262 }
     249}
  • trunk/Mars/mhvstime/MHPixVsTime.h

    r9153 r12880  
    6161
    6262#endif
    63 
    64 
    65 
  • trunk/Mars/mhvstime/MHSectorVsTime.cc

    r10166 r12880  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2006
     18!   Author(s): Thomas Bretz, 3/2004 <mailto:thomas.bretz@epfl.ch>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2012
    2121!
    2222!
     
    282282}
    283283
    284 void MHSectorVsTime::Paint(Option_t *opt)
    285 {
    286     if (!fGraph)
    287         return;
    288 
    289     if (fGraph->GetN()==0)
    290         return;
     284// --------------------------------------------------------------------------
     285//
     286// This displays the TGraph like you expect it to be (eg. time on the axis)
     287// It should also make sure, that the displayed time always is UTC and
     288// not local time...
     289//
     290void MHSectorVsTime::Draw(Option_t *opt)
     291{
     292    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
     293    pad->SetBorderMode(0);
     294    pad->SetGrid();
     295
     296    AppendPad("");
     297
     298    // This is not done automatically anymore since root 5.12/00
     299    // and it is necessary to force a proper update of the axis.
     300    TH1 *h = fGraph->GetHistogram();
     301
     302    h->SetXTitle("Time");
     303
     304    if (!fNameTime.IsNull())
     305    {
     306        TAxis *axe = h->GetXaxis();
     307        axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
     308        axe->SetTimeDisplay(1);
     309        axe->SetLabelSize(0.033);
     310        h->GetYaxis()->SetTitleOffset(1.15);
     311    }
     312
     313    // If this is set to early the plot remains empty in root 5.12/00
     314    if (fMinimum!=-1111)
     315        fGraph->SetMinimum(fMinimum);
     316    if (fMaximum!=-1111)
     317        fGraph->SetMaximum(fMaximum);
    291318
    292319    TString str(opt);
     
    301328    }
    302329
    303     // This is not done automatically anymore since root 5.12/00
    304     // and it is necessary to force a proper update of the axis.
    305     TH1 *h = fGraph->GetHistogram();
    306     if (h)
    307     {
    308         delete h;
    309         fGraph->SetHistogram(0);
    310         h = fGraph->GetHistogram();
    311     }
    312 
    313     h->SetXTitle("Time");
    314 
    315     if (!fNameTime.IsNull())
    316     {
    317         TAxis *axe = h->GetXaxis();
    318         axe->SetTimeFormat("%H:%M %F1995-01-01 00:00:00 GMT");
    319         axe->SetTimeDisplay(1);
    320         axe->SetLabelSize(0.033);
    321         h->GetYaxis()->SetTitleOffset(1.15);
    322     }
    323 
    324     // If this is set to early the plot remains empty in root 5.12/00
    325     if (fMinimum!=-1111)
    326         fGraph->SetMinimum(fMinimum);
    327     if (fMaximum!=-1111)
    328         fGraph->SetMaximum(fMaximum);
    329 
    330     // This is a workaround if the TGraph has only one point.
    331     // Otherwise MStatusDisplay::Update hangs.
    332     gPad->GetListOfPrimitives()->Remove(fGraph);
    333     fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
    334 }
    335 
    336 // --------------------------------------------------------------------------
    337 //
    338 // This displays the TGraph like you expect it to be (eg. time on the axis)
    339 // It should also make sure, that the displayed time always is UTC and
    340 // not local time...
    341 //
    342 void MHSectorVsTime::Draw(Option_t *opt)
    343 {
    344     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
    345     pad->SetBorderMode(0);
    346     pad->SetGridx();
    347     pad->SetGridy();
    348     AppendPad(opt);
     330    fGraph->Draw(str.Data());
    349331}
    350332
  • trunk/Mars/mhvstime/MHSectorVsTime.h

    r9303 r12880  
    8585
    8686    void Draw(Option_t *o=NULL);
    87     void Paint(Option_t *o=NULL);
    8887
    8988    void RecursiveRemove(TObject *obj);
  • trunk/Mars/mhvstime/MHVsTime.cc

    r9369 r12880  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz, 11/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    19 !
    20 !   Copyright: MAGIC Software Development, 2000-2007
     18!   Author(s): Thomas Bretz, 11/2003 <mailto:thomas.bretz@epfl.ch>
     19!
     20!   Copyright: MAGIC Software Development, 2000-2012
    2121!
    2222!
     
    112112
    113113    fGraph = error ? new TGraphErrors : new TGraph;
    114     fGraph->SetPoint(0, 0, 0); // Dummy point!
    115     fGraph->SetEditable();     // Used as flag: First point? yes/no
    116114    fGraph->SetMarkerStyle(kFullDotMedium);
    117115}
     
    161159    if (fError && !fError->PreProcess(plist))
    162160        return kFALSE;
    163 
    164     fGraph->Set(1);
    165     fGraph->SetPoint(0, 0, 0); // Dummy point!
    166     fGraph->SetEditable();     // Used as flag: First point? yes/no
    167161
    168162    TString title(fData ? GetRule() : (TString)"Graph");
     
    245239    if (fN==fNumEvents)
    246240    {
     241        /*
    247242        if ((fMaxPts>0 && fGraph->GetN()>fMaxPts) || fGraph->IsEditable())
    248243        {
    249244            fGraph->RemovePoint(0);
    250245            fGraph->SetEditable(kFALSE);
    251         }
     246        }*/
    252247
    253248        const Double_t val = fMean/fN*fScale;
     
    284279}
    285280
    286 void MHVsTime::Paint(Option_t *opt)
    287 {
    288     if (!fGraph)
    289         return;
    290 
    291     if (fGraph->GetN()==0)
    292         return;
    293 
    294     TString str(opt);
    295     if (!str.Contains("A"))
    296         str += "A";
    297     if (!str.Contains("P"))
    298         str += "P";
    299     if (str.Contains("same", TString::kIgnoreCase))
    300     {
    301         str.ReplaceAll("same", "");
    302         str.ReplaceAll("A", "");
    303     }
     281// --------------------------------------------------------------------------
     282//
     283// This displays the TGraph like you expect it to be (eg. time on the axis)
     284// It should also make sure, that the displayed time always is UTC and
     285// not local time...
     286//
     287void MHVsTime::Draw(Option_t *opt)
     288{
     289    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
     290    pad->SetBorderMode(0);
     291    pad->SetGrid();
     292
     293    AppendPad("");
    304294
    305295    // This is not done automatically anymore since root 5.12/00
    306296    // and it is necessary to force a proper update of the axis.
    307297    TH1 *h = fGraph->GetHistogram();
    308     if (h)
    309     {
    310         delete h;
    311         fGraph->SetHistogram(0);
    312         h = fGraph->GetHistogram();
    313     }
     298
    314299    if (h)
    315300    {
     
    336321        fGraph->SetMaximum(fMaximum);
    337322
    338 
    339     // This is a workaround if the TGraph has only one point.
    340     // Otherwise MStatusDisplay::Update hangs.
    341     gPad->GetListOfPrimitives()->Remove(fGraph);
    342     fGraph->Draw(fGraph->GetN()<2 ? "A" : str.Data());
    343 }
    344 
    345 // --------------------------------------------------------------------------
    346 //
    347 // This displays the TGraph like you expect it to be (eg. time on the axis)
    348 // It should also make sure, that the displayed time always is UTC and
    349 // not local time...
    350 //
    351 void MHVsTime::Draw(Option_t *opt)
    352 {
    353     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
    354     pad->SetBorderMode(0);
    355     AppendPad(opt);
     323    TString str(opt);
     324    if (!str.Contains("A"))
     325        str += "A";
     326    if (!str.Contains("P"))
     327        str += "P";
     328    if (str.Contains("same", TString::kIgnoreCase))
     329    {
     330        str.ReplaceAll("same", "");
     331        str.ReplaceAll("A", "");
     332    }
     333
     334    fGraph->Draw(str.Data());
    356335}
    357336
  • trunk/Mars/mhvstime/MHVsTime.h

    r9153 r12880  
    8282
    8383    void Draw(Option_t *opt=NULL);
    84     void Paint(Option_t *opt=NULL);
    8584
    8685    MParContainer *New() const;
Note: See TracChangeset for help on using the changeset viewer.