Belle II Software development
SpacePointTagger.icc.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/ckf/general/findlets/SpacePointTagger.dcl.h>
11
12#include <tracking/trackFindingCDC/utilities/Algorithms.h>
13#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14
15#include <tracking/spacePointCreation/SpacePoint.h>
16
17#include <framework/core/ModuleParamList.templateDetails.h>
18
19namespace Belle2 {
25 template <class AResult, class ACluster>
27 {
28 Super::beginEvent();
29
30 m_usedClusters.clear();
31 m_usedSpacePoints.clear();
32 }
33
35 template <class AResult, class ACluster>
37 const std::string& prefix)
38 {
39 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "singleClusterLevel"),
40 m_param_singleClusterLevel,
41 "Mark SP as used, if the share a single cluster with the results, or if they "
42 "share a whole SP.",
43 m_param_singleClusterLevel);
44 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "markUsedSpacePoints"),
45 m_param_markUsedSpacePoints,
46 "Mark used space points as assigned.",
47 m_param_markUsedSpacePoints);
48 }
49
51 template <class AResult, class ACluster>
52 void SpacePointTagger<AResult, ACluster>::apply(const std::vector<AResult>& results,
53 const std::vector<const SpacePoint*>& spacePoints)
54 {
55 if (not m_param_markUsedSpacePoints) {
56 return;
57 }
58
59 for (const AResult& result : results) {
60 const std::vector<const SpacePoint*>& hits = result.getHits();
61 for (const SpacePoint* spacePoint : hits) {
62 m_usedSpacePoints.insert(spacePoint);
63
64 if (not m_param_singleClusterLevel) {
65 continue;
66 }
67
68 const auto& relatedClusters = spacePoint->getRelationsTo<ACluster>();
69 for (const ACluster& relatedCluster : relatedClusters) {
70 m_usedClusters.insert(&relatedCluster);
71 }
72 }
73 }
74
75 for (const SpacePoint* spacePoint : spacePoints) {
76 if (TrackFindingCDC::is_in(spacePoint, m_usedSpacePoints)) {
77 spacePoint->setAssignmentState(true);
78 continue;
79 }
80
81 if (not m_param_singleClusterLevel) {
82 continue;
83 }
84
85 const auto& relatedClusters = spacePoint->getRelationsTo<ACluster>();
86 for (const ACluster& relatedCluster : relatedClusters) {
87 if (TrackFindingCDC::is_in(&relatedCluster, m_usedClusters)) {
88 spacePoint->setAssignmentState(true);
89 break;
90 }
91 }
92 }
93 }
95}
The Module parameter list class.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
void beginEvent() override
Clear the used clusters.
void apply(const std::vector< AResult > &results, const std::vector< const SpacePoint * > &spacePoints) override
Mark all space points as used, that they share clusters if the given kind with the results.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the findlet.
Abstract base class for different kinds of events.