Belle II Software release-09-00-00
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 {
39
40 public:
41
44 void initialize() override;
46 void event() override;
48 void terminate() override;
51 typedef std::tuple<int, int, int, double> trackCandHit;
52
53 protected:
54
55 std::string m_PXDClusterName;
57 std::string m_SVDClusterName;
59 std::vector<std::string> m_genfitTCNames;
61 std::string m_SPTCName;
63 std::vector<std::string> m_SpacePointArrayNames;
65 // counter variables
66
76
80
85
94 unsigned int m_lessHitsCtr;
96 unsigned int m_moreHitsCtr;
98 unsigned int m_differButOKCtr;
101 void initializeCounters();
109 bool analyzeMisMatch(const genfit::TrackCand* origTC, const genfit::TrackCand* convTC, const Belle2::SpacePointTrackCand* spTC);
110
116 std::vector<trackCandHit> getTrackCandHits(const genfit::TrackCand* trackCand);
117
130 std::array<bool, 4> checkHits(const std::vector<trackCandHit>& origHits, const std::vector<trackCandHit>& convHits);
131
140 template<int p1, int p2, int p3 = 0>
141 std::vector<trackCandHit>::const_iterator checkEntries(const std::vector<trackCandHit>& hits, const trackCandHit& hit)
142 {
143 return std::find_if(hits.begin(), hits.end(),
144 [&hit](const trackCandHit & oHit) {
145 return std::get<p1>(hit) == std::get<p1>(oHit) &&
146 std::get<p2>(hit) == std::get<p2>(oHit) &&
147 std::get<p3>(hit) == std::get<p3>(oHit);
148 }
149 );
150 }
151 };
153}
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.