Belle II Software development
BestMatchedTruthVarSet.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/trackingUtilities/varsets/VarSet.h>
11#include <tracking/trackingUtilities/varsets/VarNames.h>
12
13#include <framework/dataobjects/EventMetaData.h>
14#include <framework/datastore/StoreObjPtr.h>
15
16namespace Belle2 {
21 namespace TrackingUtilities {
22 class CDCTrack;
23 }
24 namespace TrackFindingCDC {
25
27 constexpr static char const* const bestMatchedTruthVarNames[] = {
28 // Truth: PR Track is not a fake and the best matched track (not a clone)
29 "truth",
30 // Other truth variables are mostly to be helpful during debugging.
31 "truth_track_is_fake",
32 "truth_track_is_matched",
33 "truth_matched_hits",
34 "truth_track_is_clone",
35 "truth_first_nloops",
36 "truth_event_id",
37 "truth_MCTrackID",
38 };
39
41 struct BestMatchedTruthVarNames : public TrackingUtilities::VarNames<TrackingUtilities::CDCTrack> {
42
44 // we shouldn't use public member variables but we do want to rewrite all related code using setters/getters
45 // at least tell cppcheck that everything is fine
46 // cppcheck-suppress duplInheritedMember
47 static const size_t nVars = TrackingUtilities::size(bestMatchedTruthVarNames);
48
50 // cppcheck-suppress duplInheritedMember ; intentionally hides the base class member, which is the empty default of VarNames
51 static constexpr char const* getName(int iName)
52 {
53 return bestMatchedTruthVarNames[iName];
54 }
55 };
56
61 class BestMatchedTruthVarSet : public TrackingUtilities::VarSet<BestMatchedTruthVarNames> {
62
63 public:
65 void initialize() final;
66
68 void beginEvent() final;
69
71 bool extract(const TrackingUtilities::CDCTrack* ptrCDCTrack) override;
72
73 private:
76
79 };
80 }
82}
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Class to compute floating point variables from a track which can be recorded as a flat TNtuple or ser...
void initialize() final
Require the Monte Carlo truth information at initialisation.
void beginEvent() final
Prepare the Monte Carlo truth information at start of the event.
StoreObjPtr< EventMetaData > m_eventMetaData
Pointer to the store array object with the EventMetaData.
bool extract(const TrackingUtilities::CDCTrack *ptrCDCTrack) override
Generate and assign the contained variables.
TrackingUtilities::VarSet< BestMatchedTruthVarNames > Super
Type of the base class.
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:37
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.