Ignore:
Timestamp:
09/09/04 10:51:39 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhvstime
Files:
6 edited

Legend:

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

    r4889 r4891  
    1818!   Author(s): Thomas Bretz, 12/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2003
     20!   Copyright: MAGIC Software Development, 2000-2004
    2121!
    2222!
     
    2828//
    2929// Display the pixel content versus time or event number
     30//
     31// Axis titles
     32// ===========
     33//
     34// 1) If no other title is given the rule for the y-axis is used.
     35// 2) If the MH3 has a non-default title (MH3::SetTitle called)
     36//    this title is set as the histogram title. It can be used to overwrite
     37//    the axis titles. For more information see TH1::SetTitle, eg.
     38//       SetTitle("MyGraph;;Counts");
     39//    The title for the x-axis is ignored and set automatically (MAKE SURE
     40//    YOU HAVE TWO SEMICOLON!)
    3041//
    3142/////////////////////////////////////////////////////////////////////////////
     
    4859
    4960using namespace std;
     61
     62const TString MHPixVsTime::gsDefName  = "MHPixVsTime";
     63const TString MHPixVsTime::gsDefTitle = "Graph of pixel content vs. time";
    5064
    5165// --------------------------------------------------------------------------
     
    5973    //   set the name and title of this object
    6074    //
    61     fName  = name  ? name  : "MHPixVsTime";
    62     fTitle = title ? title : "Average of MPixVsTimes";
     75    fName  = name  ? name  : gsDefName.Data();
     76    fTitle = title ? title : gsDefTitle.Data();
    6377
    6478    TString t("Pixel Index #");
     
    7791MHPixVsTime::~MHPixVsTime()
    7892{
    79   if(fGraph)
    80     delete fGraph;
     93    if (fGraph)
     94        delete fGraph;
     95}
     96
     97// --------------------------------------------------------------------------
     98//
     99// Set the name of the TGraph and the MHPixVsTime container
     100//
     101void MHPixVsTime::SetName(const char *name)
     102{
     103    fGraph->SetName(name);
     104    MParContainer::SetName(name);
     105}
     106
     107// --------------------------------------------------------------------------
     108//
     109// Set the title of the TGraph and the MHPixVsTime container
     110//
     111void MHPixVsTime::SetTitle(const char *title)
     112{
     113    fGraph->SetTitle(title);
     114    MParContainer::SetTitle(title);
    81115}
    82116
     
    124158    }
    125159
     160    if (fTitle!=gsDefTitle)
     161        fGraph->SetTitle(fTitle);
     162
    126163    return kTRUE;
    127164}
     
    190227
    191228    h->SetXTitle("Time");
    192     h->SetYTitle("");
    193229    if (!fNameTime.IsNull())
    194230    {
  • trunk/MagicSoft/Mars/mhvstime/MHPixVsTime.h

    r3394 r4891  
    2020{
    2121private:
     22    static const TString gsDefName;
     23    static const TString gsDefTitle;
     24
    2225    TGraphErrors *fGraph;
    2326    Int_t fIndex;
     
    4649    void SetType(Int_t type, Int_t e=-1) { fType = type; fTypeErr=e; }
    4750
     51    void SetName(const char *name);
     52    void SetTitle(const char *title);
     53
    4854    TH1 *GetHistByName(const TString name="");
    4955    TGraph *GetGraph() { return fGraph; }
  • trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.cc

    r4889 r4891  
    3030// single sector
    3131//
     32// 1) If no other title is given the rule for the y-axis is used.
     33// 2) If the MH3 has a non-default title (MH3::SetTitle called)
     34//    this title is set as the histogram title. It can be used to overwrite
     35//    the axis titles. For more information see TH1::SetTitle, eg.
     36//       SetTitle("MyGraph;;Counts");
     37//    The title for the x-axis is ignored and set automatically (MAKE SURE
     38//    YOU HAVE TWO SEMICOLON!)
     39//
    3240/////////////////////////////////////////////////////////////////////////////
    3341#include "MHSectorVsTime.h"
     
    5058
    5159using namespace std;
     60
     61const TString MHSectorVsTime::gsDefName  = "MSectorHVsTime";
     62const TString MHSectorVsTime::gsDefTitle = "Graph of sector mean vs. time";
    5263
    5364// --------------------------------------------------------------------------
     
    6273    //   set the name and title of this object
    6374    //
    64     fName  = name  ? name  : "MHSectorVsTime";
    65     fTitle = title ? title : "Sector mean vs time";
     75    fName  = name  ? name  : gsDefName.Data();
     76    fTitle = title ? title : gsDefTitle.Data();
    6677}
    6778
     
    7586        delete fGraph;
    7687}
     88
     89// --------------------------------------------------------------------------
     90//
     91// Set the name of the TGraph and the MHVsTime container
     92//
     93void MHSectorVsTime::SetName(const char *name)
     94{
     95    fGraph->SetName(name);
     96    MParContainer::SetName(name);
     97}
     98
     99// --------------------------------------------------------------------------
     100//
     101// Set the title of the TGraph and the MHVsTime container
     102//
     103void MHSectorVsTime::SetTitle(const char *title)
     104{
     105    fGraph->SetTitle(title);
     106    MParContainer::SetTitle(title);
     107}
     108
    77109
    78110// --------------------------------------------------------------------------
     
    127159    fGraph = fTypeErr<0 ? new TGraph : new TGraphErrors;
    128160    fGraph->SetName(fEvt ? dynamic_cast<TObject*>(fEvt)->GetName() : "MCamEvent");
    129     fGraph->SetTitle("Camera");
     161    fGraph->SetTitle(fTitle==gsDefTitle?"Camera":fTitle);
    130162
    131163    fMin =  FLT_MAX;
     
    206238void MHSectorVsTime::Draw(Option_t *opt)
    207239{
    208     /*
     240    if (!fGraph)
     241        return;
     242
    209243    if (fGraph->GetN()==0)
    210244        return;
    211         */
    212 
    213     if (fGraph->GetN()==0)
    214         return;
    215245
    216246    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(this);
     
    220250
    221251    TString str(opt);
    222     /*
    223     fGraph->GetHistogram()->SetXTitle("Time");
    224     fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S %F1995-01-01 00:00:00");
    225     fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
    226     fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
    227 
    228     fGraph->GetHistogram()->SetYTitle("");
    229      */
     252
    230253    if (!str.Contains("A"))
    231254        str += "A";
     
    242265
    243266    h->SetXTitle("Time");
    244     h->SetYTitle("");
    245267
    246268    if (!fNameTime.IsNull())
     
    252274    }
    253275
    254     *fLog << dbg << "Draw: " << str << endl;
    255276    fGraph->Draw(str);
    256 /*
    257     str.ReplaceAll("same", "");
    258     str.ReplaceAll("A", "");
    259 
    260     Int_t i=-1;
    261     Int_t col=kRed;
    262     while ((g=(TGraphErrors*)Next()))
    263     {
    264         i++;
    265         *fLog << dbg << "Check" << i << ": " << str << endl;
    266 
    267         while ((fMinSector>=0 && i<fMinSector) || (fMaxSector>=0 && i>fMaxSector))
    268             i++;
    269 
    270         h = g->GetHistogram();
    271         g->SetLineColor(col++);
    272 
    273         *fLog << dbg << "Draw" << i << ": " << g->GetTitle() << endl;
    274         g->Draw(str);
    275 
    276     }
    277 
    278     pad->Modified();
    279     pad->Update();*/
    280 }
     277}
  • trunk/MagicSoft/Mars/mhvstime/MHSectorVsTime.h

    r3394 r4891  
    2020class MHSectorVsTime : public MH
    2121{
     22private:
     23    static const TString gsDefName;
     24    static const TString gsDefTitle;
     25
    2226private:
    2327    TGraph *fGraph;
     
    5155    ~MHSectorVsTime();
    5256
     57    void SetName(const char *name);
     58    void SetTitle(const char *title);
     59
    5360    void SetNameEvt(const TString name)  { fNameEvt = name; }
    5461    void SetNameTime(const TString name) { fNameTime = name; }
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.cc

    r4889 r4891  
    2929// Use this class if you want to display any rule vs time (or event number)
    3030//
     31// Axis titles
     32// ===========
     33//
     34// 1) If no other title is given the rule for the y-axis is used.
     35// 2) If the MH3 has a non-default title (MH3::SetTitle called)
     36//    this title is set as the histogram title. It can be used to overwrite
     37//    the axis titles. For more information see TH1::SetTitle, eg.
     38//       SetTitle("MyGraph;;Counts");
     39//    The title for the x-axis is ignored and set automatically (MAKE SURE
     40//    YOU HAVE TWO SEMICOLON!)
     41//
    3142// eg.
    3243//       MHVsTime hist("MHillas.fAlpha");
     
    6374using namespace std;
    6475
    65 static const TString gsDefName  = "MHVsTime";
    66 static const TString gsDefTitle = "Container for a graph vs time/evtnumber";
     76const TString MHVsTime::gsDefName  = "MHVsTime";
     77const TString MHVsTime::gsDefTitle = "Container for a graph vs time/evtnumber";
    6778
    6879// --------------------------------------------------------------------------
     
    89100    fGraph->SetPoint(0, 0, 0); // Dummy point!
    90101    fGraph->SetEditable();     // Used as flag: First point? yes/no
     102    fGraph->SetMarkerStyle(kFullDotMedium);
    91103}
    92104
     
    137149    fGraph->SetEditable();     // Used as flag: First point? yes/no
    138150
    139     TString title(fData ? GetRule() : (TString)"Histogram");
     151
     152    TString title(fData ? GetRule() : (TString)"Graph");
    140153    title += " vs ";
    141154    title += fUseEventNumber ? "Event Number" : "Time";
    142155
    143     fGraph->SetNameTitle(fName, title);
     156    fGraph->SetNameTitle(fName, fTitle==gsDefTitle?title:fTitle);
    144157
    145158    fMean = 0;
     
    245258    }
    246259
    247     fGraph->GetHistogram()->SetMarkerStyle(kFullDotMedium);
    248     fGraph->GetHistogram()->SetYTitle(fAxisTitle.IsNull() ? GetRule() : fAxisTitle);
    249     if (fTitle!=gsDefTitle)
    250         fGraph->GetHistogram()->SetTitle(fTitle);
    251 
    252260    if (TestBit(kIsLogy))
    253261        gPad->SetLogy();
  • trunk/MagicSoft/Mars/mhvstime/MHVsTime.h

    r4889 r4891  
    1515class MHVsTime : public MH
    1616{
     17private:
     18    static const TString gsDefName;
     19    static const TString gsDefTitle;
     20
    1721protected:
    1822    // Could be const but root < 3.02/06 doesn't like this...
     
    2933    Int_t       fN;         //! Number of entries in fMean
    3034    MTime       fLast;      //! For checks
    31 
    32     TString     fAxisTitle;
    3335
    3436    enum {
     
    5052
    5153    void SetLogy(Bool_t b=kTRUE) { b ? SetBit(kIsLogy) : ResetBit(kIsLogy); }
    52     void SetAxisTitle(const char *y) { fAxisTitle=y; }
    5354
    5455    Bool_t SetupFill(const MParList *pList);
Note: See TracChangeset for help on using the changeset viewer.