Belle II Software development
RelationFromSVDTracksCreator.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/ckf/svd/findlets/RelationFromSVDTracksCreator.h>
9
10#include <tracking/spacePointCreation/SpacePointTrackCand.h>
11#include <tracking/dataobjects/RecoTrack.h>
12#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
13#include <tracking/trackFindingCDC/utilities/ReversedRange.h>
14
15#include <framework/core/ModuleParamList.h>
16
17using namespace Belle2;
18
20{
21}
22
24{
27}
28
30
31void RelationFromSVDTracksCreator::exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix)
32{
33 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "vxdTracksStoreArrayName"),
35 "Store Array name for tracks coming from VXDTF2.");
36 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "cdcTracksStoreArrayName"),
38 "Store Array name for tracks coming from CDCTF.");
39
40 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "spacePointTrackCandidatesName"),
42 "Store Array name for the SpacePointTrackCandidates coming from VXDTF2.",
44}
45
46void RelationFromSVDTracksCreator::apply(std::vector<CKFToSVDState>& seedStates, std::vector<CKFToSVDState>& states,
48{
49 for (const RecoTrack& vxdRecoTrack : m_vxdRecoTracks) {
50 if (vxdRecoTrack.getRelated<RecoTrack>(m_param_cdcTracksStoreArrayName)) {
51 continue;
52 }
53
54 CKFToSVDState* currentState = nullptr;
55
56 const SpacePointTrackCand* spacePointTrackCand =
58
59 B2ASSERT("There should be a related SPTC!", spacePointTrackCand);
60 const std::vector<const SpacePoint*> spacePoints = spacePointTrackCand->getSortedHits();
61
62 for (const SpacePoint* spacePoint : TrackFindingCDC::reversedRange(spacePoints)) {
63 const auto hasSpacePoint = [spacePoint](const CKFToSVDState & state) {
64 return state.getHit() == spacePoint;
65 };
66
67 const auto nextStateIterator = std::find_if(states.begin(), states.end(), hasSpacePoint);
68 B2ASSERT("State can not be none!", nextStateIterator != states.end());
69
70 CKFToSVDState& nextState = *nextStateIterator;
71 nextState.setRelatedSVDTrack(&vxdRecoTrack);
72
73 if (currentState) {
74 relations.emplace_back(currentState, NAN, &nextState);
75 } else {
76 for (CKFToSVDState& seedState : seedStates) {
77 // We are not setting the related SVD track of the first state!
78 relations.emplace_back(&seedState, NAN, &nextState);
79 }
80 }
81
82 currentState = &nextState;
83 }
84 }
85
86 std::sort(relations.begin(), relations.end());
87}
Specialized CKF State for extrapolating into the SVD.
Definition: CKFToSVDState.h:27
void setRelatedSVDTrack(const RecoTrack *relatedSVDTrack)
Set the related SVD track, if we go along one of them (or a nullptr)
The Module parameter list class.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
std::string m_param_spacePointTrackCandidateName
Store Array name of the space point track candidates coming from VXDTF2.
RelationFromSVDTracksCreator()
Construct this findlet and add the subfindlet as listener.
void apply(std::vector< CKFToSVDState > &seedStates, std::vector< CKFToSVDState > &states, std::vector< TrackFindingCDC::WeightedRelation< CKFToSVDState > > &relations) final
Create relations between seeds and hits or hits and hits.
std::string m_param_vxdTracksStoreArrayName
Store Array name coming from VXDTF2.
void initialize() final
Require the store array.
std::string m_param_cdcTracksStoreArrayName
Store Array name coming from CDCTF.
StoreArray< RecoTrack > m_vxdRecoTracks
Store Array of the VXD tracks to use.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters of the subfindlet.
~RelationFromSVDTracksCreator()
Default destructor.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Storage for (VXD) SpacePoint-based track candidates.
const std::vector< const Belle2::SpacePoint * > getSortedHits() const
get hits (space points) sorted by their respective sorting parameter
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
void initialize() override
Receive and dispatch signal before the start of the event processing.
Type for two related objects with a weight.
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.