Commit 822917e2 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

TreeWriter/FileWriter: move to createOutputFile scheme

parent d833fd46
Pipeline #637681 failed with stages
in 2 minutes and 48 seconds
#include "FileWriter.h"
#include "core/utils/file.h"
using namespace corryvreckan;
using namespace std;
......@@ -37,7 +38,8 @@ void FileWriter::initialise() {
m_objectList.push_back("tracks");
// Create output file and directories
m_outputFile = new TFile(m_fileName.c_str(), "RECREATE");
auto path = createOutputFile(add_file_extension(m_fileName, "root"), true);
m_outputFile = new TFile(path.c_str(), "RECREATE");
m_outputFile->cd();
// Loop over all objects to be written to file, and set up the trees
......
......@@ -12,7 +12,7 @@ This module writes an output file and fills it with trees containing the request
* `writePixels`: Boolean to choose if pixel objects are to be written out. Default value is `true`.
* `writeClusters`: Boolean to choose if cluster objects are to be written out. Default value is `false`.
* `writeTracks`: Boolean to choose if track objects are to be written out. Default value is `true`.
* `fileName`: Name of the output file. Default value is `outputTuples.root`.
* `fileName`: Name of the data file to create, relative to the output directory of the framework. The file extension `.root` will be appended if not present. Default value is `outputTuples.root`.
### Usage
```toml
......
......@@ -27,7 +27,7 @@ For each `track` with associated DUT `clusters` the following information is wri
### Parameters
* `DUT`: Name of the DUT plane.
* `fileName`: Name of the outputted ROOT file. Default value is `outputTuples`.
* `fileName`: Name of the data file to create, relative to the output directory of the framework. The file extension `.root` will be appended if not present. Default value is `outputTuples.root`.
* `treeName`: Name of the tree inside the outputted ROOT file. Default value is `tree`.
### Plots produced
......
#include "TreeWriterDUT.h"
#include "core/utils/file.h"
#include <vector>
using namespace corryvreckan;
......@@ -33,8 +35,9 @@ void TreeWriterDUT::initialise() {
LOG(DEBUG) << "Initialised TreeWriterDUT";
// Create output file and directories
m_outputFile = new TFile(m_fileName.c_str(), "RECREATE");
LOG(DEBUG) << "Made and moved to output file: " << m_fileName;
auto path = createOutputFile(add_file_extension(m_fileName, "root"));
m_outputFile = new TFile(path.c_str(), "RECREATE");
LOG(DEBUG) << "Made and moved to output file: " << path;
gDirectory->Delete("tree;*");
m_outputTree = new TTree(m_treeName.c_str(), m_treeName.c_str());
LOG(DEBUG) << "Created tree: " << m_treeName;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment