-// @(#)alimdc:$Name$:$Id$
+// @(#) $Id$
// Author: Fons Rademakers 26/11/99
/**************************************************************************
#include <errno.h>
#include <TSystem.h>
+#include <TTimeStamp.h>
+#include <TBranch.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)
}
}
-//______________________________________________________________________________
-AliTagDB::AliTagDB(const AliTagDB& tagDB): TObject(tagDB)
+static void BranchResetBit(TBranch *b)
{
-// copy constructor
+ // Reset MapObject on this branch and all the sub-branches
- Fatal("AliTagDB", "copy constructor not implemented");
-}
-
-//______________________________________________________________________________
-AliTagDB& AliTagDB::operator = (const AliTagDB& /*tagDB*/)
-{
-// assignment operator
-
- Fatal("operator =", "assignment operator not implemented");
- return *this;
+ b->ResetBit( kBranchObject | kBranchAny ); // Or in newer ROOT: b->ResetBit( kMapObject )
+ TIter next( b->GetListOfBranches() );
+ TBranch *sub = 0;
+ while ( (sub = (TBranch*)next() ) ) {
+ BranchResetBit( sub );
+ }
}
//______________________________________________________________________________
}
// 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();
+ TBranch * b = fTree->Branch("TAG", tagname, &fEventTag, bufsize, split);
+ BranchResetBit(b);
return kTRUE;
}
// Return filename based on hostname and date and time. This will make
// each file unique. The tags will be stored in the /data1/tags directory.
- static char fname[64];
+ static TString fname;
const char *fs = fFS;
// check that fs exists (crude check fails if fs is a file)
gSystem->MakeDirectory(fs);
- char hostname[64];
-
- strcpy(hostname, gSystem->HostName());
+ // Get the run number
+ Int_t runNumber = -1;
+ if (fEventTag) {
+ AliRawEventHeaderBase *header = fEventTag->GetHeader();
+ if (header) runNumber = header->Get("RunNb");
+ }
- char *s;
- if ((s = strchr(hostname, '.')))
- *s = 0;
+ TString hostname;
+ hostname.Form("%s",gSystem->HostName());
+ if ( hostname.First('.') > 0 ) hostname.Resize(hostname.First('.'));
- TDatime dt;
+ TTimeStamp ts;
- sprintf(fname, "%s/%s_%d_%d.root", fs, hostname, dt.GetDate(), dt.GetTime());
+ fname.Form("%s/Run%d.%s_%d_%d_%d.RAW.tag.root", fs, runNumber, hostname.Data(),
+ ts.GetDate(), ts.GetTime(), ts.GetNanoSec());
- return fname;
+ return fname.Data();
}