Belle II Software  release-08-01-10
RelationSVDResultVarSet.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 #include <tracking/ckf/svd/filters/results/RelationSVDResultVarSet.h>
9 
10 #include <tracking/dataobjects/RecoTrack.h>
11 
12 using namespace Belle2;
13 using namespace TrackFindingCDC;
14 
16 {
17  const RecoTrack* svdTrack = result->getRelatedSVDRecoTrack();
18  B2ASSERT("Should have a related SVD track at this stage;", svdTrack);
19 
20  const auto& svdHits = svdTrack->getSVDHitList();
21  B2ASSERT("SVD hits must be present", not svdHits.empty());
22 
23  const auto sortBySVDLayer = [](const SVDCluster * lhs, const SVDCluster * rhs) {
24  return lhs->getSensorID().getLayerNumber() < rhs->getSensorID().getLayerNumber();
25  };
26 
27  const auto& firstSVDHitIterator = std::max_element(svdHits.begin(), svdHits.end(), sortBySVDLayer);
28  var<named("svd_highest_layer")>() = (*firstSVDHitIterator)->getSensorID().getLayerNumber();
29 
30  const RecoTrack* relatedSVDRecoTrack = result->getRelatedSVDRecoTrack();
31  if (relatedSVDRecoTrack) {
32  var<named("number_of_hits_related_svd_track")>() = relatedSVDRecoTrack->getNumberOfSVDHits();
33  } else {
34  var<named("number_of_hits_related_svd_track")>() = -1;
35  }
36  return true;
37 }
Specialized CKF Result for extrapolating into the SVD.
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
std::vector< Belle2::RecoTrack::UsedSVDHit * > getSVDHitList() const
Return an unsorted list of svd hits.
Definition: RecoTrack.h:452
unsigned int getNumberOfSVDHits() const
Return the number of svd hits.
Definition: RecoTrack.h:424
bool extract(const CKFToSVDResult *object) final
Generate and assign the variables from the object.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29
VxdID getSensorID() const
Get the sensor ID.
Definition: SVDCluster.h:102
baseType getLayerNumber() const
Get the layer id.
Definition: VxdID.h:96
Abstract base class for different kinds of events.