]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliTagDB.cxx
minor bugfix in argument scanning
[u/mrichter/AliRoot.git] / RAW / AliTagDB.cxx
index 1fa421887316b6992ebade38d6119ae770ef0d32..cca810a18ae8f399859ba321922e4e2416f3e2fb 100644 (file)
 #include <errno.h>
 
 #include <TSystem.h>
+#include <TTimeStamp.h>
 
 #include "AliESD.h"
 
 #include "AliRawDB.h"
-#include "AliRawEventHeader.h"
+#include "AliRawEventTag.h"
 #include "AliTagDB.h"
+#include "AliRawEventHeaderBase.h"
 
 
 ClassImp(AliTagDB)
 
 
 //______________________________________________________________________________
-AliTagDB::AliTagDB(AliRawEventHeader *header, const char* fileName) :
+AliTagDB::AliTagDB(AliRawEventTag *eventTag, const char* fileName) :
   fTagDB(NULL),
   fTree(NULL),
-  fHeader(header),
+  fEventTag(eventTag),
   fMaxSize(-1),
   fFS(""),
   fDeleteFiles(kFALSE)
@@ -53,23 +55,6 @@ AliTagDB::AliTagDB(AliRawEventHeader *header, const char* fileName) :
    }
 }
 
-//______________________________________________________________________________
-AliTagDB::AliTagDB(const AliTagDB& tagDB): TObject(tagDB)
-{
-// copy constructor
-
-  Fatal("AliTagDB", "copy constructor not implemented");
-}
-
-//______________________________________________________________________________
-AliTagDB& AliTagDB::operator = (const AliTagDB& /*tagDB*/)
-{
-// assignment operator
-
-  Fatal("operator =", "assignment operator not implemented");
-  return *this;
-}
-
 //______________________________________________________________________________
 Bool_t AliTagDB::Create(const char* fileName)
 {
@@ -78,7 +63,7 @@ Bool_t AliTagDB::Create(const char* fileName)
    const char *name = fileName;
    if (!name) name = GetFileName();
    fTagDB = new TFile(name, "RECREATE",
-                      Form("ALICE MDC%d tag DB", AliRawDB::kMDC), 1);
+                      Form("ALICE tag DB (%s)", AliRawDB::GetAliRootTag()), 1);
    if (fTagDB->IsZombie()) {
       Error("Create", "error opening tag DB");
       fTagDB = 0;
@@ -92,12 +77,13 @@ Bool_t AliTagDB::Create(const char* fileName)
    }
 
    // Create ROOT Tree object container
-   fTree = new TTree("TAG", Form("ALICE MDC%d header data tree", AliRawDB::kMDC));
+   fTree = new TTree("T", Form("ALICE raw-data tag tree (%s)", AliRawDB::GetAliRootTag()));
    fTree->SetAutoSave(100000000);  // autosave when 100 Mbyte written
 
    Int_t bufsize = 32000;
    Int_t split   = 1;
-   fTree->Branch("header", "AliRawEventHeader", &fHeader, bufsize, split);
+   const char *tagname = fEventTag->GetName();
+   fTree->Branch("TAG", tagname, &fEventTag, bufsize, split);
 
    return kTRUE;
 }
@@ -174,17 +160,24 @@ const char *AliTagDB::GetFileName() const
    // check that fs exists (crude check fails if fs is a file)
    gSystem->MakeDirectory(fs);
 
-   char hostname[64];
+   // Get the run number
+   Int_t runNumber = -1;
+   if (fEventTag) {
+     AliRawEventHeaderBase *header = fEventTag->GetHeader();
+     if (header) runNumber = header->Get("RunNb");
+   }
 
+   char hostname[64];
    strcpy(hostname, gSystem->HostName());
 
    char *s;
    if ((s = strchr(hostname, '.')))
-      *s = 0;
+     *s = 0;
 
-   TDatime dt;
+   TTimeStamp ts;
 
-   sprintf(fname, "%s/%s_%d_%d.root", fs, hostname, dt.GetDate(), dt.GetTime());
+   sprintf(fname, "%s/Run%d.%s_%d_%d_%d.RAW.tag.root", fs, runNumber, hostname,
+          ts.GetDate(), ts.GetTime(), ts.GetNanoSec());
 
    return fname;
 }