From 07f018aa4c44307cf4dbe924b25b388ac7b0657f Mon Sep 17 00:00:00 2001
From: Nikolai Hartmann <Nikolai.Hartmann@physik.uni-muenchen.de>
Date: Wed, 9 May 2018 12:06:27 +0200
Subject: [PATCH] Allow writing new cycles of friends with same name

---
 add_friend.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/add_friend.py b/add_friend.py
index 0f1807f..11db673 100755
--- a/add_friend.py
+++ b/add_friend.py
@@ -11,7 +11,7 @@ def add_friend(infile, intree, outfile, outtree):
 
     for k in root_outfile.GetListOfKeys():
         if k.GetName() == friend_name:
-            raise ValueError("Tree with name {} already exists in outputfile".format(intree))
+            print("Tree with name {} already exists in outputfile - writing new cycle!".format(intree))
 
     root_outfile.cd()
     root_outtree = root_outfile.Get(outtree)
@@ -23,7 +23,7 @@ def add_friend(infile, intree, outfile, outtree):
     if root_outtree.GetListOfFriends():
         for k in root_outtree.GetListOfFriends():
             if k.GetName() == friend_name:
-                raise ValueError("Tree with name {} is already friend of {}".format(intree, outtree))
+                print("Tree with name {} is already friend of {} - writing new cycle!".format(intree, outtree))
 
     root_infile.cd()
     root_intree = root_infile.Get(intree)
-- 
GitLab