]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Make friends available after the AliAnalysisManager::Init() phase
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Apr 2012 14:06:51 +0000 (14:06 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Apr 2012 14:06:51 +0000 (14:06 +0000)
STEER/ESD/AliESDInputHandler.cxx
STEER/ESD/AliESDInputHandler.h

index 73ff42ca05e946690288f74717f6092074a8de0f..864dbb5bf8f91beb8bad31091a8e58052a517a97 100644 (file)
@@ -100,9 +100,9 @@ Bool_t AliESDInputHandler::Init(TTree* tree,  Option_t* opt)
     if (!fEvent) fEvent = new AliESDEvent();
     fEvent->ReadFromTree(fTree);
     fNEvents = fTree->GetEntries();
+    if (fReadFriends) ConnectFriends();
 
     if (fMixingHandler) fMixingHandler->Init(tree,  opt);
-
     return kTRUE;
 }
 
@@ -155,26 +155,15 @@ void AliESDInputHandler::CheckSelectionMask()
    if (!fEventCuts || !IsUserCallSelectionMask()) return;
    fIsSelectedResult = fEventCuts->GetSelectionMask((AliESDEvent*)fEvent);
 }
-   
-//______________________________________________________________________________
-Bool_t  AliESDInputHandler::FinishEvent()
-{
-    // Finish the event 
-  if(fEvent)fEvent->Reset();
-  if (fMixingHandler) fMixingHandler->FinishEvent();
-  return kTRUE;
-} 
 
 //______________________________________________________________________________
-Bool_t AliESDInputHandler::Notify(const char* path)
+void AliESDInputHandler::ConnectFriends()
 {
-  // Notify a directory change
-  static Bool_t firsttime = kFALSE;
-  AliInfo(Form("Directory change %s \n", path));
+// Connect the friends tree as soon as available.
   //
   // Handle the friends first
   //
-  if (!fTree->FindBranch("ESDfriend.") && fReadFriends) {
+  if (!fTree->FindBranch("ESDfriend.")) {
     // Try to add ESDfriend. branch as friend
       TString esdFriendTreeFName;
       esdFriendTreeFName = (fTree->GetCurrentFile())->GetName();
@@ -192,7 +181,28 @@ Bool_t AliESDInputHandler::Notify(const char* path)
     cTree->SetBranchStatus("ESDfriend.", 1);
     fFriend = (AliESDfriend*)(fEvent->FindListObject("AliESDfriend"));
     if (fFriend) cTree->SetBranchAddress("ESDfriend.", &fFriend);
-  } 
+  }
+}
+
+//______________________________________________________________________________
+Bool_t  AliESDInputHandler::FinishEvent()
+{
+    // Finish the event 
+  if(fEvent)fEvent->Reset();
+  if (fMixingHandler) fMixingHandler->FinishEvent();
+  return kTRUE;
+} 
+
+//______________________________________________________________________________
+Bool_t AliESDInputHandler::Notify(const char* path)
+{
+  // Notify a directory change
+  static Bool_t firsttime = kFALSE;
+  AliInfo(Form("Directory change %s \n", path));
+  //
+  // Handle the friends first
+  //
+  if (fReadFriends) ConnectFriends();
   //
   //
   SwitchOffBranches();
index f91d006f5bf47a4d793894c8bdbc40733b3ac5bb..c91eece8da60617d72e75f585f8258dc8f1e4d1a 100644 (file)
@@ -68,6 +68,7 @@ class AliESDInputHandler : public AliInputEventHandler {
  private:
     AliESDInputHandler(const AliESDInputHandler& handler);             
     AliESDInputHandler& operator=(const AliESDInputHandler& handler);  
+    void                 ConnectFriends();
  protected:
     // ESD event
     AliESDEvent    *fEvent;         //! Pointer to the event