Belle II Software development
StereoHitVarSet.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/trackFindingCDC/filters/stereoHits/StereoHitVarSet.h>
9
10#include <tracking/trackingUtilities/eventdata/hits/CDCRecoHit3D.h>
11#include <tracking/trackingUtilities/eventdata/tracks/CDCTrack.h>
12#include <tracking/trackingUtilities/eventdata/hits/CDCWireHit.h>
13
14#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
15
16#include <cdc/topology/CDCWire.h>
17
18#include <tracking/trackingUtilities/numerics/ToFinite.h>
19
20#include <cdc/dataobjects/CDCHit.h>
21
22#include <Math/Vector3D.h>
23#include <Math/Vector2D.h>
24
25#include <numeric>
26
27using namespace Belle2;
28using namespace CDC;
29using namespace TrackFindingCDC;
30using namespace TrackingUtilities;
31
33{
34 const CDCRLWireHit* rlWireHit = testPair->getTo();
35 const CDCTrack* track = testPair->getFrom();
36
37 if (not testPair or not rlWireHit or not track) return false;
38
39
40 const CDCTrajectory2D& trajectory2D = track->getStartTrajectory3D().getTrajectory2D();
41
42 const CDCRecoHit3D& recoHit3D = CDCRecoHit3D::reconstruct(*rlWireHit, trajectory2D);
43
44 const ROOT::Math::XYVector& startMomentum = trajectory2D.getMom2DAtSupport();
45 const double radius = trajectory2D.getLocalCircle()->radius();
46 const double size = track->size();
47 const ROOT::Math::XYZVector& reconstructedPosition = recoHit3D.getRecoPos3D();
48 const double reconstructedDriftLength = recoHit3D.getSignedRecoDriftLength();
49 const double reconstructedS = recoHit3D.getArcLength2D();
50 const unsigned short int adcCount = rlWireHit->getWireHit().getHit()->getADCCount();
51 const ERightLeft rlInformation = rlWireHit->getRLInfo();
52 const double backArcLength2D = track->back().getArcLength2D();
53 const double frontArcLength2D = track->front().getArcLength2D();
54 const double arcLength2DSum = std::accumulate(track->begin(), track->end(), 0.0, [](const double sum,
55 const CDCRecoHit3D & listRecoHit) { return sum + listRecoHit.getArcLength2D();});
56
57 const CDCWire& wire = rlWireHit->getWire();
58 ROOT::Math::XYVector wirePos = wire.getWirePos2DAtZ(reconstructedPosition.z());
59 ROOT::Math::XYVector disp2D = VectorUtil::getXYVector(reconstructedPosition) - wirePos;
60 const double xyDistance = disp2D.R();
61
62 const auto nearestAxialHit = std::min_element(track->begin(), track->end(), [&reconstructedS](const CDCRecoHit3D & lhs,
63 const CDCRecoHit3D & rhs) {
64 return std::abs(lhs.getArcLength2D() - reconstructedS) < std::abs(rhs.getArcLength2D() - reconstructedS);
65 });
66
67 var<named("track_size")>() = size;
68 var<named("pt")>() = toFinite(trajectory2D.getAbsMom2D(), 0);
69 var<named("reco_s")>() = toFinite(reconstructedS, 0);
70 var<named("reco_z")>() = toFinite(reconstructedPosition.z(), 0);
71 var<named("phi_track")>() = toFinite(startMomentum.Phi(), 0);
72 var<named("phi_hit")>() = reconstructedPosition.Phi();
73 var<named("theta_hit")>() = reconstructedPosition.Theta();
74 var<named("drift_length")>() = reconstructedDriftLength;
75 var<named("adc_count")>() = adcCount;
76 var<named("xy_distance_zero_z")>() = toFinite(xyDistance, 0);
77 var<named("right_hit")>() = rlInformation == ERightLeft::c_Right;
78 var<named("track_back_s")>() = toFinite(backArcLength2D, 0);
79 var<named("track_front_s")>() = toFinite(frontArcLength2D, 0);
80 var<named("track_mean_s")>() = toFinite(arcLength2DSum / size, 0);
81 var<named("s_distance")>() = toFinite(nearestAxialHit->getArcLength2D() - reconstructedS, 0);
82 var<named("track_radius")>() = toFinite(radius, 0);
83 var<named("superlayer_id")>() = rlWireHit->getISuperLayer();
84 return true;
85}
unsigned short getADCCount() const
Getter for integrated charge.
Definition CDCHit.h:230
Class representing a sense wire in the central drift chamber.
Definition CDCWire.h:50
ROOT::Math::XYVector getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
Definition CDCWire.h:184
bool extract(const BaseStereoHitFilter::Object *testPair) override
Generate and assign the contained variables.
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
CDC::ISuperLayer getISuperLayer() const
Getter for the superlayer id.
const CDC::CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
ERightLeft getRLInfo() const
Getter for the right left passage information.
Class representing a three dimensional reconstructed hit.
const ROOT::Math::XYZVector & getRecoPos3D() const
Getter for the 3d position of the hit.
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
double getArcLength2D() const
Getter for the travel distance in the xy projection.
Class representing a sequence of three dimensional reconstructed hits.
Definition CDCTrack.h:37
Particle trajectory as it is seen in xy projection represented as a circle.
double getAbsMom2D(double bZ) const
Get the estimation for the absolute value of the transvers momentum.
const UncertainPerigeeCircle & getLocalCircle() const
Getter for the circle in local coordinates.
ROOT::Math::XYVector getMom2DAtSupport(const double bZ) const
Get the momentum at the support point of the trajectory.
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition CDCWireHit.h:160
TrackingUtilities::WeightedRelation< TrackingUtilities::CDCTrack, const TrackingUtilities::CDCRLWireHit > Object
Definition Filter.dcl.h:35
double radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
static constexpr int named(const char *name)
Definition VarSet.h:78
From * getFrom() const
Getter for the pointer to the from side object.
To * getTo() const
Getter for the pointer to the to side object.
Abstract base class for different kinds of events.