src/modules/RCEWriter/RCEWriterModule.hpp

Definition of RCE Writer Module. More…

Namespaces

Name
allpix
Helper class to hold support layers for a detector model.

Classes

Name
class allpix::RCEWriterModule
Module to write object data to ROOT trees in RCE format for telescope reconstruction.

Detailed Description

Definition of RCE 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 <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"
#include "objects/PixelHit.hpp"

namespace allpix {
    class RCEWriterModule : public SequentialModule {
    public:
        RCEWriterModule(Configuration& config, Messenger*, GeometryManager*);
        ~RCEWriterModule() override = default;

        void initialize() override;

        void run(Event* event) override;

        void finalize() override;

    private:
        Messenger* messenger_;
        GeometryManager* geo_mgr_;

        // Struct to store tree and information for each detector
        struct sensor_data {
            static constexpr int kMaxHits = (1 << 14);
            TTree* tree; // no unique_ptr, ROOT takes ownership
            Int_t nhits_;
            std::array<Int_t, kMaxHits> pix_x_;
            std::array<Int_t, kMaxHits> pix_y_;
            std::array<Int_t, kMaxHits> value_;
            std::array<Int_t, kMaxHits> timing_;
            std::array<Int_t, kMaxHits> hit_in_cluster_;
        };
        // The map from detector names to the respective sensor_data struct
        std::map<std::string, sensor_data> sensors_;

        // Relevant information for the Event tree
        ULong64_t timestamp_{};
        ULong64_t frame_number_{};
        ULong64_t trigger_time_{};
        Int_t trigger_offset_{};
        Int_t trigger_info_{};
        Bool_t invalid_{};
        // The Event tree
        TTree* event_tree_{}; // no unique_ptr, ROOT takes ownership

        // Output data file to write
        std::unique_ptr<TFile> output_file_;
    };
} // namespace allpix

Updated on 2024-12-13 at 08:31:37 +0000