ATLAS Offline Software
Loading...
Searching...
No Matches
OutputStreamData.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7
8
9#ifndef EVENT_LOOP__OUTPUT_STREAM_DATA_H
10#define EVENT_LOOP__OUTPUT_STREAM_DATA_H
11
12#include <EventLoop/Global.h>
13
15#include <TFile.h>
16#include <memory>
17#include <unordered_map>
18
19class TH1;
20class StatusCode;
21class TTree;
22
23namespace EL
24{
25 namespace Detail
26 {
28
30 {
31 //
32 // public interface
33 //
34
36 public:
37 void testInvariant () const;
38
39
45 public:
46 explicit OutputStreamData (const std::string& val_fileName, const std::string& mode);
47
48
54 public:
55 explicit OutputStreamData (std::unique_ptr<TFile> val_file);
56
57
63 public:
64 explicit OutputStreamData (std::unique_ptr<SH::DiskWriter> val_writer);
65
66
72 public:
73 const std::string& mainStreamName () const noexcept;
74 void setMainStreamName (const std::string& val_mainStreamName);
75
76
81 public:
82 TFile *file () const noexcept;
83
84
91 public:
92 void saveOutput ();
93
94
100 public:
101 void close ();
102
103
109 public:
110 std::string finalFileName () const;
111
112
123 public:
124 void addOutput (std::unique_ptr<TObject> outputObject);
125
126
134 public:
135 void addClone (const TObject& prototypeObject);
136
137
147 public:
148 TDirectory *makeDirectoryFor (std::string& name);
149
150
156 public:
157 TObject *getOutputHist (const std::string& name) const noexcept;
158
159
165 public:
166 TTree *getOutputTree (const std::string& name) const noexcept;
167
168
169
170 //
171 // private interface
172 //
173
175 private:
176 std::string m_mainStreamName;
177
179 private:
180 std::unique_ptr<SH::DiskWriter> m_writer;
181
183 private:
184 std::vector<std::unique_ptr<TObject> > m_output;
185
187 private:
188 std::unordered_map<std::string,TObject*> m_outputHistMap;
189
191 private:
192 std::unordered_map<std::string,TTree*> m_outputTreeMap;
193 };
194 }
195}
196
197#endif
std::unordered_map< std::string, TObject * > m_outputHistMap
the output histogram map
TFile * file() const noexcept
the file we are writing to
TDirectory * makeDirectoryFor(std::string &name)
make the directory for the object of the given name
TObject * getOutputHist(const std::string &name) const noexcept
get the output histogram with the given name, or nullptr if there is no histogam with such a name
TTree * getOutputTree(const std::string &name) const noexcept
get the output tree with the given name, or nullptr if there is no tree with such a name
OutputStreamData(const std::string &val_fileName, const std::string &mode)
open the given file and create an output stream for it
void saveOutput()
write the list of output objects to disk and clear it
void addOutput(std::unique_ptr< TObject > outputObject)
add the given output object to this stream
std::vector< std::unique_ptr< TObject > > m_output
the list of objects to write out at the end of job
std::string m_mainStreamName
the name of the main stream
std::unique_ptr< SH::DiskWriter > m_writer
the writer we use
std::string finalFileName() const
the final path of the file created
const std::string & mainStreamName() const noexcept
the name of the main stream
void setMainStreamName(const std::string &val_mainStreamName)
std::unordered_map< std::string, TTree * > m_outputTreeMap
the output tree map
void addClone(const TObject &prototypeObject)
add a clone of the given object to the output
void testInvariant() const
test the invariant of this object
This module defines the arguments passed from the BATCH driver to the BATCH worker.