Skip to content
Snippets Groups Projects
Commit 2ff46ad5 authored by Adrien Matta's avatar Adrien Matta :skull_crossbones:
Browse files

* Detector not supporting splitting are now gathered in the _global tree

  when splitting is requested by the user
parent 9b9eb8c4
No related branches found
No related tags found
No related merge requests found
Pipeline #118557 passed
...@@ -58,7 +58,8 @@ RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool s ...@@ -58,7 +58,8 @@ RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool s
cout << "Initializing ouput trees and files "; cout << "Initializing ouput trees and files ";
if(pSplit) if(pSplit)
cout << "in split mode (one tree per detector)" << endl; cout << "in split mode (one tree per detector)" << endl;
else
cout << endl;
pTreeName=treeNameBase; pTreeName=treeNameBase;
pCurrentDirectory= gDirectory; pCurrentDirectory= gDirectory;
bool analysis=false; bool analysis=false;
...@@ -150,15 +151,15 @@ RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool s ...@@ -150,15 +151,15 @@ RootOutput::RootOutput(std::string fileNameBase, std::string treeNameBase,bool s
void RootOutput::CreateTreeAndFile(std::string name){ void RootOutput::CreateTreeAndFile(std::string name){
// Create the tree only if does not exist already // Create the tree only if does not exist already
string file_name=pBaseName; 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);
}
if(pRootFiles.find(name)==pRootFiles.end()){ if(pRootFiles.find(name)==pRootFiles.end()){
if(pSplit){
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);
}
cout << " - Creating output file " << file_name.c_str() << endl; cout << " - Creating output file " << file_name.c_str() << endl;
pRootFiles[name] = new TFile(file_name.c_str(), "RECREATE"); pRootFiles[name] = new TFile(file_name.c_str(), "RECREATE");
pRootTrees[name] = new TTree(pTreeName.c_str(), "Data created / analysed with the nptool package"); pRootTrees[name] = new TTree(pTreeName.c_str(), "Data created / analysed with the nptool package");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment