src/modules/ROOTObjectWriter/ROOTObjectWriterModule.hpp
Definition of ROOT data file writer module. More…
Namespaces
Name |
---|
allpix Helper class to hold support layers for a detector model. |
Classes
Name | |
---|---|
class | allpix::ROOTObjectWriterModule Module to write object data to ROOT trees in file for persistent storage. |
Detailed Description
Definition of ROOT data file writer module.
Copyright: Copyright (c) 2017-2024 CERN and the Allpix Squared authors. This software is distributed under the terms of the MIT License, copied verbatim in the file “LICENSE.md”. In applying this license, CERN does not waive the privileges and immunities granted to it by virtue of its status as an Intergovernmental Organization or submit itself to any jurisdiction. SPDX-License-Identifier: MIT
Source code
#include <atomic>
#include <map>
#include <string>
#include <TFile.h>
#include <TTree.h>
#include "core/config/Configuration.hpp"
#include "core/geometry/GeometryManager.hpp"
#include "core/messenger/Messenger.hpp"
#include "core/module/Event.hpp"
#include "core/module/Module.hpp"
namespace allpix {
class ROOTObjectWriterModule : public SequentialModule {
public:
ROOTObjectWriterModule(Configuration& config, Messenger* messenger, GeometryManager* geo_mgr);
~ROOTObjectWriterModule() override;
bool filter(const std::shared_ptr<BaseMessage>& message, const std::string& name) const;
void initialize() override;
void run(Event* event) override;
void finalize() override;
private:
Messenger* messenger_;
GeometryManager* geo_mgr_;
// Object names to include or exclude from writing
std::set<std::string> include_;
std::set<std::string> exclude_;
// Output data file to write
std::unique_ptr<TFile> output_file_;
std::string output_file_name_{};
// Current event
uint64_t current_event_{0};
// Current random seed
uint64_t current_seed_{0};
// List of trees that are stored in data file
std::map<std::string, std::unique_ptr<TTree>> trees_;
// List of objects of a particular type, bound to a specific detector and having a particular name
std::map<std::tuple<std::type_index, std::string, std::string>, std::vector<Object*>*> write_list_;
// Statistical information about number of objects
std::atomic<unsigned long> write_cnt_{};
};
} // namespace allpix
Updated on 2025-02-27 at 14:14:46 +0000