Ignore:
Timestamp:
11/26/03 16:05:06 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.