]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliTagDB.cxx
fixed compiler warnings (Marta)
[u/mrichter/AliRoot.git] / RAW / AliTagDB.cxx
index 4aa2a29948621228308416fe4bf7da710fd7a71b..797c13b5d25ac2bed0a71b0f3820adf7e4b33826 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <TSystem.h>
 #include <TTimeStamp.h>
+#include <TBranch.h>
 
 #include "AliESD.h"
 
@@ -55,6 +56,18 @@ AliTagDB::AliTagDB(AliRawEventTag *eventTag, const char* fileName) :
    }
 }
 
+static void BranchResetBit(TBranch *b) 
+{
+  // Reset MapObject on this branch and all the sub-branches
+
+  b->ResetBit( kBranchObject | kBranchAny ); // Or in newer ROOT: b->ResetBit( kMapObject )
+  TIter next( b->GetListOfBranches() );
+  TBranch *sub = 0;
+  while ( (sub = (TBranch*)next() ) ) {
+    BranchResetBit( sub );
+  }
+}
+
 //______________________________________________________________________________
 Bool_t AliTagDB::Create(const char* fileName)
 {
@@ -83,7 +96,8 @@ Bool_t AliTagDB::Create(const char* fileName)
    Int_t bufsize = 32000;
    Int_t split   = 1;
    const char *tagname = fEventTag->GetName();
-   fTree->Branch("TAG", tagname, &fEventTag, bufsize, split);
+   TBranch * b = fTree->Branch("TAG", tagname, &fEventTag, bufsize, split);
+   BranchResetBit(b);
 
    return kTRUE;
 }
@@ -154,7 +168,7 @@ const char *AliTagDB::GetFileName() const
    // 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[1024];
+   static TString fname;
    const char *fs = fFS;
 
    // check that fs exists (crude check fails if fs is a file)
@@ -167,17 +181,14 @@ const char *AliTagDB::GetFileName() const
      if (header) runNumber = header->Get("RunNb");
    }
 
-   char hostname[1024];
-   strcpy(hostname, gSystem->HostName());
-
-   char *s;
-   if ((s = strchr(hostname, '.')))
-     *s = 0;
+   TString hostname;
+   hostname.Form("%s",gSystem->HostName());
+   if ( hostname.First('.') > 0 ) hostname.Resize(hostname.First('.'));
 
    TTimeStamp ts;
 
-   sprintf(fname, "%s/Run%d.%s_%d_%d_%d.RAW.tag.root", fs, runNumber, hostname,
-          ts.GetDate(), ts.GetTime(), ts.GetNanoSec());
+   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();
 }