From 98e5d8dee71468d38943be2aa0e08509805b8e5a Mon Sep 17 00:00:00 2001
From: matta <matta@npt>
Date: Thu, 17 Feb 2011 21:21:57 +0000
Subject: [PATCH] * Add a convenient function to make friend tree in CINT  -
 MakeFriendTrees("RunToRead1","RunToRead2")  - can be called within CINT

---
 NPAnalysis/RRC66/RunToTreat.txt | 4 ++--
 NPLib/IORoot/RootInput.cxx      | 8 ++++++++
 NPLib/IORoot/RootInput.h        | 3 +++
 NPLib/scripts/NPToolLogon.C     | 2 ++
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/NPAnalysis/RRC66/RunToTreat.txt b/NPAnalysis/RRC66/RunToTreat.txt
index 698f27aa2..5650110f7 100644
--- a/NPAnalysis/RRC66/RunToTreat.txt
+++ b/NPAnalysis/RRC66/RunToTreat.txt
@@ -1,4 +1,4 @@
 TTreeName 
-	SimulatedTree
+	t1
 RootFileName 
-	../../Outputs/Simulation/myResult.root
+	/media/rc66_1/data/runROOT/20umTest/si20um_test0089.root
diff --git a/NPLib/IORoot/RootInput.cxx b/NPLib/IORoot/RootInput.cxx
index 7838d255f..f3814c141 100644
--- a/NPLib/IORoot/RootInput.cxx
+++ b/NPLib/IORoot/RootInput.cxx
@@ -270,3 +270,11 @@ RootInput::~RootInput()
    delete pRootFile;
    delete pRootChain;
 }
+
+/////////////////////////////////////////////////////////////////////
+TChain* MakeFriendTrees(string RunToRead1,string RunToRead2)
+   {
+      RootInput:: getInstance(RunToRead1)	;
+      RootInput:: getInstance()->AddFriendChain(RunToRead2);
+      return RootInput:: getInstance()->GetChain();
+   }
diff --git a/NPLib/IORoot/RootInput.h b/NPLib/IORoot/RootInput.h
index 463411bb0..5cee92ce0 100644
--- a/NPLib/IORoot/RootInput.h
+++ b/NPLib/IORoot/RootInput.h
@@ -79,4 +79,7 @@ private:
    int NumberOfFriend;
 };
 
+// A convenient function related to Root Input, coded Here so it can be called within ROOT CINT
+TChain* MakeFriendTrees(string,string);
+
 #endif // ROOTINPUT_HH
diff --git a/NPLib/scripts/NPToolLogon.C b/NPLib/scripts/NPToolLogon.C
index 12379ba71..c01c04901 100644
--- a/NPLib/scripts/NPToolLogon.C
+++ b/NPLib/scripts/NPToolLogon.C
@@ -69,6 +69,8 @@ void NPToolLogon(bool verbosemode = false)
       }
    }
    
+   gROOT->ProcessLine(".L $NPLIB/include/RootInput.h+");   
+   
    // Since the libdir.GetListOfFiles() commands cds to the
    // libidr directory, one has to return to the initial
    // directory
-- 
GitLab