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 static constexpr char const* getName(int iName)
51 {
52 return bestMatchedTruthVarNames[iName];
53 }
54 };
55
60 class BestMatchedTruthVarSet : public TrackingUtilities::VarSet<BestMatchedTruthVarNames> {
61
62 public:
64 void initialize() final;
65
67 void beginEvent() final;
68
70 bool extract(const TrackingUtilities::CDCTrack* ptrCDCTrack) override;
71
72 private:
75
78 };
79 }
81}
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:39
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.