Belle II Software development
BasicTrackVarSet.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/varsets/VarSet.h>
11#include <tracking/trackFindingCDC/varsets/VarNames.h>
12
13// BOOST accumulators
14#include <boost/accumulators/accumulators.hpp>
15#include <boost/accumulators/statistics/count.hpp>
16#include <boost/accumulators/statistics/min.hpp>
17#include <boost/accumulators/statistics/max.hpp>
18#include <boost/accumulators/statistics/sum.hpp>
19#include <boost/accumulators/statistics/mean.hpp>
20#include <boost/accumulators/statistics/variance.hpp>
21
22namespace bacc = boost::accumulators;
23
24namespace Belle2 {
29 namespace TrackFindingCDC {
30 class CDCTrack;
31
33 constexpr
34 static char const* const basicTrackVarNames[] = {
35 "pt",
36 "size",
37 "hits_per_layer",
38
39 "sz_slope",
40 "z0",
41 "s_range",
42 "avg_hit_dist",
43 "has_matching_segment",
44
45 "cont_layer_mean",
46 "cont_layer_variance",
47 "cont_layer_max",
48 "cont_layer_min",
49 "cont_layer_first",
50 "cont_layer_last",
51 "cont_layer_max_vs_last",
52 "cont_layer_first_vs_min",
53 "cont_layer_count",
54 "cont_layer_occupancy",
55
56 "super_layer_mean",
57 "super_layer_variance",
58 "super_layer_max",
59 "super_layer_min",
60 "super_layer_first",
61 "super_layer_last",
62 "super_layer_max_vs_last",
63 "super_layer_first_vs_min",
64 "super_layer_count",
65 "super_layer_occupancy",
66
67 "drift_length_mean",
68 "drift_length_variance",
69 "drift_length_max",
70 "drift_length_min",
71 "drift_length_sum",
72
73 "adc_mean",
74 "adc_variance",
75 "adc_max",
76 "adc_min",
77 "adc_sum",
78
79 "tot_mean",
80 "tot_variance",
81 "tot_max",
82 "tot_min",
83 "tot_sum",
84
85 "empty_s_mean",
86 "empty_s_variance",
87 "empty_s_max",
88 "empty_s_min",
89 "empty_s_sum",
90 };
91
93 struct BasicTrackVarSetNames : public VarNames<CDCTrack> {
94
96 // we shouldn't use public member variables but we do want to rewrite all related code using setters/getters
97 // at least tell cppcheck that everything is fine
98 // cppcheck-suppress duplInheritedMember
99 static const size_t nVars = size(basicTrackVarNames);
100
102 static constexpr char const* getName(int iName)
103 {
104 return basicTrackVarNames[iName];
105 }
106 };
107
112 class BasicTrackVarSet : public VarSet<BasicTrackVarSetNames> {
113
114 public:
116 bool extract(const CDCTrack* track) override;
117
123 using statistics_set = bacc::features<bacc::tag::count,
124 bacc::tag::sum,
125 bacc::tag::min,
126 bacc::tag::max,
127 bacc::tag::mean,
128 bacc::tag::lazy_variance>;
129
136 using statistics_accumulator = bacc::accumulator_set<double, statistics_set>;
137 };
138 }
140}
Class to compute floating point variables from a track which can be recorded as a flat TNtuple or ser...
bacc::features< bacc::tag::count, bacc::tag::sum, bacc::tag::min, bacc::tag::max, bacc::tag::mean, bacc::tag::lazy_variance > statistics_set
Set of statistics/features to accumulate for each variable category (e.g.
bool extract(const CDCTrack *track) override
Generate and assign the contained variables.
bacc::accumulator_set< double, statistics_set > statistics_accumulator
A boost accumulators set that aggregates statistics for the values it is called with.
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:41
Class that specifies the names of the variables.
Definition: VarNames.h:21
Generic class that generates some named float values from a given object.
Definition: VarSet.h:36
Abstract base class for different kinds of events.
Vehicle class to transport the variable names.
static const size_t nVars
Number of variables to be generated.
static constexpr char const * getName(int iName)
Getter for the name at the given index.