]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Provide methods to make AOD objects "referencable" in a separate process, i.e.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Apr 2008 14:04:11 +0000 (14:04 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 1 Apr 2008 14:04:11 +0000 (14:04 +0000)
when producing updates.

STEER/AliAODEvent.cxx
STEER/AliAODEvent.h

index e7c8c84ed377a09bc67b58bdcdfa921c19347500..a1dceaca3d0fa4e221310e822607334d51af14a1 100644 (file)
@@ -24,7 +24,8 @@
 #include <TTree.h>
 #include <TFolder.h>
 #include <TFriendElement.h>
-
+#include <TProcessID.h>
+#include <TCollection.h>
 
 #include "AliAODEvent.h"
 #include "AliAODHeader.h"
@@ -198,6 +199,21 @@ void AliAODEvent::CreateStdContent()
   return;
 }
 
+void  AliAODEvent::MakeEntriesReferencable()
+{
+    // Make all entries referencable in a subsequent process
+    //
+    TIter next(fAODObjects);
+    TObject* obj;
+    while (obj = next())
+    {
+       if(obj->InheritsFrom("TCollection"))
+           {
+               AssignIDtoCollection((TCollection*)obj);
+           }
+    }
+}
+
 //______________________________________________________________________________
 void AliAODEvent::SetStdNames()
 {
@@ -451,3 +467,15 @@ void AliAODEvent::Print(Option_t *) const
   
   return;
 }
+
+void AliAODEvent::AssignIDtoCollection(TCollection* col)
+{
+    // Static method which assigns a ID to each object in a collection
+    // In this way the objects are marked as referenced and written with 
+    // an ID. This has the advantage that TRefs to this objects can be 
+    // written by a subsequent process.
+    TIter next(col);
+    TObject* obj;
+    while (obj = next())
+       TProcessID::AssignID(obj);
+}
index d34a1c9ff5a6fe355cd8f866136a5eccee47afe4..7389f01879b1a37ca689c8cdaa35a4177344ae13 100644 (file)
@@ -173,7 +173,8 @@ class AliAODEvent : public AliVEvent {
   const void WriteToTree(TTree* tree) const {tree->Branch(fAODObjects);}
 
   void  Print(Option_t *option="") const;
-
+  void  MakeEntriesReferencable();
+  static void AssignIDtoCollection(TCollection* col);
  private :
 
   TList   *fAODObjects; //  list of AODObjects