Belle II Software development
TrackSetEvaluatorGreedyDEVModule.cc
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#include "tracking/modules/trackSetEvaluatorVXD/TrackSetEvaluatorGreedyDEVModule.h"
10
11#include <tracking/trackFindingVXD/trackSetEvaluator/Scrooge.h>
12#include <tracking/trackFindingVXD/trackSetEvaluator/OverlapResolverNodeInfo.h>
13
14#include <vector>
15
16using namespace Belle2;
17
18
19REG_MODULE(TrackSetEvaluatorGreedyDEV);
20
22{
23 setDescription("Expects a container of SpacePointTrackCandidates,\
24 selects a subset of non-overlapping TCs using the Greedy algorithm.");
25
26 addParam("NameSpacePointTrackCands", m_nameSpacePointTrackCands, "Name of expected StoreArray of SpacePoint track candidates.",
27 std::string(""));
28
29 addParam("NameOverlapNetworks", m_nameOverlapNetworks, "Name of expected StoreArray with overlap "
30 "networks.", std::string(""));
31}
32
34{
35 //Create an empty object of the type,
36 //that needs to be given to Scrooge.
37 std::vector<OverlapResolverNodeInfo> qiTrackOverlap;
38 unsigned int const nSpacePointTrackCands = m_spacePointTrackCands.getEntries();
39 qiTrackOverlap.reserve(nSpacePointTrackCands);
40
41 //fill this object with the necessary information:
42 for (auto&& spacePointTrackCand : m_spacePointTrackCands) {
43 qiTrackOverlap.emplace_back(spacePointTrackCand.getQualityIndicator(), spacePointTrackCand.getArrayIndex(),
44 m_overlapNetworks[0]->getOverlapForTrackIndex(spacePointTrackCand.getArrayIndex()),
45 true);
46 }
47
48 //make a Scrooge and update the activity
49 Scrooge scrooge;
50 scrooge.performSelection(qiTrackOverlap);
51
52 for (auto&& track : qiTrackOverlap) {
53 if (track.activityState < 0.75) {
54 m_spacePointTrackCands[track.trackIndex]->removeRefereeStatus(SpacePointTrackCand::c_isActive);
55 }
56 }
57
58 //-----------------------------------------------------------------------------------------------
59}
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Executes greedy algorithm for vector of QITrackOverlap structs.
Definition: Scrooge.h:26
void performSelection(std::vector< OverlapResolverNodeInfo > &overlapResolverNodeInfo)
Sets the isActive flag in m_qiTrackOverlap to false, for killed tracks.
Definition: Scrooge.h:33
@ c_isActive
bit 11: SPTC is active (i.e.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
void event() override final
Application of the algorithm.
std::string m_nameOverlapNetworks
name of the overlap networks
StoreArray< OverlapNetwork > m_overlapNetworks
access to tcNetwork, which will be produced by this module
StoreArray< SpacePointTrackCand > m_spacePointTrackCands
the storeArray for SpacePointTrackCands as member, is faster than recreating link for each event
std::string m_nameSpacePointTrackCands
Name of array of SpacePointTrackCand.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.