Belle II Software development
TCConvertersTestModule.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
9#pragma once
10
11#include <framework/core/Module.h>
12
13#include <genfit/TrackCand.h>
14#include <tracking/spacePointCreation/SpacePointTrackCand.h>
15
16#include <string>
17#include <array>
18#include <vector>
19#include <tuple>
20#include <algorithm> // for find_if
21
22namespace Belle2 {
36
37 public:
38
41 void initialize() override;
43 void event() override;
45 void terminate() override;
48 typedef std::tuple<int, int, int, double> trackCandHit;
49
50 protected:
51
52 std::string m_PXDClusterName;
54 std::string m_SVDClusterName;
56 std::vector<std::string> m_genfitTCNames;
58 std::string m_SPTCName;
60 std::vector<std::string> m_SpacePointArrayNames;
62 // counter variables
63
73
77
82
91 unsigned int m_lessHitsCtr;
93 unsigned int m_moreHitsCtr;
95 unsigned int m_differButOKCtr;
98 void initializeCounters();
106 bool analyzeMisMatch(const genfit::TrackCand* origTC, const genfit::TrackCand* convTC, const Belle2::SpacePointTrackCand* spTC);
107
113 std::vector<trackCandHit> getTrackCandHits(const genfit::TrackCand* trackCand);
114
127 std::array<bool, 4> checkHits(const std::vector<trackCandHit>& origHits, const std::vector<trackCandHit>& convHits);
128
137 template<int p1, int p2, int p3 = 0>
138 std::vector<trackCandHit>::const_iterator checkEntries(const std::vector<trackCandHit>& hits, const trackCandHit& hit)
139 {
140 return std::find_if(hits.begin(), hits.end(),
141 [&hit](const trackCandHit & oHit) {
142 return std::get<p1>(hit) == std::get<p1>(oHit) &&
143 std::get<p2>(hit) == std::get<p2>(oHit) &&
144 std::get<p3>(hit) == std::get<p3>(oHit);
145 }
146 );
147 }
148 };
150}
Base class for Modules.
Definition: Module.h:72
Storage for (VXD) SpacePoint-based track candidates.
Module for testing if the converting Modules do their job as intened.
std::vector< trackCandHit > getTrackCandHits(const genfit::TrackCand *trackCand)
get all TrackCandHits from a genfit::TrackCand (no such method in genfit)
int m_convertedTCCtr
counter for genfit::TrackCands which where obtained by converting from a SpacePointTrackCand
int m_failedNotSameHits
Counter for failed conversions for which the genfit::TrackCandidates do not contain the same TrackCan...
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
std::vector< std::string > m_genfitTCNames
Names of genfit::TrackCand Store Arrays.
void initialize() override
initialize: check if all required StoreArrays are present, initialize counters, etc.
unsigned int m_lessHitsCtr
Counter for cases where the original GFTC has less hits than the converted.
void event() override
event: event-wise jobs
int m_failedWrongOrder
Counter for failed conversions due to wrong ordering of TrackCandHits.
std::string m_PXDClusterName
Container name of PXDCluster.
void terminate() override
terminate: print some summary information
int m_failedNoRelationConv
Counter for failed Relation to converted genfit::TrackCand.
std::vector< std::string > m_SpacePointArrayNames
Names of SpacePoint StoreArrays.
std::tuple< int, int, int, double > trackCandHit
typedef to imitate a genfit::TrackCandHit
int m_failedWrongSortingParam
Counter for failed conversions due to one or more differing sorting parameters.
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...
int m_SpacePointTCCtr
counter for presented SpacePointTrackCands
unsigned int m_differButOKCtr
Counter for differing GFTCs, where the difference can be assigned to a refereeStatus.
std::string m_SPTCName
Container name of SpacePointTrackCands.
int m_failedOther
Counter for failed conversions for which none of the other stated coudl be assigned.
int m_failedNoSPTC
counter for conversions where no SpacePointTrackCand was created (i.e.
std::string m_SVDClusterName
Container name of SVDCluster.
int m_failedNoGFTC
counter for conversions where no genfit::TrackCand was created from a SpacePointTrackCand (i....
int m_failedNoRelationOrig
Counter for failed Relation to original genfit::TrackCand.
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
int m_genfitTCCtr
counter for presented genfit::TrackCands
void initializeCounters()
initialize all counter variables to zero, to avoid indeterministic behaviour
unsigned int m_moreHitsCtr
Counter for cases where the original GFTC has more hits than the converted.
Abstract base class for different kinds of events.