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"
17#include "ext_h101_raw_nnp_tamex.h"
18#include <R3BDataMonitor.h>
19#include <Rtypes.h>
20#include <TH1.h>
21#include <cstddef>
22#include <cstdint>
23#include <functional>
24#include <map>
25#include <memory>
26#include <string>
27#include <string_view>
28#include <sys/types.h>
29#include <type_traits>
30#include <utility>
31
32class TClonesArray;
33
34struct EXT_STR_h101_raw_nnp_tamex_t;
35using EXT_STR_h101_raw_nnp_tamex = struct EXT_STR_h101_raw_nnp_tamex_t;
36using EXT_STR_h101_raw_nnp_tamex_onion = struct EXT_STR_h101_raw_nnp_tamex_onion_t;
37class ext_data_struct_info;
38
40{
41 public:
42 using InputDataType = std::remove_all_extents_t<decltype(EXT_STR_h101_raw_nnp_tamex_onion::NN_P)>;
45
46 enum class Errors : uint8_t
47 {
52 };
53
54 // Standard constructor
56
57 // rule of 5:
63
64 // Read data from full event structure
65 auto ReadSignals(EXT_STR_h101_raw_nnp_tamex_onion* inputData) -> bool;
67
68 // Accessor to select online mode
69 void SetOnline(bool is_online) { is_online_ = is_online; }
70
71 // Set the maximum number of planes
72 void SetMaxNbPlanes(int max) { numPlanes_ = max; }
73
74 // Accessor to skip trigger times
76
77 void SetPrintErrorPerNums(size_t max_limit) { max_limit_ = max_limit; }
78
79 template <typename Optn>
80 void AddHistAction(std::unique_ptr<TH1> hist, Optn&& optn);
81
82 private:
83 bool is_online_ = false; // Don't store data for online
84 bool is_triggered_ = true; // whether Skip trigger times
85 size_t counter_ = 0;
86 size_t max_limit_ = 0;
87 size_t fOffset = 0; // Data offset
88 int numPlanes_ = 0; // Number of planes
89 EXT_STR_h101_raw_nnp_tamex_onion* inputData_; // Reader specific data structure from ucesb
91 TrigMappedDataVector mappedTrigData_; // Output array, cards' trigger
95 std::map<std::string, std::function<void(const R3B::PaddleTamexMappedData&, TH1*)>> hist_actions_;
96 std::map<Errors, uint> error_log_;
97
98 auto R3BRead() -> bool override;
99 // Reset
100 void Reset() override;
101 // Setup structure information
102 auto Init(ext_data_struct_info* /*unused*/) -> bool override;
103 void Close() override {}
104 [[nodiscard]] auto MismappedItemRequired(std::string_view item_name) const -> bool override;
105
106 void print_error();
107 template <typename ViewType>
108 auto extract_plane_signals(const ViewType& signalsPlane, int planeNum);
109 void histogram_init();
110 void histogram_action(const R3B::PaddleTamexMappedData& mappedData);
111 [[nodiscard]] auto check_trigger_needed(std::string_view item_name) const -> bool;
112 [[nodiscard]] auto check_bar_needed(std::string_view item_name) const -> bool;
113
114 public:
116};
117
118template <typename Optn>
119void R3BNeulandTamexReader2::AddHistAction(std::unique_ptr<TH1> hist, Optn&& optn)
120{
121 const auto* histName = hist->GetName();
122 histograms_.add_hist(std::move(hist));
123 hist_actions_.insert(std::make_pair(histName, std::forward<Optn>(optn)));
124}
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
std::map< int, R3B::PaddleTamexTrigMappedData > R3BPaddleTamexTrigDataContainer
std::vector< R3B::PaddleTamexMappedData > R3BPaddleTamexMappedDataContainer
R3BNeulandTamexReader2(const R3BNeulandTamexReader2 &)=default
auto R3BRead() -> bool override
void SetOnline(bool is_online)
R3BPaddleTamexMappedDataContainer MappedDataVector
std::map< std::string, std::function< void(const R3B::PaddleTamexMappedData &, TH1 *)> > hist_actions_
auto ReadSignals(EXT_STR_h101_raw_nnp_tamex_onion *inputData) -> bool
auto check_bar_needed(std::string_view item_name) const -> bool
R3BNeulandTamexReader2(EXT_STR_h101_raw_nnp_tamex_onion *, size_t)
void AddHistAction(std::unique_ptr< TH1 > hist, Optn &&optn)
auto Init(ext_data_struct_info *) -> bool override
auto extract_plane_signals(const ViewType &signalsPlane, int planeNum)
TrigMappedDataVector * mappedTrigDataPtr_
auto ReadTriggerSignals(EXT_STR_h101_raw_nnp_tamex_onion *inputData) -> bool
EXT_STR_h101_raw_nnp_tamex_onion * inputData_
auto check_trigger_needed(std::string_view item_name) const -> bool
R3BNeulandTamexReader2(R3BNeulandTamexReader2 &&)=delete
std::map< Errors, uint > error_log_
TrigMappedDataVector mappedTrigData_
std::remove_all_extents_t< decltype(EXT_STR_h101_raw_nnp_tamex_onion::NN_P)> InputDataType
void histogram_action(const R3B::PaddleTamexMappedData &mappedData)
auto operator=(R3BNeulandTamexReader2 &&) -> R3BNeulandTamexReader2 &=delete
ClassDefOverride(R3BNeulandTamexReader2, 1)
auto operator=(const R3BNeulandTamexReader2 &) -> R3BNeulandTamexReader2 &=default
MappedDataVector * mappedDataPtr_
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