Project
Loading...
Searching...
No Matches
testTempCalibrationSM.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
12#define BOOST_TEST_MODULE Test_EMCAL_Calib
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15
16#include <boost/test/unit_test.hpp>
17#include "EMCALCalib/TempCalibParamSM.h" // local header
18#include <iostream>
19#include <fstream>
20
22
23namespace o2
24{
25namespace emcal
26{
27
28BOOST_AUTO_TEST_CASE(testTempCalibrationSM)
29{
30
31 // Single channel test
32 //
33 // For each channel test set and update, and compare read value
34 // against set value
35 for (unsigned short iSM = 0; iSM < 20; iSM++) {
36 TempCalibParamSM singletest;
37
38 singletest.addTempCalibParamPerSM(iSM, 0.);
39 BOOST_CHECK_EQUAL(singletest.getTempCalibParamPerSM(iSM), 0.);
40
41 singletest.addTempCalibParamPerSM(iSM, 1.);
42 BOOST_CHECK_EQUAL(singletest.getTempCalibParamPerSM(iSM), 1.);
43 }
44
45 // Pattern test
46 //
47 // For each channel check the wheather the temperature calibration coeffcient per SM are correctly written
48 // Test data obtained from LHC18k run 289165
50
51 const char* aliceO2env = std::getenv("O2_ROOT");
52 std::string inputDir = " ";
53 if (aliceO2env) {
54 inputDir = aliceO2env;
55 }
56 inputDir += "/share/Detectors/EMC/files/";
57
58 std::string file = inputDir + "TempCalibSM_LHC18k_289166.txt";
59 std::ifstream fileTempCalibSM(file, std::ifstream::in);
60 if (!fileTempCalibSM.is_open()) {
61 std::cout << "The file TempCalibSM_LHC18k_289166.txt was not opened\n";
62 }
63
64 float TempCalibSM[20];
65
66 unsigned short iSM = 0;
67 std::string line;
68
69 // Write to the container
70 while (std::getline(fileTempCalibSM, line)) {
71 std::stringstream streamLine(line);
72 unsigned short sm;
73 streamLine >> sm >> TempCalibSM[iSM];
74 parameter.addTempCalibParamPerSM(sm, TempCalibSM[iSM]);
75 iSM++;
76 }
77
78 for (unsigned short ism = 0; ism < 20; ism++) {
79 BOOST_CHECK_EQUAL(parameter.getTempCalibParamPerSM(ism), TempCalibSM[ism]);
80 }
81
82 // Comparison test
83
84 //comparison file
85 TempCalibParamSM parameterLHC18k;
86
87 std::string fileLHC18k = inputDir + "TempCalibSM_LHC18k_289201.txt";
88 std::ifstream fileTempCalibSM_LHC18k(fileLHC18k, std::ifstream::in);
89 if (!fileTempCalibSM_LHC18k.is_open()) {
90 std::cout << "The file TempCalibSM_LHC18k_289201.txt was not opened\n";
91 }
92
93 unsigned char TempCalibSM_LHC18k;
94
95 iSM = 0;
96 // Write to the container
97 while (std::getline(fileTempCalibSM_LHC18k, line)) {
98 std::stringstream streamLine(line);
99 unsigned short sm;
100 streamLine >> sm >> TempCalibSM_LHC18k;
101 parameterLHC18k.addTempCalibParamPerSM(sm, TempCalibSM_LHC18k);
102 iSM++;
103 }
104
105 // Equal
106 //
107 // - Compare L1 phase shifts for LHC18k run 289165 with itself. The result must be true.
108 // - Compare L1 phase shifts for LHC18k run 289165 with L1 phase shifts for LHC18k run 289166. The result must be false
110 BOOST_CHECK_EQUAL(parameter == parameterLHC18k, false);
111
112 fileTempCalibSM.close();
113 fileTempCalibSM_LHC18k.close();
114}
115} // namespace emcal
116} // namespace o2
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
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this parameter(fixed during CTF decoding)") AddOptionRTC(defaultZOffsetOverR
float getTempCalibParamPerSM(unsigned short iSM) const
Get the temperature calibration coefficient for a certain SM.
void addTempCalibParamPerSM(unsigned short iSM, float TempSM)
Add temperature coefficients to the container.
BOOST_AUTO_TEST_CASE(asynch_schedule_test)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())