Belle II Software  release-08-01-10
CKFToSVDState.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 
9 #include <tracking/ckf/svd/entities/CKFToSVDState.h>
10 #include <tracking/dataobjects/RecoTrack.h>
11 #include <tracking/spacePointCreation/SpacePoint.h>
12 #include <svd/dataobjects/SVDCluster.h>
13 
14 #include <genfit/MeasuredStateOnPlane.h>
15 
16 using namespace Belle2;
17 
18 CKFToSVDState::CKFToSVDState(const RecoTrack* seed, bool reversed) : CKFState(seed)
19 {
20  if (reversed) {
21  setMeasuredStateOnPlane(seed->getMeasuredStateOnPlaneFromLastHit());
22  } else {
23  setMeasuredStateOnPlane(seed->getMeasuredStateOnPlaneFromFirstHit());
24  }
25  m_stateCache.isHitState = false;
26  m_stateCache.phi = this->getMeasuredStateOnPlane().getPos().Phi();
27  m_stateCache.theta = this->getMeasuredStateOnPlane().getPos().Theta();
28  m_stateCache.geoLayer = this->getGeometricalLayer();
29 }
30 
32 {
33  const SpacePoint* spacePoint = getHit();
34  if (not spacePoint) {
35  // return number of layer (6) + 1 -> we fake the 7th layer as the CDC
36  return 7;
37  }
38 
39  return spacePoint->getVxdID().getLayerNumber();
40 }
41 
43 {
44  const SVDRecoHit& recoHit = getRecoHit();
45  return recoHit.constructPlane(state);
46 }
47 
49 {
50  B2ASSERT("You are asking for the reco hit, although no hit is present.", not m_recoHits.empty());
51  return m_recoHits.front();
52 }
53 
54 const std::vector<SVDRecoHit>& CKFToSVDState::getRecoHits() const
55 {
56  B2ASSERT("You are asking for reco hits, although no hit is present.", not m_recoHits.empty());
57  return m_recoHits;
58 }
59 
61 {
62  m_recoHits.reserve(2);
63  for (const SVDCluster& svdCluster : hit->getRelationsTo<SVDCluster>()) {
64  m_recoHits.emplace_back(&svdCluster);
65  }
66  m_stateCache.isHitState = true;
67  m_stateCache.sensorID = hit->getVxdID();
68  m_stateCache.geoLayer = this->getGeometricalLayer();
69  m_stateCache.ladder = m_stateCache.sensorID.getLadderNumber();
70  const VXD::SensorInfoBase& sensorInfo = VXD::GeoCache::getInstance().getSensorInfo(hit->getVxdID());
71  m_stateCache.sensorCenterPhi = sensorInfo.pointToGlobal(ROOT::Math::XYZVector(0., 0., 0.), true).Phi();
72  m_stateCache.phi = hit->getPosition().Phi();
73  m_stateCache.theta = hit->getPosition().Theta();
74  m_stateCache.localNormalizedu = hit->getNormalizedLocalU();
75  m_stateCache.localNormalizedv = hit->getNormalizedLocalV();
76 }
77 
79 {
80  return m_relatedSVDTrack;
81 }
82 
83 void CKFToSVDState::setRelatedSVDTrack(const RecoTrack* relatedSVDTrack)
84 {
85  if (m_relatedSVDTrack and m_relatedSVDTrack != relatedSVDTrack) {
86  B2FATAL("You are resetting the related track to a different value!");
87  }
88  m_relatedSVDTrack = relatedSVDTrack;
89 }
State object to store one step in the CKF algorithm together with its parent (the state before),...
Definition: CKFState.h:29
void setMeasuredStateOnPlane(const genfit::MeasuredStateOnPlane &mSoP)
Set the mSoP.
Definition: CKFState.h:86
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlane() const
Get the mSoP if already set during extrapolation (or fitting)
Definition: CKFState.h:93
stateCache m_stateCache
Cache the most important data of this state for better runtime performance.
Definition: CKFState.h:150
const Hit * getHit() const
Return the SP this state is related to. May be nullptr.
Definition: CKFState.h:66
const RecoTrack * getRelatedSVDTrack() const
Return the related SVD track, if we go along one of them (or a nullptr)
unsigned int getGeometricalLayer() const
Extract the real layer this state sits on.
genfit::SharedPlanePtr getPlane(const genfit::MeasuredStateOnPlane &state) const
Return the plane of the first SVD cluster.
std::vector< SVDRecoHit > m_recoHits
Precache the PXDRecoHits for runtime performance reasons.
Definition: CKFToSVDState.h:60
const std::vector< SVDRecoHit > & getRecoHits() const
Helper function for getting the already created reco hits (runtime reasons)
const SVDRecoHit & getRecoHit() const
Helper function for getting the already created reco hit (runtime reasons)
void setRelatedSVDTrack(const RecoTrack *relatedSVDTrack)
Set the related SVD track, if we go along one of them (or a nullptr)
CKFToSVDState(const SpacePoint *hit)
When constructed by a hit, set the reco hit.
const RecoTrack * m_relatedSVDTrack
The related SVD track, if we go along one of them (or a nullptr)
Definition: CKFToSVDState.h:63
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29
SVDRecoHit - an extended form of SVDHit containing geometry information.
Definition: SVDRecoHit.h:47
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Definition: SpacePoint.h:148
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214
Base class to provide Sensor Information for PXD and SVD.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96
#StateOnPlane with additional covariance matrix.
virtual SharedPlanePtr constructPlane(const StateOnPlane &state) const override
Construct (virtual) detector plane (use state's AbsTrackRep).
Abstract base class for different kinds of events.
std::shared_ptr< genfit::DetPlane > SharedPlanePtr
Shared Pointer to a DetPlane.