Project
Loading...
Searching...
No Matches
ClusterAccumulator.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 "ClusterAccumulator.h"
16#include "GPUTPCGeometry.h"
17#include "CfUtils.h"
18#include "GPUParam.h"
20
21using namespace o2::gpu;
22using namespace o2::gpu::tpccf;
23
24GPUd() bool ClusterAccumulator::toNative(const ChargePos& pos, Charge q, tpc::ClusterNative& cn, const GPUParam& param) const
25{
26 cn.qTot = CAMath::Float2UIntRn(mQtot);
27 if (cn.qTot <= param.rec.tpc.cfQTotCutoff) {
28 return false;
29 }
30 cn.qMax = q;
31 if (cn.qMax <= param.rec.tpc.cfQMaxCutoff) {
32 return false;
33 }
34 if (mTimeMean < param.rec.tpc.clustersShiftTimebinsClusterizer) {
35 return false;
36 }
37 if (q <= param.rec.tpc.cfQMaxCutoffSingleTime && mTimeSigma == 0) {
38 return false;
39 }
40 if (q <= param.rec.tpc.cfQMaxCutoffSinglePad && mPadSigma == 0) {
41 return false;
42 }
43
44 bool isEdgeCluster = CfUtils::isAtEdge(pos, param.tpcGeometry.NPads(pos.row()));
45 bool wasSplitInTime = mSplitInTime >= param.rec.tpc.cfMinSplitNum;
46 bool wasSplitInPad = mSplitInPad >= param.rec.tpc.cfMinSplitNum;
47 bool isSingleCluster = (mPadSigma == 0) || (mTimeSigma == 0);
48
49 uint8_t flags = 0;
50 flags |= (isEdgeCluster) ? tpc::ClusterNative::flagEdge : 0;
51 flags |= (wasSplitInTime) ? tpc::ClusterNative::flagSplitTime : 0;
52 flags |= (wasSplitInPad) ? tpc::ClusterNative::flagSplitPad : 0;
53 flags |= (isSingleCluster) ? tpc::ClusterNative::flagSingle : 0;
54
55 cn.setTimeFlags(mTimeMean - param.rec.tpc.clustersShiftTimebinsClusterizer, flags);
56 cn.setPad(mPadMean);
57 cn.setSigmaTime(mTimeSigma);
58 cn.setSigmaPad(mPadSigma);
59
60 return true;
61}
62
63GPUd() void ClusterAccumulator::update(Charge splitCharge, Delta2 d)
64{
65 mQtot += splitCharge;
66 mPadMean += splitCharge * d.x;
67 mTimeMean += splitCharge * d.y;
68 mPadSigma += splitCharge * d.x * d.x;
69 mTimeSigma += splitCharge * d.y * d.y;
70}
71
73{
74 Charge q = charge.unpack();
75
76 update(q, d);
77
78 bool split = charge.isSplit();
79 mSplitInTime += (d.y != 0 && split);
80 mSplitInPad += (d.x != 0 && split);
81
82 return q;
83}
84
86{
87 Charge q = charge.unpack();
88
89 bool split = charge.isSplit();
90 bool has3x3 = charge.has3x3Peak();
91
92 update((has3x3) ? 0.f : q, d);
93
94 mSplitInTime += (d.y != 0 && split && !has3x3);
95 mSplitInPad += (d.x != 0 && split && !has3x3);
96
97 return q;
98}
99
100GPUd() void ClusterAccumulator::finalize(const ChargePos& pos, Charge q, TPCTime timeOffset, const GPUTPCGeometry& geo)
101{
102 mQtot += q;
103
104 mPadMean /= mQtot;
105 mTimeMean /= mQtot;
106 mPadSigma /= mQtot;
107 mTimeSigma /= mQtot;
108
109 mPadSigma = CAMath::Sqrt(mPadSigma - mPadMean * mPadMean);
110 mTimeSigma = CAMath::Sqrt(mTimeSigma - mTimeMean * mTimeMean);
111
112 Pad pad = pos.pad();
113 mPadMean += pad;
114 mTimeMean += timeOffset + pos.time();
115
116 if (CfUtils::isAtEdge(pos, geo.NPads(pos.row()))) {
117 bool leftEdge = (pad < 2);
118 bool correct = (leftEdge) ? (pad < mPadMean) : (pad > mPadMean);
119 mPadMean = (correct) ? pad : mPadMean;
120 }
121}
GPUd() bool ClusterAccumulator
Class of a TPC cluster in TPC-native coordinates (row, time)
int16_t charge
Definition RawEventData.h:5
uint16_t pos
Definition RawData.h:3
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLbitfield flags
Definition glcorearb.h:1570
GLenum GLfloat param
Definition glcorearb.h:271
std::vector< std::string > split(const std::string &str, char delimiter=',')