Belle II Software  release-08-01-10
CKFToPXDState.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/pxd/entities/CKFToPXDState.h>
10 #include <tracking/dataobjects/RecoTrack.h>
11 #include <tracking/spacePointCreation/SpacePoint.h>
12 #include <pxd/dataobjects/PXDCluster.h>
13 
14 #include <genfit/MeasuredStateOnPlane.h>
15 
16 using namespace Belle2;
17 
18 CKFToPXDState::CKFToPXDState(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.ptSeed = this->getMeasuredStateOnPlane().getMom().Pt();
27  m_stateCache.phi = this->getMeasuredStateOnPlane().getPos().Phi();
28  m_stateCache.theta = this->getMeasuredStateOnPlane().getPos().Theta();
29  m_stateCache.geoLayer = this->getGeometricalLayer();
30 }
31 
33 {
34  const SpacePoint* spacePoint = getHit();
35  if (not spacePoint) {
36  // return number of layer (2) + 1 -> we fake the 3th layer as the SVD
37  return 3;
38  }
39 
40  return spacePoint->getVxdID().getLayerNumber();
41 }
42 
44 {
45  const PXDRecoHit& recoHit = getRecoHit();
46  return recoHit.constructPlane(state);
47 }
48 
50 {
51  B2ASSERT("You are asking for the reco hit, although no hit is present.", not m_recoHits.empty());
52  return m_recoHits.front();
53 }
54 
55 const std::vector<PXDRecoHit>& CKFToPXDState::getRecoHits() const
56 {
57  B2ASSERT("You are asking for the reco hit, although no hit is present.", not m_recoHits.empty());
58  return m_recoHits;
59 }
60 
62 {
63  for (const PXDCluster& pxdCluster : hit->getRelationsTo<PXDCluster>()) {
64  m_recoHits.emplace_back(&pxdCluster);
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 }
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
unsigned int getGeometricalLayer() const
Extract the real layer this state sits on.
const PXDRecoHit & getRecoHit() const
Helper function for getting the already created reco hit (runtime reasons)
genfit::SharedPlanePtr getPlane(const genfit::MeasuredStateOnPlane &state) const
Return the plane of the first PXD cluster.
const std::vector< PXDRecoHit > & getRecoHits() const
Helper function for getting the already created reco hits (runtime reasons)
CKFToPXDState(const SpacePoint *hit)
When constructed by a hit, set the reco hit.
std::vector< PXDRecoHit > m_recoHits
Precache the PXDRecoHits for runtime performance reasons.
Definition: CKFToPXDState.h:54
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
PXDRecoHit - an extended form of PXDCluster containing geometry information.
Definition: PXDRecoHit.h:49
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
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.