Skip to content

Commit 011d107

Browse files
authored
[ALICE3] TF3: add proto-digitizer (#15340)
1 parent 0528e00 commit 011d107

8 files changed

Lines changed: 387 additions & 1 deletion

File tree

Detectors/Upgrades/ALICE3/IOTOF/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111

1212
add_subdirectory(base)
1313
add_subdirectory(simulation)
14+
add_subdirectory(DataFormatsIOTOF)
1415
add_subdirectory(macros)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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(DataFormatsIOTOF
13+
SOURCES src/Digit.cxx
14+
# SOURCES src/MCLabel.cxx
15+
# SOURCES src/Cluster.cxx
16+
PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT)
17+
18+
o2_target_root_dictionary(DataFormatsIOTOF
19+
HEADERS include/DataFormatsIOTOF/Digit.h
20+
# HEADERS include/DataFormatsIOTOF/MCLabel.h
21+
# HEADERS include/DataFormatsIOTOF/Cluster.h
22+
)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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+
///
13+
/// \file Digit.h
14+
/// \brief Definition of IOTOF digit class
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#ifndef ALICEO2_IOTOF_DIGIT_H
20+
#define ALICEO2_IOTOF_DIGIT_H
21+
22+
#include "DataFormatsITSMFT/Digit.h"
23+
24+
namespace o2::iotof
25+
{
26+
class Digit : public o2::itsmft::Digit
27+
{
28+
public:
29+
Digit() = default;
30+
~Digit() = default;
31+
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.)
32+
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time) {};
33+
34+
// Setters
35+
void setTime(double time) { mTime = time; }
36+
37+
// Getters
38+
double getTime() const { return mTime; }
39+
40+
private:
41+
double mTime = 0.; ///< Measured time (ns)
42+
ClassDefNV(Digit, 1);
43+
};
44+
45+
} // namespace o2::iotof
46+
#endif // ALICEO2_IOTOF_DIGIT_H
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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::iotof::Digit + ;
19+
// #pragma link C++ class std::vector < o2::iotof::Digit> + ;
20+
#endif
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
///
13+
/// \file Digit.cxx
14+
/// \brief Implementation of IOTOF digit class
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#include "DataFormatsIOTOF/Digit.h"
20+
21+
using namespace o2::iotof;

Detectors/Upgrades/ALICE3/IOTOF/simulation/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
o2_add_library(IOTOFSimulation
1313
SOURCES src/Layer.cxx
1414
src/Detector.cxx
15+
src/Digitizer.cxx
1516
# src/IOTOFServices.cxx
1617
PUBLIC_LINK_LIBRARIES O2::IOTOFBase
18+
O2::DataFormatsIOTOF
1719
O2::ITSMFTSimulation)
1820

1921
o2_target_root_dictionary(IOTOFSimulation
2022
HEADERS include/IOTOFSimulation/Detector.h
21-
include/IOTOFSimulation/Layer.h)
23+
include/IOTOFSimulation/Layer.h
24+
include/IOTOFSimulation/Digitizer.h)
2225
# include/IOTOFSimulation/IOTOFServices.h)
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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+
///
13+
/// \file Digitizer.h
14+
/// \brief Definition of the ALICE3 TOF digitizer
15+
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
16+
/// \since 2026-03-17
17+
///
18+
19+
#ifndef ALICEO2_IOTOF_DIGITIZER_H
20+
#define ALICEO2_IOTOF_DIGITIZER_H
21+
22+
#include "ITSMFTSimulation/Hit.h"
23+
#include "DataFormatsITSMFT/Digit.h"
24+
#include "DataFormatsIOTOF/Digit.h"
25+
#include "DataFormatsITSMFT/ROFRecord.h"
26+
#include "CommonDataFormat/InteractionRecord.h"
27+
#include "SimulationDataFormat/MCCompLabel.h"
28+
#include "SimulationDataFormat/MCTruthContainer.h"
29+
#include "IOTOFBase/GeometryTGeo.h"
30+
31+
namespace o2::iotof
32+
{
33+
34+
/// \class Digitizer
35+
/// \brief Digitizer for the ALICE3 Inner/Outer TOF detector
36+
///
37+
/// Converts MC hits into detector digits by:
38+
/// - Applying time smearing according to detector resolution
39+
/// - Converting energy loss to charge
40+
/// - Applying charge threshold
41+
/// - Managing readout frames (ROF)
42+
class Digitizer
43+
{
44+
public:
45+
void setDigits(std::vector<o2::iotof::Digit>* dig) { mDigits = dig; }
46+
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
47+
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
48+
49+
/// Initialize the digitizer
50+
void init();
51+
52+
/// Steer conversion of hits to digits
53+
void process(const std::vector<o2::itsmft::Hit>* hits, int evID, int srcID);
54+
55+
/// Set the event time
56+
void setEventTime(const o2::InteractionTimeRecord& irt) { mEventTime = irt; }
57+
58+
/// Set continuous readout mode
59+
void setContinuous(bool v) { mContinuous = v; }
60+
bool isContinuous() const { return mContinuous; }
61+
62+
/// Flush the output container
63+
void fillOutputContainer();
64+
65+
// Provide the common iotof::GeometryTGeo to access matrices and segmentation
66+
void setGeometry(const o2::iotof::GeometryTGeo* gm) { mGeometry = gm; }
67+
68+
// Setters for digitization parameters
69+
void setChargeThreshold(float thr) { mChargeThreshold = thr; }
70+
void setTimeResolution(float res) { mTimeResolution = res; }
71+
void setEfficiency(float eff) { mEfficiency = eff; }
72+
void setEnergyToCharge(float e2c) { mEnergyToCharge = e2c; }
73+
74+
// Getters
75+
float getChargeThreshold() const { return mChargeThreshold; }
76+
float getTimeResolution() const { return mTimeResolution; }
77+
float getEfficiency() const { return mEfficiency; }
78+
79+
private:
80+
/// Process a single hit
81+
void processHit(const o2::itsmft::Hit& hit, int evID, int srcID);
82+
83+
/// Apply time smearing to simulate detector resolution
84+
double smearTime(double time) const;
85+
86+
/// Convert energy loss to charge
87+
int energyToCharge(float energyLoss) const;
88+
89+
/// Check if the hit passes efficiency cut
90+
bool isEfficient() const;
91+
92+
static constexpr float sec2ns = 1e9f; ///< seconds to nanoseconds conversion
93+
94+
const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry
95+
96+
std::vector<o2::iotof::Digit>* mDigits = nullptr; //! output digits
97+
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
98+
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels
99+
100+
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
101+
bool mContinuous = true; ///< continuous readout mode
102+
103+
// Digitization parameters
104+
float mChargeThreshold = 100.f; ///< charge threshold for digit creation (electrons)
105+
float mTimeResolution = 0.020f; ///< time resolution sigma in ns (20 ps default)
106+
float mEfficiency = 0.98f; ///< detection efficiency
107+
float mEnergyToCharge = 3.6e-9f; ///< energy loss to electrons conversion (3.6 eV per e-h pair in Si)
108+
};
109+
} // namespace o2::iotof
110+
111+
#endif

0 commit comments

Comments
 (0)