Belle II Software  release-05-01-25
StereoHitVarSet.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - 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/trackFindingCDC/filters/stereoHits/StereoHitVarSet.h>
11 
12 #include <tracking/trackFindingCDC/eventdata/tracks/CDCTrack.h>
13 #include <tracking/trackFindingCDC/eventdata/hits/CDCRecoHit3D.h>
14 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
15 
16 #include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
17 
18 #include <tracking/trackFindingCDC/topology/CDCWire.h>
19 
20 #include <tracking/trackFindingCDC/numerics/ToFinite.h>
21 
22 #include <cdc/dataobjects/CDCHit.h>
23 
24 #include <numeric>
25 
26 using namespace Belle2;
27 using namespace TrackFindingCDC;
28 
30 {
31  const CDCRLWireHit* rlWireHit = testPair->getTo();
32  const CDCTrack* track = testPair->getFrom();
33 
34  if (not testPair or not rlWireHit or not track) return false;
35 
36 
37  const CDCTrajectory2D& trajectory2D = track->getStartTrajectory3D().getTrajectory2D();
38 
39  const CDCRecoHit3D& recoHit3D = CDCRecoHit3D::reconstruct(*rlWireHit, trajectory2D);
40 
41  const Vector2D& startMomentum = trajectory2D.getMom2DAtSupport();
42  const double radius = trajectory2D.getLocalCircle()->radius();
43  const double size = track->size();
44  const Vector3D& reconstructedPosition = recoHit3D.getRecoPos3D();
45  const double reconstructedDriftLength = recoHit3D.getSignedRecoDriftLength();
46  const double reconstructedS = recoHit3D.getArcLength2D();
47  const unsigned short int adcCount = rlWireHit->getWireHit().getHit()->getADCCount();
48  const ERightLeft rlInformation = rlWireHit->getRLInfo();
49  const double backArcLength2D = track->back().getArcLength2D();
50  const double frontArcLength2D = track->front().getArcLength2D();
51  const double arcLength2DSum = std::accumulate(track->begin(), track->end(), 0.0, [](const double sum,
52  const CDCRecoHit3D & listRecoHit) { return sum + listRecoHit.getArcLength2D();});
53 
54  const CDCWire& wire = rlWireHit->getWire();
55  Vector2D wirePos = wire.getWirePos2DAtZ(reconstructedPosition.z());
56  Vector2D disp2D = reconstructedPosition.xy() - wirePos;
57  const double xyDistance = disp2D.norm();
58 
59  const auto nearestAxialHit = std::min_element(track->begin(), track->end(), [&reconstructedS](const CDCRecoHit3D & lhs,
60  const CDCRecoHit3D & rhs) {
61  return std::abs(lhs.getArcLength2D() - reconstructedS) < std::abs(rhs.getArcLength2D() - reconstructedS);
62  });
63 
64  var<named("track_size")>() = size;
65  var<named("pt")>() = toFinite(trajectory2D.getAbsMom2D(), 0);
66  var<named("reco_s")>() = toFinite(reconstructedS, 0);
67  var<named("reco_z")>() = toFinite(reconstructedPosition.z(), 0);
68  var<named("phi_track")>() = toFinite(startMomentum.phi(), 0);
69  var<named("phi_hit")>() = reconstructedPosition.phi();
70  var<named("theta_hit")>() = reconstructedPosition.theta();
71  var<named("drift_length")>() = reconstructedDriftLength;
72  var<named("adc_count")>() = adcCount;
73  var<named("xy_distance_zero_z")>() = toFinite(xyDistance, 0);
74  var<named("right_hit")>() = rlInformation == ERightLeft::c_Right;
75  var<named("track_back_s")>() = toFinite(backArcLength2D, 0);
76  var<named("track_front_s")>() = toFinite(frontArcLength2D, 0);
77  var<named("track_mean_s")>() = toFinite(arcLength2DSum / size, 0);
78  var<named("s_distance")>() = toFinite(nearestAxialHit->getArcLength2D() - reconstructedS, 0);
79  var<named("track_radius")>() = toFinite(radius, 0);
80  var<named("superlayer_id")>() = rlWireHit->getISuperLayer();
81  return true;
82 }
Belle2::TrackFindingCDC::CDCRecoHit3D
Class representing a three dimensional reconstructed hit.
Definition: CDCRecoHit3D.h:62
Belle2::TrackFindingCDC::CDCTrack
Class representing a sequence of three dimensional reconstructed hits.
Definition: CDCTrack.h:51
Belle2::TrackFindingCDC::Vector2D
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:37
Belle2::TrackFindingCDC::CDCTrajectory2D::getLocalCircle
const UncertainPerigeeCircle & getLocalCircle() const
Getter for the cirlce in local coordinates.
Definition: CDCTrajectory2D.h:466
Belle2::TrackFindingCDC::CDCRLWireHit::getWireHit
const CDCWireHit & getWireHit() const
Getter for the wire hit associated with the oriented hit.
Definition: CDCRLWireHit.h:202
Belle2::TrackFindingCDC::CDCRLWireHit::getISuperLayer
ISuperLayer getISuperLayer() const
Getter for the superlayer id.
Definition: CDCRLWireHit.cc:143
Belle2::TrackFindingCDC::CDCRLWireHit::getWire
const CDCWire & getWire() const
Getter for the wire the oriented hit associated to.
Definition: CDCRLWireHit.cc:133
Belle2::TrackFindingCDC::CDCWireHit::getHit
const CDCHit * getHit() const
Getter for the CDCHit pointer into the StoreArray.
Definition: CDCWireHit.h:167
Belle2::TrackFindingCDC::CDCRecoHit3D::getArcLength2D
double getArcLength2D() const
Getter for the travel distance in the xy projection.
Definition: CDCRecoHit3D.h:380
Belle2::TrackFindingCDC::Vector2D::phi
double phi() const
Gives the azimuth angle being the angle to the x axes ( range -M_PI to M_PI )
Definition: Vector2D.h:583
Belle2::TrackFindingCDC::CDCTrajectory2D
Particle trajectory as it is seen in xy projection represented as a circle.
Definition: CDCTrajectory2D.h:46
Belle2::TrackFindingCDC::PerigeeCircle::radius
double radius() const
Gives the signed radius of the circle. If it was a line this will be infinity.
Definition: PerigeeCircle.h:344
Belle2::TrackFindingCDC::CDCWire::getWirePos2DAtZ
Vector2D getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
Definition: CDCWire.h:194
Belle2::CDCHit::getADCCount
unsigned short getADCCount() const
Getter for integrated charge.
Definition: CDCHit.h:241
Belle2::TrackFindingCDC::CDCRLWireHit::getRLInfo
ERightLeft getRLInfo() const
Getter for the right left passage information.
Definition: CDCRLWireHit.h:244
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::CDCRLWireHit
Class representing an oriented hit wire including a hypotheses whether the causing track passes left ...
Definition: CDCRLWireHit.h:51
Belle2::TrackFindingCDC::Vector3D::theta
double theta() const
Getter for the polar angle.
Definition: Vector3D.h:538
Belle2::TrackFindingCDC::Vector3D
A three dimensional vector.
Definition: Vector3D.h:34
Belle2::TrackFindingCDC::NRightLeft::ERightLeft
ERightLeft
Enumeration to represent the distinct possibilities of the right left passage.
Definition: ERightLeft.h:35
Belle2::TrackFindingCDC::StereoHitVarSet::extract
bool extract(const BaseStereoHitFilter::Object *testPair) override
Generate and assign the contained variables.
Definition: StereoHitVarSet.cc:29
Belle2::TrackFindingCDC::Vector3D::xy
const Vector2D & xy() const
Getter for the xy projected vector ( reference ! )
Definition: Vector3D.h:500
Belle2::TrackFindingCDC::Vector2D::norm
double norm() const
Calculates the length of the vector.
Definition: Vector2D.h:189
Belle2::TrackFindingCDC::CDCWire
Class representing a sense wire in the central drift chamber.
Definition: CDCWire.h:60
Belle2::TrackFindingCDC::CDCRecoHit3D::getSignedRecoDriftLength
double getSignedRecoDriftLength() const
Returns the drift length next to the reconstructed position.
Definition: CDCRecoHit3D.h:356
Belle2::TrackFindingCDC::VarSet< StereoHitVarNames >::named
constexpr static int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:88
Belle2::TrackFindingCDC::Vector3D::z
double z() const
Getter for the z coordinate.
Definition: Vector3D.h:488
Belle2::TrackFindingCDC::VarSet< StereoHitVarNames >::var
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:103
Belle2::TrackFindingCDC::CDCRecoHit3D::reconstruct
static CDCRecoHit3D reconstruct(const CDCRecoHit2D &recoHit2D, const CDCTrajectory2D &trajectory2D)
Reconstructs the three dimensional hit from the two dimensional and the two dimensional trajectory.
Definition: CDCRecoHit3D.cc:58
Belle2::TrackFindingCDC::CDCRecoHit3D::getRecoPos3D
const Vector3D & getRecoPos3D() const
Getter for the 3d position of the hit.
Definition: CDCRecoHit3D.h:295
Belle2::TrackFindingCDC::CDCTrajectory2D::getMom2DAtSupport
Vector2D getMom2DAtSupport(const double bZ) const
Get the momentum at the support point of the trajectory.
Definition: CDCTrajectory2D.h:308
Belle2::TrackFindingCDC::Filter::Object
AObject Object
Type of the object to be analysed.
Definition: Filter.dcl.h:43
Belle2::TrackFindingCDC::Vector3D::phi
double phi() const
Getter for the azimuth angle.
Definition: Vector3D.h:532
Belle2::TrackFindingCDC::CDCTrajectory2D::getAbsMom2D
double getAbsMom2D(double bZ) const
Get the estimation for the absolute value of the transvers momentum.