From 6338a73ec7e7626634ec8aa9ca57f6d0b283435a Mon Sep 17 00:00:00 2001 From: tomeichlersmith Date: Tue, 30 Jan 2024 09:10:05 -0600 Subject: [PATCH] need to enter the output event file before creating and writing ROOT requires us to be in the correct directory when we create the output TTree for us to have it written into the correct location. In order to allow downstream processors to `getHistoDirectory()` and enter that directory for the histograms we need to enter the output event file again here so that our run tree ends up in the correct location. --- src/Framework/EventFile.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Framework/EventFile.cxx b/src/Framework/EventFile.cxx index d760180..ec281a0 100644 --- a/src/Framework/EventFile.cxx +++ b/src/Framework/EventFile.cxx @@ -320,6 +320,17 @@ void EventFile::writeRunTree() { fileName_ + "'."); } + /** + * ROOT requires us to be in the correct directory when we create + * the output TTree for us to have it written into the correct + * location. + * + * In order to allow downstream processors to getHistoDirectory() + * and enter that directory for this histograms we need to enter + * the output event file again here so that our run tree ends up + * in the correct location. + */ + file_->cd(); runTree = new TTree("LDMX_Run", "LDMX run header"); // create the branch on this tree