Project
Loading...
Searching...
No Matches
Cluster.h
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#ifndef ALICEO2_CPV_CLUSTER_H_
13#define ALICEO2_CPV_CLUSTER_H_
14
16#include <cmath>
17
18namespace o2
19{
20namespace cpv
21{
22class Geometry;
25
26constexpr float kMinX = -72.32; // Minimal coordinate in X direction
27constexpr float kStepX = 0.0025; // digitization step in X direction
28constexpr float kMinZ = -63.3; // Minimal coordinate in Z direction
29constexpr float kStepZ = 0.002; // digitization step in Z direction
30constexpr float kStepE = 0.036; // Amplitude digitization parameter
31
33{
34
35 union CluStatus {
36 uint8_t mBits;
37 struct {
38 uint8_t multiplicity : 5; // Pad multiplicty, bits 0-4
39 uint8_t module : 2; // module number, bits 5-6
40 uint8_t unfolded : 1; // unfolded bit, bit 7
41 };
42 };
43
44 public:
45 Cluster() = default;
46 Cluster(unsigned char mult, char mod, char exMax, float x, float z, float e) : mMulDigit(mult), mModule(mod), mNExMax(exMax), mLocalPosX(x), mLocalPosZ(z), mEnergy(e) {}
47 Cluster(const Cluster& clu) = default;
48
49 ~Cluster() = default;
50
54 bool operator<(const Cluster& other) const;
58 bool operator>(const Cluster& other) const;
59
60 void setEnergy(float e) { mEnergy = e; }
61 float getEnergy() const { return mEnergy; }
62
63 void getLocalPosition(float& posX, float& posZ) const
64 {
65 posX = mLocalPosX;
66 posZ = mLocalPosZ;
67 }
68 unsigned char getMultiplicity() const { return mMulDigit; } // gets the number of digits making this recpoint
69 // 0: was no unfolging, -1: unfolding failed
70 char getModule() const { return mModule; } // CPV module of a current cluster
71
72 // 0: was no unfolging, -1: unfolding failed
73 void setNExMax(char nmax = 1) { mNExMax = nmax; }
74 char getNExMax() const { return mNExMax; } // Number of maxima found in cluster in unfolding:
75 // 0: was no unfolging, -1: unfolding failed
76
77 // raw access for CTF encoding
78 uint16_t getPackedPosX() const { return uint16_t((mLocalPosX - kMinX) / kStepX); }
79 void setPackedPosX(uint16_t v) { mLocalPosX = kMinX + kStepX * v; }
80
81 uint16_t getPackedPosZ() const { return uint16_t((mLocalPosZ - kMinZ) / kStepZ); }
82 void setPackedPosZ(uint16_t v) { mLocalPosZ = kMinZ + kStepZ * v; }
83
84 uint8_t getPackedEnergy() const { return uint8_t(std::min(255, int((mEnergy > 100.) ? (log(mEnergy - 63.) / kStepE) : mEnergy))); }
85 void setPackedEnergy(uint8_t v) { mEnergy = ((v > 100) ? (exp(kStepE * v) + 63.) : (v * 1.)); }
86
87 uint8_t getPackedClusterStatus() const
88 {
89 CluStatus s = {0};
90 s.multiplicity = std::min(mMulDigit, static_cast<unsigned char>(31)); // 5 bits available
91 s.module = mModule - 2;
92 s.unfolded = mNExMax > 1;
93 return s.mBits;
94 }
96 {
97 CluStatus s = {v};
98 mMulDigit = s.multiplicity;
99 mModule = s.module + 2;
100 mNExMax = s.unfolded ? 1 : 2;
101 }
102
103 void setPacked(uint16_t posX, uint16_t posZ, uint8_t en, uint8_t status)
104 {
105 setPackedPosX(posX);
106 setPackedPosZ(posZ);
107 setPackedEnergy(en);
109 }
110
111 protected:
112 unsigned char mMulDigit = 0;
113 char mModule = 0;
114 char mNExMax = -1;
115 float mLocalPosX = 0.;
116 float mLocalPosZ = 0.;
117 float mEnergy = 0.;
118
120};
121
122} // namespace cpv
123
124namespace framework
125{
126template <typename T>
127struct is_messageable;
128template <>
129struct is_messageable<o2::cpv::Cluster> : std::true_type {
130};
131} // namespace framework
132
133} // namespace o2
134
135#endif
uint64_t exp(uint64_t base, uint8_t exp) noexcept
Contains CPV cluster parameters.
Definition Cluster.h:33
void setPackedPosZ(uint16_t v)
Definition Cluster.h:82
void setPacked(uint16_t posX, uint16_t posZ, uint8_t en, uint8_t status)
Definition Cluster.h:103
char getNExMax() const
Definition Cluster.h:74
void setEnergy(float e)
Definition Cluster.h:60
uint16_t getPackedPosX() const
Definition Cluster.h:78
bool operator<(const Cluster &other) const
Comparison oparator, based on time and coordinates.
Definition Cluster.cxx:21
char mNExMax
number of (Ex-)maxima before unfolding
Definition Cluster.h:114
unsigned char mMulDigit
Digit nultiplicity.
Definition Cluster.h:112
Cluster(const Cluster &clu)=default
Cluster(unsigned char mult, char mod, char exMax, float x, float z, float e)
Definition Cluster.h:46
float mLocalPosX
Center of gravity position in local module coordunates (phi direction)
Definition Cluster.h:115
void setPackedPosX(uint16_t v)
Definition Cluster.h:79
bool operator>(const Cluster &other) const
Comparison oparator, based on time and coordinates.
Definition Cluster.cxx:47
void setPackedEnergy(uint8_t v)
Definition Cluster.h:85
uint8_t getPackedEnergy() const
Definition Cluster.h:84
unsigned char getMultiplicity() const
Definition Cluster.h:68
float getEnergy() const
Definition Cluster.h:61
uint16_t getPackedPosZ() const
Definition Cluster.h:81
char mModule
Module number.
Definition Cluster.h:113
uint8_t getPackedClusterStatus() const
Definition Cluster.h:87
char getModule() const
Definition Cluster.h:70
ClassDefNV(Cluster, 1)
void getLocalPosition(float &posX, float &posZ) const
Definition Cluster.h:63
Cluster()=default
float mEnergy
full energy of a cluster
Definition Cluster.h:117
float mLocalPosZ
Center of gravity position in local module coordunates (z direction)
Definition Cluster.h:116
~Cluster()=default
void setPackedClusterStatus(uint8_t v)
Definition Cluster.h:95
void setNExMax(char nmax=1)
Definition Cluster.h:73
GLint GLenum GLint x
Definition glcorearb.h:403
const GLdouble * v
Definition glcorearb.h:832
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr float kMinZ
Definition Cluster.h:28
constexpr float kStepZ
Definition Cluster.h:29
constexpr float kStepX
Definition Cluster.h:27
constexpr float kMinX
Definition Cluster.h:26
constexpr float kStepE
Definition Cluster.h:30
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other
Cluster clu