R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BNeulandCalToHitPar.cxx
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
15#include "R3BNeulandParSet.h"
16#include "R3BValueError.h"
17#include <R3BNeulandCommon.h>
18#include <R3BShared.h>
19#include <Rtypes.h>
20#include <RtypesCore.h>
21#include <algorithm>
22#include <cmath>
23#include <range/v3/algorithm/max_element.hpp>
24#include <range/v3/view/map.hpp>
25#include <range/v3/view/transform.hpp>
26#include <string_view>
27
28namespace
29{
30 auto calculate_threshold(const R3B::Neuland::HitModulePar& modulePar, R3B::Side side)
31 {
32 const auto value = modulePar.pmt_threshold.get(side).value *
34 const auto err = 0.;
35 return R3B::ValueError<double>{ value, err };
36 }
37
38} // namespace
39
40namespace R3B::Neuland
41{
42 Cal2HitPar::Cal2HitPar(std::string_view name, std::string_view title, std::string_view context, Bool_t own)
43 : ParSet(name, title, context, own)
44 {
45 }
46
48 {
49 auto threshold_views =
50 ranges::views::transform(module_pars_ | ranges::views::values,
51 [](const auto& ele)
52 {
53 return std::max(calculate_threshold(ele, R3B::Side::left).value,
54 calculate_threshold(ele, R3B::Side::right).value);
55 });
56
57 auto max_value = ranges::max_element(threshold_views);
58 if (max_value != threshold_views.end())
59 {
60 energy_cut_ = *max_value;
61 }
62 }
63
64} // namespace R3B::Neuland
65
ClassImp(R3B::Neuland::Cal2HitPar)
Cal2HitPar(std::string_view name="NeulandHitPar", std::string_view title="Neuland Cal2Hit calibration", std::string_view context="TestDefaultContext", Bool_t own=kTRUE)
std::unordered_map< unsigned int, ::R3B::Neuland::HitModulePar > module_pars_
ParSet(std::string_view name="parSet", std::string_view title="Neuland parameter", std::string_view context="TestDefaultContext", bool own=true)
Simulation of NeuLAND Bar/Paddle.
constexpr auto TotalBarLength
ValueError< double > light_attenuation_length
LRPair< ValueError< double > > pmt_threshold