Belle II Software  release-06-00-14
PruneRecoTracksModule.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/pruneRecoTracks/PruneRecoTracksModule.h>
10 #include <framework/datastore/StoreArray.h>
11 #include <tracking/dataobjects/RecoTrack.h>
12 
13 using namespace Belle2;
14 
15 REG_MODULE(PruneRecoTracks);
16 
18  Module()
19 {
20  setDescription("Prunes RecoTracks.");
22 
23  addParam("storeArrayName", m_storeArrayName,
24  "Name of the StoreArray which is pruned",
26 
27  addParam("removeHits", m_do_remove_hits,
28  "Remove hits in the module or leave it for PruneRecoHitsModule"
30 }
31 
33 {
35 
36  if (recoTracks.isOptional()) {
37  StoreArray<RecoHitInformation> recoHitInformation;
38  recoHitInformation.isRequired();
39 
40  m_subsetOfUnprunedRecoHitInformation.registerSubset(recoHitInformation, DataStore::c_DontWriteOut);
41  }
42 }
43 
45 {
47  if (tracks.getEntries() > 0) {
48  for (auto& t : tracks) {
49  t.prune();
50  }
51 
52  if (m_do_remove_hits) {
53  m_subsetOfUnprunedRecoHitInformation.select([](const RecoHitInformation * recoHitInformation) {
54  return recoHitInformation->getFlag() != RecoHitInformation::RecoHitFlag::c_pruned;
55  });
56  }
57  }
58 }
59 
@ c_DontWriteOut
Object/array should be NOT saved by output modules.
Definition: DataStore.h:71
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
PruneRecoTracksModule()
Constructor of the module. Setting up parameters and description.
void initialize() override
Initialize the Module.
void event() override
Event processing, prunes the RecoTracks contained in each event.
bool m_do_remove_hits
Remove pruned reco hits or leave this for PruneRecoHitsModule.
std::string m_storeArrayName
Name of the StoreArray to prune.
SelectSubset< RecoHitInformation > m_subsetOfUnprunedRecoHitInformation
We use SelectSubset here to delete all pruned RecoHitInformation.
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
RecoHitFlag getFlag() const
Get the additional flag.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
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.