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 FrameBit = 6 }; // this bit set means that the cluster is in the nominal (alpha=20*sector+10 deg.) sector frame rather than aligned
55
56 Cluster() = default;
57
58 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);
59
60 ~Cluster() = default;
61
62 bool isInNominalSector() const { return isBitSet(FrameBit); }
64
65 std::int8_t getSector() const { return getCount(); }
66 void setSector(std::int8_t value) { setCount(value); }
67
68 std::int16_t getPadInSector() const { return getSensorID(); }
69 void setPadInSector(std::int16_t value) { setSensorID(value); }
70
71 double getTimeRaw() const { return mTimeRaw; } // Cluster ToF getter
72 void setTimeRaw(double timeRaw) { mTimeRaw = timeRaw; } // Cluster ToF setter
73 double getTime() const { return mTime; } // Cluster ToF getter
74 void setTime(double time) { mTime = time; } // Cluster ToF setter
75 float getTot() const { return mTot; } // Cluster Charge getter
76 void setTot(float tot) { mTot = tot; } // Cluster ToT setter
77 int getL0L1Latency() const { return mL0L1Latency; }; // L0L1 latency
78 void setL0L1Latency(int value) { mL0L1Latency = value; }; // L0-L1 latency
79 int getDeltaBC() const { return mDeltaBC; }; // deltaBC
80 void setDeltaBC(int value) { mDeltaBC = value; }; // deltaBC
81 //float getZ() const {return mZ;} // Cluster Z - already in the definition of the cluster
82
83 float getR() // Cluster Radius (it is the same in sector and global frame)
84 {
85 if (mR == RadiusOutOfRange) {
86 mR = o2::gpu::CAMath::Sqrt(getX() * getX() + getY() * getY() + getZ() * getZ());
87 }
88 return mR;
89 }
90
91 float getPhi() // Cluster Phi in sector frame
92 {
93 if (mPhi == PhiOutOfRange) {
94 mPhi = o2::gpu::CAMath::ATan2(getY(), getX());
95 }
96 return mPhi;
97 }
98 float getR() const // Cluster Radius (it is the same in sector and global frame)
99 {
100 if (mR == RadiusOutOfRange) {
101 return o2::gpu::CAMath::Sqrt(getX() * getX() + getY() * getY() + getZ() * getZ());
102 }
103 return mR;
104 }
105
106 float getPhi() const // Cluster Phi in sector frame
107 {
108 if (mPhi == PhiOutOfRange) {
109 return o2::gpu::CAMath::ATan2(getY(), getX());
110 }
111 return mPhi;
112 }
113
114 void setR(float value) { mR = value; }
115 void setPhi(float value) { mPhi = value; }
116
117 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()
118 int getMainContributingChannel() const { return getSector() * NPADSXSECTOR + getPadInSector(); }
119
120 void addBitInContributingChannels(int bit) { setBit(bit); }
122 std::uint8_t getAdditionalContributingChannels() const { return getBits(); }
124
125 bool isAdditionalChannelSet(int bit /* e.g. o2::tof::Cluster::kUpLeft */) const { return isBitSet(bit); }
126
127 void setMainContributingChannel(int newvalue)
128 {
129 setSector(newvalue / NPADSXSECTOR);
130 setPadInSector(newvalue % NPADSXSECTOR);
131 }
132
133 void setEntryInTree(int value) { mEntryInTree = value; }
134 int getEntryInTree() const { return mEntryInTree; }
135
136 int getBC() const { return int(mTimeRaw * BC_TIME_INPS_INV); }
137
138 void setDigitInfo(int idig, int ch, double t, float tot);
139 int getDigitInfoCH(int idig) const { return mDigitInfoCh[idig]; }
140 double getDigitInfoT(int idig) const { return mDigitInfoT[idig]; }
141 float getDigitInfoTOT(int idig) const { return mDigitInfoTOT[idig]; }
142 float getTgeant() const { return mTgeant; }
143 void setTgeant(float val) { mTgeant = val; }
144 double getT0true() const { return mT0true; }
145 void setT0true(double val) { mT0true = val; }
146
147 private:
148#if !defined(GPUCA_GPUCODE) && !defined(GPUCA_STANDALONE)
150#endif
151 double mTimeRaw; // raw TOF time // CZ: in AliRoot it is a double
152 double mTime; // calibrated TOF time // CZ: in AliRoot it is a double
153 float mTot; // Time-Over-threshold // CZ: in AliRoot it is a double
154 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)
155 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)
156 //float mZ; //! z-coordinate // CZ: to be verified if it is the same in the BaseCluster class
157 float mR = RadiusOutOfRange;
158 float mPhi = PhiOutOfRange;
159 int mEntryInTree;
160
161 // add extra info to trace all digit infos (for commissioning phase)
162 int mDigitInfoCh[6] = {0, 0, 0, 0, 0, 0};
163 double mDigitInfoT[6] = {0., 0., 0., 0., 0., 0.};
164 float mDigitInfoTOT[6] = {0., 0., 0., 0., 0., 0.};
165 float mTgeant = 0.0;
166 double mT0true = 0.0;
167
168 ClassDefNV(Cluster, 5);
169};
170
171#ifndef GPUCA_GPUCODE
172std::ostream& operator<<(std::ostream& os, Cluster& c);
173#endif
174} // namespace tof
175
188namespace framework
189{
190template <typename T>
191struct is_messageable;
192template <>
193struct is_messageable<o2::tof::Cluster> : std::true_type {
194};
195} // namespace framework
196
197} // namespace o2
198#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:134
void setDigitInfo(int idig, int ch, double t, float tot)
Definition Cluster.cxx:78
bool isAdditionalChannelSet(int bit) const
Definition Cluster.h:125
void setT0true(double val)
Definition Cluster.h:145
float getTgeant() const
Definition Cluster.h:142
int getMainContributingChannel() const
Definition Cluster.h:118
double getDigitInfoT(int idig) const
Definition Cluster.h:140
int getDigitInfoCH(int idig) const
Definition Cluster.h:139
void setPadInSector(std::int16_t value)
Definition Cluster.h:69
std::int16_t getPadInSector() const
Definition Cluster.h:68
void setL0L1Latency(int value)
Definition Cluster.h:78
int getDeltaBC() const
Definition Cluster.h:79
float getPhi() const
Definition Cluster.h:106
void setEntryInTree(int value)
Definition Cluster.h:133
int getNumOfContributingChannels() const
Definition Cluster.cxx:34
void setPhi(float value)
Definition Cluster.h:115
void setTot(float tot)
Definition Cluster.h:76
void setR(float value)
Definition Cluster.h:114
void setInNominalSector()
Definition Cluster.h:63
double getTimeRaw() const
Definition Cluster.h:71
int getL0L1Latency() const
Definition Cluster.h:77
float getTot() const
Definition Cluster.h:75
void setSector(std::int8_t value)
Definition Cluster.h:66
double getT0true() const
Definition Cluster.h:144
float getDigitInfoTOT(int idig) const
Definition Cluster.h:141
float getR() const
Definition Cluster.h:98
Cluster()=default
void setTime(double time)
Definition Cluster.h:74
void setAdditionalContributingChannels(std::uint8_t mask)
Definition Cluster.h:123
std::int8_t getSector() const
Definition Cluster.h:65
int getBC() const
Definition Cluster.h:136
void setMainContributingChannel(int newvalue)
Definition Cluster.h:127
void setTimeRaw(double timeRaw)
Definition Cluster.h:72
void setTgeant(float val)
Definition Cluster.h:143
bool isInNominalSector() const
Definition Cluster.h:62
std::uint8_t getAdditionalContributingChannels() const
Definition Cluster.h:122
friend class boost::serialization::access
Definition Cluster.h:149
double getTime() const
Definition Cluster.h:73
void setDeltaBC(int value)
Definition Cluster.h:80
void addBitInContributingChannels(int bit)
Definition Cluster.h:120
~Cluster()=default
float getR()
Definition Cluster.h:83
void resetBitInContributingChannels(int bit)
Definition Cluster.h:121
float getPhi()
Definition Cluster.h:91
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 ...