Belle II Software development
PXDResultVarSet.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/pxd/filters/results/PXDResultVarSet.h>
9#include <tracking/ckf/pxd/entities/CKFToPXDResult.h>
10
11#include <tracking/spacePointCreation/SpacePoint.h>
12#include <tracking/dataobjects/RecoTrack.h>
13
14#include <framework/core/ModuleParamList.templateDetails.h>
15
16using namespace Belle2;
17using namespace TrackFindingCDC;
18
19PXDResultVarSet::PXDResultVarSet() : Super()
20{
21 addProcessingSignalListener(&m_advancer);
22}
23
25{
26 ModuleParamList moduleParamList;
27 m_advancer.exposeParameters(&moduleParamList, "");
28 moduleParamList.getParameter<std::string>("direction").setValue("both");
29
31}
32
34{
35 const ROOT::Math::XYZVector& resultMomentum = result->getMomentum();
36 var<named("pt")>() = resultMomentum.Rho();
37 var<named("theta")>() = resultMomentum.Theta();
38
39 const std::vector<const SpacePoint*>& spacePoints = result->getHits();
40
41 var<named("number_of_hits")>() = spacePoints.size();
42
43 std::vector<bool> layerUsed;
44 layerUsed.resize(7, false);
45
46 for (const SpacePoint* spacePoint : spacePoints) {
47 layerUsed[spacePoint->getVxdID().getLayerNumber()] = true;
48 }
49 // Counting the occurrences of 'true' rather counts the number of layers used,
50 // not the number of holes. But renaming this variable would break the MVA-based result filter.
51 // Could be renamed if the weight file for the MVA result filter was retrained afterwards and
52 // the new weight file was then uploaded to the DB and would replace the current one.
53 var<named("number_of_holes")>() = std::count(layerUsed.begin(), layerUsed.end(), true);
54
55 var<named("has_missing_layer_1")>() = layerUsed[1] == 0;
56 var<named("has_missing_layer_2")>() = layerUsed[2] == 0;
57 var<named("has_missing_layer_3")>() = layerUsed[3] == 0;
58 var<named("has_missing_layer_4")>() = layerUsed[4] == 0;
59 var<named("has_missing_layer_5")>() = layerUsed[5] == 0;
60 var<named("has_missing_layer_6")>() = layerUsed[6] == 0;
61
62 // Since the vector layerUsed only contains bool values, there can be no number 2, so this
63 // variable is basically useless. But also here, just removing the variable would likely break
64 // the MVA-based result filter, so this could only be removed in case the MVA is retrained and
65 // the new weight file was uploaded to the DB.
66 var<named("number_of_overlap_hits")>() = std::count(layerUsed.begin(), layerUsed.end(), 2);
67
68 if (spacePoints.empty()) {
69 var<named("last_hit_layer")>() = -1;
70 var<named("first_hit_layer")>() = -1;
71 } else {
72 var<named("last_hit_layer")>() = spacePoints.back()->getVxdID().getLayerNumber();
73 var<named("first_hit_layer")>() = spacePoints.front()->getVxdID().getLayerNumber();
74 }
75
76 genfit::MeasuredStateOnPlane mSoP = result->getMSoP();
77 const genfit::MeasuredStateOnPlane& firstCDCHit = result->getSeedMSoP();
78 m_advancer.extrapolateToPlane(mSoP, firstCDCHit.getPlane());
79
80 const auto& distance = mSoP.getPos() - firstCDCHit.getPos();
81 var<named("distance_to_seed_track")>() = distance.Mag();
82 var<named("distance_to_seed_track_xy")>() = distance.Pt();
83
84 const RecoTrack* seedTrack = result->getSeed();
85
86 var<named("chi2")>() = result->getChi2();
87 var<named("chi2_vxd_max")>() = result->getMaximalChi2();
88 var<named("chi2_vxd_min")>() = result->getMinimalChi2();
89 var<named("chi2_seed")>() = seedTrack->getTrackFitStatus()->getChi2();
90 var<named("weight_sum")>() = result->getWeightSum();
91 return true;
92}
Specialized CKF Result for extrapolating into the PXD.
The Module parameter list class.
void initialize() override
Receive and dispatch signal before the start of the event processing.
PXDAdvancer m_advancer
Findlet for advancing.
bool extract(const CKFToPXDResult *object) final
Generate and assign the variables from the object.
This is the Reconstruction Event-Data Model Track.
Definition RecoTrack.h:79
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
Definition RecoTrack.h:621
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition SpacePoint.h:42
static constexpr int named(const char *name)
Definition VarSet.h:78
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Abstract base class for different kinds of events.