Belle II Software  release-08-01-10
StoreArrayMerger.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 #include <tracking/modules/vxdCDCTrackMerger/StoreArrayMerger.h>
9 
10 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
11 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
12 
13 #include <framework/core/ModuleParamList.templateDetails.h>
14 
15 using namespace Belle2;
16 
17 void StoreArrayMerger::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
18 {
19  Super::exposeParameters(moduleParamList, prefix);
20 
21  // CDC input tracks
22  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "CDCRecoTrackStoreArrayName"), m_param_cdcRecoTrackStoreArrayName,
23  "StoreArray name of the CDC Track Store Array", m_param_cdcRecoTrackStoreArrayName);
24  // VXD input tracks
25  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "VXDRecoTrackStoreArrayName"), m_param_vxdRecoTrackStoreArrayName,
26  "StoreArray name of the VXD Track Store Array", m_param_vxdRecoTrackStoreArrayName);
27 }
28 
30 {
33 
36 
38 }
39 
40 void StoreArrayMerger::apply(std::vector<RecoTrack*>& cdcRecoTrackVector, std::vector<RecoTrack*>& vxdRecoTrackVector)
41 {
42  cdcRecoTrackVector.reserve(m_cdcRecoTracks.getEntries());
43  vxdRecoTrackVector.reserve(m_vxdRecoTracks.getEntries());
44 
45  for (RecoTrack& recoTrack : m_cdcRecoTracks) {
46  cdcRecoTrackVector.push_back(&recoTrack);
47  }
48 
49  for (RecoTrack& recoTrack : m_vxdRecoTracks) {
50  vxdRecoTrackVector.push_back(&recoTrack);
51  }
52 }
53 
54 void StoreArrayMerger::removeCDCRecoTracksWithPartner(std::vector<RecoTrack*>& tracks)
55 {
57 }
58 
59 void StoreArrayMerger::removeVXDRecoTracksWithPartner(std::vector<RecoTrack*>& tracks)
60 {
62 }
63 
64 void StoreArrayMerger::removeRecoTracksWithPartner(std::vector<RecoTrack*>& tracks, const std::string& partnerStoreArrayName)
65 {
66  const auto& trackHasAlreadyRelations = [&partnerStoreArrayName](const RecoTrack * recoTrack) {
67  return recoTrack->getRelated<RecoTrack>(partnerStoreArrayName) != nullptr;
68  };
69 
70  TrackFindingCDC::erase_remove_if(tracks, trackHasAlreadyRelations);
71 }
The Module parameter list class.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
void apply(std::vector< RecoTrack * > &cdcRecoTrackVector, std::vector< RecoTrack * > &vxdRecoTrackVector) override
Fetch the RecoTracks from the two input Store Arrays and fill them into two vectors.
std::string m_param_cdcRecoTrackStoreArrayName
StoreArray name of the CDC Track Store Array.
void initialize() override
Require/register the store arrays.
std::string m_param_vxdRecoTrackStoreArrayName
StoreArray name of the VXD Track Store Array.
void removeCDCRecoTracksWithPartner(std::vector< RecoTrack * > &tracks)
Helper function to remove all tracks, which have a related VXD track from the vector.
StoreArray< RecoTrack > m_vxdRecoTracks
VXD Reco Tracks Store Array.
void removeRecoTracksWithPartner(std::vector< RecoTrack * > &tracks, const std::string &partnerStoreArrayName)
Helper function to remove all element in a std::vector, which have already a relation to the given st...
void removeVXDRecoTracksWithPartner(std::vector< RecoTrack * > &tracks)
Helper function to remove all tracks, which have a related CDC track from the vector.
StoreArray< RecoTrack > m_cdcRecoTracks
CDC Reco Tracks Store Array.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the findlet.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Definition: StoreArray.h:140
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.