New raw-data TAGS infrastructure
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Jan 2007 11:17:56 +0000 (11:17 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 18 Jan 2007 11:17:56 +0000 (11:17 +0000)
RAW/AliMDC.cxx
RAW/AliMDC.h
RAW/AliTagDB.cxx
RAW/AliTagDB.h
RAW/AliTagNullDB.cxx
RAW/AliTagNullDB.h

index 5b5844d0615c3470a6980355e87282a81b1972c4..44401e418970812740870218b626dafb4021ef42 100644 (file)
@@ -70,6 +70,7 @@
 #include "AliRawRootdDB.h"
 #include "AliRawNullDB.h"
 #include "AliTagDB.h"
+#include "AliRawEventTag.h"
 #include "AliFilter.h"
 
 #include "AliMDC.h"
@@ -88,6 +89,7 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode,
   fStats(NULL),
   fRawDB(NULL),
   fTagDB(NULL),
+  fEventTag(new AliRawEventTag),
   fCompress(compress),
   fDeleteFiles(deleteFiles),
   fFilterMode(filterMode),
@@ -160,6 +162,7 @@ AliMDC::~AliMDC()
   delete fStats;
   delete fESD;
   delete fEvent;
+  delete fEventTag;
 }
  
 //______________________________________________________________________________
@@ -353,23 +356,28 @@ Int_t AliMDC::ProcessEvent(void* event, Bool_t isIovecArray)
   // Store raw event in tree
   Int_t nBytes = fRawDB->Fill();
 
+  // Fill the event tag object
+  fEventTag->SetHeader(fEvent->GetHeader());
+  fEventTag->SetGUID(fRawDB->GetDB()->GetUUID().AsString());
+  fEventTag->SetEventNumber(fRawDB->GetEvents()-1);
+
   // Create Tag DB here only after the raw data header
   // version was already identified
   if (!fIsTagDBCreated) {
     if (fFileNameTagDB) {
       if (fMaxSizeTagDB > 0) {
-       fTagDB = new AliTagDB(fEvent->GetHeader(), NULL);
+       fTagDB = new AliTagDB(fEventTag, NULL);
        fTagDB->SetMaxSize(fMaxSizeTagDB);
        fTagDB->SetFS(fFileNameTagDB);
        fTagDB->Create();
       } else {
-       fTagDB = new AliTagDB(fEvent->GetHeader(), fFileNameTagDB);
+       fTagDB = new AliTagDB(fEventTag, fFileNameTagDB);
       }
     }
     fIsTagDBCreated = kTRUE;
   }
 
-  // Store header in tree
+  // Store event tag in tree
   if (fTagDB) fTagDB->Fill();
 
   // Make top event object ready for next event data
index de5eb6df8d2b1317f437664da3ee7fa0b07619a5..10b3bb1bcc88dd652af360614f7cb5b7c786a1f5 100644 (file)
@@ -31,6 +31,7 @@ class AliRawEquipmentHeader;
 class AliRawData;
 class AliRawDB;
 class AliTagDB;
+class AliRawEventTag;
 class AliStats;
 class AliESD;
 
@@ -88,6 +89,7 @@ private:
    AliStats    *fStats;       // statistics
    AliRawDB    *fRawDB;       // raw data DB
    AliTagDB    *fTagDB;       // tag DB
+   AliRawEventTag *fEventTag; // raw-data event tag object
    Int_t        fCompress;    // compression factor used for raw output DB
    Bool_t       fDeleteFiles; // flag for deletion of files
    EFilterMode  fFilterMode;  // high level filter mode
index f5450b6134fb192d2aeaa45f18ab9ad72078302d..cca810a18ae8f399859ba321922e4e2416f3e2fb 100644 (file)
 #include <errno.h>
 
 #include <TSystem.h>
+#include <TTimeStamp.h>
 
 #include "AliESD.h"
 
 #include "AliRawDB.h"
-#include "AliRawEventHeaderBase.h"
+#include "AliRawEventTag.h"
 #include "AliTagDB.h"
+#include "AliRawEventHeaderBase.h"
 
 
 ClassImp(AliTagDB)
 
 
 //______________________________________________________________________________
-AliTagDB::AliTagDB(AliRawEventHeaderBase *header, const char* fileName) :
+AliTagDB::AliTagDB(AliRawEventTag *eventTag, const char* fileName) :
   fTagDB(NULL),
   fTree(NULL),
-  fHeader(header),
+  fEventTag(eventTag),
   fMaxSize(-1),
   fFS(""),
   fDeleteFiles(kFALSE)
@@ -75,13 +77,13 @@ Bool_t AliTagDB::Create(const char* fileName)
    }
 
    // Create ROOT Tree object container
-   fTree = new TTree("TAG", Form("ALICE header data tree (%s)", AliRawDB::GetAliRootTag()));
+   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;
-   const char *headername = fHeader->GetName();
-   fTree->Branch("header", headername, &fHeader, bufsize, split);
+   const char *tagname = fEventTag->GetName();
+   fTree->Branch("TAG", tagname, &fEventTag, bufsize, split);
 
    return kTRUE;
 }
@@ -158,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;
 }
index 8490d6f8c722cc6a8b1a40d0345505357b5f2181..30df9d2d15025ed9029e60cc0e061ca658f3c23a 100644 (file)
 
 
 // Forward class declarations
-class AliRawEventHeaderBase;
+class AliRawEventTag;
 
 
 class AliTagDB : public TObject {
 
 public:
-   AliTagDB(AliRawEventHeaderBase *header, const char* fileName = NULL);
+   AliTagDB(AliRawEventTag *eventTag, const char* fileName = NULL);
    virtual ~AliTagDB() { Close(); }
 
    Bool_t          Create(const char* fileName = NULL);
@@ -54,14 +54,14 @@ public:
    Double_t           GetBytesWritten() const { return fTagDB->GetBytesWritten(); }
    TFile             *GetDB() const { return fTagDB; }
    const char        *GetDBName() const { return fTagDB->GetName(); }
-   AliRawEventHeaderBase *GetHeader() const { return fHeader; }
+   AliRawEventTag    *GetEventTag() const { return fEventTag; }
    Int_t              GetEvents() const { return (Int_t) fTree->GetEntries(); }
    Float_t            GetCompressionFactor() const;
 
 protected:
    TFile             *fTagDB;     // DB to store header information only (tag)
    TTree             *fTree;      // tree use to store header
-   AliRawEventHeaderBase *fHeader;    // header via which data is stored
+   AliRawEventTag    *fEventTag;  // pointer to event tag object via which data is stored
    Double_t           fMaxSize;   // maximum size in bytes of tag DB
    TString            fFS;        // tag DB file system location
    Bool_t             fDeleteFiles; // flag for deletion of files
index 98438334141d23f4a4886901d1df9d82ca45f19a..68f5243f3617835e65f704910b531798ccb7d3fe 100644 (file)
@@ -29,8 +29,8 @@ ClassImp(AliTagNullDB)
 
 
 //______________________________________________________________________________
-AliTagNullDB::AliTagNullDB(AliRawEventHeaderBase *header) :
-   AliTagDB(header, "/dev/null")
+AliTagNullDB::AliTagNullDB(AliRawEventTag *eventTag) :
+   AliTagDB(eventTag, "/dev/null")
 {
    // Create tag db writing to /dev/null.
 
index 06f407a58edd43abff5b522f0491bc9905008fb5..c8ad2a26f6f1fd9f73b7f63ba080e8ea983d3941 100644 (file)
@@ -18,7 +18,7 @@
 class AliTagNullDB : public AliTagDB {
 
 public:
-   AliTagNullDB(AliRawEventHeaderBase *header);
+   AliTagNullDB(AliRawEventTag *eventTag);
    ~AliTagNullDB() { Close(); }
 
    void Close();