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#include "TPCBase/Mapper.h"
23
24namespace o2::tpc
25{
26
27// testing default binning and custom binning
28BOOST_AUTO_TEST_CASE(TrackResidualsBinning_test)
29{
30 TrackResiduals residUniform;
31 TrackResiduals residCustom;
32 residUniform.initBinning();
33
34 // fill uniform binning in Y/X manually
35 std::vector<float> binY2X;
36 for (int iBin = 0; iBin <= residUniform.getNY2XBins(); ++iBin) {
37 binY2X.push_back(-1. + 2. / residUniform.getNY2XBins() * iBin);
38 }
39 residCustom.setY2XBinning(binY2X);
40 // fill uniform binning in Z/X manually
41 std::vector<float> binZ2X;
42 for (int iBin = 0; iBin <= residUniform.getNZ2XBins(); ++iBin) {
43 binZ2X.push_back(1. / residUniform.getNZ2XBins() * iBin);
44 }
45 residCustom.setZ2XBinning(binZ2X);
46 residCustom.initBinning();
47
48 float x, p, z, xRef, pRef, zRef;
49 for (int ix = 0; ix < residUniform.getNXBins(); ++ix) {
50 for (int ip = 0; ip < residUniform.getNY2XBins(); ++ip) {
51 for (int iz = 0; iz < residUniform.getNZ2XBins(); ++iz) {
52 residUniform.getVoxelCoordinates(0, ix, ip, iz, xRef, pRef, zRef);
53 residCustom.getVoxelCoordinates(0, ix, ip, iz, x, p, z);
54 BOOST_CHECK_SMALL(x - xRef, 1e-6f);
55 BOOST_CHECK_SMALL(p - pRef, 1e-6f);
56 BOOST_CHECK_SMALL(z - zRef, 1e-6f);
57 }
58 }
59 }
60}
61
62// the y/x grid ends at the pad plane's edge of each pad row
63BOOST_AUTO_TEST_CASE(TrackResidualsY2XEdge_test)
64{
65 TrackResiduals resid;
66 resid.initBinning();
67 const auto& mapper = Mapper::instance();
68 for (int ix = 0; ix < resid.getNXBins(); ++ix) {
69 const float halfWidth = 0.5f * mapper.getNumberOfPadsInRowSector(ix) * mapper.getPadRegionInfo(Mapper::REGION[ix]).getPadWidth();
70 BOOST_CHECK_CLOSE(resid.getMaxY2X(ix) * resid.getX(ix), halfWidth, 1e-3);
71 }
72}
73
74} // namespace o2::tpc
Definition of the TrackResiduals class.
static Mapper & instance(const std::string mappingDir="")
Definition Mapper.h:44
static constexpr unsigned REGION[PADROWS]
region for global pad row
Definition Mapper.h:537
void setY2XBinning(const std::vector< float > &binning)
float getX(int ix) const
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.
float getMaxY2X(int ix) const
GLint GLenum GLint x
Definition glcorearb.h:403
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
Global TPC definitions and constants.
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)