Compatibility with ROOT trunk
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisTaskTagCreator.cxx
index 7d4f489..48c4b96 100644 (file)
@@ -35,6 +35,9 @@
 #include "AliLog.h"
 
 
+using std::cout;
+using std::endl;
+using std::ofstream;
 ClassImp(AliAnalysisTaskTagCreator)
 
 ////////////////////////////////////////////////////////////////////////
@@ -75,6 +78,7 @@ void AliAnalysisTaskTagCreator::UserCreateOutputObjects()
     TBranch * btag = fTreeT->Branch("AliTAG", "AliRunTag", &fRunTag);
     btag->SetCompressionLevel(9);
     fTagCreator = new AliAODTagCreator();
+    PostData(1, fTreeT);
 }
 
 void AliAnalysisTaskTagCreator::Init()
@@ -117,13 +121,19 @@ void AliAnalysisTaskTagCreator::UserExec(Option_t */*option*/)
        fturl = url->GetFile();
     }
 
-    evtTag->SetGUID(guid);
-    if(fAODFileName.Length() != 0) {
-       evtTag->SetMD5("");
-       evtTag->SetTURL(fturl);
-       evtTag->SetSize(0);
+    if (fRunTag->GetFileId(guid) == -1) {
+      AliFileTag *eftag = new AliFileTag();
+
+      eftag->SetGUID(guid);
+      if(fAODFileName.Length() != 0) {
+       eftag->SetMD5("");
+       eftag->SetTURL(fturl);
+       eftag->SetSize(0);
+      }
+      else eftag->SetPath(fturl);
+
+      fRunTag->AddFileTag(eftag);
     }
-    else evtTag->SetPath(fturl);
     //
     // Add the event tag
     fRunTag->AddEventTag(*evtTag);