Belle II Software development
CDCObservations2D.test.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
9#include <tracking/trackFindingCDC/geometry/Vector2D.h>
10#include <tracking/trackFindingCDC/fitting/CDCObservations2D.h>
11
12#include <gtest/gtest.h>
13
14
15using namespace Belle2;
16using namespace TrackFindingCDC;
17
18
19TEST(TrackFindingCDCTest, fitting_CDCObservations2D_centralize)
20{
21 CDCObservations2D observations;
22
23 observations.fill(Vector2D(0, 0));
24 observations.fill(Vector2D(1, 2));
25 observations.fill(Vector2D(2, 4));
26
27 Vector2D centralPoint = observations.centralize();
28
29 EXPECT_EQ(Vector2D(1, 2), centralPoint) <<
30 "Central point of observation (0,0) , (1,1) and (2,2) is not (1,1)" ;
31
32 EXPECT_EQ(-1, observations.getX(0));
33 EXPECT_EQ(-2, observations.getY(0));
34
35 EXPECT_EQ(0, observations.getX(1));
36 EXPECT_EQ(0, observations.getY(1));
37
38 EXPECT_EQ(1, observations.getX(2));
39 EXPECT_EQ(2, observations.getY(2));
40}
41
42
Class serving as a storage of observed drift circles to present to the Riemann fitter.
double getX(int iObservation) const
Getter for the x value of the observation at the given index.
Vector2D centralize()
Picks one observation as a reference point and transform all observations to that new origin.
double getY(int iObservation) const
Getter for the y value of the observation at the given index.
std::size_t fill(double x, double y, double signedRadius=0.0, double weight=1.0)
Appends the observed position.
A two dimensional vector which is equipped with functions for correct handeling of orientation relat...
Definition: Vector2D.h:32
Abstract base class for different kinds of events.