Ignore:
Timestamp:
11/22/03 21:14:14 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mhist
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhist/MFillH.cc

    r2556 r2557  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
     18!   Author(s): Thomas Bretz, 07/2001 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
     
    155155
    156156    AddToBranchList(Form("%s.*", (const char*)ExtractName(hist)));
    157     AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
     157    if (par)
     158        AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
    158159
    159160    if (title)
     
    224225
    225226    AddToBranchList(fH->GetDataMember());
    226     AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
     227    if (par)
     228        AddToBranchList(Form("%s.*", (const char*)ExtractName(par)));
    227229
    228230    if (title)
  • trunk/MagicSoft/Mars/mhist/MHCamera.cc

    r2550 r2557  
    568568    Update(gPad->GetLogy(), isbox, iscol);
    569569    PaintAxisTitle();
     570
     571    if (opt.Contains("pixelindex"))
     572        PaintIndices(kFALSE);
     573    if (opt.Contains("sectorindex"))
     574        PaintIndices(kTRUE);
    570575}
    571576
     
    627632}
    628633
    629 void MHCamera::DrawPixelIndices()
     634void MHCamera::PaintIndices(Bool_t sector)
    630635{
    631636    if (fNcells<=1)
    632637        return;
    633 
    634     // FIXME: Is this correct?
    635     for (int i=0; i<kItemsLegend; i++)
    636         fColors[i] = 16;
    637 
    638     if (!gPad)
    639         Draw();
    640638
    641639    TText txt;
     
    645643    for (Int_t i=0; i<fNcells-2; i++)
    646644    {
     645        const MGeomPix &h = (*fGeomCam)[i];
     646
    647647        TString num;
    648         num += i;
    649 
    650         const MGeomPix &h = (*fGeomCam)[i];
    651         TText *nt = txt.DrawText(h.GetX(), h.GetY(), num);
    652         nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
    653     }
    654 }
    655 
    656 void MHCamera::DrawSectorIndices()
    657 {
    658     if (fNcells<=1)
    659         return;
    660 
    661     for (int i=0; i<kItemsLegend; i++)
    662         fColors[i] = 16;
    663 
    664     if (!gPad)
    665         Draw();
    666 
    667     TText txt;
    668     txt.SetTextFont(122);
    669     txt.SetTextAlign(22);   // centered/centered
    670 
    671     for (Int_t i=0; i<fNcells-2; i++)
    672     {
    673         TString num;
    674         num += (*fGeomCam)[i].GetSector();
    675 
    676         const MGeomPix &h = (*fGeomCam)[i];
    677         TText *nt = txt.DrawText(h.GetX(), h.GetY(), num);
    678         nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
     648        num += sector ? h.GetSector() : i;
     649
     650        txt.SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()/1.05);
     651        txt.PaintText(h.GetX(), h.GetY(), num);
    679652    }
    680653}
  • trunk/MagicSoft/Mars/mhist/MHCamera.h

    r2484 r2557  
    5959    Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog);
    6060
     61    void  PaintIndices(Bool_t sector);
    6162    void  Update(Bool_t islog, Bool_t isbox, Bool_t iscol);
    6263    void  UpdateLegend(Float_t min, Float_t max, Bool_t islog);
     
    144145    void  FillRandom(TH1 *h, Int_t ntimes=5000) { TH1::FillRandom(h, ntimes); }
    145146    void  FillRandom();
    146 
    147     void  DrawPixelIndices();
    148     void  DrawSectorIndices();
    149147
    150148    void  PrintInfo() const { Print(""); } // *MENU*
  • trunk/MagicSoft/Mars/mhist/MHVsTime.cc

    r2556 r2557  
    6060//
    6161MHVsTime::MHVsTime(const char *rule)
    62     : fHist(NULL), fData(NULL), fScale(1)
     62    : fGraph(NULL), fData(NULL), fScale(1)
    6363
    6464    fName  = gsDefName;
     
    6868        return;
    6969
    70     fHist = new TGraph;
     70    fGraph = new TGraph;
    7171    fData = new MDataChain(rule);
    7272}
     
    7878MHVsTime::~MHVsTime()
    7979{
    80     if (fHist)
    81         delete fHist;
     80    if (fGraph)
     81        delete fGraph;
    8282
    8383    if (fData)
     
    9292TString MHVsTime::GetDataMember() const
    9393{
    94     *fLog << dbg << fData->GetDataMember() << endl;
    9594    return fData ? fData->GetDataMember() : (TString)"";
    9695}
     
    105104{
    106105    // reset histogram (necessary if the same eventloop is run more than once)
    107     //fHist->Reset();
     106    //fGraph->Reset();
    108107
    109108    if (fData && !fData->PreProcess(plist))
    110109        return kFALSE;
    111110
    112     if (fHist)
     111    if (fGraph)
    113112    {
    114         delete fHist;
    115         fHist = new TGraph;
     113        delete fGraph;
     114        fGraph = new TGraph;
    116115    }
    117116
     
    119118    title += " vs Time";
    120119
    121     fHist->SetNameTitle(fName, title);
     120    fGraph->SetNameTitle(fName, title);
    122121
    123122    return kTRUE;
     
    130129void MHVsTime::SetName(const char *name)
    131130{
    132     fHist->SetName(name);
     131    fGraph->SetName(name);
    133132    MParContainer::SetName(name);
    134133}
     
    140139void MHVsTime::SetTitle(const char *title)
    141140{
    142     fHist->SetTitle(title);
     141    fGraph->SetTitle(title);
    143142    MParContainer::SetTitle(title);
    144143}
     
    160159    const Double_t T = (*t);///3600;
    161160
    162     fHist->SetPoint(fHist->GetN(), T>12*3600?T-24*3600:T, v);
     161    fGraph->SetPoint(fGraph->GetN(), T>12*3600?T-24*3600:T, v);
    163162
    164163    return kTRUE;
     
    182181void MHVsTime::Draw(Option_t *opt)
    183182{
    184     if (fHist->GetN()==0)
     183    if (fGraph->GetN()==0)
    185184        return;
    186185
    187     TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fHist);
     186    TVirtualPad *pad = gPad ? gPad : MakeDefCanvas(fGraph);
    188187    pad->SetBorderMode(0);
    189188
     
    192191    TString str(opt);
    193192
    194     fHist->GetHistogram()->SetXTitle("Time");
    195     fHist->GetHistogram()->SetYTitle(GetRule());
    196     fHist->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
    197     fHist->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
    198     fHist->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
    199     fHist->Draw("AP");
    200     if (fHist->TestBit(kIsLogy))
     193    fGraph->GetHistogram()->SetXTitle("Time");
     194    fGraph->GetHistogram()->SetYTitle(GetRule());
     195    fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
     196    fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
     197    fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
     198    fGraph->Draw("AP");
     199    if (fGraph->TestBit(kIsLogy))
    201200        pad->SetLogy();
    202201
     
    229228Int_t MHVsTime::GetNbins() const
    230229{
    231     return fHist->GetN();
    232 }
    233 
     230    return fGraph->GetN();
     231}
     232/*
    234233TH1 *MHVsTime::GetHist()
    235234{
    236     return fHist ? fHist->GetHistogram() : 0;
     235    return fGraph ? fGraph->GetHistogram() : 0;
    237236}
    238237
    239238const TH1 *MHVsTime::GetHist() const
    240239{
    241     return fHist ? fHist->GetHistogram() : 0;
     240    return fGraph ? fGraph->GetHistogram() : 0;
    242241}
    243242
     
    246245    return GetHist();
    247246}
     247*/
  • trunk/MagicSoft/Mars/mhist/MHVsTime.h

    r2556 r2557  
    1313protected:
    1414    // Could be const but root < 3.02/06 doesn't like this...
    15     TGraph     *fHist;  // Histogram to fill
     15    TGraph     *fGraph;  // Histogram to fill
    1616    MDataChain *fData;  // Object from which the data is filled
    1717    Double_t    fScale; // Scale for axis (eg unit)
     
    3838    TString GetRule() const;
    3939
    40     const TH1 *GetHist() const;
    41     TH1 *GetHist();
    42     TH1 *GetHistByName(const TString name="");
     40    /*
     41//    const TH1 *GetHist() const;
     42//    TH1 *GetHist();
     43//    TH1 *GetHistByName(const TString name="");
     44*/
     45    const TGraph *GetGraph() const { return fGraph; }
     46    TGraph *GetGraph() { return fGraph; }
     47
    4348
    4449    void Draw(Option_t *opt=NULL);
Note: See TracChangeset for help on using the changeset viewer.