Belle II Software  release-05-02-19
AddVXDTrackCandidateSubSetsModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jonas Wagner *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include "tracking/modules/trackSetEvaluatorVXD/AddVXDTrackCandidateSubSetsModule.h"
12 #include <vector>
13 
14 using namespace Belle2;
15 
16 
17 REG_MODULE(AddVXDTrackCandidateSubSets)
18 
20 {
21  setDescription("Module that creates additional candidates that each miss a different SpacePoint.");
22  setPropertyFlags(c_ParallelProcessingCertified);
23 
24  addParam("NameSpacePointTrackCands", m_nameSpacePointTrackCands, "Name of expected StoreArray.", m_nameSpacePointTrackCands);
25  addParam("MinOriginalSpacePoints", m_minOriginalSpacePoints,
26  "Minimal number of SpacePoints required for the original SpacePointTrackCandidate to create subsets from it."
27  " Should be at least 4, so that the subsets have 3 SpacePoints.",
28  m_minOriginalSpacePoints);
29 }
30 
32 {
34 }
35 
37 {
38  const unsigned int nTracks = m_spacePointTrackCands.getEntries();
39  std::vector<int> trackCandIndices;
40  trackCandIndices.reserve(nTracks);
41  for (auto& sptc : m_spacePointTrackCands) {
42  if (not sptc.hasRefereeStatus(SpacePointTrackCand::c_isActive)) continue;
43  trackCandIndices.push_back(sptc.getArrayIndex());
44  }
45 
46  for (int iCand : trackCandIndices) {
47  addSubCandidates(iCand);
48  }
49 }
50 
52 {
53  auto sptc = m_spacePointTrackCands[iCand];
54  int nHits = sptc->getNHits();
55 
56  // minimum length of subset track candidate is 3, thus original track should have at least 4
57  if (nHits < m_minOriginalSpacePoints) return;
58 
59  for (int iHit = 0; iHit < nHits; ++iHit) {
60  std::vector<const SpacePoint*> tmp = sptc->getHits();
61  tmp.erase(tmp.begin() + iHit);
62 
63  m_sptcCreator.createSPTC(m_spacePointTrackCands, tmp, sptc->getFamily());
64  }
65 }
66 
Belle2::AddVXDTrackCandidateSubSetsModule::m_minOriginalSpacePoints
int m_minOriginalSpacePoints
Minimal number of SPs of the original SPTC.
Definition: AddVXDTrackCandidateSubSetsModule.h:66
Belle2::AddVXDTrackCandidateSubSetsModule::m_sptcCreator
SpacePointTrackCandCreator< StoreArray< Belle2::SpacePointTrackCand > > m_sptcCreator
member variables
Definition: AddVXDTrackCandidateSubSetsModule.h:60
Belle2::AddVXDTrackCandidateSubSetsModule
Module that creates additional candidates that each miss a different SpacePoint.
Definition: AddVXDTrackCandidateSubSetsModule.h:39
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::SpacePointTrackCand::c_isActive
@ c_isActive
bit 11: SPTC is active (i.e.
Definition: SpacePointTrackCand.h:94
Belle2::AddVXDTrackCandidateSubSetsModule::m_spacePointTrackCands
StoreArray< SpacePointTrackCand > m_spacePointTrackCands
StoreArray for input SpacePointTrackCands.
Definition: AddVXDTrackCandidateSubSetsModule.h:63
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::AddVXDTrackCandidateSubSetsModule::m_nameSpacePointTrackCands
std::string m_nameSpacePointTrackCands
Name of input StoreArray containing SpacePointTrackCands.
Definition: AddVXDTrackCandidateSubSetsModule.h:56
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::AddVXDTrackCandidateSubSetsModule::event
void event() override final
event loop.
Definition: AddVXDTrackCandidateSubSetsModule.cc:36
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::AddVXDTrackCandidateSubSetsModule::addSubCandidates
void addSubCandidates(int iCand)
Actually creates the new SPTCs by removing single SPs from the SPTC with the provided StoreArray inde...
Definition: AddVXDTrackCandidateSubSetsModule.cc:51
Belle2::AddVXDTrackCandidateSubSetsModule::initialize
void initialize() override final
Requires SpacePointTrackCands.
Definition: AddVXDTrackCandidateSubSetsModule.cc:31