Belle II Software  release-05-01-25
PXDResultVarSet.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 *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/ckf/pxd/filters/results/PXDResultVarSet.h>
11 
12 #include <tracking/spacePointCreation/SpacePoint.h>
13 #include <tracking/dataobjects/RecoTrack.h>
14 
15 #include <framework/core/ModuleParamList.templateDetails.h>
16 
17 using namespace std;
18 using namespace Belle2;
19 using namespace TrackFindingCDC;
20 
21 PXDResultVarSet::PXDResultVarSet() : Super()
22 {
23  addProcessingSignalListener(&m_advancer);
24 }
25 
27 {
28  ModuleParamList moduleParamList;
29  m_advancer.exposeParameters(&moduleParamList, "");
30  moduleParamList.getParameter<std::string>("direction").setValue("both");
31 
33 }
34 
36 {
37  const TVector3& resultMomentum = result->getMomentum();
38  var<named("pt")>() = resultMomentum.Pt();
39  var<named("theta")>() = resultMomentum.Theta();
40 
41  const std::vector<const SpacePoint*>& spacePoints = result->getHits();
42 
43  var<named("number_of_hits")>() = spacePoints.size();
44 
45  std::vector<bool> layerUsed;
46  layerUsed.resize(7, false);
47 
48  for (const SpacePoint* spacePoint : spacePoints) {
49  layerUsed[spacePoint->getVxdID().getLayerNumber()] = true;
50  }
51  var<named("number_of_holes")>() = std::count(layerUsed.begin(), layerUsed.end(), true);
52 
53  var<named("has_missing_layer_1")>() = layerUsed[1] == 0;
54  var<named("has_missing_layer_2")>() = layerUsed[2] == 0;
55  var<named("has_missing_layer_3")>() = layerUsed[3] == 0;
56  var<named("has_missing_layer_4")>() = layerUsed[4] == 0;
57  var<named("has_missing_layer_5")>() = layerUsed[5] == 0;
58  var<named("has_missing_layer_6")>() = layerUsed[6] == 0;
59 
60  var<named("number_of_overlap_hits")>() = std::count(layerUsed.begin(), layerUsed.end(), 2);
61 
62  if (spacePoints.empty()) {
63  var<named("last_hit_layer")>() = -1;
64  var<named("first_hit_layer")>() = -1;
65  } else {
66  var<named("last_hit_layer")>() = spacePoints.back()->getVxdID().getLayerNumber();
67  var<named("first_hit_layer")>() = spacePoints.front()->getVxdID().getLayerNumber();
68  }
69 
70  genfit::MeasuredStateOnPlane mSoP = result->getMSoP();
71  const genfit::MeasuredStateOnPlane& firstCDCHit = result->getSeedMSoP();
72  m_advancer.extrapolateToPlane(mSoP, firstCDCHit.getPlane());
73 
74  const auto& distance = mSoP.getPos() - firstCDCHit.getPos();
75  var<named("distance_to_seed_track")>() = distance.Mag();
76  var<named("distance_to_seed_track_xy")>() = distance.Pt();
77 
78  const RecoTrack* seedTrack = result->getSeed();
79 
80  var<named("chi2")>() = result->getChi2();
81  var<named("chi2_vxd_max")>() = result->getMaximalChi2();
82  var<named("chi2_vxd_min")>() = result->getMinimalChi2();
83  var<named("chi2_seed")>() = seedTrack->getTrackFitStatus()->getChi2();
84  var<named("weight_sum")>() = result->getWeightSum();
85  return true;
86 }
Belle2::RecoTrack::getTrackFitStatus
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:537
genfit::FitStatus::getChi2
double getChi2() const
Get chi^2 of the fit.
Definition: FitStatus.h:120
Belle2::Advancer::extrapolateToPlane
double extrapolateToPlane(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const genfit::SharedPlanePtr &plane) const
Extrapolate the mSoP of one plane to another plane and return the traveled distance or NAN,...
Definition: Advancer.cc:24
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::ModuleParamList::getParameter
ModuleParam< T > & getParameter(const std::string &name) const
Returns a reference to a parameter.
Definition: ModuleParamList.templateDetails.h:90
Belle2::PXDResultVarSet::initialize
void initialize() override
Receive signal before the start of the event processing.
Definition: PXDResultVarSet.cc:26
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::addProcessingSignalListener
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
Definition: CompositeProcessingSignalListener.cc:57
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::initialize
void initialize() override
Receive and dispatch signal before the start of the event processing.
Definition: CompositeProcessingSignalListener.cc:17
Belle2::SpacePoint
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:52
Belle2::PXDResultVarSet::extract
bool extract(const CKFToPXDResult *object) final
Generate and assign the variables from the object.
Definition: PXDResultVarSet.cc:35
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2::CKFToPXDResult
Specialized CKF Result for extrapolating into the PXD.
Definition: CKFToPXDResult.h:31
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::VarSet< PXDResultVarNames >::named
constexpr static int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:88
Belle2::PXDResultVarSet::m_advancer
PXDAdvancer m_advancer
Findlet for advancing.
Definition: PXDResultVarSet.h:98
Belle2::TrackFindingCDC::VarSet< PXDResultVarNames >::var
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:103
Belle2::ModuleParamList
The Module parameter list class.
Definition: ModuleParamList.h:46
Belle2::Advancer::exposeParameters
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Expose the parameters.
Definition: Advancer.cc:54