Belle II Software development
AddVXDTrackCandidateSubSetsModule.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/AddVXDTrackCandidateSubSetsModule.h"
10#include <vector>
11
12using namespace Belle2;
13
14
15REG_MODULE(AddVXDTrackCandidateSubSets);
16
18{
19 setDescription("Module that creates additional candidates that each miss a different SpacePoint.");
21
22 addParam("NameSpacePointTrackCands", m_nameSpacePointTrackCands, "Name of expected StoreArray.", m_nameSpacePointTrackCands);
23 addParam("MinOriginalSpacePoints", m_minOriginalSpacePoints,
24 "Minimal number of SpacePoints required for the original SpacePointTrackCandidate to create subsets from it."
25 " Should be at least 4, so that the subsets have 3 SpacePoints.",
27}
28
30{
32}
33
35{
36 const unsigned int nTracks = m_spacePointTrackCands.getEntries();
37 std::vector<int> trackCandIndices;
38 trackCandIndices.reserve(nTracks);
39 for (auto& sptc : m_spacePointTrackCands) {
40 if (not sptc.hasRefereeStatus(SpacePointTrackCand::c_isActive)) continue;
41 trackCandIndices.push_back(sptc.getArrayIndex());
42 }
43
44 for (int iCand : trackCandIndices) {
45 addSubCandidates(iCand);
46 }
47}
48
50{
51 auto sptc = m_spacePointTrackCands[iCand];
52 int nHits = sptc->getNHits();
53
54 // minimum length of subset track candidate is 3, thus original track should have at least 4
55 if (nHits < m_minOriginalSpacePoints) return;
56
57 for (int iHit = 0; iHit < nHits; ++iHit) {
58 std::vector<const SpacePoint*> tmp = sptc->getHits();
59 tmp.erase(tmp.begin() + iHit);
60
61 m_sptcCreator.createSPTC(m_spacePointTrackCands, tmp, sptc->getFamily());
62 }
63}
64
SpacePointTrackCandCreator< StoreArray< Belle2::SpacePointTrackCand > > m_sptcCreator
member variables
void initialize() override final
Requires SpacePointTrackCands.
int m_minOriginalSpacePoints
Minimal number of SPs of the original SPTC.
void addSubCandidates(int iCand)
Actually creates the new SPTCs by removing single SPs from the SPTC with the provided StoreArray inde...
StoreArray< SpacePointTrackCand > m_spacePointTrackCands
StoreArray for input SpacePointTrackCands.
std::string m_nameSpacePointTrackCands
Name of input StoreArray containing SpacePointTrackCands.
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
@ c_isActive
bit 11: SPTC is active (i.e.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
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.