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