Belle II Software development
SegmentInPhi0CurvBox.h
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#pragma once
9
10#include <tracking/trackingUtilities/eventdata/segments/CDCSegment2D.h>
11#include <tracking/trackingUtilities/eventdata/trajectories/CDCTrajectory2D.h>
12#include <tracking/trackFindingCDC/hough/phi0_curv/Phi0CurvBox.h>
13#include <tracking/trackingUtilities/geometry/VectorUtil.h>
14
15#include <Math/Vector2D.h>
16
17namespace Belle2 {
22 namespace TrackFindingCDC {
23
29
37 TrackingUtilities::Weight operator()(const TrackingUtilities::CDCSegment2D* segment,
38 const Phi0CurvBox* phi0CurvBox)
39 {
40 if (segment->empty()) return NAN;
41 const TrackingUtilities::CDCTrajectory2D& trajectory2D = segment->getTrajectory2D();
42 TrackingUtilities::Weight weight = operator()(&trajectory2D, phi0CurvBox);
43 return weight * segment->size();
44 }
45
50 TrackingUtilities::Weight operator()(const TrackingUtilities::CDCTrajectory2D* trajectory2D,
51 const Phi0CurvBox* phi0CurvBox)
52 {
53 double curvature = trajectory2D->getCurvature();
54 const ROOT::Math::XYVector& phi0Vec = trajectory2D->getStartUnitMom2D();
55
56 bool in = isPhi0CurvPointIn(phi0Vec, curvature, phi0CurvBox);
57 return in ? 1 : NAN;
58 }
59
60
65 TrackingUtilities::Weight operator()(const TrackingUtilities::CDCFacet* facet,
66 const Phi0CurvBox* phi0CurvBox)
67 {
68 const ParameterLine2D& line = facet->getStartToEndLine();
69
70 const ROOT::Math::XYVector pos2D = facet->getMiddleRecoPos2D();
71 const ROOT::Math::XYVector phiVec = VectorUtil::unit(line.tangential());
72
73 // Calculate the curvature and phi0 of the circle through the origin
74 // that touches the position pos2D under the angle phiVec.
75 double curvature = 2 * VectorUtil::Cross(pos2D, phiVec) / pos2D.Mag2();
76 ROOT::Math::XYVector phi0Vec = VectorUtil::flippedOver(phiVec, pos2D);
77
78 bool in = isPhi0CurvPointIn(phi0Vec, curvature, phi0CurvBox);
79 return in ? 1 : NAN;
80 // All facets are currently worth the same weight
81 // Facets contain three hits but in general contribute only one
82 // additional hit due to overlaps with neighboring facets.
83 // Hence we stick with 1 as weight here.
84 }
85
87 bool isPhi0CurvPointIn(const ROOT::Math::XYVector& phi0Vec,
88 const double curvature,
89 const Phi0CurvBox* phi0CurvBox)
90 {
91
92 const ROOT::Math::XYVector& lowerPhi0Vec = phi0CurvBox->getLowerPhi0Vec();
93 const ROOT::Math::XYVector& upperPhi0Vec = phi0CurvBox->getUpperPhi0Vec();
94
95 // Allow containment to keep the reversal symmetry
96 if (phi0CurvBox->isIn<1>(curvature)) {
97 return VectorUtil::isBetween(phi0Vec, lowerPhi0Vec, upperPhi0Vec);
98
99 } else if (phi0CurvBox->isIn<1>(-curvature)) {
100 return VectorUtil::isBetween(-phi0Vec, lowerPhi0Vec, upperPhi0Vec);
101
102 } else {
103 return false;
104
105 }
106
107 }
108 };
109
110 }
112}
Predicate class to check for the containment of segments in a phi0 curv hough space part.
bool isPhi0CurvPointIn(const ROOT::Math::XYVector &phi0Vec, const double curvature, const Phi0CurvBox *phi0CurvBox)
Predicate checking if the phi0 vector and curvature are contained in the given box.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCFacet *facet, const Phi0CurvBox *phi0CurvBox)
Checks if the given hit triplet is considered part of the hough box in phi0, curvature space.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCTrajectory2D *trajectory2D, const Phi0CurvBox *phi0CurvBox)
Checks if the given trajectory is considered part of the hough box in phi0, curvature space.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCSegment2D *segment, const Phi0CurvBox *phi0CurvBox)
Checks if the segment is contained in a phi0 curv hough space.
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition CDCFacet.h:33
ROOT::Math::XYVector getMiddleRecoPos2D() const
Getter for the reconstructed position at the second hit on the fit line.
Definition CDCFacet.cc:76
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
Definition CDCFacet.cc:94
A reconstructed sequence of two dimensional hits in one super layer.
Particle trajectory as it is seen in xy projection represented as a circle.
double getCurvature() const
Getter for the curvature as seen from the xy projection.
Abstract base class for different kinds of events.