Project
Loading...
Searching...
No Matches
testGPUCATracking.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 CATracking
17#define BOOST_TEST_MAIN
18#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
26
27#include "TPCFastTransformPOD.h"
28#include "GPUO2Interface.h"
29#include "GPUO2InterfaceUtils.h"
31#include "TPCPadGainCalib.h"
32#include "CalibdEdxContainer.h"
33
34using namespace o2::gpu;
35
36#include <vector>
37#include <iostream>
38#include <iomanip>
39
40using namespace o2::dataformats;
41
42namespace o2
43{
44namespace tpc
45{
46
48BOOST_AUTO_TEST_CASE(CATracking_test1)
49{
50 GPUO2Interface tracker;
51
52 float solenoidBz = -5.00668; // B-field
53 float refX = 83.; // transport tracks to this x after tracking, >500 for disabling
54 bool continuous = false; // time frame data v.s. triggered events
55
57 config.configDeviceBackend.deviceType = gpudatatypes::DeviceType::CPU;
59
60 config.configProcessing.ompThreads = 4; // 4 threads if we run on the CPU, 1 = default, 0 = auto-detect
61 config.configProcessing.runQA = false; // Run QA after tracking
62 config.configProcessing.eventDisplay = nullptr; // Ptr to event display backend, for running standalone OpenGL event display
63
64 config.configGRP.solenoidBzNominalGPU = solenoidBz;
65 config.configGRP.grpContinuousMaxTimeBin = continuous ? GPUSettings::TPC_MAX_TF_TIME_BIN : 0; // Number of timebins in timeframe if continuous, 0 otherwise
66
67 config.configReconstruction.tpc.nWays = 3; // Should always be 3!
68 config.configReconstruction.tpc.searchWindowDZDR = 2.5f; // Should always be 2.5 for looper-finding and/or continuous tracking
69 config.configReconstruction.tpc.trackReferenceX = refX;
70
71 config.configWorkflow.steps.set(gpudatatypes::RecoStep::TPCConversion, gpudatatypes::RecoStep::TPCSectorTracking,
72 gpudatatypes::RecoStep::TPCMerging, gpudatatypes::RecoStep::TPCCompression, gpudatatypes::RecoStep::TPCdEdx);
73 config.configWorkflow.inputs.set(gpudatatypes::InOutType::TPCClusters);
74 config.configWorkflow.outputs.set(gpudatatypes::InOutType::TPCMergedTracks);
75
76 auto fastTransformTmp = TPCFastTransformHelperO2::instance()->create(0);
78 TPCFastTransformPOD::create(fastTransformBuf, *fastTransformTmp);
79 config.configCalib.fastTransform = fastTransformBuf.get();
80
81 auto dEdxCalibContainer = GPUO2InterfaceUtils::getCalibdEdxContainerDefault();
82 config.configCalib.dEdxCalibContainer = dEdxCalibContainer.get();
83 std::unique_ptr<TPCPadGainCalib> gainCalib = GPUO2InterfaceUtils::getPadGainCalibDefault();
84 config.configCalib.tpcPadGain = gainCalib.get();
85
86 tracker.Initialize(config);
87 std::vector<ClusterNativeContainer> cont(constants::MAXGLOBALPADROW);
88
89 for (int i = 0; i < constants::MAXGLOBALPADROW; i++) {
90 cont[i].sector = 0;
91 cont[i].globalPadRow = i;
92 cont[i].clusters.resize(1);
93 cont[i].clusters[0].setTimeFlags(2, 0);
94 cont[i].clusters[0].setPad(0);
95 cont[i].clusters[0].setSigmaTime(1);
96 cont[i].clusters[0].setSigmaPad(1);
97 cont[i].clusters[0].qMax = 10;
98 cont[i].clusters[0].qTot = 50;
99 }
100 std::unique_ptr<ClusterNative[]> clusterBuffer;
101 std::unique_ptr<ClusterNativeAccess> clusters = ClusterNativeHelper::createClusterNativeIndex(clusterBuffer, cont, nullptr, nullptr);
102
104 ptrs.clustersNative = clusters.get();
105
106 int retVal = tracker.RunTracking(&ptrs);
108 BOOST_CHECK_EQUAL((int)ptrs.nMergedTracks, 1);
109}
110} // namespace tpc
111} // namespace o2
Definition of container class for dE/dx corrections.
Helper class to read the binary format of TPC ClusterNative.
Class of a TPC cluster in TPC-native coordinates (row, time)
Helper class for memory management of TPC Data Formats, external from the actual data type classes to...
int32_t i
int32_t retVal
class to create TPC fast transformation
POD correction map.
void set(S v)
Definition bitfield.h:55
static std::unique_ptr< TPCPadGainCalib > getPadGainCalibDefault()
static std::unique_ptr< o2::tpc::CalibdEdxContainer > getCalibdEdxContainerDefault()
int32_t Initialize(const GPUO2InterfaceConfiguration &config)
int32_t RunTracking(GPUTrackingInOutPointers *data, GPUInterfaceOutputs *outputs=nullptr, uint32_t iThread=0, GPUInterfaceInputUpdate *inputUpdateCallback=nullptr)
static constexpr const uint32_t TPC_MAX_TF_TIME_BIN
Definition GPUSettings.h:47
static TPCFastTransformPOD * create(aligned_unique_buffer_ptr< TPCFastTransformPOD > &destVector, const TPCFastTransform &src)
Create POD transform from old flat-buffer one. Provided vector will serve as a buffer.
static std::unique_ptr< ClusterNativeAccess > createClusterNativeIndex(std::unique_ptr< ClusterNative[]> &buffer, std::vector< ClusterNativeContainer > &clusters, MCLabelContainer *bufferMC=nullptr, std::vector< MCLabelContainer > *mcTruth=nullptr)
static TPCFastTransformHelperO2 * instance()
Singleton.
std::unique_ptr< TPCFastTransform > create(int64_t TimeStamp)
_______________ Main functionality ________________________
Definition of a container to keep/associate and arbitrary number of labels associated to an index wit...
constexpr int MAXGLOBALPADROW
Definition Constants.h:34
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
S< o2::tpc::CalibdEdxContainer >::type * dEdxCalibContainer
S< TPCFastTransformPOD >::type * fastTransform
S< TPCPadGainCalib >::type * tpcPadGain
gpudatatypes::RecoStepField steps
gpudatatypes::InOutTypeField inputs
gpudatatypes::InOutTypeField outputs
const o2::tpc::ClusterNativeAccess * clustersNative
std::vector< Cluster > clusters
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())