Project
Loading...
Searching...
No Matches
AnalysisCluster.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_EMCAL_ANALYSISCLUSTER_H_
13#define ALICEO2_EMCAL_ANALYSISCLUSTER_H_
14
15#include "MathUtils/Cartesian.h" // IWYU pragma: keep
16
17#include <Rtypes.h>
18#include <TLorentzVector.h>
19
20#include <fairlogger/Logger.h>
21#include <gsl/span>
22
23#include <array>
24
25namespace o2::emcal
26{
27
35
37{
38
39 public:
43 class CellOutOfRangeException final : public std::exception
44 {
45 public:
48 CellOutOfRangeException(Int_t cellIndex) : mCellIndex(cellIndex),
49 mMessage("Cell index " + std::to_string(mCellIndex) + " out of range.")
50 {
51 }
52
54 ~CellOutOfRangeException() noexcept final = default;
55
58 [[nodiscard]] Int_t getCellIndex() const noexcept { return mCellIndex; }
59
62 [[nodiscard]] const char* what() const noexcept final { return mMessage.data(); }
63
64 private:
65 Int_t mCellIndex;
66 std::string mMessage;
67 };
68
69 AnalysisCluster() = default;
70 ~AnalysisCluster() = default;
71 AnalysisCluster(const AnalysisCluster& clus) = default;
73 void clear();
74
75 // Common EMCAL/PHOS/FMD/PMD
76
77 void setID(int id) { mID = id; }
78 [[nodiscard]] int getID() const { return mID; }
79
80 void setE(float ene) { mEnergy = ene; }
81 [[nodiscard]] float E() const { return mEnergy; }
82
83 void setChi2(float chi2) { mChi2 = chi2; }
84 [[nodiscard]] float Chi2() const { return mChi2; }
85
90 {
91 return mGlobalPos;
92 }
93
96 {
97 return mLocalPos;
98 }
99
100 void setDispersion(float disp) { mDispersion = disp; }
101 [[nodiscard]] float getDispersion() const { return mDispersion; }
102
103 void setM20(float m20) { mM20 = m20; }
104 [[nodiscard]] float getM20() const { return mM20; }
105
106 void setM02(float m02) { mM02 = m02; }
107 [[nodiscard]] float getM02() const { return mM02; }
108
109 void setNExMax(unsigned char nExMax) { mNExMax = nExMax; }
110 [[nodiscard]] unsigned char getNExMax() const { return mNExMax; }
111
112 void setEmcCpvDistance(float dEmcCpv) { mEmcCpvDistance = dEmcCpv; }
113 [[nodiscard]] float getEmcCpvDistance() const { return mEmcCpvDistance; }
114 void setTrackDistance(float dx, float dz)
115 {
116 mTrackDx = dx;
117 mTrackDz = dz;
118 }
119 [[nodiscard]] float getTrackDx() const { return mTrackDx; }
120 [[nodiscard]] float getTrackDz() const { return mTrackDz; }
121
122 void setDistanceToBadChannel(float dist) { mDistToBadChannel = dist; }
123 [[nodiscard]] float getDistanceToBadChannel() const { return mDistToBadChannel; }
124
125 void setNCells(int n) { mNCells = n; }
126 [[nodiscard]] int getNCells() const { return mNCells; }
127
130 void setCellsIndices(const std::vector<unsigned short>& array)
131 {
133 }
134
135 [[nodiscard]] const std::vector<unsigned short>& getCellsIndices() const { return mCellsIndices; }
136
141 void setCellsAmplitudeFraction(const std::vector<float>& array)
142 {
144 }
145 [[nodiscard]] const std::vector<float>& getCellsAmplitudeFraction() const { return mCellsAmpFraction; }
146
147 [[nodiscard]] int getCellIndex(int i) const
148 {
149 if (i >= 0 && i < mNCells) {
150 return mCellsIndices[i];
151 }
153 }
154
155 [[nodiscard]] float getCellAmplitudeFraction(int i) const
156 {
157 if (i >= 0 && i < mNCells) {
158 return mCellsAmpFraction[i];
159 }
161 }
162
163 [[nodiscard]] bool getIsExotic() const { return mIsExotic; }
164 void setIsExotic(bool b) { mIsExotic = b; }
165
167 {
168 mTime = time;
169 }
170
171 [[nodiscard]] float getClusterTime() const
172 {
173 return mTime;
174 }
175
176 [[nodiscard]] int getIndMaxInput() const { return mInputIndMax; }
177 void setIndMaxInput(const int ind) { mInputIndMax = ind; }
178
179 [[nodiscard]] float getCoreEnergy() const { return mCoreEnergy; }
180 void setCoreEnergy(float energy) { mCoreEnergy = energy; }
181
182 [[nodiscard]] float getFCross() const { return mFCross; }
183 void setFCross(float fCross) { mFCross = fCross; }
184
189 [[nodiscard]] TLorentzVector getMomentum(std::array<const float, 3> vertexPosition) const;
190
191 protected:
193 std::vector<int> mLabels;
194
195 int mNCells = 0;
196
198 std::vector<unsigned short> mCellsIndices; //[mNCells]
199
202 std::vector<float> mCellsAmpFraction; //[mNCells][0.,1.,16]
203
206 float mEnergy = 0;
207 float mCoreEnergy = 0.;
208 float mDispersion = 0;
209 float mChi2 = 0;
210 float mM20 = 0;
211 float mM02 = 0;
212
213 float mEmcCpvDistance = 1024;
214
215 float mTrackDx = 1024;
216 float mTrackDz = 1024;
217
218 float mDistToBadChannel = 1024;
219
220 int mID = 0;
221 unsigned char mNExMax = 0;
222
223 float mTime = 0.;
224
225 bool mIsExotic = false;
226 float mFCross = 0.f;
227
228 int mInputIndMax = -1;
229
231};
232
233} // namespace o2::emcal
234#endif // ANALYSISCLUSTER_H
int16_t time
Definition RawEventData.h:4
int32_t i
Exception handling non-existing cell indices.
const char * what() const noexcept final
Access to error message of the exception.
CellOutOfRangeException(Int_t cellIndex)
Constructor, setting cell wrong cell index raising the exception.
~CellOutOfRangeException() noexcept final=default
Destructor.
Int_t getCellIndex() const noexcept
Access to cell ID raising the exception.
Cluster class for kinematic cluster parametersported from AliVCluster in AliRoot.
float mDistToBadChannel
Distance to nearest bad channel.
math_utils::Point3D< float > mGlobalPos
Position in global coordinate system (cm).
void setNExMax(unsigned char nExMax)
float mM02
2-nd moment along the main eigen axis.
const std::vector< float > & getCellsAmplitudeFraction() const
void setFCross(float fCross)
void setDistanceToBadChannel(float dist)
AnalysisCluster(const AnalysisCluster &clus)=default
void setCoreEnergy(float energy)
float mTrackDx
Distance to closest track in phi.
unsigned char getNExMax() const
float mEmcCpvDistance
the distance from PHOS EMC rec.point to the closest CPV rec.point.
math_utils::Point3D< float > getGlobalPosition() const
float mChi2
Chi2 of cluster fit (unfolded clusters)
math_utils::Point3D< float > getLocalPosition() const
float mTrackDz
Distance to closest track in z.
int mInputIndMax
exoticity parameter (1-E_cross/E_cell^max)
float mEnergy
Energy measured by calorimeter in GeV.
void setGlobalPosition(const math_utils::Point3D< float > &x)
Set the cluster global position.
void setCellsAmplitudeFraction(const std::vector< float > &array)
int mID
Unique Id of the cluster.
bool mIsExotic
! Cluster marked as "exotic" (high energy deposition concentrated in a single cell)
void setCellsIndices(const std::vector< unsigned short > &array)
Set the array of cell indices.
math_utils::Point3D< float > mLocalPos
Local position in the sub-detector coordinate.
void setEmcCpvDistance(float dEmcCpv)
TLorentzVector getMomentum(std::array< const float, 3 > vertexPosition) const
float mM20
2-nd moment along the second eigen axis.
ClassDefNV(AnalysisCluster, 3)
AnalysisCluster & operator=(const AnalysisCluster &source)=default
void setLocalPosition(const math_utils::Point3D< float > &x)
float mDispersion
Cluster shape dispersion.
float getDistanceToBadChannel() const
float getCellAmplitudeFraction(int i) const
std::vector< float > mCellsAmpFraction
const std::vector< unsigned short > & getCellsIndices() const
std::vector< int > mLabels
TODO to replace later by o2::MCLabel when implementing the MC handling.
void setIndMaxInput(const int ind)
void setTrackDistance(float dx, float dz)
unsigned char mNExMax
Number of Local (Ex-)maxima before unfolding.
std::vector< unsigned short > mCellsIndices
Array of cell indices contributing to this cluster.
void setClusterTime(float time)
float mCoreEnergy
Energy in a shower core.
float mTime
Time of the digit/cell with maximal energy deposition.
int mNCells
Number of cells in cluster.
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
GLenum array
Definition glcorearb.h:4274
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLsizei GLsizei GLchar * source
Definition glcorearb.h:798
GLuint id
Definition glcorearb.h:650
std::string to_string(gsl::span< T, Size > span)
Definition common.h:52