|
ATLAS Offline Software
|
Go to the documentation of this file.
33 class DirectoryReset {
38 ~DirectoryReset() {
m_dir.cd(); }
54 explicit MyWriter (std::unique_ptr<TFile> val_file)
55 :
m_file (std::move (val_file))
58 throw std::runtime_error (
"encountered null pointer for output file");
68 std::string getPath ()
const
94 std::unique_ptr<TFile> checkedOpenFile (
const std::string&
path,
const std::string&
mode)
96 std::unique_ptr<TFile>
result (TFile::Open (
path.c_str(),
mode.c_str()));
98 throw std::runtime_error (
"failed to open file " +
path +
" with mode " +
mode);
134 : m_writer (std::move (val_writer))
177 for (std::unique_ptr<TObject>&
object :
m_output)
179 std::string
name =
object->GetName();
183 TNamed *named =
dynamic_cast<TNamed*
>(
object.get());
185 named->SetName (
name.c_str());
190 dir->WriteObject (
object.
get(),
name.c_str());
204 addOutput (std::unique_ptr<TObject> outputObject)
208 TTree *
const tree =
dynamic_cast<TTree*
> (outputObject.get());
222 outputObject.release();
229 TH1 *
const hist =
dynamic_cast<TH1*
> (outputObject.get());
232 m_output.emplace_back (std::move (outputObject));
234 hist->SetDirectory (
nullptr);
241 addClone (
const TObject& prototypeObject)
247 DirectoryReset dirReset;
251 std::string
name = prototypeObject.GetName();
255 std::unique_ptr<TObject>
clone {prototypeObject.Clone()};
269 std::string::size_type
split =
name.rfind (
"/");
270 if (
split == std::string::npos)
297 auto iter = m_outputHistMap.find (
name);
298 return iter != m_outputHistMap.end() ? iter->second :
nullptr;
308 auto iter = m_outputTreeMap.find (
name);
309 return iter != m_outputTreeMap.end() ? iter->second :
nullptr;
void addOutput(std::unique_ptr< TObject > outputObject)
add the given output object to this stream
all data needed to manage a given output stream
TFile * file() const noexcept
the file we are writing to
std::vector< std::unique_ptr< TObject > > m_output
the list of objects to write out at the end of job
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
TDirectory & m_dir
The directory we need to return to.
path
python interpreter configuration --------------------------------------—
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
void addClone(const TObject &prototypeObject)
add a clone of the given object to the output
std::string dirname(std::string name)
void close()
close this file
std::unique_ptr< SH::DiskWriter > m_writer
the writer we use
bool const RAWDATA *ch2 const
std::unique_ptr< TFile > m_file
description: this is a custom writer for the old-school drivers that don't use an actual writer
std::unordered_map< std::string, TTree * > m_outputTreeMap
the output tree map
std::string finalFileName() const
the final path of the file created
std::string m_path
the path being used
This module defines the arguments passed from the BATCH driver to the BATCH worker.
an interface that manages writing a single output file
void testInvariant() const
test the invariant of this object
bool SetDirectory(TObject *object, TDirectory *directory)
effects: set the directory this object is associated with returns: whether the object type actively k...
TDirectory * makeDirectoryFor(std::string &name)
make the directory for the object of the given name
#define RCU_REQUIRE2_SOFT(x, y)
std::unordered_map< std::string, TObject * > m_outputHistMap
the output histogram map
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
#define RCU_CHANGE_INVARIANT(x)
void saveOutput()
write the list of output objects to disk and clear it
#define RCU_READ_INVARIANT(x)
OutputStreamData(const std::string &val_fileName, const std::string &mode)
open the given file and create an output stream for it
#define RCU_NEW_INVARIANT(x)