Belle II Software development
SpacePointLoaderAndPreparer.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 <framework/datastore/StoreArray.h>
11#include <framework/core/ModuleParamList.h>
12#include <framework/geometry/B2Vector3.h>
13#include <framework/database/DBObjPtr.h>
14#include <mdst/dbobjects/BeamSpot.h>
15#include <tracking/trackFindingCDC/findlets/base/Findlet.h>
16#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
17#include <tracking/vxdHoughTracking/entities/VXDHoughState.h>
18#include <tracking/spacePointCreation/SpacePoint.h>
19
20namespace Belle2 {
25 namespace vxdHoughTracking {
31 class SpacePointLoaderAndPreparer : public TrackFindingCDC::Findlet<const SpacePoint*, VXDHoughState> {
34
35 public:
38
40 void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
41 {
42 Super::exposeParameters(moduleParamList, prefix);
43
44 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "SVDSpacePointStoreArrayName"), m_SVDSpacePointStoreArrayName,
45 "Name of the SVDSpacePoints Store Array.", m_SVDSpacePointStoreArrayName);
46
47 moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "useAllSpacePoints"), m_useAllSpacePoints,
48 "Use all SVDSpacePoints for track finding or only unassigned ones?", m_useAllSpacePoints);
49 };
50
52 void initialize() override
53 {
56 };
57
59 void beginRun() override
60 {
62
63 DBObjPtr<BeamSpot> beamSpotDB;
64 if (beamSpotDB.isValid()) {
65 m_BeamSpotPosition = (*beamSpotDB).getIPPosition();
66 } else {
67 m_BeamSpotPosition.SetXYZ(0., 0., 0.);
68 }
69 }
70
72 void apply(std::vector<const SpacePoint*>& spacePoints, std::vector<VXDHoughState>& hits) override
73 {
74 if (m_storeSpacePoints.getEntries() == 0) return;
75
76 hits.reserve(m_storeSpacePoints.getEntries());
77 spacePoints.reserve(m_storeSpacePoints.getEntries());
78 for (auto& spacePoint : m_storeSpacePoints) {
79 if (not m_useAllSpacePoints and spacePoint.getAssignmentState() == true) {
80 continue;
81 }
82 hits.emplace_back(VXDHoughState(&spacePoint, m_BeamSpotPosition));
83 spacePoints.emplace_back(&spacePoint);
84 }
85 };
86
87 private:
89 std::string m_SVDSpacePointStoreArrayName = "SVDSpacePoints";
90
93
96
98 bool m_useAllSpacePoints = false;
99 };
100
101 }
103}
bool isValid() const
Check whether a valid object was obtained from the database.
Class for accessing objects in the database.
Definition DBObjPtr.h:21
The Module parameter list class.
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition Findlet.h:26
SpacePointLoaderAndPreparer()
Load clusters and prepare them for intercept finding.
B2Vector3D m_BeamSpotPosition
B2Vector3D actually containing the BeamSpot position. This will be passed on to the VXDHoughState for...
bool m_useAllSpacePoints
Use all SVDSpacePoints for track finding or only unassigned ones.
void apply(std::vector< const SpacePoint * > &spacePoints, std::vector< VXDHoughState > &hits) override
Load the SVD SpacePoints and create a VXDHoughState object for each hit.
std::string m_SVDSpacePointStoreArrayName
StoreArray name of the input Track Store Array.
TrackFindingCDC::Findlet< const SpacePoint *, VXDHoughState > Super
Parent class.
StoreArray< SpacePoint > m_storeSpacePoints
Input SpacePoints Store Array.
void beginRun() override
Retrieve the BeamSpot from DB.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
Simple container for hit information to be used during intercept finding.
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition B2Vector3.h:516
Abstract base class for different kinds of events.