11#ifndef ALICEO2_EMCAL_CLUSTERFACTORY_H_
12#define ALICEO2_EMCAL_CLUSTERFACTORY_H_
19#include "fmt/format.h"
42template <
class InputType>
54 mClusterID(clusterIndex),
55 mMaxClusters(maxClusters),
58 mErrorMessage = fmt::format(
"Cluster out of range: %d, max %d", mClusterID, mMaxClusters);
66 const
char*
what() const noexcept final {
return mErrorMessage.data(); }
79 std::string mErrorMessage;
89 mCellIndex(cellIndex),
90 mMaxCellIndex(maxCellIndex),
93 mErrorMessage = Form(
"Cell Index out of range: %d, max %d", mCellIndex, mMaxCellIndex);
101 const
char*
what() const noexcept final {
return mErrorMessage.data(); }
113 int mMaxCellIndex = 0;
114 std::string mErrorMessage;
129 const
char*
what() const noexcept final {
return "Geometry not set"; }
190 bool mForward =
true;
202 ClusterFactory(gsl::span<const o2::emcal::Cluster> clustersContainer, gsl::span<const InputType> inputsContainer, gsl::span<const int> cellsIndices);
244 mJustCluster = justCluster;
266 static void getDeffW0(
const Double_t esum, Double_t& deff, Double_t& w0);
282 bool isExoticCell(
short towerId,
float ecell,
float const exoticTime)
const;
289 float getECross(
short absID,
float energy,
float const exoticTime)
const;
316 Double_t
tMaxInCm(
const Double_t e = 0.0,
const int key = 0)
const;
338 void setContainer(gsl::span<const o2::emcal::Cluster> clusterContainer, gsl::span<const InputType> cellContainer, gsl::span<const int> indicesContainer, std::optional<gsl::span<const o2::emcal::CellLabel>> cellLabelContainer = std::nullopt)
340 mClustersContainer = clusterContainer;
341 mInputsContainer = cellContainer;
342 mCellsIndices = indicesContainer;
346 if (cellLabelContainer) {
347 mCellLabelContainer = cellLabelContainer.value();
353 mLoolUpTowerToIndex.fill(-1);
354 for (
auto iCellIndex : mCellsIndices) {
355 mLoolUpTowerToIndex[mInputsContainer[iCellIndex].getTower()] = iCellIndex;
362 return mClustersContainer.size();
381 const
char*
what() const noexcept final {
return "Lookup table not initialized, exotics evaluation not possible!"; }
419 float mCoreRadius = 10;
421 float mLogWeight = 4.5;
423 bool mJustCluster = kFALSE;
424 bool mLookUpInit =
false;
426 mutable int mSuperModuleNumber = 0;
427 float mDistToBadTower = -1;
428 bool mSharedCluster =
false;
429 float mExoticCellFraction = 0.97;
430 float mExoticCellDiffTime = 1e6;
431 float mExoticCellMinAmplitude = 4.;
432 float mExoticCellInCrossMinAmplitude = 0.1;
433 bool mUseWeightExotic =
false;
435 gsl::span<const o2::emcal::Cluster> mClustersContainer;
436 gsl::span<const InputType> mInputsContainer;
437 gsl::span<const int> mCellsIndices;
438 std::array<short, 17664> mLoolUpTowerToIndex;
439 gsl::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.
std::tuple< int, float, float, bool > getMaximalEnergyIndex(gsl::span< const int > inputsIndices) const
Finds the maximum energy in the cluster and computes the Summed amplitude of digits/cells.
float GetCellWeight(float eCell, float eCluster) const
return weight of cell for shower shape calculation
void setContainer(gsl::span< const o2::emcal::Cluster > clusterContainer, gsl::span< const InputType > cellContainer, gsl::span< const int > indicesContainer, std::optional< gsl::span< const o2::emcal::CellLabel > > cellLabelContainer=std::nullopt)
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)
float getExoticCellDiffTime() const
void setGeometry(o2::emcal::Geometry *geometry)
Initialize Cluster Factory with geometry.
bool getLookUpInit() const
void setLookUpTable(void)
float getECross(short absID, float energy, float const exoticTime) const
Calculate the energy in the cross around the energy of a given cell.
void evalGlobalPosition(gsl::span< const int > inputsIndices, AnalysisCluster &cluster) const
Calculates the center of gravity in the global ALICE coordinates.
bool isExoticCell(short towerId, float ecell, float const exoticTime) const
Look to cell neighbourhood and reject if it seems exotic.
void evalLocalPosition(gsl::span< const int > inputsIndices, AnalysisCluster &cluster) const
Calculates the center of gravity in the local EMCAL-module coordinates.
Double_t tMaxInCm(const Double_t e=0.0, const int key=0) const
void setExoticCellFraction(float exoticCellFraction)
bool getCoreRadius() const
void setUseWeightExotic(float useWeightExotic)
static void getDeffW0(const Double_t esum, Double_t &deff, Double_t &w0)
void evalTime(gsl::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
Time is set to the time of the digit with the maximum energy.
int getMultiplicityAtLevel(float level, gsl::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
Calculates the multiplicity of digits/cells with energy larger than level*energy.
ClusterFactory()=default
Dummy constructor.
void evalLocalPositionFit(Double_t deff, Double_t w0, Double_t phiSlope, gsl::span< const int > inputsIndices, AnalysisCluster &cluster) const
evaluates local position of clusters in SM
bool getUseWeightExotic() const
void evalElipsAxis(gsl::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
ClusterIterator end() const
Get forward end iteration marker.
void evalCoreEnergy(gsl::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
void setExoticCellInCrossMinAmplitude(float exoticCellInCrossMinAmplitude)
float GetECALogWeight() const
void setExoticCellMinAmplitude(float exoticCellMinAmplitude)
bool sharedCluster() const
ClusterFactory & operator=(const ClusterFactory &cf)=default
Assignment operator.
void evalDispersion(gsl::span< const int > inputsIndices, AnalysisCluster &clusterAnalysis) const
ClusterIterator begin() const
Get forward start iterator.
float etaToTheta(float arg) const
Converts Eta (Radians) to Theta (Radians)
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 setExoticCellDiffTime(float exoticCellDiffTime)
cluster class for MC particle IDs and their respective energy fraction
EMCAL geometry definition.
GLubyte GLubyte GLubyte GLubyte w
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.