11#ifndef ALICEO2_EMCAL_CLUSTERFACTORY_H_
12#define ALICEO2_EMCAL_CLUSTERFACTORY_H_
25#include <fmt/format.h>
42template <
class InputType>
54 mClusterID(clusterIndex),
55 mMaxClusters(maxClusters),
56 mErrorMessage(
fmt::
format(
"Cluster out of range: %d, max %d", mClusterID, mMaxClusters))
65 [[nodiscard]] const
char*
what() const noexcept final {
return mErrorMessage.data(); }
78 std::string mErrorMessage;
88 mCellIndex(cellIndex),
89 mMaxCellIndex(maxCellIndex),
90 mErrorMessage(
fmt::
format(
"Cell Index out of range: %d, max %d", mCellIndex, mMaxCellIndex))
99 [[nodiscard]] const
char*
what() const noexcept final {
return mErrorMessage.data(); }
111 int mMaxCellIndex = 0;
112 std::string mErrorMessage;
127 [[nodiscard]] const
char*
what() const noexcept final {
return "Geometry not set"; }
188 bool mForward =
true;
200 ClusterFactory(std::span<const o2::emcal::Cluster> clustersContainer, std::span<const InputType> inputsContainer, std::span<const int> cellsIndices);
242 mJustCluster = justCluster;
264 static void getDeffW0(
const Double_t esum, Double_t& deff, Double_t& w0);
281 bool isExoticCell(
short towerId,
float ecell,
float const exoticTime,
float& fCross)
const;
288 float getECross(
short absID,
float energy,
float const exoticTime)
const;
315 Double_t
tMaxInCm(
const Double_t e = 0.0,
const int key = 0)
const;
337 void setContainer(std::span<const o2::emcal::Cluster> clusterContainer, std::span<const InputType> cellContainer, std::span<const int> indicesContainer, std::span<const o2::emcal::CellLabel> cellLabelContainer = {})
339 mClustersContainer = clusterContainer;
340 mInputsContainer = cellContainer;
341 mCellsIndices = indicesContainer;
345 if (!cellLabelContainer.empty()) {
346 mCellLabelContainer = cellLabelContainer;
352 mLoolUpTowerToIndex.fill(-1);
353 for (
auto iCellIndex : mCellsIndices) {
354 mLoolUpTowerToIndex[mInputsContainer[iCellIndex].getTower()] = iCellIndex;
361 return mClustersContainer.size();
380 [[nodiscard]] const
char*
what() const noexcept final {
return "Lookup table not initialized, exotics evaluation not possible!"; }
422 float mCoreRadius = 10;
424 float mLogWeight = 4.5;
426 bool mJustCluster = kFALSE;
427 bool mLookUpInit =
false;
429 mutable int mSuperModuleNumber = 0;
430 float mDistToBadTower = -1;
431 bool mSharedCluster =
false;
432 float mExoticCellFraction = 0.97;
433 float mExoticCellDiffTime = 1e6;
434 float mExoticCellMinAmplitude = 4.;
435 float mExoticCellInCrossMinAmplitude = 0.1;
436 bool mUseWeightExotic =
false;
438 std::span<const o2::emcal::Cluster> mClustersContainer;
439 std::span<const InputType> mInputsContainer;
440 std::span<const int> mCellsIndices;
441 std::array<short, 17664> mLoolUpTowerToIndex{};
442 std::span<const o2::emcal::CellLabel> mCellLabelContainer;
Cluster class for kinematic cluster parametersported from AliVCluster in AliRoot.
int getMaxNumberOfCellIndexs() const
Get the maximum number of cell indices handled by the cluster factory.
CellIndexRangeException(int cellIndex, int maxCellIndex)
Constructor defining the error.
~CellIndexRangeException() noexcept final=default
Destructor.
const char * what() const noexcept final
Provide error message.
int getCellIndex() const
Get the index of the cell raising the exception.
ClusterIterator & operator--()
Prefix decrementation operator.
AnalysisCluster * operator*()
Get pointer to the current cluster.
bool operator!=(const ClusterIterator &rhs) const
Check for not equalness.
int current_index() const
Get the index of the current event.
AnalysisCluster & operator&()
Get reference to the current cluster.
~ClusterIterator()=default
Destructor.
bool operator==(const ClusterIterator &rhs) const
Check for equalness.
ClusterIterator & operator++()
Prefix incrementation operator.
const char * what() const noexcept final
Provide error message.
int getMaxNumberOfClusters() const
Get the maximum number of events handled by the event handler.
~ClusterRangeException() noexcept final=default
Destructor.
int getClusterID() const
Get the ID of the event raising the exception.
ClusterRangeException(int clusterIndex, int maxClusters)
Constructor defining the error.
const char * what() const noexcept final
Provide error message.
GeometryNotSetException()=default
Constructor.
~GeometryNotSetException() noexcept final=default
Destructor.
Exception handling uninitialized look up table.
UninitLookUpTableException()=default
constructor
const char * what() const noexcept final
Access to error message of the exception.
~UninitLookUpTableException() noexcept final=default
Destructor.
EMCal clusters factory Ported from class AliEMCALcluster.
ClusterIterator rend() const
Get backward end iteration marker.
ClusterIterator rbegin() const
Get backward start iterator.
void reset()
Reset containers.
float GetCellWeight(float eCell, float eCluster) const
return weight of cell for shower shape calculation
int getSuperModuleNumber() const
~ClusterFactory()=default
Destructor.
float thetaToEta(float arg) const
Converts Theta (Radians) to Eta (Radians)
ClusterFactory(const ClusterFactory &rp)=default
Copy constructor.
void doEvalLocal2tracking(bool justCluster)
void evalGlobalPosition(std::span< const int > inputsIndices, AnalysisCluster &cluster) const
Calculates the center of gravity in the global ALICE coordinates.
std::tuple< int, float, float, bool > getMaximalEnergyIndex(std::span< const int > inputsIndices) const
Finds the maximum energy in the cluster and computes the Summed amplitude of digits/cells.
float getExoticCellDiffTime() const
void setGeometry(o2::emcal::Geometry *geometry)
Initialize Cluster Factory with geometry.
bool getLookUpInit() const
float getECross(short absID, float energy, float const exoticTime) const
Calculate the energy in the cross around the energy of a given cell.
int getMultiplicityAtLevel(float level, std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
Calculates the multiplicity of digits/cells with energy larger than level*energy.
Double_t tMaxInCm(const Double_t e=0.0, const int key=0) const
void evalTime(std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
Time is set to the time of the digit with the maximum energy.
void setExoticCellFraction(float exoticCellFraction)
void evalLocalPosition(std::span< const int > inputsIndices, AnalysisCluster &cluster) const
Calculates the center of gravity in the local EMCAL-module coordinates.
static void getDeffW0(const Double_t esum, Double_t &deff, Double_t &w0)
float getCoreRadius() const
ClusterFactory()=default
Dummy constructor.
void setContainer(std::span< const o2::emcal::Cluster > clusterContainer, std::span< const InputType > cellContainer, std::span< const int > indicesContainer, std::span< const o2::emcal::CellLabel > cellLabelContainer={})
bool getUseWeightExotic() const
ClusterIterator end() const
Get forward end iteration marker.
void setExoticCellInCrossMinAmplitude(float exoticCellInCrossMinAmplitude)
float GetECALogWeight() const
void evalLocalPositionFit(double deff, double mLogWeight, double phiSlope, std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
evaluates local position of clusters in SM
void setExoticCellMinAmplitude(float exoticCellMinAmplitude)
bool sharedCluster() const
void evalCoreEnergy(std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
ClusterFactory & operator=(const ClusterFactory &cf)=default
Assignment operator.
void evalDispersion(std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
void setUseWeightExotic(bool useWeightExotic)
ClusterIterator begin() const
Get forward start iterator.
float etaToTheta(float arg) const
Converts Eta (Radians) to Theta (Radians)
bool isExoticCell(short towerId, float ecell, float const exoticTime, float &fCross) const
Look to cell neighbourhood and reject if it seems exotic.
void evalElipsAxis(std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
void setCoreRadius(float radius)
float getExoticCellInCrossMinAmplitude() const
float getExoticCellMinAmplitude() const
int getNumberOfClusters() const
void evalLocal2TrackingCSTransform() const
void setSharedCluster(bool s)
float getExoticCellFraction() const
void SetECALogWeight(Float_t w)
AnalysisCluster buildCluster(int index, o2::emcal::ClusterLabel *clusterLabel=nullptr) const
evaluates cluster parameters: position, shower shape, primaries ...
void evalNExMax(std::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
Calculate the number of local maxima in the cluster.
void setExoticCellDiffTime(float exoticCellDiffTime)
cluster class for MC particle IDs and their respective energy fraction
EMCAL geometry definition.
GLubyte GLubyte GLubyte GLubyte w
GLint GLint GLsizei GLint GLenum format