R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandTamexReader2.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2023 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13#pragma once
14
16#include "R3BReader.h"
18#include <R3BDataMonitor.h>
19#include <Rtypes.h>
20#include <map>
21
22class TClonesArray;
23
27class ext_data_struct_info;
28
30{
31 public:
32 using InputDataType = std::remove_all_extents_t<decltype(EXT_STR_h101_raw_nnp_tamex_onion::NN_P)>;
35
43
44 // Standard constructor
46
47 // rule of 5:
48 ~R3BNeulandTamexReader2() override { print_error(); };
53
54 // Read data from full event structure
55 auto ReadSignals(EXT_STR_h101_raw_nnp_tamex_onion* inputData) -> bool;
57
58 // Accessor to select online mode
59 void SetOnline(bool is_online) { is_online_ = is_online; }
60
61 // Set the maximum number of planes
62 void SetMaxNbPlanes(uint max) { numPlanes_ = max; }
63
64 // Accessor to skip trigger times
65 void SetSkipTriggerTimes() { is_triggered_ = false; }
66
67 void SetPrintErrorPerNums(size_t max_limit) { max_limit_ = max_limit; }
68
69 template <typename Optn>
70 void AddHistAction(std::unique_ptr<TH1> hist, Optn&& optn);
71
72 private:
73 bool is_online_ = false; // Don't store data for online
74 bool is_triggered_ = true; // whether Skip trigger times
75 size_t counter_ = 0;
76 size_t max_limit_ = 0;
77 size_t fOffset = 0; // Data offset
78 uint numPlanes_ = 0; // Number of planes
79 EXT_STR_h101_raw_nnp_tamex_onion* inputData_; // Reader specific data structure from ucesb
80 MappedDataVector mappedData_; // Output array
81 TrigMappedDataVector mappedTrigData_; // Output array, cards' trigger
82 MappedDataVector* mappedDataPtr_ = nullptr;
83 TrigMappedDataVector* mappedTrigDataPtr_ = nullptr;
84 R3B::DataMonitor histograms_;
85 std::map<std::string, std::function<void(const R3B::PaddleTamexMappedData&, TH1*)>> hist_actions_;
86 std::map<Errors, uint> error_log_;
87
88 auto R3BRead() -> bool override;
89 // Reset
90 void Reset() override;
91 // Setup structure information
92 auto Init(ext_data_struct_info* /*unused*/) -> bool override;
93 void Close() override {}
94 [[nodiscard]] auto MismappedItemRequired(std::string_view item_name) const -> bool override;
95
96 void print_error();
97 template <typename ViewType>
98 auto extract_plane_signals(const ViewType& signalsPlane, int planeNum);
99 void histogram_init();
100 void histogram_action(const R3B::PaddleTamexMappedData& mappedData);
101 [[nodiscard]] auto check_trigger_needed(std::string_view item_name) const -> bool;
102 [[nodiscard]] auto check_bar_needed(std::string_view item_name) const -> bool;
103
104 public:
106};
107
108template <typename Optn>
109void R3BNeulandTamexReader2::AddHistAction(std::unique_ptr<TH1> hist, Optn&& optn)
110{
111 const auto* histName = hist->GetName();
112 histograms_.add_hist(std::move(hist));
113 hist_actions_.insert(std::make_pair(histName, std::forward<Optn>(optn)));
114}
std::vector< R3B::PaddleTamexMappedData > R3BPaddleTamexMappedDataContainer
std::map< unsigned int, R3B::PaddleTamexTrigMappedData > R3BPaddleTamexTrigDataContainer
R3BNeulandTamexReader2(const R3BNeulandTamexReader2 &)=default
auto R3BRead() -> bool override
void SetOnline(bool is_online)
R3BPaddleTamexMappedDataContainer MappedDataVector
auto ReadSignals(EXT_STR_h101_raw_nnp_tamex_onion *inputData) -> bool
R3BNeulandTamexReader2(EXT_STR_h101_raw_nnp_tamex_onion *, size_t)
void AddHistAction(std::unique_ptr< TH1 > hist, Optn &&optn)
auto ReadTriggerSignals(EXT_STR_h101_raw_nnp_tamex_onion *inputData) -> bool
R3BNeulandTamexReader2(R3BNeulandTamexReader2 &&)=delete
std::remove_all_extents_t< decltype(EXT_STR_h101_raw_nnp_tamex_onion::NN_P)> InputDataType
auto operator=(R3BNeulandTamexReader2 &&) -> R3BNeulandTamexReader2 &=delete
ClassDefOverride(R3BNeulandTamexReader2, 1)
auto operator=(const R3BNeulandTamexReader2 &) -> R3BNeulandTamexReader2 &=default
auto Init(ext_data_struct_info *) -> bool override
R3BPaddleTamexTrigDataContainer TrigMappedDataVector
void SetPrintErrorPerNums(size_t max_limit)
auto MismappedItemRequired(std::string_view item_name) const -> bool override
R3BReader(TString const &)
Definition R3BReader.cxx:16
struct EXT_STR_h101_raw_nnp_tamex_onion_t EXT_STR_h101_raw_nnp_tamex_onion
struct EXT_STR_h101_raw_nnp_tamex_t EXT_STR_h101_raw_nnp_tamex
struct EXT_STR_h101_raw_nnp_tamex_onion_t::@127156365214235377121271237251051250151332130037 NN_P[26]