src/modules/DepositionGenerator/PrimariesReaderGenie.hpp

Defines the GENIE MC generator file reader module for primary particles. More…

Namespaces

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

Classes

Name
class allpix::PrimariesReaderGenie
Reads particles from an input data file.

Detailed Description

Defines the GENIE MC generator file reader module for primary particles.

Copyright: Copyright (c) 2022-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


#ifndef ALLPIX_PRIMARIES_DEPOSITION_MODULE_READER_GENIE_H
#define ALLPIX_PRIMARIES_DEPOSITION_MODULE_READER_GENIE_H

#include "PrimariesReader.hpp"

#include <TFile.h>
#include <TTreeReader.h>
#include <TTreeReaderArray.h>

namespace allpix {
    class PrimariesReaderGenie : public PrimariesReader {
    public:
        explicit PrimariesReaderGenie(const Configuration& config);

        std::vector<Particle> getParticles() override;

    private:
        // Helper to create and check tree branches
        template <typename T> void create_tree_reader(std::shared_ptr<T>& branch_ptr, const std::string& name);
        template <typename T> void check_tree_reader(const Configuration& config, std::shared_ptr<T> branch_ptr);

        std::unique_ptr<TFile> input_file_;

        std::shared_ptr<TTreeReader> tree_reader_;
        std::shared_ptr<TTreeReaderValue<int>> event_;
        std::shared_ptr<TTreeReaderArray<int>> pdg_code_;
        std::shared_ptr<TTreeReaderArray<float>> px_;
        std::shared_ptr<TTreeReaderArray<float>> py_;
        std::shared_ptr<TTreeReaderArray<float>> pz_;
        std::shared_ptr<TTreeReaderArray<float>> energy_;
    };
} // namespace allpix

#endif /* ALLPIX_PRIMARIES_DEPOSITION_MODULE_READER_GENIE_H */

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