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
4 changes: 3 additions & 1 deletion Detectors/Upgrades/ALICE3/ECal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@
# or submit itself to any jurisdiction.

add_subdirectory(base)
add_subdirectory(simulation)
add_subdirectory(simulation)
add_subdirectory(reconstruction)
add_subdirectory(DataFormatsECal)
23 changes: 23 additions & 0 deletions Detectors/Upgrades/ALICE3/ECal/DataFormatsECal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
# All rights not expressly granted are reserved.
#
# This software is distributed under the terms of the GNU General Public
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
#
# 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.

o2_add_library(DataFormatsECal
SOURCES src/Digit.cxx
SOURCES src/MCLabel.cxx
SOURCES src/Cluster.cxx
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
O2::SimulationDataFormat
AliceO2::InfoLogger)

o2_target_root_dictionary(DataFormatsECal
HEADERS include/DataFormatsECal/Digit.h
HEADERS include/DataFormatsECal/MCLabel.h
HEADERS include/DataFormatsECal/Cluster.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file Cluster.h
/// \brief Definition of ECal cluster class
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>

#ifndef ALICEO2_ECAL_CLUSTER_H
#define ALICEO2_ECAL_CLUSTER_H
#include <map>
#include <vector>
#include <Rtypes.h>
#include <TLorentzVector.h>

namespace o2
{
namespace ecal
{
class Cluster
{
public:
Cluster() = default;
Cluster(const Cluster& clu) = default;
~Cluster() = default;

// setters
void addDigit(int digitIndex, int towerId, double energy);
void setNLM(int nMax) { mNLM = nMax; }
void setE(float energy) { mE = energy; }
void setX(float x) { mX = x; }
void setY(float y) { mY = y; }
void setZ(float z) { mZ = z; }
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(); }
int getDigitIndex(int i) const { return mDigitIndex[i]; }
int getDigitTowerId(int i) const { return mDigitTowerId[i]; }
float getDigitEnergy(int i) const { return mDigitEnergy[i]; }
float getNLM() const { return mNLM; }
float getTime() const { return mTime; }
float getE() const { return mE; }
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 getTheta() const { return std::atan2(getR(), mZ); }
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
ClassDefNV(Cluster, 1);
};
} // namespace ecal
} // namespace o2

#endif // ALICEO2_ECAL_CLUSTER_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file Digit.h
/// \brief Definition of ECal digit class
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>

#ifndef ALICEO2_ECAL_DIGIT_H
#define ALICEO2_ECAL_DIGIT_H

#include <Rtypes.h>
#include <CommonDataFormat/TimeStamp.h>

namespace o2
{
namespace ecal
{
class Digit : public o2::dataformats::TimeStamp<double>
{
public:
Digit() = default;
Digit(int tower, double amplitudeGeV, double time);
~Digit() = default;

// setters
void setTower(int tower) { mTower = tower; }
void setAmplitude(double amplitude) { mAmplitudeGeV = amplitude; }
void setEnergy(double energy) { mAmplitudeGeV = energy; }
void setLabel(int label) { mLabel = label; }

// getters
int getTower() const { return mTower; }
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)
int32_t mLabel = -1; ///< Index of the corresponding entry/entries in the MC label array
ClassDefNV(Digit, 1);
};

} // namespace ecal
} // namespace o2
#endif // ALICEO2_ECAL_DIGIT_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file MCLabel.h
/// \brief MCLabel class to store MC truth info for ECal
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>

#ifndef ALICEO2_ECAL_MCLABEL_H
#define ALICEO2_ECAL_MCLABEL_H

#include <SimulationDataFormat/MCCompLabel.h>

namespace o2
{
namespace ecal
{
class MCLabel : public o2::MCCompLabel
{
public:
MCLabel() = default;
MCLabel(int trackID, int eventID, int srcID, bool fake, float edep) : o2::MCCompLabel(trackID, eventID, srcID, fake), mEdep(edep) {}
float getEdep() const { return mEdep; }

private:
float mEdep = 0; // deposited energy

ClassDefNV(MCLabel, 1);
};
} // namespace ecal
} // namespace o2

#endif // ALICEO2_ECAL_MCLABEL_H
56 changes: 56 additions & 0 deletions Detectors/Upgrades/ALICE3/ECal/DataFormatsECal/src/Cluster.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file Cluster.cxx
/// \brief Implementation of ECal cluster class
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>

#include <map>
#include <vector>
#include <DataFormatsECal/Cluster.h>
#include <DataFormatsECal/Digit.h>

using namespace o2::ecal;

ClassImp(Cluster);

//==============================================================================
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
{
float maxEnergy = 0;
int maxID = 0;
for (const auto& [mcTrackID, energy] : mMcTrackEnergy) {
if (energy > maxEnergy) {
maxEnergy = energy;
maxID = mcTrackID;
}
}
return maxID;
}

//==============================================================================
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);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class o2::ecal::Digit + ;
#pragma link C++ class o2::ecal::MCLabel + ;
#pragma link C++ class o2::ecal::Cluster + ;
#pragma link C++ class std::vector < o2::ecal::Digit> + ;
#pragma link C++ class std::vector < o2::ecal::Cluster> + ;
#include "SimulationDataFormat/MCTruthContainer.h"
#pragma link C++ class o2::dataformats::MCTruthContainer < o2::ecal::MCLabel> + ;
#endif
24 changes: 24 additions & 0 deletions Detectors/Upgrades/ALICE3/ECal/DataFormatsECal/src/Digit.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file Digit.cxx
/// \brief Implementation of ECal digit class
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>

#include <DataFormatsECal/Digit.h>

using namespace o2::ecal;

Digit::Digit(int tower, double amplitudeGeV, double time)
: mTower(tower), mAmplitudeGeV(amplitudeGeV), o2::dataformats::TimeStamp<double>(time)
{
}
19 changes: 19 additions & 0 deletions Detectors/Upgrades/ALICE3/ECal/DataFormatsECal/src/MCLabel.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// 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.

/// \file MCLabel.cxx
/// \brief MCLabel class to store MC truth info for ECal
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>

#include <DataFormatsECal/MCLabel.h>

ClassImp(o2::ecal::MCLabel);
4 changes: 2 additions & 2 deletions Detectors/Upgrades/ALICE3/ECal/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!-- doxy
\page refDetectorsUpgradesALICE3TRK Tracker
\page refDetectorsUpgradesALICE3ECL ECAL
/doxy -->

# ALICE 3 Electromagnetic Calorimenter

This is top page for the ECL detector documentation.
This is top page for the ECAL detector documentation.

<!-- doxy
/doxy -->
10 changes: 7 additions & 3 deletions Detectors/Upgrades/ALICE3/ECal/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
# or submit itself to any jurisdiction.

o2_add_library(ECalBase
SOURCES src/GeometryTGeo.cxx
SOURCES src/Geometry.cxx
src/GeometryTGeo.cxx
src/ECalBaseParam.cxx
src/Hit.cxx
PUBLIC_LINK_LIBRARIES O2::DetectorsBase)

o2_target_root_dictionary(ECalBase
HEADERS include/ECalBase/GeometryTGeo.h
include/ECalBase/ECalBaseParam.h)
HEADERS include/ECalBase/Geometry.h
include/ECalBase/GeometryTGeo.h
include/ECalBase/ECalBaseParam.h
include/ECalBase/Hit.h)
Loading