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