Project
Loading...
Searching...
No Matches
testTrackResiduals.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
17#define BOOST_TEST_MODULE Test TrackResidualsTest class
18#define BOOST_TEST_MAIN
19#define BOOST_TEST_DYN_LINK
20#include <boost/test/unit_test.hpp>
22
23namespace o2::tpc
24{
25
26// testing default binning and custom binning
27BOOST_AUTO_TEST_CASE(TrackResidualsBinning_test)
28{
29 TrackResiduals residUniform;
30 TrackResiduals residCustom;
31 residUniform.initBinning();
32
33 // fill uniform binning in Y/X manually
34 std::vector<float> binY2X;
35 for (int iBin = 0; iBin <= residUniform.getNY2XBins(); ++iBin) {
36 binY2X.push_back(-1. + 2. / residUniform.getNY2XBins() * iBin);
37 }
38 residCustom.setY2XBinning(binY2X);
39 // fill uniform binning in Z/X manually
40 std::vector<float> binZ2X;
41 for (int iBin = 0; iBin <= residUniform.getNZ2XBins(); ++iBin) {
42 binZ2X.push_back(1. / residUniform.getNZ2XBins() * iBin);
43 }
44 residCustom.setZ2XBinning(binZ2X);
45 residCustom.initBinning();
46
47 float x, p, z, xRef, pRef, zRef;
48 for (int ix = 0; ix < residUniform.getNXBins(); ++ix) {
49 for (int ip = 0; ip < residUniform.getNY2XBins(); ++ip) {
50 for (int iz = 0; iz < residUniform.getNZ2XBins(); ++iz) {
51 residUniform.getVoxelCoordinates(0, ix, ip, iz, xRef, pRef, zRef);
52 residCustom.getVoxelCoordinates(0, ix, ip, iz, x, p, z);
53 BOOST_CHECK_SMALL(x - xRef, 1e-6f);
54 BOOST_CHECK_SMALL(p - pRef, 1e-6f);
55 BOOST_CHECK_SMALL(z - zRef, 1e-6f);
56 }
57 }
58 }
59}
60
61} // namespace o2::tpc
Definition of the TrackResiduals class.
void setY2XBinning(const std::vector< float > &binning)
void setZ2XBinning(const std::vector< float > &binning)
void getVoxelCoordinates(int isec, int ix, int ip, int iz, float &x, float &p, float &z) const
void initBinning()
Initializes the binning in X, Y/X and Z.
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
Global TPC definitions and constants.
Definition SimTraits.h:167
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)