Belle II Software  release-05-02-19
PruneRecoTracksModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2012 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Thomas Hauth *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/modules/pruneRecoTracks/PruneRecoTracksModule.h>
12 #include <framework/datastore/StoreArray.h>
13 #include <tracking/dataobjects/RecoTrack.h>
14 
15 using namespace Belle2;
16 
17 REG_MODULE(PruneRecoTracks);
18 
20  Module()
21 {
22  setDescription("Prunes RecoTracks.");
24 
25  addParam("storeArrayName", m_storeArrayName,
26  "Name of the StoreArray which is pruned",
28 
29  addParam("removeHits", m_do_remove_hits,
30  "Remove hits in the module or leave it for PruneRecoHitsModule"
32 }
33 
35 {
37 
38  if (recoTracks.isOptional()) {
39  StoreArray<RecoHitInformation> recoHitInformation;
40  recoHitInformation.isRequired();
41 
42  m_subsetOfUnprunedRecoHitInformation.registerSubset(recoHitInformation, DataStore::c_DontWriteOut);
43  }
44 }
45 
47 {
49  if (tracks.getEntries() > 0) {
50  for (auto& t : tracks) {
51  t.prune();
52  }
53 
54  if (m_do_remove_hits) {
55  m_subsetOfUnprunedRecoHitInformation.select([](const RecoHitInformation * recoHitInformation) {
56  return recoHitInformation->getFlag() != RecoHitInformation::RecoHitFlag::c_pruned;
57  });
58  }
59  }
60 }
61 
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ 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:82
Belle2::PruneRecoTracksModule::m_subsetOfUnprunedRecoHitInformation
SelectSubset< RecoHitInformation > m_subsetOfUnprunedRecoHitInformation
We use SelectSubset here to delete all pruned RecoHitInformation.
Definition: PruneRecoTracksModule.h:57
Belle2::PruneRecoTracksModule::event
void event() override
Event processing, prunes the RecoTracks contained in each event.
Definition: PruneRecoTracksModule.cc:46
Belle2::DataStore::c_DontWriteOut
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:73
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::RecoHitInformation::getFlag
RecoHitFlag getFlag() const
Get the additional flag.
Definition: RecoHitInformation.h:200
Belle2::PruneRecoTracksModule::m_storeArrayName
std::string m_storeArrayName
Name of the StoreArray to prune.
Definition: PruneRecoTracksModule.h:54
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::RecoHitInformation
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
Definition: RecoHitInformation.h:48
Belle2::Module::addParam
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:562
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::PruneRecoTracksModule::PruneRecoTracksModule
PruneRecoTracksModule()
Constructor of the module. Setting up parameters and description.
Definition: PruneRecoTracksModule.cc:19
Belle2::PruneRecoTracksModule::initialize
void initialize() override
Initialize the Module.
Definition: PruneRecoTracksModule.cc:34
Belle2::PruneRecoTracksModule::m_do_remove_hits
bool m_do_remove_hits
Remove pruned reco hits or leave this for PruneRecoHitsModule.
Definition: PruneRecoTracksModule.h:60