Changeset 2571


Ignore:
Timestamp:
11/26/03 16:05:06 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2568 r2571  
    44
    55                                                 -*-*- END OF LINE -*-*-
     6 2003/11/26: Thomas Bretz
     7
     8   * mhist/MHVsTime.[h,cc]:
     9     - implemented usage of Event number
     10
     11
     12
    613 2003/11/25: Thomas Bretz
    714 
  • trunk/MagicSoft/Mars/mhist/MHVsTime.cc

    r2557 r2571  
    4747#include "MParList.h"
    4848#include "MDataChain.h"
     49#include "MRawEvtHeader.h"
    4950
    5051ClassImp(MHVsTime);
     
    5354
    5455static const TString gsDefName  = "MHVsTime";
    55 static const TString gsDefTitle = "Container for a graph vs time";
     56static const TString gsDefTitle = "Container for a graph vs time/evtnumber";
    5657
    5758// --------------------------------------------------------------------------
     
    116117
    117118    TString title(fData ? GetRule() : (TString)"Histogram");
    118     title += " vs Time";
     119    title += " vs ";
     120    title += fUseEventNumber ? "Event Number" : "Time";
    119121
    120122    fGraph->SetNameTitle(fName, title);
     
    149151Bool_t MHVsTime::Fill(const MParContainer *par, const Stat_t w)
    150152{
    151     const MTime *t = dynamic_cast<const MTime*>(par);
    152     if (!t)
    153     {
    154         *fLog << err << dbginf << "No MTime found..." << endl;
    155         return kFALSE;
     153    Double_t t = 0;
     154    if (fUseEventNumber)
     155    {
     156        const MRawEvtHeader *h = dynamic_cast<const MRawEvtHeader*>(par);
     157        t = h ? h->GetDAQEvtNumber() : fGraph->GetN();
     158    }
     159    else
     160    {
     161        const MTime *tm = dynamic_cast<const MTime*>(par);
     162        if (!tm)
     163        {
     164            *fLog << err << dbginf << "No MTime found..." << endl;
     165            return kFALSE;
     166        }
     167        const Double_t T = (*tm);///3600;
     168        t = T>12*3600?T-24*3600:T;
    156169    }
    157170
    158171    const Double_t v = fData->GetValue()*fScale;
    159     const Double_t T = (*t);///3600;
    160 
    161     fGraph->SetPoint(fGraph->GetN(), T>12*3600?T-24*3600:T, v);
     172
     173    fGraph->SetPoint(fGraph->GetN(), t, v);
    162174
    163175    return kTRUE;
     
    191203    TString str(opt);
    192204
    193     fGraph->GetHistogram()->SetXTitle("Time");
     205    if (fUseEventNumber)
     206        fGraph->GetHistogram()->SetXTitle("Event Number");
     207    else
     208    {
     209        fGraph->GetHistogram()->SetXTitle("Time");
     210        fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
     211        fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
     212        fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
     213    }
    194214    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);
    198215    fGraph->Draw("AP");
    199216    if (fGraph->TestBit(kIsLogy))
     
    213230    MHVsTime *h=new MHVsTime(fData ? (const char*)GetRule() : NULL);
    214231    h->SetScale(fScale);
     232    if (fUseEventNumber)
     233        h->SetUseEventNumber();
    215234    return h;
    216235}
  • trunk/MagicSoft/Mars/mhist/MHVsTime.h

    r2557 r2571  
    1818
    1919    enum {
    20         kIsLogy = BIT(18)
     20        kIsLogy = BIT(18),
     21        kUseEventNumber = BIT(20)
    2122    };
     23
     24    Bool_t fUseEventNumber;
    2225
    2326public:
     
    4649    TGraph *GetGraph() { return fGraph; }
    4750
     51    void SetUseEventNumber(Bool_t use = kTRUE) { fUseEventNumber = use; }
    4852
    4953    void Draw(Option_t *opt=NULL);
Note: See TracChangeset for help on using the changeset viewer.