Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Cluster
Cluster() = default;
Cluster(const Cluster& clu) = default;
~Cluster() = default;

// setters
void addDigit(int digitIndex, int towerId, double energy);
void setNLM(int nMax) { mNLM = nMax; }
Expand All @@ -42,7 +42,7 @@ class Cluster
void setChi2(float chi2) { mChi2 = chi2; }
void setEdgeFlag(bool isEdge) { mEdge = isEdge; }
void addMcTrackID(int mcTrackID, float energy) { mMcTrackEnergy[mcTrackID] += energy; }

// getters
const std::map<int, float>& getMcTrackEnergy() { return mMcTrackEnergy; }
int getMultiplicity() const { return mDigitIndex.size(); }
Expand All @@ -55,28 +55,28 @@ class Cluster
float getX() const { return mX; }
float getY() const { return mY; }
float getZ() const { return mZ; }
float getR() const { return std::sqrt(mX*mX + mY*mY); }
float getR() const { return std::sqrt(mX * mX + mY * mY); }
float getTheta() const { return std::atan2(getR(), mZ); }
float getEta() const { return -std::log(std::tan(getTheta()/2.)); }
float getEta() const { return -std::log(std::tan(getTheta() / 2.)); }
float getPhi() const { return std::atan2(mY, mX); }
float getChi2() const { return mChi2; }
bool isAtTheEdge() const { return mEdge; }
int getMcTrackID() const;
TLorentzVector getMomentum() const;

private:
std::vector<int> mDigitIndex; // vector of digit indices in digits vector
std::vector<int> mDigitTowerId; // vector of corresponding digit tower Ids
std::vector<float> mDigitEnergy; // vector of corresponding digit energies
std::map<int, float> mMcTrackEnergy; // MC track indices and corresponding energies
int mNLM = 0; // number of local maxima in the initial cluster
float mTime = 0; // cluster time
float mE = 0; // cluster energy
float mX = 0; // estimated x-coordinate
float mY = 0; // estimated y-ccordinate
float mZ = 0; // estimated z-ccordinate
float mChi2 = 0; // chi2 wrt EM shape
bool mEdge = 0; // set to true if one of cluster digits is at the chamber edge
std::vector<int> mDigitIndex; // vector of digit indices in digits vector
std::vector<int> mDigitTowerId; // vector of corresponding digit tower Ids
std::vector<float> mDigitEnergy; // vector of corresponding digit energies
std::map<int, float> mMcTrackEnergy; // MC track indices and corresponding energies
int mNLM = 0; // number of local maxima in the initial cluster
float mTime = 0; // cluster time
float mE = 0; // cluster energy
float mX = 0; // estimated x-coordinate
float mY = 0; // estimated y-ccordinate
float mZ = 0; // estimated z-ccordinate
float mChi2 = 0; // chi2 wrt EM shape
bool mEdge = 0; // set to true if one of cluster digits is at the chamber edge
ClassDefNV(Cluster, 1);
};
} // namespace ecal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Digit : public o2::dataformats::TimeStamp<double>
Digit() = default;
Digit(int tower, double amplitudeGeV, double time);
~Digit() = default;

// setters
void setTower(int tower) { mTower = tower; }
void setAmplitude(double amplitude) { mAmplitudeGeV = amplitude; }
Expand All @@ -42,7 +42,7 @@ class Digit : public o2::dataformats::TimeStamp<double>
double getAmplitude() const { return mAmplitudeGeV; }
double getEnergy() const { return mAmplitudeGeV; }
int getLabel() const { return mLabel; }

private:
double mAmplitudeGeV = 0.; ///< Amplitude (GeV)
int32_t mTower = -1; ///< Tower index (absolute cell ID)
Expand Down
20 changes: 11 additions & 9 deletions Detectors/Upgrades/ALICE3/ECal/DataFormatsECal/src/Cluster.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>


#include <map>
#include <vector>
#include <DataFormatsECal/Cluster.h>
Expand All @@ -25,18 +24,20 @@ using namespace o2::ecal;
ClassImp(Cluster);

//==============================================================================
void Cluster::addDigit(int digitIndex, int towerId, double energy){
void Cluster::addDigit(int digitIndex, int towerId, double energy)
{
mE += energy;
mDigitIndex.push_back(digitIndex);
mDigitTowerId.push_back(towerId);
mDigitEnergy.push_back(energy);
}

//==============================================================================
int Cluster::getMcTrackID() const {
int Cluster::getMcTrackID() const
{
float maxEnergy = 0;
int maxID = 0;
for (const auto& [mcTrackID, energy] : mMcTrackEnergy){
for (const auto& [mcTrackID, energy] : mMcTrackEnergy) {
if (energy > maxEnergy) {
maxEnergy = energy;
maxID = mcTrackID;
Expand All @@ -46,9 +47,10 @@ int Cluster::getMcTrackID() const {
}

//==============================================================================
TLorentzVector Cluster::getMomentum() const {
double r = std::sqrt(mX*mX + mY*mY + mZ*mZ);
if (r==0) return TLorentzVector();
return TLorentzVector(mE*mX/r, mE*mY/r, mE*mZ/r, mE);
TLorentzVector Cluster::getMomentum() const
{
double r = std::sqrt(mX * mX + mY * mY + mZ * mZ);
if (r == 0)
return TLorentzVector();
return TLorentzVector(mE * mX / r, mE * mY / r, mE * mZ / r, mE);
}

2 changes: 1 addition & 1 deletion Detectors/Upgrades/ALICE3/ECal/base/src/Geometry.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
#include <ECalBase/ECalBaseParam.h>
#include "CommonConstants/MathConstants.h"
using namespace o2::ecal;
using o2::constants::math::TwoPI;
using o2::constants::math::PIHalf;
using o2::constants::math::TwoPI;

//==============================================================================
Geometry::Geometry()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include <DataFormatsECal/Digit.h>
#include <DataFormatsECal/Cluster.h>

using o2::ecal::Digit;
using o2::ecal::Cluster;
using o2::ecal::Digit;
class TF1;

namespace o2
Expand All @@ -32,29 +32,30 @@ namespace ecal
{
class Clusterizer
{
public:
public:
Clusterizer(bool applyCorrectionZ = 1, bool applyCorrectionE = 1);
~Clusterizer() = default;
void initialize(){};
void initialize() {};
void addDigitToCluster(Cluster& cluster, int row, int col, const gsl::span<const Digit>& digits);
void findClusters(const gsl::span<const Digit>& digits, std::vector<Cluster>& foundClusters, std::vector<Cluster>& unfoldedClusters);
void makeClusters(const gsl::span<const Digit>& digits, std::vector<Cluster>& clusters);
void makeUnfoldings(std::vector<Cluster>& foundClusters, std::vector<Cluster>& unfoldedClusters);
void unfoldOneCluster(Cluster *iniClu, int nMax, int *digitId, float *maxAtEnergy, std::vector<Cluster>& unfoldedClusters);
void unfoldOneCluster(Cluster* iniClu, int nMax, int* digitId, float* maxAtEnergy, std::vector<Cluster>& unfoldedClusters);
void evalClusters(std::vector<Cluster>& clusters);
int getNumberOfLocalMax(Cluster& clu, int *maxAt, float *maxAtEnergy);
int getNumberOfLocalMax(Cluster& clu, int* maxAt, float* maxAtEnergy);
double showerShape(double dx, double dz, bool isCrystal);
void setLogWeight(double logWeight) { mLogWeight = logWeight; }
void setClusteringThreshold(double threshold) { mClusteringThreshold = threshold; }
void setCrystalDigitThreshold(double threshold) { mCrystalDigitThreshold = threshold; }
void setSamplingDigitThreshold(double threshold) { mSamplingDigitThreshold = threshold; }
private:

private:
std::vector<std::vector<int>> mDigitIndices; // 2D map of digit indices used for recursive cluster finding
bool mUnfoldClusters = true; // to perform cluster unfolding
double mCrystalDigitThreshold = 0.040; // minimal energy of crystal digit
double mSamplingDigitThreshold = 0.100; // minimal energy of sampling digit
double mClusteringThreshold = 0.050; // minimal energy of digit to start clustering (GeV)
double mClusteringTimeGate = 1e9; // maximal time difference between digits to be accepted to clusters (in ns)
double mClusteringTimeGate = 1e9; // maximal time difference between digits to be accepted to clusters (in ns)
int mNLMMax = 30; // maximal number of local maxima in unfolding
double mLogWeight = 4.; // cutoff used in log. weight calculation
double mUnfogingEAccuracy = 1.e-4; // accuracy of energy calculation in unfoding prosedure (GeV)
Expand Down
Loading