Skip to content

Commit 08d68bd

Browse files
committed
First version of ECal sim, digitizer and clusterizer
1 parent 2a19535 commit 08d68bd

File tree

31 files changed

+1924
-222
lines changed

31 files changed

+1924
-222
lines changed

Detectors/Upgrades/ALICE3/ECal/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@
1010
# or submit itself to any jurisdiction.
1111

1212
add_subdirectory(base)
13-
add_subdirectory(simulation)
13+
add_subdirectory(simulation)
14+
add_subdirectory(reconstruction)
15+
add_subdirectory(DataFormatsECal)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
# See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
# All rights not expressly granted are reserved.
4+
#
5+
# This software is distributed under the terms of the GNU General Public
6+
# License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
#
8+
# In applying this license CERN does not waive the privileges and immunities
9+
# granted to it by virtue of its status as an Intergovernmental Organization
10+
# or submit itself to any jurisdiction.
11+
12+
o2_add_library(DataFormatsECal
13+
SOURCES src/Digit.cxx
14+
SOURCES src/MCLabel.cxx
15+
SOURCES src/Cluster.cxx
16+
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
17+
O2::SimulationDataFormat
18+
AliceO2::InfoLogger)
19+
20+
o2_target_root_dictionary(DataFormatsECal
21+
HEADERS include/DataFormatsECal/Digit.h
22+
HEADERS include/DataFormatsECal/MCLabel.h
23+
HEADERS include/DataFormatsECal/Cluster.h)
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file Cluster.h
13+
/// \brief Definition of ECal cluster class
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
16+
17+
#ifndef ALICEO2_ECAL_CLUSTER_H
18+
#define ALICEO2_ECAL_CLUSTER_H
19+
#include <map>
20+
#include <vector>
21+
#include <Rtypes.h>
22+
#include <TLorentzVector.h>
23+
24+
namespace o2
25+
{
26+
namespace ecal
27+
{
28+
class Cluster
29+
{
30+
public:
31+
Cluster() = default;
32+
Cluster(const Cluster& clu) = default;
33+
~Cluster() = default;
34+
35+
// setters
36+
void addDigit(int digitIndex, int towerId, double energy);
37+
void setNLM(int nMax) { mNLM = nMax; }
38+
void setE(float energy) { mE = energy; }
39+
void setX(float x) { mX = x; }
40+
void setY(float y) { mY = y; }
41+
void setZ(float z) { mZ = z; }
42+
void setChi2(float chi2) { mChi2 = chi2; }
43+
void setEdgeFlag(bool isEdge) { mEdge = isEdge; }
44+
void addMcTrackID(int mcTrackID, float energy) { mMcTrackEnergy[mcTrackID] += energy; }
45+
46+
// getters
47+
const std::map<int, float>& getMcTrackEnergy() { return mMcTrackEnergy; }
48+
int getMultiplicity() const { return mDigitIndex.size(); }
49+
int getDigitIndex(int i) const { return mDigitIndex[i]; }
50+
int getDigitTowerId(int i) const { return mDigitTowerId[i]; }
51+
float getDigitEnergy(int i) const { return mDigitEnergy[i]; }
52+
float getNLM() const { return mNLM; }
53+
float getTime() const { return mTime; }
54+
float getE() const { return mE; }
55+
float getX() const { return mX; }
56+
float getY() const { return mY; }
57+
float getZ() const { return mZ; }
58+
float getR() const { return std::sqrt(mX*mX + mY*mY); }
59+
float getTheta() const { return std::atan2(getR(), mZ); }
60+
float getEta() const { return -std::log(std::tan(getTheta()/2.)); }
61+
float getPhi() const { return std::atan2(mY, mX); }
62+
float getChi2() const { return mChi2; }
63+
bool isAtTheEdge() const { return mEdge; }
64+
int getMcTrackID() const;
65+
TLorentzVector getMomentum() const;
66+
67+
private:
68+
std::vector<int> mDigitIndex; // vector of digit indices in digits vector
69+
std::vector<int> mDigitTowerId; // vector of corresponding digit tower Ids
70+
std::vector<float> mDigitEnergy; // vector of corresponding digit energies
71+
std::map<int, float> mMcTrackEnergy; // MC track indices and corresponding energies
72+
int mNLM = 0; // number of local maxima in the initial cluster
73+
float mTime = 0; // cluster time
74+
float mE = 0; // cluster energy
75+
float mX = 0; // estimated x-coordinate
76+
float mY = 0; // estimated y-ccordinate
77+
float mZ = 0; // estimated z-ccordinate
78+
float mChi2 = 0; // chi2 wrt EM shape
79+
bool mEdge = 0; // set to true if one of cluster digits is at the chamber edge
80+
ClassDefNV(Cluster, 1);
81+
};
82+
} // namespace ecal
83+
} // namespace o2
84+
85+
#endif // ALICEO2_ECAL_CLUSTER_H
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file Digit.h
13+
/// \brief Definition of ECal digit class
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
16+
17+
#ifndef ALICEO2_ECAL_DIGIT_H
18+
#define ALICEO2_ECAL_DIGIT_H
19+
20+
#include <Rtypes.h>
21+
#include <CommonDataFormat/TimeStamp.h>
22+
23+
namespace o2
24+
{
25+
namespace ecal
26+
{
27+
class Digit : public o2::dataformats::TimeStamp<double>
28+
{
29+
public:
30+
Digit() = default;
31+
Digit(int tower, double amplitudeGeV, double time);
32+
~Digit() = default;
33+
34+
// setters
35+
void setTower(int tower) { mTower = tower; }
36+
void setAmplitude(double amplitude) { mAmplitudeGeV = amplitude; }
37+
void setEnergy(double energy) { mAmplitudeGeV = energy; }
38+
void setLabel(int label) { mLabel = label; }
39+
40+
// getters
41+
int getTower() const { return mTower; }
42+
double getAmplitude() const { return mAmplitudeGeV; }
43+
double getEnergy() const { return mAmplitudeGeV; }
44+
int getLabel() const { return mLabel; }
45+
46+
private:
47+
double mAmplitudeGeV = 0.; ///< Amplitude (GeV)
48+
int32_t mTower = -1; ///< Tower index (absolute cell ID)
49+
int32_t mLabel = -1; ///< Index of the corresponding entry/entries in the MC label array
50+
ClassDefNV(Digit, 1);
51+
};
52+
53+
} // namespace ecal
54+
} // namespace o2
55+
#endif // ALICEO2_ECAL_DIGIT_H
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file MCLabel.h
13+
/// \brief MCLabel class to store MC truth info for ECal
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
16+
17+
#ifndef ALICEO2_ECAL_MCLABEL_H
18+
#define ALICEO2_ECAL_MCLABEL_H
19+
20+
#include <SimulationDataFormat/MCCompLabel.h>
21+
22+
namespace o2
23+
{
24+
namespace ecal
25+
{
26+
class MCLabel : public o2::MCCompLabel
27+
{
28+
public:
29+
MCLabel() = default;
30+
MCLabel(int trackID, int eventID, int srcID, bool fake, float edep) : o2::MCCompLabel(trackID, eventID, srcID, fake), mEdep(edep) {}
31+
float getEdep() const { return mEdep; }
32+
33+
private:
34+
float mEdep = 0; // deposited energy
35+
36+
ClassDefNV(MCLabel, 1);
37+
};
38+
} // namespace ecal
39+
} // namespace o2
40+
41+
#endif // ALICEO2_ECAL_MCLABEL_H
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file Cluster.cxx
13+
/// \brief Implementation of ECal cluster class
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
16+
17+
18+
#include <map>
19+
#include <vector>
20+
#include <DataFormatsECal/Cluster.h>
21+
#include <DataFormatsECal/Digit.h>
22+
23+
using namespace o2::ecal;
24+
25+
ClassImp(Cluster);
26+
27+
//==============================================================================
28+
void Cluster::addDigit(int digitIndex, int towerId, double energy){
29+
mE += energy;
30+
mDigitIndex.push_back(digitIndex);
31+
mDigitTowerId.push_back(towerId);
32+
mDigitEnergy.push_back(energy);
33+
}
34+
35+
//==============================================================================
36+
int Cluster::getMcTrackID() const {
37+
float maxEnergy = 0;
38+
int maxID = 0;
39+
for (const auto& [mcTrackID, energy] : mMcTrackEnergy){
40+
if (energy > maxEnergy) {
41+
maxEnergy = energy;
42+
maxID = mcTrackID;
43+
}
44+
}
45+
return maxID;
46+
}
47+
48+
//==============================================================================
49+
TLorentzVector Cluster::getMomentum() const {
50+
double r = std::sqrt(mX*mX + mY*mY + mZ*mZ);
51+
if (r==0) return TLorentzVector();
52+
return TLorentzVector(mE*mX/r, mE*mY/r, mE*mZ/r, mE);
53+
}
54+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
#ifdef __CLING__
13+
14+
#pragma link off all globals;
15+
#pragma link off all classes;
16+
#pragma link off all functions;
17+
18+
#pragma link C++ class o2::ecal::Digit + ;
19+
#pragma link C++ class o2::ecal::MCLabel + ;
20+
#pragma link C++ class o2::ecal::Cluster + ;
21+
#pragma link C++ class std::vector < o2::ecal::Digit> + ;
22+
#pragma link C++ class std::vector < o2::ecal::Cluster> + ;
23+
#include "SimulationDataFormat/MCTruthContainer.h"
24+
#pragma link C++ class o2::dataformats::MCTruthContainer < o2::ecal::MCLabel> + ;
25+
#endif
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file Digit.cxx
13+
/// \brief Implementation of ECal digit class
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
16+
17+
#include <DataFormatsECal/Digit.h>
18+
19+
using namespace o2::ecal;
20+
21+
Digit::Digit(int tower, double amplitudeGeV, double time)
22+
: mTower(tower), mAmplitudeGeV(amplitudeGeV), o2::dataformats::TimeStamp<double>(time)
23+
{
24+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file MCLabel.cxx
13+
/// \brief MCLabel class to store MC truth info for ECal
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
16+
17+
#include <DataFormatsECal/MCLabel.h>
18+
19+
ClassImp(o2::ecal::MCLabel);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<!-- doxy
2-
\page refDetectorsUpgradesALICE3TRK Tracker
2+
\page refDetectorsUpgradesALICE3ECL ECAL
33
/doxy -->
44

55
# ALICE 3 Electromagnetic Calorimenter
66

7-
This is top page for the ECL detector documentation.
7+
This is top page for the ECAL detector documentation.
88

99
<!-- doxy
1010
/doxy -->

0 commit comments

Comments
 (0)