Index: trunk/MagicSoft/Mars/Changelog
===================================================================
--- trunk/MagicSoft/Mars/Changelog	(revision 2570)
+++ trunk/MagicSoft/Mars/Changelog	(revision 2571)
@@ -4,4 +4,11 @@
 
                                                  -*-*- END OF LINE -*-*-
+ 2003/11/26: Thomas Bretz
+
+   * mhist/MHVsTime.[h,cc]:
+     - implemented usage of Event number
+
+
+
  2003/11/25: Thomas Bretz
  
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.cc
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2570)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.cc	(revision 2571)
@@ -47,4 +47,5 @@
 #include "MParList.h"
 #include "MDataChain.h"
+#include "MRawEvtHeader.h"
 
 ClassImp(MHVsTime);
@@ -53,5 +54,5 @@
 
 static const TString gsDefName  = "MHVsTime";
-static const TString gsDefTitle = "Container for a graph vs time";
+static const TString gsDefTitle = "Container for a graph vs time/evtnumber";
 
 // --------------------------------------------------------------------------
@@ -116,5 +117,6 @@
 
     TString title(fData ? GetRule() : (TString)"Histogram");
-    title += " vs Time";
+    title += " vs ";
+    title += fUseEventNumber ? "Event Number" : "Time";
 
     fGraph->SetNameTitle(fName, title);
@@ -149,15 +151,25 @@
 Bool_t MHVsTime::Fill(const MParContainer *par, const Stat_t w)
 {
-    const MTime *t = dynamic_cast<const MTime*>(par);
-    if (!t)
-    {
-        *fLog << err << dbginf << "No MTime found..." << endl;
-        return kFALSE;
+    Double_t t = 0;
+    if (fUseEventNumber)
+    {
+        const MRawEvtHeader *h = dynamic_cast<const MRawEvtHeader*>(par);
+        t = h ? h->GetDAQEvtNumber() : fGraph->GetN();
+    }
+    else
+    {
+        const MTime *tm = dynamic_cast<const MTime*>(par);
+        if (!tm)
+        {
+            *fLog << err << dbginf << "No MTime found..." << endl;
+            return kFALSE;
+        }
+        const Double_t T = (*tm);///3600;
+        t = T>12*3600?T-24*3600:T;
     }
 
     const Double_t v = fData->GetValue()*fScale;
-    const Double_t T = (*t);///3600;
-
-    fGraph->SetPoint(fGraph->GetN(), T>12*3600?T-24*3600:T, v);
+
+    fGraph->SetPoint(fGraph->GetN(), t, v);
 
     return kTRUE;
@@ -191,9 +203,14 @@
     TString str(opt);
 
-    fGraph->GetHistogram()->SetXTitle("Time");
+    if (fUseEventNumber)
+        fGraph->GetHistogram()->SetXTitle("Event Number");
+    else
+    {
+        fGraph->GetHistogram()->SetXTitle("Time");
+        fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
+        fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
+        fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
+    }
     fGraph->GetHistogram()->SetYTitle(GetRule());
-    fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%H:%M:%S");
-    fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);
-    fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);
     fGraph->Draw("AP");
     if (fGraph->TestBit(kIsLogy))
@@ -213,4 +230,6 @@
     MHVsTime *h=new MHVsTime(fData ? (const char*)GetRule() : NULL);
     h->SetScale(fScale);
+    if (fUseEventNumber)
+        h->SetUseEventNumber();
     return h;
 }
Index: trunk/MagicSoft/Mars/mhist/MHVsTime.h
===================================================================
--- trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 2570)
+++ trunk/MagicSoft/Mars/mhist/MHVsTime.h	(revision 2571)
@@ -18,6 +18,9 @@
 
     enum {
-        kIsLogy = BIT(18)
+        kIsLogy = BIT(18),
+        kUseEventNumber = BIT(20)
     };
+
+    Bool_t fUseEventNumber;
 
 public:
@@ -46,4 +49,5 @@
     TGraph *GetGraph() { return fGraph; }
 
+    void SetUseEventNumber(Bool_t use = kTRUE) { fUseEventNumber = use; }
 
     void Draw(Option_t *opt=NULL);
