Project
Loading...
Searching...
No Matches
GPUdEdx.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
14
15#include "GPUdEdx.h"
16#include "GPUdEdxInfo.h"
17#include "GPUCommonAlgorithm.h"
18#include "GPUParam.h"
19
20using namespace o2::gpu;
21
22static_assert(GPUdEdx::MAX_NCL <= 255); // Must fit in mNClsROC (uint8_t)!
23
24#ifndef GPUCA_GPUCODE_DEVICE
26{
27 new (this) GPUdEdx;
28}
29#endif
30
32{
33 checkSubThresh(255);
34 const int32_t truncLow = param.rec.tpc.dEdxTruncLow;
35 const int32_t truncHigh = param.rec.tpc.dEdxTruncHigh;
36 const int32_t countIROC = mNClsROC[0];
37 const int32_t countOROC1 = mNClsROC[1];
38 const int32_t countOROC2 = mNClsROC[2];
39 const int32_t countOROC3 = mNClsROC[3];
40 output.dEdxTotIROC = GetSortTruncMean(mChargeTot + countOROC3 + countOROC2 + countOROC1, countIROC, truncLow, truncHigh);
41 output.dEdxTotOROC1 = GetSortTruncMean(mChargeTot + countOROC3 + countOROC2, countOROC1, truncLow, truncHigh);
42 output.dEdxTotOROC2 = GetSortTruncMean(mChargeTot + countOROC3, countOROC2, truncLow, truncHigh);
43 output.dEdxTotOROC3 = GetSortTruncMean(mChargeTot, countOROC3, truncLow, truncHigh);
44 output.dEdxTotTPC = GetSortTruncMean(mChargeTot, mCount, truncLow, truncHigh);
45 output.dEdxMaxIROC = GetSortTruncMean(mChargeMax + countOROC3 + countOROC2 + countOROC1, countIROC, truncLow, truncHigh);
46 output.dEdxMaxOROC1 = GetSortTruncMean(mChargeMax + countOROC3 + countOROC2, countOROC1, truncLow, truncHigh);
47 output.dEdxMaxOROC2 = GetSortTruncMean(mChargeMax + countOROC3, countOROC2, truncLow, truncHigh);
48 output.dEdxMaxOROC3 = GetSortTruncMean(mChargeMax, countOROC3, truncLow, truncHigh);
49 output.dEdxMaxTPC = GetSortTruncMean(mChargeMax, mCount, truncLow, truncHigh);
50 output.NHitsIROC = countIROC - mNClsROCSubThresh[0];
51 output.NHitsSubThresholdIROC = countIROC;
52 output.NHitsOROC1 = countOROC1 - mNClsROCSubThresh[1];
53 output.NHitsSubThresholdOROC1 = countOROC1;
54 output.NHitsOROC2 = countOROC2 - mNClsROCSubThresh[2];
55 output.NHitsSubThresholdOROC2 = countOROC2;
56 output.NHitsOROC3 = countOROC3 - mNClsROCSubThresh[3];
57 output.NHitsSubThresholdOROC3 = countOROC3;
58}
59
60GPUd() float GPUdEdx::GetSortTruncMean(GPUCA_PAR_DEDX_STORAGE_TYPE_A* GPUrestrict() array, int32_t count, int32_t trunclow, int32_t trunchigh)
61{
62 trunclow = count * trunclow / 128;
63 trunchigh = count * trunchigh / 128;
64 if (trunclow >= trunchigh) {
65 return (0.f);
66 }
67 CAAlgo::sort(array, array + count);
68 float mean = 0;
69 for (int32_t i = trunclow; i < trunchigh; i++) {
70 mean += (float)array[i] * (1.f / scalingFactor<GPUCA_PAR_DEDX_STORAGE_TYPE_A>::factor);
71 }
72 return (mean / (trunchigh - trunclow));
73}
int32_t i
#define GPUrestrict()
GPUd() void GPUdEdx
Definition GPUdEdx.cxx:25
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
static constexpr size_t MAX_NCL
Definition GPUdEdx.h:39
GLint GLsizei count
Definition glcorearb.h:399
GLenum array
Definition glcorearb.h:4274
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLfloat param
Definition glcorearb.h:271
double mean(std::vector< double >::const_iterator first, std::vector< double >::const_iterator last)
vec clear()