Belle II Software  release-05-02-19
TCConvertersTestModule.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Madlener *
7  * *
8  **************************************************************************/
9 
10 #pragma once
11 
12 #include <framework/core/Module.h>
13 
14 #include <genfit/TrackCand.h>
15 #include <tracking/spacePointCreation/SpacePointTrackCand.h>
16 
17 #include <string>
18 #include <array>
19 #include <vector>
20 #include <tuple>
21 #include <algorithm> // for find_if
22 
23 namespace Belle2 {
39  class TCConvertersTestModule : public Module {
40 
41  public:
42 
45  void initialize() override; /*<< initialize: check if all required StoreArrays are present, initialize counters, etc. */
46 
47  void event() override;
49  void terminate() override;
52  typedef std::tuple<int, int, int, double> trackCandHit;
53 
54  protected:
55 
56  std::string m_PXDClusterName;
58  std::string m_SVDClusterName;
60  std::vector<std::string> m_genfitTCNames;
62  std::string m_SPTCName;
64  std::vector<std::string> m_SpacePointArrayNames;
66  // counter variables
67 
68  int m_genfitTCCtr;
70  int m_convertedTCCtr;
72  int m_SpacePointTCCtr;
76  int m_failedNoSPTC;
77 
80  int m_failedNoGFTC;
81 
82  int m_failedOther;
86 
95  unsigned int m_lessHitsCtr;
97  unsigned int m_moreHitsCtr;
99  unsigned int m_differButOKCtr;
110  bool analyzeMisMatch(const genfit::TrackCand* origTC, const genfit::TrackCand* convTC, const Belle2::SpacePointTrackCand* spTC);
111 
117  std::vector<trackCandHit> getTrackCandHits(const genfit::TrackCand* trackCand);
118 
131  std::array<bool, 4> checkHits(const std::vector<trackCandHit>& origHits, const std::vector<trackCandHit>& convHits);
132 
141  template<int p1, int p2, int p3 = 0>
142  std::vector<trackCandHit>::const_iterator checkEntries(const std::vector<trackCandHit>& hits, const trackCandHit& hit)
143  {
144  return std::find_if(hits.begin(), hits.end(),
145  [&hit](const trackCandHit & oHit) {
146  return std::get<p1>(hit) == std::get<p1>(oHit) &&
147  std::get<p2>(hit) == std::get<p2>(oHit) &&
148  std::get<p3>(hit) == std::get<p3>(oHit);
149  }
150  );
151  }
152  };
154 }
Belle2::TCConvertersTestModule::m_differButOKCtr
unsigned int m_differButOKCtr
Counter for differing GFTCs, where the difference can be assigned to a refereeStatus.
Definition: TCConvertersTestModule.h:106
Belle2::TCConvertersTestModule::initialize
void initialize() override
Initialize the Module.
Definition: TCConvertersTestModule.cc:45
Belle2::TCConvertersTestModule::m_failedWrongOrder
int m_failedWrongOrder
Counter for failed conversions due to wrong ordering of TrackCandHits.
Definition: TCConvertersTestModule.h:94
Belle2::TCConvertersTestModule::event
void event() override
event: event-wise jobs
Definition: TCConvertersTestModule.cc:63
genfit::TrackCand
Track candidate – seed values and indices.
Definition: TrackCand.h:69
Belle2::TCConvertersTestModule::m_failedNotSameHits
int m_failedNotSameHits
Counter for failed conversions for which the genfit::TrackCandidates do not contain the same TrackCan...
Definition: TCConvertersTestModule.h:92
Belle2::TCConvertersTestModule::analyzeMisMatch
bool analyzeMisMatch(const genfit::TrackCand *origTC, const genfit::TrackCand *convTC, const Belle2::SpacePointTrackCand *spTC)
analyze why the conversion failed, and check if it can be explained by the referee Status of the SPTC...
Definition: TCConvertersTestModule.cc:170
Belle2::TCConvertersTestModule::m_convertedTCCtr
int m_convertedTCCtr
counter for genfit::TrackCands which where obtained by converting from a SpacePointTrackCand
Definition: TCConvertersTestModule.h:77
Belle2::TCConvertersTestModule::m_SpacePointArrayNames
std::vector< std::string > m_SpacePointArrayNames
Names of SpacePoint StoreArrays.
Definition: TCConvertersTestModule.h:71
Belle2::TCConvertersTestModule::m_SVDClusterName
std::string m_SVDClusterName
Container name of SVDCluster.
Definition: TCConvertersTestModule.h:65
Belle2::TCConvertersTestModule::getTrackCandHits
std::vector< trackCandHit > getTrackCandHits(const genfit::TrackCand *trackCand)
get all TrackCandHits from a genfit::TrackCand (no such method in genfit)
Definition: TCConvertersTestModule.cc:215
Belle2::TCConvertersTestModule::trackCandHit
std::tuple< int, int, int, double > trackCandHit
terminate: print some summary information
Definition: TCConvertersTestModule.h:59
Belle2::TCConvertersTestModule::m_failedWrongSortingParam
int m_failedWrongSortingParam
Counter for failed conversions due to one or more differing sorting parameters.
Definition: TCConvertersTestModule.h:96
Belle2::TCConvertersTestModule::m_lessHitsCtr
unsigned int m_lessHitsCtr
Counter for cases where the original GFTC has less hits than the converted.
Definition: TCConvertersTestModule.h:102
Belle2::TCConvertersTestModule::m_failedNoRelationConv
int m_failedNoRelationConv
Counter for failed Relation to converted genfit::TrackCand.
Definition: TCConvertersTestModule.h:100
Belle2::TCConvertersTestModule::m_genfitTCNames
std::vector< std::string > m_genfitTCNames
Names of genfit::TrackCand Store Arrays.
Definition: TCConvertersTestModule.h:67
Belle2::TCConvertersTestModule::m_failedNoSPTC
int m_failedNoSPTC
counter for conversions where no SpacePointTrackCand was created (i.e.
Definition: TCConvertersTestModule.h:83
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TCConvertersTestModule::initializeCounters
void initializeCounters()
initialize all counter variables to zero, to avoid indeterministic behaviour
Definition: TCConvertersTestModule.cc:286
Belle2::TCConvertersTestModule::m_SPTCName
std::string m_SPTCName
Container name of SpacePointTrackCands.
Definition: TCConvertersTestModule.h:69
Belle2::TCConvertersTestModule::m_failedNoRelationOrig
int m_failedNoRelationOrig
Counter for failed Relation to original genfit::TrackCand.
Definition: TCConvertersTestModule.h:98
Belle2::TCConvertersTestModule::checkEntries
std::vector< trackCandHit >::const_iterator checkEntries(const std::vector< trackCandHit > &hits, const trackCandHit &hit)
check if there is a match if only certain entries (p1, p2 and p3) of a trackCandHit are compared
Definition: TCConvertersTestModule.h:149
Belle2::TCConvertersTestModule::m_PXDClusterName
std::string m_PXDClusterName
Container name of PXDCluster.
Definition: TCConvertersTestModule.h:63
Belle2::TCConvertersTestModule::m_failedOther
int m_failedOther
Counter for failed conversions for which none of the other stated coudl be assigned.
Definition: TCConvertersTestModule.h:89
Belle2::TCConvertersTestModule::m_SpacePointTCCtr
int m_SpacePointTCCtr
counter for presented SpacePointTrackCands
Definition: TCConvertersTestModule.h:79
Belle2::TCConvertersTestModule::checkHits
std::array< bool, 4 > checkHits(const std::vector< trackCandHit > &origHits, const std::vector< trackCandHit > &convHits)
check if the same trackCandHits are contained in both vectors
Definition: TCConvertersTestModule.cc:226
Belle2::TCConvertersTestModule::m_failedNoGFTC
int m_failedNoGFTC
counter for conversions where no genfit::TrackCand was created from a SpacePointTrackCand (i....
Definition: TCConvertersTestModule.h:87
Belle2::TCConvertersTestModule::m_genfitTCCtr
int m_genfitTCCtr
counter for presented genfit::TrackCands
Definition: TCConvertersTestModule.h:75
Belle2::TCConvertersTestModule::TCConvertersTestModule
TCConvertersTestModule()
constructor
Definition: TCConvertersTestModule.cc:24
Belle2::SpacePointTrackCand
Storage for (VXD) SpacePoint-based track candidates.
Definition: SpacePointTrackCand.h:51
Belle2::TCConvertersTestModule::terminate
void terminate() override
This method is called at the end of the event processing.
Definition: TCConvertersTestModule.cc:143
Belle2::TCConvertersTestModule::m_moreHitsCtr
unsigned int m_moreHitsCtr
Counter for cases where the original GFTC has more hits than the converted.
Definition: TCConvertersTestModule.h:104