Belle II Software  release-06-01-15
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 #include <vxd/geometry/GeoCache.h>
20 
21 #include <string>
22 #include <vector>
23 
24 namespace Belle2 {
29  namespace vxdHoughTracking {
35  class SpacePointLoaderAndPreparer : public TrackFindingCDC::Findlet<const SpacePoint*, VXDHoughState> {
38 
39  public:
42 
44  void exposeParameters(ModuleParamList* moduleParamList, const std::string& prefix) override
45  {
46  Super::exposeParameters(moduleParamList, prefix);
47 
48  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "SVDSpacePointStoreArrayName"), m_param_SVDSpacePointStoreArrayName,
49  "Name of the SVDSpacePoints Store Array.", m_param_SVDSpacePointStoreArrayName);
50 
51  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimumUClusterTime"), m_param_minimumUClusterTime,
52  "Minimum time of the u cluster (in ns).", m_param_minimumUClusterTime);
53 
54  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "minimumVClusterTime"), m_param_minimumVClusterTime,
55  "Minimum time of the v cluster (in ns).", m_param_minimumVClusterTime);
56 
57  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maximumUClusterTime"), m_param_maximumUClusterTime,
58  "Maximum time of the u cluster (in ns).", m_param_maximumUClusterTime);
59 
60  moduleParamList->addParameter(TrackFindingCDC::prefixed(prefix, "maximumVClusterTime"), m_param_maximumVClusterTime,
61  "Maximum time of the v cluster (in ns).", m_param_maximumVClusterTime);
62  };
63 
65  void initialize() override
66  {
69  };
70 
72  void beginRun() override
73  {
75 
76  if (m_BeamSpotDB.isValid()) {
78  const TVector3& BeamSpotPosition = m_BeamSpot.getIPPosition();
79  m_BeamSpotPosition.SetXYZ(BeamSpotPosition.X(), BeamSpotPosition.Y(), BeamSpotPosition.Z());
80  } else {
81  m_BeamSpotPosition.SetXYZ(0., 0., 0.);
82  }
83  B2INFO("DATCON uses following BeamSpot: " <<
84  m_BeamSpotPosition.X() << ", " << m_BeamSpotPosition.Y() << ", " << m_BeamSpotPosition.Z());
85  }
86 
88  void apply(std::vector<const SpacePoint*>& spacePoints, std::vector<VXDHoughState>& hits) override
89  {
90  if (m_storeSpacePoints.getEntries() == 0) return;
91 
92  hits.reserve(m_storeSpacePoints.getEntries());
93  spacePoints.reserve(m_storeSpacePoints.getEntries());
94  for (auto& spacePoint : m_storeSpacePoints) {
95  if (spacePoint.TimeU() >= m_param_minimumUClusterTime and
96  spacePoint.TimeV() >= m_param_minimumVClusterTime and
97  spacePoint.TimeU() <= m_param_maximumUClusterTime and
98  spacePoint.TimeV() <= m_param_maximumVClusterTime) {
99  hits.emplace_back(VXDHoughState(&spacePoint, m_BeamSpotPosition));
100  spacePoints.emplace_back(&spacePoint);
101  }
102  }
103  };
104 
105  private:
107  std::string m_param_SVDSpacePointStoreArrayName = "SVDSpacePoints";
108 
117 
120 
127  };
128 
129  }
131 }
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:420
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:416
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:418
void SetXYZ(DataType x, DataType y, DataType z)
set all coordinates using data type
Definition: B2Vector3.h:445
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Definition: BeamSpot.h:22
const TVector3 & getIPPosition() const
Get the IP position.
Definition: BeamSpot.h:66
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
The Module parameter list class.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
void initialize() override
Receive and dispatch signal before the start of the event processing.
void beginRun() override
Receive and dispatch signal for the beginning of a new run.
Interface for a minimal algorithm part that wants to expose some parameters to a module.
Definition: Findlet.h:26
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Definition: Findlet.h:69
Interface for an algorithm part that needs to receive the module processing signals.
Findlet for loading SVDClusters that were created by the DATCONSVDSimpleClusterizerModule and prepare...
SpacePointLoaderAndPreparer()
Load clusters and prepare them for intercept finding.
B2Vector3D m_BeamSpotPosition
B2Vector3D actually contining the BeamSpot position. This will be passed on to the VXDHoughState for ...
void apply(std::vector< const SpacePoint * > &spacePoints, std::vector< VXDHoughState > &hits) override
Load the SVD SpacePoints and create a VXDHoughState object for each hit.
StoreArray< SpacePoint > m_storeSpacePoints
Input SpacePoints Store Array.
void beginRun() override
Retrieve the BeamSpot from DB.
std::string m_param_SVDSpacePointStoreArrayName
StoreArray name of the input Track Store Array.
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.
Definition: VXDHoughState.h:24
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.