Commit 9b9eb8c4 authored by Adrien Matta's avatar Adrien Matta
Browse files

* npanalysis now support splitting tree output

        - output one tree per detector in a folder with associated .tree
          file
parent aaae8074
Pipeline #118556 canceled with stages
......@@ -11,11 +11,11 @@ include("${CMAKE_BINARY_DIR}/ressources/CMake/NPTool_CMake_Preamble.cmake")
# Major change in the Core/Physics (affecting the detector/analysis/simulation)
set(NPLIB_VERSION_MAJOR 2)
set(NPLIB_VERSION_MAJOR 3)
# Minor change in the Core/Physics (not affecting any other part)
set(NPLIB_VERSION_MINOR 2)
set(NPLIB_VERSION_MINOR 0)
# Change any of the detector in NPA
set(NPLIB_VERSION_DETA 45)
set(NPLIB_VERSION_DETA 0)
#activate Multithreading (on by default)
if(NOT DEFINED NPMULTITHREADING)
......
......@@ -88,6 +88,7 @@ NPL::DetectorManager::DetectorManager(){
m_ShieldFrontRadius = 0 ;
m_ShieldBackRadius = 0 ;
m_ShieldMaterial = "" ;
m_RootOutput=RootOutput::getInstance();
}
......@@ -266,7 +267,6 @@ void NPL::DetectorManager::BuildPhysicalEvent(){
for (it =begin; it != end; ++it) {
(it->second->*m_ClearEventPhysicsPtr)();
(it->second->*m_BuildPhysicalPtr)();
if(m_FillSpectra){
(it->second->*m_FillSpectra)();
if(m_CheckSpectra)
(it->second->*m_CheckSpectra)();
......@@ -498,6 +498,12 @@ void NPL::DetectorManager::CheckSpectraServer(){
std::cout <<"WARNING: requesting to check spectra server, which is not started" << std::endl;
}
////////////////////////////////////////////////////////////////////////////////
void NPL::DetectorManager::FillOutputTree(){
m_RootOutput->Fill();
}
////////////////////////////////////////////////////////////////////////////////
bool NPL::DetectorManager::IsCryogenic() const {return m_CryoTarget;};
double NPL::DetectorManager::GetTargetThickness() const {return m_TargetThickness;};
......
......@@ -23,6 +23,7 @@
// NPL
#include "NPVDetector.h"
#include "NPSpectraServer.h"
#include "RootOutput.h"
// ROOT
#include "TH1.h"
......@@ -67,6 +68,13 @@ namespace NPL{
private :
NPL::SpectraServer* m_SpectraServer;
private:// root outpu
RootOutput* m_RootOutput;
public:
void FillOutputTree();
private:
// The std::map containning all detectors
// Using a Map one can access to any detector using its name
......
......@@ -106,6 +106,8 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
fLastPhyFile = false;
fLastResFile = false;
fLastAnyFile = false;
fIsAnalysis = false;
fIsSimulation= false;
fVerboseLevel = 1;
fNumberOfEntryToAnalyse = -1;
fFirstEntryToAnalyse = 0;
......@@ -114,7 +116,6 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
fDisableAllBranchOption = false;
fInputPhysicalTreeOption = false;
fGenerateHistoOption = false ;
fPROOFMode = false;
fCircularTree = false;
fOnline = false;
fG4BatchMode = false;
......@@ -158,6 +159,8 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
else if (argument == "-T" && argc >= i + 2) { std::string file = argv[++i] ; std::string tree = argv[++i]; CreateRunToTreatFile(file,tree);}
else if (argument == "--cal" && argc >= i + 1) fCalibrationFileName = argv[++i] ;
else if (argument == "-S" && argc >= i + 1) fIsSplit=true;
else if (argument == "-C" && argc >= i + 1) fCalibrationFileName = argv[++i] ;
......@@ -185,8 +188,6 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){
else if (argument == "--generate-histo") fGenerateHistoOption = true ;
else if (argument == "--proof") fPROOFMode = true ;
else if (argument == "-L") fNumberOfEntryToAnalyse = atoi(argv[++i]) ;
else if (argument == "--random-seed") fRandomSeed = atoi(argv[++i]) ;
......@@ -444,12 +445,12 @@ void NPOptionManager::DisplayHelp(){
std::cout << "\t--output -O <arg>\t\tSet arg as the Output File Name (output tree)" << std::endl ;
std::cout << "\t--tree-name <arg>\t\tSet arg as the Output Tree Name " << std::endl ;
std::cout << "\t--definition <definition> \tAdd <definition> to the list of definition" << std::endl ;
std::cout << "\t-S \t\t\t\tOne tree output per detector" << std::endl ;
std::cout << "\t--verbose -V <arg>\t\tSet the verbose level, 0 for nothing, 1 for normal printout."<<std::endl;
std::cout << "\t\t\t\t\tError and warning are not affected" << std::endl ;
std::cout << std::endl << "NPAnalysis only:"<<std::endl;
std::cout << "\t--run -R <arg>\t\t\tSet arg as the run to read file list" << std::endl ;
std::cout << "\t-T <name> <file>\t\tTree <name> from root file <file>" << std::endl ;
std::cout << "\t--cal -C <arg>\t\t\tSet arg as the calibration file list" << std::endl ;
std::cout << "\t--disable-branch\t\tDisable of branch of Input tree except the one of the detector (faster)" << std::endl ;
std::cout << "\t--generate-histo -GH\t\tInstantiate the T*Spectra class of each detector" << std::endl ;
......
......@@ -103,9 +103,12 @@ class NPOptionManager{
bool GetGenerateHistoOption() {return fGenerateHistoOption;}
bool GetCheckHistoOption() {return fCheckHistoOption;}
bool GetOnline() {return fOnline;}
bool GetPROOF() {return fPROOFMode;}
bool GetG4BatchMode() {return fG4BatchMode;}
bool GetCircularTree() {return fCircularTree;}
bool GetCircularTree() {return fCircularTree;}
bool IsAnalysis() {return fIsAnalysis;};
bool IsSimulation() {return fIsSimulation;}
bool IsSplit() {return fIsSplit;}
int GetVerboseLevel() {return fVerboseLevel;}
int GetNumberOfEntryToAnalyse() {return fNumberOfEntryToAnalyse;}
int GetFirstEntryToAnalyse() {return fFirstEntryToAnalyse;}
......@@ -121,7 +124,8 @@ class NPOptionManager{
void SetDetectorFile(const std::string& name) {fDetectorFileName = name;CheckDetectorConfiguration();}
void SetRunToReadFile(const std::string& name) {fRunToReadFileName = name;}
void SetVerboseLevel(int VerboseLevel) {fVerboseLevel = VerboseLevel;}
void SetIsAnalysis(bool val=true){fIsAnalysis=val;};
void SetIsSimulation(bool val=true){fIsSimulation=val;}
public: // user definition
bool HasDefinition(std::string def) {return(fDefinition.find(def)!=fDefinition.end());}
......@@ -143,17 +147,19 @@ class NPOptionManager{
std::string fCalibrationFileName;
std::string fOutputFileName;
std::string fOutputTreeName;
bool fIsSplit; // One tree per detector
bool fDisableAllBranchOption;
bool fInputPhysicalTreeOption;
bool fGenerateHistoOption;
bool fCheckHistoOption;
bool fOnline; // true if spectra server is started
bool fPROOFMode; // if true, the system run in a pROOF environment
bool fLastSimFile;
bool fLastPhyFile;
bool fLastResFile;
bool fLastAnyFile;
bool fCircularTree;
bool fIsAnalysis;
bool fIsSimulation;
int fVerboseLevel; // 0 for not talk, 1 for talking
int fNumberOfEntryToAnalyse; // use to limit the number of analysed in NPA
int fFirstEntryToAnalyse; // use to set the first event analysed in NPA (total: fFirstEntryToAnalyse -> fFirstEntryToAnalyse + fNumberOfEntryToAnalyse)
......
/*****************************************************************************
* Copyright (C) 2009-2016 this file is part of the NPTool Project *
* Copyright (C) 2009-2021 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
......@@ -9,7 +9,7 @@
* Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
* *
* Creation Date : 21/07/09 *
* Last update : *
* Last update : 10/05/21 Add support for Split tree input (A. Matta) *
*---------------------------------------------------------------------------*
* Decription: This class is a singleton class which deals with the ROOT *
* input file and tree both for NPSimulation and NPAnalysis. *
......
#ifndef ROOTINPUT_HH
#define ROOTINPUT_HH
/*****************************************************************************
* Copyright (C) 2009-2016 this file is part of the NPTool Project *
* Copyright (C) 2009-2021 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
......@@ -11,7 +11,7 @@
* Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
* *
* Creation Date : 21/07/09 *
* Last update : *
* Last update : 10/05/21 Add support for Split tree input (A. Matta) *
*---------------------------------------------------------------------------*
* Decription: This class is a singleton class which deals with the ROOT *
* input file and tree both for NPSimulation and NPAnalysis. *
......
/*****************************************************************************
* Copyright (C) 2009-2016 this file is part of the NPTool Project *
* Copyright (C) 2009-2021 this file is part of the NPTool Project *
* *
* For the licensing terms see $NPTOOL/Licence/NPTool_Licence *
* For the list of contributors see $NPTOOL/Licence/Contributors *
......@@ -9,13 +9,14 @@
* Original Author: N. de Sereville contact address: deserevi@ipno.in2p3.fr *
* *
* Creation Date : 21/07/09 *
* Last update : 03/02/11 *
* Last update : 10/05/21 *
*---------------------------------------------------------------------------*
* Decription: This class is a singleton class which deals with the ROOT *
* output file and tree both for NPSimulation and NPAnalysis. *
*---------------------------------------------------------------------------*
* Comment: *
* + 03/02/11: Add support for TAsciiFile objects (N. de Sereville) *
* + 10/05/21: Add support for split tree output (A. Matta) *
* *
* *
*****************************************************************************/
......@@ -31,10 +32,10 @@ using namespace std;
RootOutput* RootOutput::instance = 0;
////////////////////////////////////////////////////////////////////////////////
RootOutput* RootOutput::getInstance(std::string fileNameBase, std::string treeNameBase){
RootOutput* RootOutput::getInstance(std::string fileNameBase, std::string treeNameBase,bool split){
// A new instance of RootOutput is created if it does not exist:
if (instance == 0) {
instance = new RootOutput(fileNameBase.c_str(), treeNameBase.c_str());
instance = new RootOutput(fileNameBase.c_str(), treeNameBase.c_str(),split);
}
// The instance of RootOutput is returned:
......@@ -50,103 +51,159 @@ void RootOutput::Destroy(){
}
////////////////////////////////////////////////////////////////////////////////
RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase){
TDirectory* currentPath= gDirectory;
RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool split){
pSplit = (split || NPOptionManager::getInstance()->IsSplit());
cout << endl << "/////////// ROOT Output files ///////////" << endl;
cout << "Initializing ouput trees and files ";
if(pSplit)
cout << "in split mode (one tree per detector)" << endl;
pTreeName=treeNameBase;
pCurrentDirectory= gDirectory;
bool analysis=false;
bool simulation=false;
if(fileNameBase.find("Analysis/")!=std::string::npos){
if(NPOptionManager::getInstance()->IsAnalysis()){
analysis = true;
fileNameBase.erase(0,8);
}
else if(fileNameBase.find("Simulation/")!=std::string::npos){
else if(NPOptionManager::getInstance()->IsAnalysis()){
simulation= true;
fileNameBase.erase(0,10);
}
// The ROOT file is created
if(!NPOptionManager::getInstance()->GetPROOF()){
std::string fileName;
if(analysis)
fileName = NPOptionManager::getInstance()->GetAnalysisOutputPath();
else if(simulation)
fileName = NPOptionManager::getInstance()->GetSimulationOutputPath();
else
fileName="./";
if (fileNameBase.find("root")!=std::string::npos) fileName += fileNameBase;
else fileName += fileNameBase + ".root";
pRootFile = new TFile(fileName.c_str(), "RECREATE");
if(treeNameBase=="SimulatedTree"){
string path = getenv("NPTOOL");
path+="/.last_sim_file";
ofstream last_sim_file(path.c_str());
last_sim_file << "TTreeName" << endl
<< " " << treeNameBase <<endl
<< "RootFileName" <<endl
<< " " << fileName<<endl;
last_sim_file.close();
// Setup the base name
if(analysis)
pBaseName = NPOptionManager::getInstance()->GetAnalysisOutputPath();
else if(simulation)
pBaseName = NPOptionManager::getInstance()->GetSimulationOutputPath();
else
pBaseName="./";
pBaseName += "/"+fileNameBase;
if (fileNameBase.find("root")==std::string::npos)
pBaseName += ".root";
if(pSplit){
// Create a folder for all the trees
string stripname = pBaseName;
stripname.erase(stripname.find(".root"),5);
string path = stripname.substr(0,stripname.rfind("/"));
string filebase = stripname.substr(stripname.rfind("/")+1);
string command = "mkdir -p "+stripname;
int res = system(command.c_str());
if(res!=0){
std::cout << "Error creating folder " << stripname << std::endl;
exit(1);
}
// create the master file
pMasterFile=stripname+"/"+filebase+".tree";
ofstream master(pMasterFile.c_str(),std::ofstream::trunc);
master.close();
}
else{
CreateTreeAndFile("global");
}
/////
// Create the last file
if(treeNameBase=="SimulatedTree"){
string path = getenv("NPTOOL");
path+="/.last_sim_file";
ofstream last_sim_file(path.c_str());
last_sim_file << "Tree "<< pTreeName <<endl
<< " " << pBaseName<<endl;
last_sim_file.close();
}
else if(treeNameBase=="PhysicsTree"){
string path = getenv("NPTOOL");
path+="/.last_phy_file";
ofstream last_phy_file(path.c_str());
last_phy_file << "TTreeName" << endl
<< " " << treeNameBase <<endl
<< "RootFileName" <<endl
<< " " << fileName<<endl;
last_phy_file.close();
}
else if(treeNameBase=="PhysicsTree"){
string path = getenv("NPTOOL");
path+="/.last_phy_file";
ofstream last_phy_file(path.c_str());
last_phy_file << "Tree "<< pTreeName<<endl
<< " " << pBaseName <<endl;
last_phy_file.close();
}
else if(treeNameBase=="ResultTree"){
string path = getenv("NPTOOL");
path+="/.last_res_file";
ofstream last_res_file(path.c_str());
last_res_file << "Tree " << pTreeName << endl
<< " " << pBaseName<<endl;
last_res_file.close();
}
else if(treeNameBase=="ResultTree"){
string path = getenv("NPTOOL");
path+="/.last_res_file";
ofstream last_res_file(path.c_str());
last_res_file << "TTreeName" << endl
<< " " << treeNameBase <<endl
<< "RootFileName" <<endl
<< " " << fileName<<endl;
last_res_file.close();
}
else{
string path = getenv("NPTOOL");
path+="/.last_any_file";
ofstream last_any_file(path.c_str());
last_any_file << "TTreeName" << endl
<< " " << treeNameBase <<endl
<< "RootFileName" <<endl
<< " " << fileName << endl;
last_any_file.close();
}
else{
string path = getenv("NPTOOL");
path+="/.last_any_file";
ofstream last_any_file(path.c_str());
last_any_file << "Tree " << pTreeName <<endl
<< " " << pBaseName<< endl;
last_any_file.close();
}
InitAsciiFiles();
}
////////////////////////////////////////////////////////////////////////////////
void RootOutput::CreateTreeAndFile(std::string name){
// Create the tree only if does not exist already
string file_name=pBaseName;
if(name!="global"){
string strip= pBaseName.substr(pBaseName.rfind("/"));
strip = strip.substr(0,strip.rfind(".root"));
string insertion= "_"+name;
file_name.insert(file_name.rfind(".root"),insertion);
file_name.insert(file_name.rfind("/"),strip);
}
else{ // the file path must be the current directory
// Does not create the Output file at instantiation
pRootFile = 0 ;
}
if(pRootFiles.find(name)==pRootFiles.end()){
cout << " - Creating output file " << file_name.c_str() << endl;
pRootFiles[name] = new TFile(file_name.c_str(), "RECREATE");
pRootTrees[name] = new TTree(pTreeName.c_str(), "Data created / analysed with the nptool package");
pRootFiles[name]->SetCompressionLevel(1);
pRootTree = new TTree(treeNameBase.c_str(), "Data created / analysed with the NPTool package");
pRootFile->SetCompressionLevel(1);
pRootList = new TList();
// Init TAsciiFile objects
gDirectory->cd(pCurrentDirectory->GetPath());
// Init TAsciiFile objects
InitAsciiFiles();
gDirectory->cd(currentPath->GetPath());
if(NPOptionManager::getInstance()->GetCircularTree()){
cout << "Information: Output tree is set to circular mode" << endl;
pRootTrees[name]->SetCircular(1000);
}
if(NPOptionManager::getInstance()->GetCircularTree()){
cout << "Information: Output tree is set to circular mode" << endl;
pRootTree->SetCircular(1000);
}
if(pSplit){// Add the tree to the .tree file
ofstream master(pMasterFile.c_str(),std::ofstream::app);
file_name = file_name.substr(file_name.rfind("/")+1);
master << file_name.c_str() << endl;
master.close();
}
}
//
/*
for(auto it = m_DetectorMap.begin() ; it!=m_DetectorMap.end() ;++it){
string insertion = "_"+it->first;
master << filebase << insertion << ".root" << std::endl;
string filename=path+"/"+filebase+"/"+filebase+insertion+".root";
auto file = new TFile(filename.c_str(),"RECREATE");
string treename = "RawTree_"+it->first;
auto tree = new TTree("RawTree",treename.c_str());
m_TreeMap[it->first]=tree;
m_FileMap[it->first]=file;
tree->SetDirectory(file);
std::cout << "Splitting tree: " << filename << std::endl;
it->second->InitBranch(tree);
}
master.close();
*/
}
////////////////////////////////////////////////////////////////////////////////
void RootOutput::Fill(){
for(auto it = pRootTrees.begin();it!=pRootTrees.end();it++){
it->second->Fill();
}
}
////////////////////////////////////////////////////////////////////////////////
void RootOutput::InitAsciiFiles(){
......@@ -159,15 +216,15 @@ void RootOutput::InitAsciiFiles(){
pEventGenerator = new TAsciiFile();
pEventGenerator->SetNameTitle("EventGenerator", fileNameEG.c_str());
pEventGenerator->Append(fileNameEG.c_str());
pEventGenerator->Write(0,TAsciiFile::kOverwrite);
//pEventGenerator->Write(0,TAsciiFile::kOverwrite);
// Detector configuration
// Get file name from NPOptionManager
std::string fileNameDC = OptionManager->GetDetectorFile();
pDetectorConfiguration = new TAsciiFile();
pDetectorConfiguration->SetNameTitle("DetectorConfiguration", fileNameDC.c_str());
pDetectorConfiguration->Append(fileNameDC.c_str());
pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
//pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
// Run to treat file
// Get file name from NPOptionManager
......@@ -176,7 +233,7 @@ void RootOutput::InitAsciiFiles(){
std::string fileNameRT = OptionManager->GetRunToReadFile();
pRunToTreatFile->SetNameTitle("RunToTreat", fileNameRT.c_str());
pRunToTreatFile->Append(fileNameRT.c_str());
pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
//pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
}
// Calibration files
......@@ -184,61 +241,44 @@ void RootOutput::InitAsciiFiles(){
if (!OptionManager->IsDefault("Calibration")) {
std::string fileNameCal = OptionManager->GetCalibrationFile();
pCalibrationFile->SetNameTitle("Calibration", fileNameCal.c_str());
pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
//pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
}
// Analysis configuration files
pAnalysisConfigFile = new TAsciiFile();
pAnalysisConfigFile->SetNameTitle("AnalysisConfig", "AnalysisConfig");
pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
//pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
}
////////////////////////////////////////////////////////////////////////////////
RootOutput::~RootOutput(){
// The data is written to the file and the tree is closed:
if (pRootFile && !NPOptionManager::getInstance()->GetPROOF()) {
TDirectory* currentPath= gDirectory;
gDirectory->cd(pRootFile->GetPath());
// write TAsciiFile if used
// EventGenerator
if (!pEventGenerator->IsEmpty()) pEventGenerator->Write(0,TAsciiFile::kOverwrite);
// DetectorConfiguration
if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
// CalibrationFile
if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
// RunToTreatFile
if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
// Analysis ConfigFile
if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
cout << endl;
cout << endl << "Root Output summary" << endl;
cout << " - Number of entries in the Tree: " << pRootTree->GetEntries() << endl;
cout << " - Number of bites written to file: " << pRootTree->Write(0, TObject::kOverwrite) << endl;
pRootFile->Flush();
pRootFile->Purge(1);
gDirectory->cd(currentPath->GetPath());
pRootFile->Close();
}
else if (pRootFile && NPOptionManager::getInstance()->GetPROOF()){
if (!pEventGenerator->IsEmpty()) pEventGenerator->Write(0,TAsciiFile::kOverwrite);
// DetectorConfiguration
if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
// CalibrationFile
if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
// RunToTreatFile
if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
// Analysis ConfigFile
if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
}
else if(!pRootFile && NPOptionManager::getInstance()->GetPROOF()){
if (pRootFiles.size()>0) {
cout << endl << endl << "Root Output summary" << endl;
TDirectory* pCurrentDirectory= gDirectory;
for(auto it = pRootFiles.begin(); it!=pRootFiles.end();it++){
cout << " - " <<it->first << " tree and file " << endl;
gDirectory->cd(it->second->GetPath());
// write TAsciiFile if used
// EventGenerator
if (!pEventGenerator->IsEmpty()) pEventGenerator->Write(0,TAsciiFile::kOverwrite);
// DetectorConfiguration
if (!pDetectorConfiguration->IsEmpty()) pDetectorConfiguration->Write(0,TAsciiFile::kOverwrite);
// CalibrationFile
if (!pCalibrationFile->IsEmpty()) pCalibrationFile->Write(0,TAsciiFile::kOverwrite);
// RunToTreatFile
if (!pRunToTreatFile->IsEmpty()) pRunToTreatFile->Write(0,TAsciiFile::kOverwrite);
// Analysis ConfigFile
if (!pAnalysisConfigFile->IsEmpty()) pAnalysisConfigFile->Write(0,TAsciiFile::kOverwrite);
cout << " -> Number of entries in the " << it->first << " Tree: " << pRootTrees[it->first]->GetEntries() << endl;
cout << " -> Number of bites written to file: " << pRootTrees[it->first]->Write(0, TObject::kOverwrite) << endl;
it->second->Flush();
it->second->Purge(1);
gDirectory->cd(pCurrentDirectory->GetPath());
it->second->Close();
}
}
else {
......@@ -247,20 +287,27 @@ RootOutput::~RootOutput(){
}
////////////////////////////////////////////////////////////////////////////////
TFile* RootOutput::InitFile(std::string fileNameBase){
if(NPOptionManager::getInstance()->GetPROOF()){
std::string GlobalPath = getenv("NPTOOL");
std::string fileName = GlobalPath + "/Outputs/Analysis/";
if (fileNameBase.find("root")!=std::string::npos) fileName += fileNameBase;
else fileName += fileNameBase + ".root";
pRootFile = new TFile(fileName.c_str(), "RECREATE");
pRootFile->Flush();
return pRootFile;
}
TFile* RootOutput::GetFile(std::string name) {
if(!pSplit)