From c31789693e87b538c4f1601db69ac26b1faebdd5 Mon Sep 17 00:00:00 2001 From: adrien-matta <a.matta@surrey.ac.uk> Date: Thu, 9 Apr 2015 11:21:24 +0100 Subject: [PATCH] * Tweaking root file read --- NPLib/Core/RootInput.cxx | 6 +++--- NPLib/Core/RootOutput.cxx | 6 ++++-- NPLib/Utility/npanalysis.cxx | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/NPLib/Core/RootInput.cxx b/NPLib/Core/RootInput.cxx index 44bae05e4..495d55226 100644 --- a/NPLib/Core/RootInput.cxx +++ b/NPLib/Core/RootInput.cxx @@ -30,6 +30,7 @@ #include "RootInput.h" #include "TAsciiFile.h" +#include "TEnv.h" RootInput* RootInput::instance = 0; //////////////////////////////////////////////////////////////////////////////// RootInput* RootInput::getInstance(string configFileName){ @@ -138,6 +139,8 @@ RootInput::RootInput(string configFileName){ if (!CheckRootFileName || !CheckTreeName) cout << "\033[1;33mWARNING: Token not found for InputTree Declaration : Input Tree may not be instantiate properly\033[0m" << endl; + pRootChain->SetCacheLearnEntries(100); + gEnv->SetValue("TFile.AsyncPrefetching", 1); } //////////////////////////////////////////////////////////////////////////////// @@ -282,9 +285,6 @@ RootInput::~RootInput(){ if (res == 0) { // if does exist, delete it if (system("rm -rf ./.tmp") != 0) cout << "RootInput::~RootInput() problem deleting ./.tmp directory" << endl; } - - //delete pRootFile; - //delete pRootChain; } //////////////////////////////////////////////////////////////////////////////// diff --git a/NPLib/Core/RootOutput.cxx b/NPLib/Core/RootOutput.cxx index f2b7e7ed0..f8191733f 100644 --- a/NPLib/Core/RootOutput.cxx +++ b/NPLib/Core/RootOutput.cxx @@ -71,12 +71,14 @@ RootOutput::RootOutput(TString fileNameBase, TString treeNameBase) pRootFile = 0 ; } - pRootTree = new TTree(treeNameBase, "Data created / analyzed with the NPTool package"); + pRootTree = new TTree(treeNameBase, "Data created / analysed with the NPTool package"); pRootList = new TList(); // Init TAsciiFile objects InitAsciiFiles(); gDirectory->cd(currentPath->GetPath()); + + pRootTree->SetAutoSave(1000000000); } @@ -167,7 +169,7 @@ RootOutput::~RootOutput() } else { - cout << "No histograms and Tree !" << endl; + cout << "\033[1;31mNo histograms and Tree !\033[0m" << endl; } } diff --git a/NPLib/Utility/npanalysis.cxx b/NPLib/Utility/npanalysis.cxx index eb9d0f783..328dd5cf2 100644 --- a/NPLib/Utility/npanalysis.cxx +++ b/NPLib/Utility/npanalysis.cxx @@ -139,8 +139,8 @@ void ProgressDisplay(clock_t& begin, clock_t& end, unsigned int& treated,unsigne printf("\r \033[1;32m ******* Progress: %.1f%% | Rate: %.1fk evt/s | Remain: %s *******\033[0m", percent,event_rate/1000.,timer); fflush(stdout); - begin = clock() ; inter=0; + begin = clock() ; } treated++; -- GitLab