Skip to content
Closed
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 @@ -9,30 +9,30 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_EMCAL_ANALYSISCLUSTER_H_
#define ALICEO2_EMCAL_ANALYSISCLUSTER_H_
/// \file AnalysisCluster.h
/// \class AnalysisCluster
/// \brief Cluster class for kinematic cluster parameters
/// \ingroup EMCALDataFormat
/// ported from AliVCluster in AliRoot
/// \author Hadi Hassan <hadi.hassan@cern.ch>, Oak Ridge National Laboratory
/// \since March 05, 2020

#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_ANALYSISCLUSTER_H_
#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_ANALYSISCLUSTER_H_

#include <fairlogger/Logger.h>
#include <gsl/span>
#include <array>
#include <string>
#include <vector>
#include "Rtypes.h"
#include "MathUtils/Cartesian.h"
#include "TLorentzVector.h"
#include "Math/Vector4D.h"

namespace o2
{

namespace emcal
{

/// \class AnalysisCluster
/// \brief Cluster class for kinematic cluster parameters
/// \ingroup EMCALDataFormat
/// ported from AliVCluster in AliRoot
/// \author Hadi Hassan <hadi.hassan@cern.ch>, Oak Ridge National Laboratory
/// \since March 05, 2020
///

class AnalysisCluster
{

Expand All @@ -45,9 +45,9 @@ class AnalysisCluster
public:
/// \brief Constructor, setting cell wrong cell index raising the exception
/// \param cellIndex Cell index raising the exception
CellOutOfRangeException(Int_t cellIndex) : std::exception(),
mCellIndex(cellIndex),
mMessage("Cell index " + std::to_string(mCellIndex) + " out of range.")
CellOutOfRangeException(int cellIndex) : std::exception(),
mCellIndex(cellIndex),
mMessage("Cell index " + std::to_string(mCellIndex) + " out of range.")
{
}

Expand All @@ -56,14 +56,14 @@ class AnalysisCluster

/// \brief Access to cell ID raising the exception
/// \return Cell ID
Int_t getCellIndex() const noexcept { return mCellIndex; }
int getCellIndex() const noexcept { return mCellIndex; }

/// \brief Access to error message of the exception
/// \return Error message
const char* what() const noexcept final { return mMessage.data(); }

private:
Int_t mCellIndex; ///< Cell index raising the exception
int mCellIndex; ///< Cell index raising the exception
std::string mMessage; ///< error Message
};

Expand Down Expand Up @@ -128,12 +128,12 @@ class AnalysisCluster

///
/// Set the array of cell indices.
void setCellsIndices(const std::vector<unsigned short>& array)
void setCellsIndices(const std::vector<uint16_t>& array)
{
mCellsIndices = array;
}

const std::vector<unsigned short>& getCellsIndices() const { return mCellsIndices; }
const std::vector<uint16_t>& getCellsIndices() const { return mCellsIndices; }

///
/// Set the array of cell amplitude fractions.
Expand Down Expand Up @@ -186,10 +186,10 @@ class AnalysisCluster
void setFCross(float fCross) { mFCross = fCross; }

///
/// Returns TLorentzVector with momentum of the cluster. Only valid for clusters
/// Returns ROOT::Math::PxPyPzEVector with momentum of the cluster. Only valid for clusters
/// identified as photons or pi0 (overlapped gamma) produced on the vertex
/// Vertex can be recovered with esd pointer doing:
TLorentzVector getMomentum(std::array<const float, 3> vertexPosition) const;
ROOT::Math::PxPyPzEVector getMomentum(std::array<const float, 3> vertexPosition) const;

protected:
/// TODO to replace later by o2::MCLabel when implementing the MC handling
Expand All @@ -198,7 +198,7 @@ class AnalysisCluster
int mNCells = 0; ///< Number of cells in cluster.

/// Array of cell indices contributing to this cluster.
std::vector<unsigned short> mCellsIndices; //[mNCells]
std::vector<uint16_t> mCellsIndices; //[mNCells]

/// Array with cell amplitudes fraction. Only usable for unfolded clusters, where cell can be shared.
/// here we store what fraction of the cell energy is assigned to a given cluster.
Expand Down Expand Up @@ -235,4 +235,4 @@ class AnalysisCluster

} // namespace emcal
} // namespace o2
#endif // ANALYSISCLUSTER_H
#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_ANALYSISCLUSTER_H_
47 changes: 24 additions & 23 deletions DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,7 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_EMCAL_CELL_H_
#define ALICEO2_EMCAL_CELL_H_

#include <bitset>
#include <cfloat>
#include <climits>
#include "DataFormatsEMCAL/Constants.h"

namespace o2
{
namespace emcal
{

/// \file Cell.h
/// \class Cell
/// \brief EMCAL compressed cell information
/// \author Anders Knospe, University of Houston
Expand Down Expand Up @@ -55,6 +43,19 @@ namespace emcal
/// | Cell type | 2 | - | 0=LG, 1=HG, 2=LEMon, 4=TRU |
///
/// The remaining bits are 0

#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELL_H_
#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELL_H_

#include <bitset>
#include <cfloat>
#include <climits>
#include "DataFormatsEMCAL/Constants.h"

namespace o2
{
namespace emcal
{
class Cell
{
public:
Expand All @@ -71,7 +72,7 @@ class Cell
/// \param energy Energy
/// \param timestamp Cell time
/// \param ctype Channel type
Cell(short tower, float energy, float timestamp, ChannelType_t ctype = ChannelType_t::LOW_GAIN);
Cell(int16_t tower, float energy, float timestamp, ChannelType_t ctype = ChannelType_t::LOW_GAIN);

/// \brief Constructor, from encoded bit representation
/// \param tower Tower bitsets
Expand All @@ -86,11 +87,11 @@ class Cell

/// \brief Set the tower ID
/// \param tower Tower ID
void setTower(short tower) { mTowerID = tower; }
void setTower(int16_t tower) { mTowerID = tower; }

/// \brief Get the tower ID
/// \return Tower ID
short getTower() const { return mTowerID; }
int16_t getTower() const { return mTowerID; }

/// \brief Set the time stamp
/// \param timestamp Time in ns
Expand Down Expand Up @@ -134,28 +135,28 @@ class Cell

/// \brief Check whether the cell is a low gain cell
/// \return True if the cell type is low gain, false otherwise
Bool_t getLowGain() const { return isChannelType(ChannelType_t::LOW_GAIN); }
bool getLowGain() const { return isChannelType(ChannelType_t::LOW_GAIN); }

/// \brief Mark cell as high gain cell
void setHighGain() { setType(ChannelType_t::HIGH_GAIN); }

/// \brief Check whether the cell is a high gain cell
/// \return True if the cell type is high gain, false otherwise
Bool_t getHighGain() const { return isChannelType(ChannelType_t::HIGH_GAIN); };
bool getHighGain() const { return isChannelType(ChannelType_t::HIGH_GAIN); }

/// \brief Mark cell as LED monitor cell
void setLEDMon() { setType(ChannelType_t::LEDMON); }

/// \brief Check whether the cell is a LED monitor cell
/// \return True if the cell type is LED monitor, false otherwise
Bool_t getLEDMon() const { return isChannelType(ChannelType_t::LEDMON); }
bool getLEDMon() const { return isChannelType(ChannelType_t::LEDMON); }

/// \brief Mark cell as TRU cell
void setTRU() { setType(ChannelType_t::TRU); }

/// \brief Check whether the cell is a TRU cell
/// \return True if the cell type is TRU, false otherwise
Bool_t getTRU() const { return isChannelType(ChannelType_t::TRU); }
bool getTRU() const { return isChannelType(ChannelType_t::TRU); }

/// \brief Apply compression as done during writing to / reading from CTF
/// \param version Encoder version
Expand Down Expand Up @@ -214,7 +215,7 @@ class Cell
static float getEnergyFromPackedBitfieldV0(const char* bitfield);
static float getTimeFromPackedBitfieldV0(const char* bitfield);
static ChannelType_t getCellTypeFromPackedBitfieldV0(const char* bitfield);
static short getTowerFromPackedBitfieldV0(const char* bitfield);
static int16_t getTowerFromPackedBitfieldV0(const char* bitfield);

static uint16_t encodeTime(float timestamp);
static uint16_t encodeEnergyV0(float energy);
Expand Down Expand Up @@ -248,7 +249,7 @@ class Cell

float mEnergy = FLT_MIN; ///< Energy
float mTimestamp = FLT_MIN; ///< Timestamp
short mTowerID = SHRT_MAX; ///< Tower ID
int16_t mTowerID = SHRT_MAX; ///< Tower ID
ChannelType_t mChannelType = ChannelType_t::HIGH_GAIN; ///< Cell type

ClassDefNV(Cell, 3);
Expand All @@ -262,4 +263,4 @@ std::ostream& operator<<(std::ostream& stream, const Cell& cell);
} // namespace emcal
} // namespace o2

#endif
#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELL_H_
28 changes: 14 additions & 14 deletions DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/CellLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef ALICEO2_EMCAL_CELLLABEL_H_
#define ALICEO2_EMCAL_CELLLABEL_H_
/// \file CellLabel.h
/// \class CellLabel
/// \brief cell class for MC particle IDs and their respective amplitude fraction
/// \ingroup EMCALDataFormat
/// \author Marvin Hemmer <marvin.hemmer@cern.ch>, Goethe university Frankfurt
/// \since December 13, 2023
///

#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELLLABEL_H_
#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELLLABEL_H_

#include <fairlogger/Logger.h>
#include <gsl/span>
Expand All @@ -22,14 +30,6 @@ namespace o2

namespace emcal
{

/// \class CellLabel
/// \brief cell class for MC particle IDs and their respective amplitude fraction
/// \ingroup EMCALDataFormat
/// \author Marvin Hemmer <marvin.hemmer@cern.ch>, Goethe university Frankfurt
/// \since December 13, 2023
///

class CellLabel
{
public:
Expand All @@ -46,15 +46,15 @@ class CellLabel

/// \brief Getter of label size
/// \param index index which label to get
size_t GetLabelSize(void) const { return mLabels.size(); }
size_t getLabelSize(void) const { return mLabels.size(); }

/// \brief Getter for label
/// \param index index which label to get
int32_t GetLabel(size_t index) const { return mLabels[index]; }
int32_t getLabel(size_t index) const { return mLabels[index]; }

/// \brief Getter for amplitude fraction
/// \param index index which amplitude fraction to get
float GetAmplitudeFraction(size_t index) const { return mAmplitudeFraction[index]; }
float getAmplitudeFraction(size_t index) const { return mAmplitudeFraction[index]; }

protected:
gsl::span<const int32_t> mLabels; ///< List of MC particles that generated the cluster, ordered in deposited energy.
Expand All @@ -63,4 +63,4 @@ class CellLabel

} // namespace emcal
} // namespace o2
#endif // ALICEO2_EMCAL_CELLLABEL_H_
#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CELLLABEL_H_
26 changes: 14 additions & 12 deletions DataFormats/Detectors/EMCAL/include/DataFormatsEMCAL/Cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef ALICEO2_EMCAL_CLUSTER_H_
#define ALICEO2_EMCAL_CLUSTER_H_

/// \file Cluster.h
/// \class Cluster
/// \brief EMCAL Cluster
/// \ingroup EMCALDataFormat
/// \author Markus Fasel <markus.fasel@cern.ch>, Oak Ridge National Laboratory
///

#ifndef DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTER_H_
#define DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTER_H_

#include <array>
#include <iosfwd>
Expand All @@ -20,25 +28,19 @@

namespace o2
{

namespace emcal
{

/// \class Cluster
/// \brief EMCAL Cluster
/// \ingroup EMCALDataFormat
///
class Cluster : public o2::dataformats::TimeStamp<Float16_t>
{
using CellIndexRange = o2::dataformats::RangeRefComp<8>;

public:
Cluster() = default;
Cluster(Float_t time, int firstcell, int ncells);
Cluster(float time, int firstcell, int ncells);
~Cluster() noexcept = default;

Int_t getNCells() const { return mCellIndices.getEntries(); }
Int_t getCellIndexFirst() const { return mCellIndices.getFirstEntry(); }
int getNCells() const { return mCellIndices.getEntries(); }
int getCellIndexFirst() const { return mCellIndices.getFirstEntry(); }
CellIndexRange getCellIndexRange() const { return mCellIndices; }

void setCellIndices(int firstcell, int ncells)
Expand All @@ -62,4 +64,4 @@ std::ostream& operator<<(std::ostream& stream, const o2::emcal::Cluster& cluster

} // namespace o2

#endif
#endif // DATAFORMATS_DETECTORS_EMCAL_INCLUDE_DATAFORMATSEMCAL_CLUSTER_H_
Loading