From 32ba9c6159df548d012c6806677e1777a95c0e28 Mon Sep 17 00:00:00 2001 From: kleinb Date: Mon, 24 Nov 2008 09:34:57 +0000 Subject: [PATCH] Avoid double booking of esdfriends branch in AliReconstruction, protection in AliESDEvent --- STEER/AliESDEvent.cxx | 1 + STEER/AliReconstruction.cxx | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/STEER/AliESDEvent.cxx b/STEER/AliESDEvent.cxx index 82a5d6d1d88..016b0fedc54 100644 --- a/STEER/AliESDEvent.cxx +++ b/STEER/AliESDEvent.cxx @@ -1130,6 +1130,7 @@ void AliESDEvent::WriteToTree(TTree* tree) const { while ((obj = next())) { branchname.Form("%s", obj->GetName()); + if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend."; if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) { if(!branchname.EndsWith("."))branchname += "."; } diff --git a/STEER/AliReconstruction.cxx b/STEER/AliReconstruction.cxx index e8bd14393d5..c1ed0ac387d 100644 --- a/STEER/AliReconstruction.cxx +++ b/STEER/AliReconstruction.cxx @@ -1353,13 +1353,23 @@ void AliReconstruction::SlaveBegin(TTree*) ftree = new TTree("esdTree", "Tree with ESD objects"); fesd = new AliESDEvent(); fesd->CreateStdContent(); + + fesd->WriteToTree(ftree); if (fWriteESDfriend) { + // careful: + // Since we add the branch manually we must + // book and add it after WriteToTree + // otherwise it is created twice, + // once via writetotree and once here. + // The case for AliESDfriend is now + // caught also in AlIESDEvent::WriteToTree but + // be careful when changing the name (AliESDfriend is not + // a TNamed so we had to hardwire it) fesdf = new AliESDfriend(); TBranch *br=ftree->Branch("ESDfriend.","AliESDfriend", &fesdf); br->SetFile("AliESDfriends.root"); fesd->AddObject(fesdf); } - fesd->WriteToTree(ftree); ftree->GetUserInfo()->Add(fesd); fhlttree = new TTree("HLTesdTree", "Tree with HLT ESD objects"); -- 2.39.3