CbmRoot
Loading...
Searching...
No Matches
V0TriggerConfig.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
5#include "V0TriggerConfig.h"
6
7
8namespace cbm::algo::evbuild
9{
10
11 // ----- Constructor from YAML ------------------------------------------
13 {
14 if (!config) {
15 fIsSet = false;
16 return;
17 }
18 fTrackStartZ_min = GetDoubleRequired(config, "track_start_z_min");
19 fTrackStartZ_max = GetDoubleRequired(config, "track_start_z_max");
20 fTrackEndZ_min = GetDoubleRequired(config, "track_end_z_min");
21 fTrackImpactX_min = GetDoubleRequired(config, "track_impact_x_min");
22 fTrackImpactX_max = GetDoubleRequired(config, "track_impact_x_max");
23 fTrackImpactY_min = GetDoubleRequired(config, "track_impact_y_min");
24 fTrackImpactY_max = GetDoubleRequired(config, "track_impact_y_max");
25 fPairDeltaT_max = GetDoubleRequired(config, "pair_deltaT_max");
26 fPairDist_max = GetDoubleRequired(config, "pair_dist_max");
27 fPairZ_min = GetDoubleRequired(config, "pair_z_min");
28 fPairZ_max = GetDoubleRequired(config, "pair_z_max");
29 fIsSet = true;
30 }
31 // --------------------------------------------------------------------------
32
33
34 // ----- Geta a required double value from YAML -------------------------
35 double V0TriggerConfig::GetDoubleRequired(const YAML::Node& config, const char* key)
36 {
37 auto value = config[key];
38 if (!value) throw std::runtime_error(key + std::string(" required but not defined"));
39 return value.as<double>();
40 }
41 // --------------------------------------------------------------------------
42
43
44 // ----- Save to YAML ---------------------------------------------------
45 YAML::Node V0TriggerConfig::ToYaml() const
46 {
47 YAML::Node result;
48 result["track_start_z_min"] = fTrackStartZ_min;
49 result["track_start_z_max"] = fTrackStartZ_max;
50 result["track_end_z_min"] = fTrackEndZ_min;
51 result["track_impact_x_min"] = fTrackImpactX_min;
52 result["track_impact_x_max"] = fTrackImpactX_max;
53 result["track_impact_y_min"] = fTrackImpactY_min;
54 result["track_impact_y_max"] = fTrackImpactY_max;
55 result["pair_deltaT_max"] = fPairDeltaT_max;
56 result["pair_dist_max"] = fPairDist_max;
57 result["pair_z_min"] = fPairZ_min;
58 result["pair_z_max"] = fPairZ_max;
59 return result;
60 }
61 // --------------------------------------------------------------------------
62
63
64} // namespace cbm::algo::evbuild
double fPairZ_min
Maximum distance at closest approach.
double fTrackStartZ_max
Minimum z at first track measurement.
double fPairDeltaT_max
Maximum y of excluded track impact in target plane.
double fTrackImpactX_max
Minimum x of excluded track impact in target plane.
double fTrackImpactX_min
Minimum z at last track measurement.
double fTrackEndZ_min
Maximum z at first track measurement.
double GetDoubleRequired(const YAML::Node &config, const char *key)
Flag whether a configuration was set.
YAML::Node ToYaml() const
Save to YAML.
double fPairDist_max
Maximum time difference of tracks.
double fTrackImpactY_max
Minimum y of excluded track impact in target plane.
V0TriggerConfig()
Default constructor.
double fTrackImpactY_min
Maximum x of excluded track impact in target plane.