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/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
11#include <tracking/trackFindingCDC/eventdata/trajectories/CDCTrajectory2D.h>
12#include <tracking/trackFindingCDC/hough/phi0_curv/Phi0CurvBox.h>
13#include <tracking/trackFindingCDC/geometry/Vector2D.h>
14
15namespace Belle2 {
20 namespace TrackFindingCDC {
21
27
35 Weight operator()(const CDCSegment2D* segment,
36 const Phi0CurvBox* phi0CurvBox)
37 {
38 if (segment->empty()) return NAN;
39 const CDCTrajectory2D& trajectory2D = segment->getTrajectory2D();
40 Weight weight = operator()(&trajectory2D, phi0CurvBox);
41 return weight * segment->size();
42 }
43
48 Weight operator()(const CDCTrajectory2D* trajectory2D,
49 const Phi0CurvBox* phi0CurvBox)
50 {
51 double curvature = trajectory2D->getCurvature();
52 const Vector2D& phi0Vec = trajectory2D->getStartUnitMom2D();
53
54 bool in = isPhi0CurvPointIn(phi0Vec, curvature, phi0CurvBox);
55 return in ? 1 : NAN;
56 }
57
58
63 Weight operator()(const CDCFacet* facet,
64 const Phi0CurvBox* phi0CurvBox)
65 {
66 const ParameterLine2D& line = facet->getStartToEndLine();
67
68 const Vector2D pos2D = facet->getMiddleRecoPos2D();
69 const Vector2D phiVec = line.tangential().unit();
70
71 // Calculate the curvature and phi0 of the circle through the origin
72 // that touches the position pos2D under the angle phiVec.
73 double curvature = 2 * pos2D.cross(phiVec) / pos2D.normSquared();
74 Vector2D phi0Vec = phiVec.flippedOver(pos2D);
75
76 bool in = isPhi0CurvPointIn(phi0Vec, curvature, phi0CurvBox);
77 return in ? 1 : NAN;
78 // All facets are currently worth the same weight
79 // Facets contain three hits but in general contribute only one
80 // additional hit due to overlaps with neighboring facets.
81 // Hence we stick with 1 as weight here.
82 }
83
85 bool isPhi0CurvPointIn(const Vector2D& phi0Vec,
86 const double curvature,
87 const Phi0CurvBox* phi0CurvBox)
88 {
89
90 const Vector2D& lowerPhi0Vec = phi0CurvBox->getLowerPhi0Vec();
91 const Vector2D& upperPhi0Vec = phi0CurvBox->getUpperPhi0Vec();
92
93 // Allow containment to keep the reversal symmetry
94 if (phi0CurvBox->isIn<1>(curvature)) {
95 return phi0Vec.isBetween(lowerPhi0Vec, upperPhi0Vec);
96
97 } else if (phi0CurvBox->isIn<1>(-curvature)) {
98 return (-phi0Vec).isBetween(lowerPhi0Vec, upperPhi0Vec);
99
100 } else {
101 return false;
102
103 }
104
105 }
106 };
107
108 }
110}
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition: CDCFacet.h:32
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
Definition: CDCFacet.cc:94
Vector2D getMiddleRecoPos2D() const
Getter for the reconstructed position at the second hit on the fit line.
Definition: CDCFacet.cc:76
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
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.
A line with a support point and tangential vector.
Predicate class to check for the containment of segments in a phi0 curv hough space part.
bool isPhi0CurvPointIn(const Vector2D &phi0Vec, const double curvature, const Phi0CurvBox *phi0CurvBox)
Predicate checking if the phi0 vector and curvature are contained in the given box.
Weight operator()(const CDCSegment2D *segment, const Phi0CurvBox *phi0CurvBox)
Checks if the segment is contained in a phi0 curv hough space.
Weight operator()(const CDCTrajectory2D *trajectory2D, const Phi0CurvBox *phi0CurvBox)
Checks if the given trajectory is considered part of the hough box in phi0, curvature space.
Weight operator()(const CDCFacet *facet, const Phi0CurvBox *phi0CurvBox)
Checks if the given hit triplet is considered part of the hough box in phi0, curvature space.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
double cross(const Vector2D &rhs) const
Calculated the two dimensional cross product.
Definition: Vector2D.h:163
bool isBetween(const Vector2D &lower, const Vector2D &upper) const
Checks if this vector is between two other vectors Between means here that when rotating the lower ve...
Definition: Vector2D.h:525
double normSquared() const
Calculates .
Definition: Vector2D.h:169
Vector2D flippedOver(const Vector2D &reflectionLine) const
Reflects this vector over line designated by the given vector.
Definition: Vector2D.h:371
Abstract base class for different kinds of events.