Belle II Software  release-05-02-19
RecoTracksCopierModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/modules/recoTracksCopier/RecoTracksCopierModule.h>
12 
13 using namespace Belle2;
14 
15 REG_MODULE(RecoTracksCopier);
16 
18  Module()
19 {
20  setDescription("Copies RecoTracks without their fit information.");
22 
23  addParam("inputStoreArrayName", m_inputStoreArrayName,
24  "Name of the input StoreArray");
25  addParam("outputStoreArrayName", m_outputStoreArrayName,
26  "Name of the output StoreArray");
27  addParam("onlyFittedTracks", m_param_onlyFittedTracks, "Only copy fitted tracks", m_param_onlyFittedTracks);
28 
29 }
30 
32 {
34 
37 
38  m_outputRecoTracks.registerRelationTo(m_inputRecoTracks);
39 
40  if (m_tracks.optionalRelationTo(m_inputRecoTracks)) {
41  m_tracks.registerRelationTo(m_outputRecoTracks);
42  }
43 }
44 
46 {
47  for (const RecoTrack& recoTrack : m_inputRecoTracks) {
48  if (m_param_onlyFittedTracks and not recoTrack.wasFitSuccessful()) {
49  continue;
50  }
51  RecoTrack* newRecoTrack = recoTrack.copyToStoreArray(m_outputRecoTracks);
52  newRecoTrack->addHitsFromRecoTrack(&recoTrack);
53  newRecoTrack->addRelationTo(&recoTrack);
54 
55  for (Track& track : recoTrack.getRelationsWith<Track>()) {
56  track.addRelationTo(newRecoTrack);
57  }
58  }
59 }
60 
Belle2::RecoTracksCopierModule::m_inputRecoTracks
StoreArray< RecoTrack > m_inputRecoTracks
Store Array of the input tracks.
Definition: RecoTracksCopierModule.h:57
Belle2::RecoTracksCopierModule::m_inputStoreArrayName
std::string m_inputStoreArrayName
Name of the input StoreArray.
Definition: RecoTracksCopierModule.h:52
Belle2::RecoTrack::registerRequiredRelations
static void registerRequiredRelations(StoreArray< RecoTrack > &recoTracks, std::string const &pxdHitsStoreArrayName="", std::string const &svdHitsStoreArrayName="", std::string const &cdcHitsStoreArrayName="", std::string const &bklmHitsStoreArrayName="", std::string const &eklmHitsStoreArrayName="", std::string const &recoHitInformationStoreArrayName="")
Convenience method which registers all relations required to fully use a RecoTrack.
Definition: RecoTrack.cc:42
Belle2::RecoTrack::addHitsFromRecoTrack
size_t addHitsFromRecoTrack(const RecoTrack *recoTrack, unsigned int sortingParameterOffset=0, bool reversed=false, boost::optional< double > optionalMinimalWeight=boost::none)
Add all hits from another RecoTrack to this RecoTrack.
Definition: RecoTrack.cc:230
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::RecoTracksCopierModule::RecoTracksCopierModule
RecoTracksCopierModule()
Constructor of the module. Setting up parameters and description.
Definition: RecoTracksCopierModule.cc:17
Belle2::RelationsInterface::addRelationTo
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
Definition: RelationsObject.h:144
Belle2::RecoTrack::copyToStoreArray
RecoTrack * copyToStoreArray(StoreArray< RecoTrack > &storeArray) const
Append a new RecoTrack to the given store array and copy its general properties, but not the hits the...
Definition: RecoTrack.cc:506
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::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::RecoTracksCopierModule::m_tracks
StoreArray< Track > m_tracks
Store Array of the input tracks (for relations)
Definition: RecoTracksCopierModule.h:61
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::DataStore::c_ErrorIfAlreadyRegistered
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:74
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::Track
Class that bundles various TrackFitResults.
Definition: Track.h:35
Belle2::RecoTracksCopierModule::m_outputStoreArrayName
std::string m_outputStoreArrayName
Name of the output StoreArray.
Definition: RecoTracksCopierModule.h:54
Belle2::RecoTracksCopierModule::m_param_onlyFittedTracks
bool m_param_onlyFittedTracks
Parameter: Copy only fitted tracks.
Definition: RecoTracksCopierModule.h:64
Belle2::RecoTracksCopierModule::event
void event() override
Event processing, copies store array.
Definition: RecoTracksCopierModule.cc:45
Belle2::RecoTracksCopierModule::m_outputRecoTracks
StoreArray< RecoTrack > m_outputRecoTracks
Store Array of the output tracks.
Definition: RecoTracksCopierModule.h:59
Belle2::RecoTracksCopierModule::initialize
void initialize() override
Declare required StoreArray.
Definition: RecoTracksCopierModule.cc:31