Belle II Software  release-08-01-10
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/trackFindingCDC/varsets/VarSet.h>
11 #include <tracking/trackFindingCDC/varsets/VarNames.h>
12 
13 #include <framework/dataobjects/EventMetaData.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22  class CDCTrack;
23 
25  constexpr static char const* const bestMatchedTruthVarNames[] = {
26  // Truth: PR Track is not a fake and the best matched track (not a clone)
27  "truth",
28  // Other truth variables are mostly to be helpful during debugging.
29  "truth_track_is_fake",
30  "truth_track_is_matched",
31  "truth_matched_hits",
32  "truth_track_is_clone",
33  "truth_first_nloops",
34  "truth_event_id",
35  "truth_MCTrackID",
36  };
37 
39  struct BestMatchedTruthVarNames : public VarNames<CDCTrack> {
40 
42  // we shouldn't use public member variables but we do want to rewrite all related code using setters/getters
43  // at least tell cppcheck that everything is fine
44  // cppcheck-suppress duplInheritedMember
45  static const size_t nVars = size(bestMatchedTruthVarNames);
46 
48  static constexpr char const* getName(int iName)
49  {
50  return bestMatchedTruthVarNames[iName];
51  }
52  };
53 
58  class BestMatchedTruthVarSet : public VarSet<BestMatchedTruthVarNames> {
59 
60  public:
62  void initialize() final;
63 
65  void beginEvent() final;
66 
68  bool extract(const CDCTrack* ptrCDCTrack) override;
69 
70  private:
73 
76  };
77  }
79 }
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 CDCTrack *ptrCDCTrack) override
Generate and assign the contained variables.
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.