src/modules/TextWriter/TextWriterModule.hpp
Definition of ASCII text file writer module. More…
Namespaces
Name |
---|
allpix Helper class to hold support layers for a detector model. |
Classes
Name | |
---|---|
class | allpix::TextWriterModule Module to write object data to simple ASCII text files. |
Detailed Description
Definition of ASCII text 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 <fstream>
#include <map>
#include <string>
#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 TextWriterModule : public SequentialModule {
public:
TextWriterModule(Configuration& config, Messenger* messenger, GeometryManager* geo_mgr);
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_;
// Object names to include or exclude from writing
std::set<std::string> include_;
std::set<std::string> exclude_;
// Output data file to write
std::string output_file_name_{};
std::unique_ptr<std::ofstream> output_file_;
// Statistical information about number of objects
std::atomic<unsigned long> write_cnt_{};
std::atomic<unsigned long> msg_cnt_{};
};
} // namespace allpix
Updated on 2024-12-13 at 08:31:37 +0000