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
14
15#ifndef ALICEO2_TOF_CLUSTER_H
16#define ALICEO2_TOF_CLUSTER_H
17
18#include "GPUCommonRtypes.h"
19#include "GPUCommonMath.h"
22#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
23#include <boost/serialization/base_object.hpp> // for base_object
24#include <cstdlib>
25#include <vector>
26#endif
27
28namespace o2
29{
30namespace tof
31{
35
36class Cluster : public o2::BaseCluster<float>
37{
38 static constexpr float RadiusOutOfRange = 9999; // used to check if the radius was already calculated or not
39 static constexpr float PhiOutOfRange = 9999; // used to check if phi was already calculated or not
40
41 static constexpr int NPADSXSECTOR = 8736;
42 static constexpr double BC_TIME_INPS_INV = 1.E-3 / o2::constants::lhc::LHCBunchSpacingNS;
43
44 public:
45 enum { kUpLeft = 0, // 2^0, 1st bit
46 kUp = 1, // 2^1, 2nd bit
47 kUpRight = 2, // 2^2, 3rd bit
48 kRight = 3, // 2^3, 4th bit
49 kDownRight = 4, // 2^4, 5th bit
50 kDown = 5, // 2^5, 6th bit
51 kDownLeft = 6, // 2^6, 7th bit
52 kLeft = 7 }; // 2^7, 8th bit
53
54 Cluster() = default;
55
56 Cluster(std::int16_t sensid, float x, float y, float z, float sy2, float sz2, float syz, double timeRaw, double time, float tot, int L0L1latency, int deltaBC, float geanttime = 0.0, double t0 = 0.0);
57
58 ~Cluster() = default;
59
60 std::int8_t getSector() const { return getCount(); }
61 void setSector(std::int8_t value) { setCount(value); }
62
63 std::int16_t getPadInSector() const { return getSensorID(); }
64 void setPadInSector(std::int16_t value) { setSensorID(value); }
65
66 double getTimeRaw() const { return mTimeRaw; } // Cluster ToF getter
67 void setTimeRaw(double timeRaw) { mTimeRaw = timeRaw; } // Cluster ToF setter
68 double getTime() const { return mTime; } // Cluster ToF getter
69 void setTime(double time) { mTime = time; } // Cluster ToF setter
70 float getTot() const { return mTot; } // Cluster Charge getter
71 void setTot(float tot) { mTot = tot; } // Cluster ToT setter
72 int getL0L1Latency() const { return mL0L1Latency; }; // L0L1 latency
73 void setL0L1Latency(int value) { mL0L1Latency = value; }; // L0-L1 latency
74 int getDeltaBC() const { return mDeltaBC; }; // deltaBC
75 void setDeltaBC(int value) { mDeltaBC = value; }; // deltaBC
76 //float getZ() const {return mZ;} // Cluster Z - already in the definition of the cluster
77
78 float getR() // Cluster Radius (it is the same in sector and global frame)
79 {
80 if (mR == RadiusOutOfRange) {
81 mR = o2::gpu::CAMath::Sqrt(getX() * getX() + getY() * getY() + getZ() * getZ());
82 }
83 return mR;
84 }
85
86 float getPhi() // Cluster Phi in sector frame
87 {
88 if (mPhi == PhiOutOfRange) {
89 mPhi = o2::gpu::CAMath::ATan2(getY(), getX());
90 }
91 return mPhi;
92 }
93 float getR() const // Cluster Radius (it is the same in sector and global frame)
94 {
95 if (mR == RadiusOutOfRange) {
96 return o2::gpu::CAMath::Sqrt(getX() * getX() + getY() * getY() + getZ() * getZ());
97 }
98 return mR;
99 }
100
101 float getPhi() const // Cluster Phi in sector frame
102 {
103 if (mPhi == PhiOutOfRange) {
104 return o2::gpu::CAMath::ATan2(getY(), getX());
105 }
106 return mPhi;
107 }
108
109 void setR(float value) { mR = value; }
110 void setPhi(float value) { mPhi = value; }
111
112 int getNumOfContributingChannels() const; // returns the number of hits associated to the cluster, i.e. the number of hits that built the cluster; it is the equivalente of the old AliESDTOFCluster::GetNTOFhits()
113 int getMainContributingChannel() const { return getSector() * NPADSXSECTOR + getPadInSector(); }
114
115 void addBitInContributingChannels(int bit) { setBit(bit); }
117 std::uint8_t getAdditionalContributingChannels() const { return getBits(); }
119
120 bool isAdditionalChannelSet(int bit /* e.g. o2::tof::Cluster::kUpLeft */) const { return isBitSet(bit); }
121
122 void setMainContributingChannel(int newvalue)
123 {
124 setSector(newvalue / NPADSXSECTOR);
125 setPadInSector(newvalue % NPADSXSECTOR);
126 }
127
128 void setEntryInTree(int value) { mEntryInTree = value; }
129 int getEntryInTree() const { return mEntryInTree; }
130
131 int getBC() const { return int(mTimeRaw * BC_TIME_INPS_INV); }
132
133 void setDigitInfo(int idig, int ch, double t, float tot);
134 int getDigitInfoCH(int idig) const { return mDigitInfoCh[idig]; }
135 double getDigitInfoT(int idig) const { return mDigitInfoT[idig]; }
136 float getDigitInfoTOT(int idig) const { return mDigitInfoTOT[idig]; }
137 float getTgeant() const { return mTgeant; }
138 void setTgeant(float val) { mTgeant = val; }
139 double getT0true() const { return mT0true; }
140 void setT0true(double val) { mT0true = val; }
141
142 private:
143#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
145#endif
146 double mTimeRaw; // raw TOF time // CZ: in AliRoot it is a double
147 double mTime; // calibrated TOF time // CZ: in AliRoot it is a double
148 float mTot; // Time-Over-threshold // CZ: in AliRoot it is a double
149 int mL0L1Latency; // L0L1 latency // CZ: is it different per cluster? Checking one ESD file, it seems that it is always the same (see: /alice/data/2017/LHC17n/000280235/pass1/17000280235019.100/AliESDs.root)
150 int mDeltaBC; // DeltaBC --> can it be a char or short? // CZ: is it different per cluster? Checking one ESD file, it seems that it can vary (see: /alice/data/2017/LHC17n/000280235/pass1/17000280235019.100/AliESDs.root)
151 //float mZ; //! z-coordinate // CZ: to be verified if it is the same in the BaseCluster class
152 float mR = RadiusOutOfRange;
153 float mPhi = PhiOutOfRange;
154 int mEntryInTree;
155
156 // add extra info to trace all digit infos (for commissioning phase)
157 int mDigitInfoCh[6] = {0, 0, 0, 0, 0, 0};
158 double mDigitInfoT[6] = {0., 0., 0., 0., 0., 0.};
159 float mDigitInfoTOT[6] = {0., 0., 0., 0., 0., 0.};
160 float mTgeant = 0.0;
161 double mT0true = 0.0;
162
163 ClassDefNV(Cluster, 5);
164};
165
166#ifndef GPUCA_GPUCODE
167std::ostream& operator<<(std::ostream& os, Cluster& c);
168#endif
169} // namespace tof
170
183namespace framework
184{
185template <typename T>
186struct is_messageable;
187template <>
188struct is_messageable<o2::tof::Cluster> : std::true_type {
189};
190} // namespace framework
191
192} // namespace o2
193#endif
int16_t time
Definition RawEventData.h:4
Header to collect LHC related constants.
uint32_t c
Definition RawData.h:2
void setBits(std::uint8_t b)
Definition BaseCluster.h:96
void setCount(std::int8_t c)
Definition BaseCluster.h:94
std::int8_t getCount() const
Definition BaseCluster.h:83
void setSensorID(std::int16_t sid)
Definition BaseCluster.h:92
std::uint8_t getBits() const
Definition BaseCluster.h:85
bool isBitSet(int bit) const
Definition BaseCluster.h:86
std::int16_t getSensorID() const
Definition BaseCluster.h:81
HMPID cluster implementation.
Definition Cluster.h:27
Cluster class for TOF.
Definition Cluster.h:37
int getEntryInTree() const
Definition Cluster.h:129
void setDigitInfo(int idig, int ch, double t, float tot)
Definition Cluster.cxx:78
bool isAdditionalChannelSet(int bit) const
Definition Cluster.h:120
void setT0true(double val)
Definition Cluster.h:140
float getTgeant() const
Definition Cluster.h:137
int getMainContributingChannel() const
Definition Cluster.h:113
double getDigitInfoT(int idig) const
Definition Cluster.h:135
int getDigitInfoCH(int idig) const
Definition Cluster.h:134
void setPadInSector(std::int16_t value)
Definition Cluster.h:64
std::int16_t getPadInSector() const
Definition Cluster.h:63
void setL0L1Latency(int value)
Definition Cluster.h:73
int getDeltaBC() const
Definition Cluster.h:74
float getPhi() const
Definition Cluster.h:101
void setEntryInTree(int value)
Definition Cluster.h:128
int getNumOfContributingChannels() const
Definition Cluster.cxx:34
void setPhi(float value)
Definition Cluster.h:110
void setTot(float tot)
Definition Cluster.h:71
void setR(float value)
Definition Cluster.h:109
double getTimeRaw() const
Definition Cluster.h:66
int getL0L1Latency() const
Definition Cluster.h:72
float getTot() const
Definition Cluster.h:70
void setSector(std::int8_t value)
Definition Cluster.h:61
double getT0true() const
Definition Cluster.h:139
float getDigitInfoTOT(int idig) const
Definition Cluster.h:136
float getR() const
Definition Cluster.h:93
Cluster()=default
void setTime(double time)
Definition Cluster.h:69
void setAdditionalContributingChannels(std::uint8_t mask)
Definition Cluster.h:118
std::int8_t getSector() const
Definition Cluster.h:60
int getBC() const
Definition Cluster.h:131
void setMainContributingChannel(int newvalue)
Definition Cluster.h:122
void setTimeRaw(double timeRaw)
Definition Cluster.h:67
void setTgeant(float val)
Definition Cluster.h:138
std::uint8_t getAdditionalContributingChannels() const
Definition Cluster.h:117
friend class boost::serialization::access
Definition Cluster.h:144
double getTime() const
Definition Cluster.h:68
void setDeltaBC(int value)
Definition Cluster.h:75
void addBitInContributingChannels(int bit)
Definition Cluster.h:115
~Cluster()=default
float getR()
Definition Cluster.h:78
void resetBitInContributingChannels(int bit)
Definition Cluster.h:116
float getPhi()
Definition Cluster.h:86
GLint GLenum GLint x
Definition glcorearb.h:403
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLuint GLfloat * val
Definition glcorearb.h:1582
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t0
Definition glcorearb.h:5034
GLint GLuint mask
Definition glcorearb.h:291
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr double LHCBunchSpacingNS
std::ostream & operator<<(std::ostream &os, Cluster &c)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...