Belle II Software development
CosmicsTrackMergerFindlet.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/cosmicsTrackMerger/CosmicsTrackMergerFindlet.h>
9
10#include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
11#include <tracking/trackFindingCDC/utilities/Algorithms.h>
12
13using namespace Belle2;
14using namespace TrackFindingCDC;
15
17{
19}
20
22{
23 return "Links tracks by extraction of track paths in a cellular automaton.";
24}
25
26void CosmicsTrackMergerFindlet::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
27{
28 m_trackRelationCreator.exposeParameters(moduleParamList, prefix);
29 m_cellularPathFinder.exposeParameters(moduleParamList, prefix);
30
31 moduleParamList->addParameter("inputRecoTracks", m_param_inputRecoTracks,
32 "Store Array name of the input reco tracks.", m_param_inputRecoTracks);
33 moduleParamList->addParameter("outputRecoTracks", m_param_outputRecoTracks,
34 "Store Array name of the output reco tracks.", m_param_outputRecoTracks);
35}
36
38{
40
43
45}
46
48{
49 m_inputTrackVector.clear();
50
51 // Read the tracks from the Store Array
52 for (const RecoTrack& recoTrack : m_inputTracks) {
53 m_inputTrackVector.emplace_back(&recoTrack);
54 }
55
56 std::sort(m_inputTrackVector.begin(), m_inputTrackVector.end());
57
58 // Obtain the tracks as pointers
59 std::vector<const CellularRecoTrack*> trackPtrs = as_pointers<const CellularRecoTrack>(m_inputTrackVector);
60
61 // Create linking relations
62 m_trackRelations.clear();
64
65 // Find linking paths
66 m_trackPaths.clear();
68
69 // Write out the tracks to the data store
70 // TODO: other possibility would be to use relations for this!
71 // One would need to extend the RelatedTrackCombiner for this
72 for (const std::vector<const CellularRecoTrack*>& trackPath : m_trackPaths) {
73 // We use the first track to give us the momentum seed etc.
74 const RecoTrack* firstTrack = *(trackPath.front());
75 RecoTrack* newRecoTrack = firstTrack->copyToStoreArray(m_outputTracks);
76
77 unsigned int numberOfAddedHits = 0;
78 for (const CellularRecoTrack* cellularRecoTrack : trackPath) {
79 numberOfAddedHits += newRecoTrack->addHitsFromRecoTrack(*cellularRecoTrack, numberOfAddedHits);
80 }
81 }
82}
StoreArray< RecoTrack > m_outputTracks
StoreArray for the output tracks.
void initialize() final
Init the store arrays.
std::vector< TrackFindingCDC::Path< const CellularRecoTrack > > m_trackPaths
Memory for the track paths generated from the graph.
std::string getDescription() final
Short description of the findlet.
TrackFindingCDC::MultipassCellularPathFinder< const CellularRecoTrack > m_cellularPathFinder
Instance of the cellular automaton path finder.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
StoreArray< RecoTrack > m_inputTracks
StoreArray for the input tracks.
std::vector< CellularRecoTrack > m_inputTrackVector
Storage for the input tracks.
std::vector< TrackFindingCDC::WeightedRelation< const CellularRecoTrack > > m_trackRelations
Memory for the relations between tracks to be followed on linking.
TrackFindingCDC::WeightedRelationCreator< const CellularRecoTrack, PhiRecoTrackRelationFilter > m_trackRelationCreator
Creator of the track relations for linking.
std::string m_param_outputRecoTracks
Parameter for the output reco tracks.
std::string m_param_inputRecoTracks
Parameter for the input reco tracks.
CosmicsTrackMergerFindlet()
Constructor adding the filter as a subordinary processing signal listener.
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
Definition: DataStore.h:72
The Module parameter list class.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
size_t addHitsFromRecoTrack(const RecoTrack *recoTrack, unsigned int sortingParameterOffset=0, bool reversed=false, std::optional< double > optionalMinimalWeight=std::nullopt)
Add all hits from another RecoTrack to this RecoTrack.
Definition: RecoTrack.cc:240
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:529
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:53
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
void initialize() override
Receive and dispatch signal before the start of the event processing.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Mixin class to attach an automaton cell to an object or pointer.
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.