10#include <framework/geometry/B2Vector3.h>
11#include <framework/datastore/RelationsObject.h>
12#include <framework/logging/Logger.h>
14#include <vxd/geometry/GeoCache.h>
15#include <vxd/geometry/SensorInfoBase.h>
17#include <pxd/dataobjects/PXDCluster.h>
19#include <svd/dataobjects/SVDCluster.h>
21#include <genfit/PlanarMeasurement.h>
59 explicit SpacePoint(std::vector<SVDCluster const*>& clusters,
82 double UClusterTime = 0.,
double VClusterTime = 0.) :
111 return !(*
this == b);
117 return "SpacePoint with index: " + std::to_string(
getArrayIndex()) +
263 static double getUWedged(
const std::pair<double, double>& hitLocalUnwedged,
VxdID vxdID,
267 return (aSensorInfo->getWidth(hitLocalUnwedged.second) / aSensorInfo->getWidth()) * hitLocalUnwedged.first;
282 return (aSensorInfo->getWidth() / aSensorInfo->getWidth(hitLocalWedged.second)) * hitLocalWedged.first;
296 static void boundaryEnforce(
double& value,
const double& otherValue,
double lower = 0,
double higher = 1,
unsigned int side = 0,
302 double sloppyTerm = 1e-3;
303 if (value < lower - sloppyTerm) {
304 B2WARNING(
"SpacePoint::boundaryEnforce: value had to be moved (lowerCheck)! old: " << value <<
", new: " << lower);
305 B2WARNING(
"On sensor: " << vxdID <<
" side: " << (side == 0 ?
" U " :
" V") <<
306 " when the other coordinate is: " << otherValue);
310 if (value > higher + sloppyTerm) {
311 B2WARNING(
"SpacePoint::boundaryEnforce: value had to be moved (higherCheck)! old: " << value <<
", new: " << higher);
312 B2WARNING(
"On sensor: " << vxdID <<
" side: " << (side == 0 ?
" U " :
" V") <<
313 " when the other coordinate is: " << otherValue);
DataType Z() const
access variable Z (= .at(2) without boundary check)
DataType X() const
access variable X (= .at(0) without boundary check)
DataType Y() const
access variable Y (= .at(1) without boundary check)
void Sqrt()
calculates the square root of the absolute values of the coordinates element-wise
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Defines interface for accessing relations of objects in StoreArray.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
bool isUOnly() const
Returns true if the SP is single clustered and the cluster is a u cluster.
friend std::ostream & operator<<(std::ostream &out, const SpacePoint &aSP)
overloaded '<<' stream operator.
virtual ~SpacePoint()
Currently SpacePoint is used as base class for test beam related TBSpacePoint.
float getQualityEstimationError() const
Getter for the spacePoint quality index error.
double m_VClusterTime
Time of the cluster on the V side in ns.
static void boundaryEnforce(double &value, const double &otherValue, double lower=0, double higher=1, unsigned int side=0, VxdID vxdID=VxdID())
Enforce 'value' in the range ['lower', 'higher'].
std::pair< bool, bool > m_clustersAssigned
The bool value is true, when correct information of the coordinate exists.
VXD::SensorInfoBase::SensorType m_sensorType
Stores the SensorType using the scheme of SensorInfoBase.
unsigned short getNClustersAssigned() const
Returns the number of Clusters assigned to this SpacePoint.
std::string getName() const override
Print out some info for this SpacePoint.
double m_UClusterTime
Time of the cluster on the U side in ns.
double TimeV() const
return the time in ns of the cluster on the V side
bool operator!=(const SpacePoint &b) const
Comparison for inequality with another SpacePoint.
SpacePoint()
Default constructor for the ROOT IO.
float getQualityEstimation() const
Getter for the quality of this SpacePoint.
void setAssignmentState(bool isAssigned) const
Setter for association with a track.
double getNormalizedLocalV() const
Return normalized local coordinates of the cluster in v (0 <= posV <= 1).
std::pair< bool, bool > getIfClustersAssigned() const
Returns, if u(v)-coordinate is based on cluster information.
void setQualityEstimation(float qualityIndicator)
Setter for the quality of this SpacePoint.
bool isUAndV() const
Returns true if the SP is not single clustered.
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
SpacePoint(const B2Vector3D &pos, const B2Vector3D &posError, std::pair< double, double > normalizedLocal, std::pair< bool, bool > clustersAssigned, VxdID sensorID, Belle2::VXD::SensorInfoBase::SensorType detID, double UClusterTime=0., double VClusterTime=0.)
Constructor for debugging or other special purposes.
virtual std::vector< genfit::PlanarMeasurement > getGenfitCompatible() const
returns a vector of genfit::PlanarMeasurement, which is needed for genfit::track.
void setPositionError(double uSigma, double vSigma, const VXD::SensorInfoBase *aSensorInfo)
Setter for global position error from on-sensor sigmas.
static std::pair< double, double > convertLocalToNormalizedCoordinates(const std::pair< double, double > &hitLocal, VxdID vxdID, const VXD::SensorInfoBase *aSensorInfo=nullptr)
converts a local hit into sensor-independent relative coordinates.
B2Vector3D m_positionError
Global position error vector in sigma.
const B2Vector3D & getPositionError() const
return the hitErrors in sigma of the global position
VxdID::baseType m_vxdID
Stores the VxdID.
bool getAssignmentState() const
Getter for status of assignment to a track.
double TimeU() const
return the time in ns of the cluster on the U side
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
float m_qualityIndicator
Stores a quality indicator.
static std::pair< double, double > convertNormalizedToLocalCoordinates(const std::pair< double, double > &hitNormalized, Belle2::VxdID vxdID, const Belle2::VXD::SensorInfoBase *aSensorInfo=nullptr)
converts a hit in sensor-independent relative coordinates into local coordinate of given sensor.
void setQualityEstimationError(double qualityIndicatorError)
Setter for the spacePoint quality index error.
bool operator==(const SpacePoint &b) const
Compare, if two SpacePoints are the same one.
const B2Vector3D & getPosition() const
return the position vector in global coordinates
bool m_isAssigned
Stores whether this SpacePoint is connected to a track.
bool isVOnly() const
Returns true if the SP is single clustered and the cluster is a v cluster.
static double getUUnwedged(const std::pair< double, double > &hitLocalWedged, VxdID::baseType vxdID, const VXD::SensorInfoBase *aSensorInfo=nullptr)
takes a wedged uCoordinate, and transforms it to general uCoordinate.
double Z() const
return the z-value of the global position of the SpacePoint
std::pair< double, double > m_normalizedLocal
Local position vector normalized to sensor size (0 <= x <= 1).
double X() const
return the x-value of the global position of the SpacePoint
static B2Vector3D getGlobalCoordinates(const std::pair< double, double > &hitLocal, VxdID vxdID, const VXD::SensorInfoBase *aSensorInfo=nullptr)
converts a local hit on a given sensor into global coordinates.
double getNormalizedLocalU() const
Return normalized local coordinates of the cluster in u (0 <= posU <= 1).
static double getUWedged(const std::pair< double, double > &hitLocalUnwedged, VxdID vxdID, const VXD::SensorInfoBase *aSensorInfo=nullptr)
takes a general uCoordinate, and transforms it to corrected uCoordinate for wedged sensors.
float m_qualityIndicatorError
Stores the error on the quality indicator.
double Y() const
return the y-value of the global position of the SpacePoint
B2Vector3D m_position
Global position vector.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Base class to provide Sensor Information for PXD and SVD.
SensorType
Enum specifing the type of sensor the SensorInfo represents.
ROOT::Math::XYZVector vectorToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a vector from local to global coordinates.
Class to uniquely identify a any structure of the PXD and SVD.
unsigned short baseType
The base integer type for VxdID.
Abstract base class for different kinds of events.