Belle II Software development
ResultStorer.icc.h
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#pragma once
9
10#include <tracking/ckf/general/findlets/ResultStorer.dcl.h>
11
12#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
13#include <tracking/ckf/general/utilities/SearchDirection.h>
14#include <tracking/dataobjects/RecoTrack.h>
15
16#include <framework/core/ModuleParamList.templateDetails.h>
17
18namespace Belle2 {
24 template <class AResult>
25 void ResultStorer<AResult>::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
26 {
27 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "exportTracks"), m_param_exportTracks,
28 "Export the result tracks into a StoreArray.",
30
31 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "outputRecoTrackStoreArrayName"),
33 "StoreArray name of the output Track Store Array.");
34 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "outputRelationRecoTrackStoreArrayName"),
36 "StoreArray name of the tracks, the output reco tracks should be related to.");
38 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "writeOutDirection"),
40 "Write out the relations with the direction of the VXD part as weight");
41 }
42
44 template <class AResult>
61
63 template <class AResult>
64 void ResultStorer<AResult>::apply(std::vector<AResult>& results)
65 {
66 if (not m_param_exportTracks) {
67 return;
68 }
69
70 for (const auto& result : results) {
71
72 const ROOT::Math::XYZVector& trackPosition = result.getPosition();
73 const ROOT::Math::XYZVector& trackMomentum = result.getMomentum();
74 const short& trackCharge = result.getCharge();
75
76 RecoTrack* newRecoTrack = m_outputRecoTracks.appendNew(trackPosition, trackMomentum, trackCharge);
77 result.addToRecoTrack(*newRecoTrack);
78
79 const RecoTrack* seed = result.getSeed();
80 if (not seed) {
81 continue;
82 }
83 seed->addRelationTo(newRecoTrack, m_param_writeOutDirection);
84 }
85 }
86
87
87}
The Module parameter list class.
This is the Reconstruction Event-Data Model Track.
Definition RecoTrack.h:79
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
StoreArray< RecoTrack > m_outputRecoTracks
Output Reco Tracks Store Array.
bool m_param_exportTracks
Export the tracks or not.
TrackFindingCDC::EForwardBackward m_param_writeOutDirection
Direction parameter converted from the string parameters.
std::string m_param_outputRecoTrackStoreArrayName
StoreArray name of the output Track Store Array.
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
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 addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
void initialize() override
Create the store arrays.
TrackFindingCDC::EForwardBackward fromString(const std::string &directionString)
Helper function to turn a direction string into a valid forward backward information.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
void apply(std::vector< AResult > &results) override
Load in the reco tracks and the hits.
Abstract base class for different kinds of events.