From efa344bc1d1c9fc6b0bd936ce5b276df6f5b31da Mon Sep 17 00:00:00 2001
From: matta <matta@npt>
Date: Tue, 26 Feb 2013 11:10:40 +0000
Subject: [PATCH] * fixing bug in RootOutput  - Tree was not declared in non
 proof mode

---
 NPAnalysis/MakePhysicalTree/RunToTreat.txt |  5 +++--
 NPLib/IORoot/RootInput.cxx                 |  2 ++
 NPLib/IORoot/RootOutput.cxx                | 12 +++++-------
 NPLib/Sharc/TSharcPhysics.cxx              |  1 +
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/NPAnalysis/MakePhysicalTree/RunToTreat.txt b/NPAnalysis/MakePhysicalTree/RunToTreat.txt
index 698f27aa2..c4a2947a8 100644
--- a/NPAnalysis/MakePhysicalTree/RunToTreat.txt
+++ b/NPAnalysis/MakePhysicalTree/RunToTreat.txt
@@ -1,4 +1,5 @@
 TTreeName 
-	SimulatedTree
+	S1107Data
 RootFileName 
-	../../Outputs/Simulation/myResult.root
+	/Volumes/S1107/RootData/data2251*.root
+
diff --git a/NPLib/IORoot/RootInput.cxx b/NPLib/IORoot/RootInput.cxx
index 13c05a178..de8cc2dbc 100644
--- a/NPLib/IORoot/RootInput.cxx
+++ b/NPLib/IORoot/RootInput.cxx
@@ -111,6 +111,8 @@ RootInput::RootInput(string configFileName)
             }
          }
       }
+     
+     cout << "ROOTInput has loaded  " << pRootChain->GetEntries() << " entries in the inout chain " << endl ;
    }
          
    if (!CheckRootFileName || !CheckTreeName) 
diff --git a/NPLib/IORoot/RootOutput.cxx b/NPLib/IORoot/RootOutput.cxx
index 37a15abb2..2d1bea3d2 100644
--- a/NPLib/IORoot/RootOutput.cxx
+++ b/NPLib/IORoot/RootOutput.cxx
@@ -62,17 +62,17 @@ RootOutput::RootOutput(TString fileNameBase, TString treeNameBase)
     TString fileName = GlobalPath + "/Outputs/";
     if (fileNameBase.Contains("root")) fileName += fileNameBase;
     else fileName += fileNameBase + ".root";
-   pRootFile = new TFile(fileName, "RECREATE");
-
    
+      pRootFile = new TFile(fileName, "RECREATE");
   }
   
   else{ // the file path must be the current directory
     // Does not create the Output file at instantiation
     pRootFile = 0 ;
-    pRootTree = new TTree(treeNameBase, "Data created / analyzed with the NPTool package");
-    pRootList = new TList();
   }
+  
+  pRootTree = new TTree(treeNameBase, "Data created / analyzed with the NPTool package");
+  pRootList = new TList();
 
    // Init TAsciiFile objects
    InitAsciiFiles();
@@ -130,9 +130,7 @@ RootOutput::~RootOutput()
       cout << "Got histograms and Tree !" << endl;
       cout << "  - Number of entries in the Tree: " << pRootTree->GetEntries() << endl;
       cout << "  - Number of bites written to file: " << pRootTree->Write() << endl;
-      
-      gDirectory->Cd(pRootFile->GetName());
-      
+
       // write TAsciiFile if used
       // EventGenerator
       if (!pEventGenerator->IsEmpty()) pEventGenerator->Write();
diff --git a/NPLib/Sharc/TSharcPhysics.cxx b/NPLib/Sharc/TSharcPhysics.cxx
index 63b4ac0fd..a57aa3d8c 100644
--- a/NPLib/Sharc/TSharcPhysics.cxx
+++ b/NPLib/Sharc/TSharcPhysics.cxx
@@ -644,6 +644,7 @@ void TSharcPhysics::InitializeRootInputRaw()
   inputChain->SetBranchStatus( "Sharc" , true )               ;
   inputChain->SetBranchStatus( "fSharc_*" , true )               ;
   inputChain->SetBranchAddress( "Sharc" , &m_EventData )      ;
+
 }
 
 ///////////////////////////////////////////////////////////////////////////
-- 
GitLab