Belle II Software development
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
16using namespace Belle2;
17
18CKFToPXDState::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.thetaSeed = this->getMeasuredStateOnPlane().getMom().Theta();
28 m_stateCache.phi = this->getMeasuredStateOnPlane().getPos().Phi();
29 m_stateCache.theta = this->getMeasuredStateOnPlane().getPos().Theta();
30 m_stateCache.perp = this->getMeasuredStateOnPlane().getPos().Perp();
31 m_stateCache.geoLayer = this->getGeometricalLayer();
32}
33
35{
36 const SpacePoint* spacePoint = getHit();
37 if (not spacePoint) {
38 // return number of layer (2) + 1 -> we fake the 3th layer as the SVD
39 return 3;
40 }
41
42 return spacePoint->getVxdID().getLayerNumber();
43}
44
45genfit::SharedPlanePtr CKFToPXDState::getPlane(const genfit::MeasuredStateOnPlane& state) const
46{
47 const PXDRecoHit& recoHit = getRecoHit();
48 return recoHit.constructPlane(state);
49}
50
52{
53 B2ASSERT("You are asking for the reco hit, although no hit is present.", not m_recoHits.empty());
54 return m_recoHits.front();
55}
56
57const std::vector<PXDRecoHit>& CKFToPXDState::getRecoHits() const
58{
59 B2ASSERT("You are asking for the reco hit, although no hit is present.", not m_recoHits.empty());
60 return m_recoHits;
61}
62
64{
65 for (const PXDCluster& pxdCluster : hit->getRelationsTo<PXDCluster>()) {
66 m_recoHits.emplace_back(&pxdCluster);
67 }
68 m_stateCache.isHitState = true;
69 m_stateCache.sensorID = hit->getVxdID();
70 m_stateCache.geoLayer = this->getGeometricalLayer();
71 m_stateCache.ladder = m_stateCache.sensorID.getLadderNumber();
72 const VXD::SensorInfoBase& sensorInfo = VXD::GeoCache::getInstance().getSensorInfo(hit->getVxdID());
73 m_stateCache.sensorCenterPhi = sensorInfo.pointToGlobal(ROOT::Math::XYZVector(0., 0., 0.), true).Phi();
74 m_stateCache.phi = hit->getPosition().Phi();
75 m_stateCache.theta = hit->getPosition().Theta();
76 m_stateCache.perp = hit->getPosition().Perp();
77 m_stateCache.localNormalizedu = hit->getNormalizedLocalU();
78 m_stateCache.localNormalizedv = hit->getNormalizedLocalV();
79}
const genfit::MeasuredStateOnPlane & getMeasuredStateOnPlane() const
Definition CKFState.h:93
void setMeasuredStateOnPlane(const genfit::MeasuredStateOnPlane &mSoP)
Definition CKFState.h:86
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.
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
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition GeoCache.cc:214
Base class to provide Sensor Information for PXD and SVD.
baseType getLayerNumber() const
Get the layer id.
Definition VxdID.h:96
Abstract base class for different kinds of events.