Project
Loading...
Searching...
No Matches
testTPCMapper.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
15
16#define BOOST_TEST_MODULE Test TPC Mapper
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
20#include <cstdlib>
21#include <fstream>
22#include <iostream>
23#include <sstream>
24#include <string>
25#include "TPCBase/Mapper.h"
26
27namespace o2
28{
29namespace tpc
30{
31
40BOOST_AUTO_TEST_CASE(Mapper_complex_test1)
41{
42 Mapper& mapper = Mapper::instance();
43 std::vector<std::string> mappingTables{{"/TABLE-IROC.txt", "/TABLE-OROC1.txt", "/TABLE-OROC2.txt", "/TABLE-OROC3.txt"}};
44 std::vector<int> nPads{{0, mapper.getPadsInIROC(), mapper.getPadsInOROC1(), mapper.getPadsInOROC2()}};
45 std::vector<float> signTest{{-1.f, 1.f}};
46
47 // ===| Input variables |=====================================================
48 // pad info
49 GlobalPadNumber padIndex;
50 unsigned int padRow, pad;
51 float xPos, yPos;
52
53 // pad plane info
54 unsigned int connector, pin, partion, region;
55
56 // FEC info
57 unsigned int fecIndex, fecConnector, fecChannel, sampaChip, sampaChannel;
58
59 for (int i = 0; i < mappingTables.size(); ++i) {
60 std::string line;
61 const char* aliceO2env = std::getenv("O2_ROOT");
62 std::string inputDir = " ";
63 if (aliceO2env) {
64 inputDir = aliceO2env;
65 }
66 inputDir += "/share/Detectors/TPC/files";
67
68 std::string file = inputDir + mappingTables[i];
69 std::ifstream infile(file, std::ifstream::in);
70 while (std::getline(infile, line)) {
71 std::stringstream streamLine(line);
72 streamLine >> padIndex >> padRow >> pad >> xPos >> yPos >> connector >> pin >> partion >> region >> fecIndex >> fecConnector >> fecChannel >> sampaChip >> sampaChannel;
73
74 const float localX = xPos / 10.f;
75 const float localY = yPos / 10.f;
76
77 // test for z > 0 and z< 0
78 for (int j = 0; j < signTest.size(); ++j) {
79
81 const GlobalPosition3D pos((-1.f) * signTest[j] * localX, localY, signTest[j] * 10.f);
82
84 const DigitPos digi = mapper.findDigitPosFromGlobalPosition(pos);
85
87 BOOST_CHECK(pad == int(digi.getPadPos().getPad()));
88 BOOST_CHECK(pad == int(digi.getPadSecPos().getPadPos().getPad()));
89
90 BOOST_CHECK(padRow == int(digi.getPadSecPos().getPadPos().getRow()));
91
92 const CRU cru(digi.getCRU());
94 BOOST_CHECK(region == int(cru.region()));
95 const PadRegionInfo& regionDigi = mapper.getPadRegionInfo(cru.region());
96 BOOST_CHECK(region == int(regionDigi.getRegion()));
97 BOOST_CHECK(partion == int(regionDigi.getPartition()));
98
99 const int rowInSector = digi.getPadPos().getRow() + regionDigi.getGlobalRowOffset();
100 BOOST_CHECK(padRow == rowInSector);
101
103 const GlobalPadNumber padPos = mapper.globalPadNumber(PadPos(rowInSector, digi.getPadPos().getPad()));
104 const PadCentre& padCentre = mapper.padCentre(padPos);
105
106 LocalPosition3D posLoc(padCentre.X(), padCentre.Y(), pos.Z());
107
109 BOOST_CHECK_CLOSE(posLoc.X(), pos.Y(), 1E-12);
110 BOOST_CHECK_CLOSE(posLoc.Y(), signTest[j] * pos.X(), 1E-12);
111
112 GlobalPosition3D posGlob = Mapper::LocalToGlobal(posLoc, cru.sector());
113
117 BOOST_CHECK_CLOSE((-1.f) * signTest[j] * pos.X(), posGlob.X(), 1E-12);
118 BOOST_CHECK_CLOSE(pos.Y(), posGlob.Y(), 1E-12);
119 }
120 }
121 }
122}
123} // namespace tpc
124} // namespace o2
int32_t i
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font Renderer for event Frontend to use for event ROOT macros used as track filter Console script file
uint16_t pos
Definition RawData.h:3
uint32_t j
Definition RawData.h:0
unsigned char region() const
Definition CRU.h:64
const Sector sector() const
Definition CRU.h:65
const CRU & getCRU() const
Definition DigitPos.h:30
PadSecPos getPadSecPos() const
Definition DigitPos.cxx:28
PadPos getPadPos() const
Definition DigitPos.h:32
GlobalPadNumber globalPadNumber(const PadPos &globalPadPosition) const
Definition Mapper.h:56
const DigitPos findDigitPosFromGlobalPosition(const GlobalPosition3D &pos) const
Definition Mapper.h:716
static constexpr unsigned short getPadsInOROC1()
Definition Mapper.h:410
static Mapper & instance(const std::string mappingDir="")
Definition Mapper.h:44
static constexpr unsigned short getPadsInIROC()
Definition Mapper.h:409
const PadRegionInfo & getPadRegionInfo(const unsigned char region) const
Definition Mapper.h:385
const PadCentre & padCentre(GlobalPadNumber padNumber) const
Definition Mapper.h:51
static constexpr unsigned short getPadsInOROC2()
Definition Mapper.h:411
static GlobalPosition3D LocalToGlobal(const LocalPosition3D &pos, const double alpha)
Definition Mapper.h:461
unsigned char getGlobalRowOffset() const
unsigned char getRegion() const
unsigned char getPartition() const
const PadPos & getPadPos() const
Definition PadSecPos.h:48
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
math_utils::Point3D< float > LocalPosition3D
Definition Defs.h:111
math_utils::Point2D< float > PadCentre
Pad centres as 2D float.
Definition Defs.h:107
math_utils::Point3D< float > GlobalPosition3D
Definition Defs.h:110
unsigned short GlobalPadNumber
global pad number
Definition Defs.h:114
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_CHECK(tree)