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
1 change: 1 addition & 0 deletions Detectors/Upgrades/ALICE3/IOTOF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@

add_subdirectory(base)
add_subdirectory(simulation)
add_subdirectory(DataFormatsIOTOF)
add_subdirectory(macros)
22 changes: 22 additions & 0 deletions Detectors/Upgrades/ALICE3/IOTOF/DataFormatsIOTOF/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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(DataFormatsIOTOF
SOURCES src/Digit.cxx
# SOURCES src/MCLabel.cxx
# SOURCES src/Cluster.cxx
PUBLIC_LINK_LIBRARIES O2::DataFormatsITSMFT)

o2_target_root_dictionary(DataFormatsIOTOF
HEADERS include/DataFormatsIOTOF/Digit.h
# HEADERS include/DataFormatsIOTOF/MCLabel.h
# HEADERS include/DataFormatsIOTOF/Cluster.h
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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 IOTOF digit class
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#ifndef ALICEO2_IOTOF_DIGIT_H
#define ALICEO2_IOTOF_DIGIT_H

#include "DataFormatsITSMFT/Digit.h"

namespace o2::iotof
{
class Digit : public o2::itsmft::Digit
{
public:
Digit() = default;
~Digit() = default;
Digit(UShort_t chipindex = 0, UShort_t row = 0, UShort_t col = 0, Int_t charge = 0, double time = 0.)
: o2::itsmft::Digit(chipindex, row, col, charge), mTime(time) {};

// Setters
void setTime(double time) { mTime = time; }

// Getters
double getTime() const { return mTime; }

private:
double mTime = 0.; ///< Measured time (ns)
ClassDefNV(Digit, 1);
};

} // namespace o2::iotof
#endif // ALICEO2_IOTOF_DIGIT_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// 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::iotof::Digit + ;
// #pragma link C++ class std::vector < o2::iotof::Digit> + ;
#endif
21 changes: 21 additions & 0 deletions Detectors/Upgrades/ALICE3/IOTOF/DataFormatsIOTOF/src/Digit.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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 IOTOF digit class
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#include "DataFormatsIOTOF/Digit.h"

using namespace o2::iotof;
5 changes: 4 additions & 1 deletion Detectors/Upgrades/ALICE3/IOTOF/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
o2_add_library(IOTOFSimulation
SOURCES src/Layer.cxx
src/Detector.cxx
src/Digitizer.cxx
# src/IOTOFServices.cxx
PUBLIC_LINK_LIBRARIES O2::IOTOFBase
O2::DataFormatsIOTOF
O2::ITSMFTSimulation)

o2_target_root_dictionary(IOTOFSimulation
HEADERS include/IOTOFSimulation/Detector.h
include/IOTOFSimulation/Layer.h)
include/IOTOFSimulation/Layer.h
include/IOTOFSimulation/Digitizer.h)
# include/IOTOFSimulation/IOTOFServices.h)
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// 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 Digitizer.h
/// \brief Definition of the ALICE3 TOF digitizer
/// \author Nicolò Jacazio, Università del Piemonte Orientale (IT)
/// \since 2026-03-17
///

#ifndef ALICEO2_IOTOF_DIGITIZER_H
#define ALICEO2_IOTOF_DIGITIZER_H

#include "ITSMFTSimulation/Hit.h"
#include "DataFormatsITSMFT/Digit.h"
#include "DataFormatsIOTOF/Digit.h"
#include "DataFormatsITSMFT/ROFRecord.h"
#include "CommonDataFormat/InteractionRecord.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTruthContainer.h"
#include "IOTOFBase/GeometryTGeo.h"

namespace o2::iotof
{

/// \class Digitizer
/// \brief Digitizer for the ALICE3 Inner/Outer TOF detector
///
/// Converts MC hits into detector digits by:
/// - Applying time smearing according to detector resolution
/// - Converting energy loss to charge
/// - Applying charge threshold
/// - Managing readout frames (ROF)
class Digitizer
{
public:
void setDigits(std::vector<o2::iotof::Digit>* dig) { mDigits = dig; }
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }

/// Initialize the digitizer
void init();

/// Steer conversion of hits to digits
void process(const std::vector<o2::itsmft::Hit>* hits, int evID, int srcID);

/// Set the event time
void setEventTime(const o2::InteractionTimeRecord& irt) { mEventTime = irt; }

/// Set continuous readout mode
void setContinuous(bool v) { mContinuous = v; }
bool isContinuous() const { return mContinuous; }

/// Flush the output container
void fillOutputContainer();

// Provide the common iotof::GeometryTGeo to access matrices and segmentation
void setGeometry(const o2::iotof::GeometryTGeo* gm) { mGeometry = gm; }

// Setters for digitization parameters
void setChargeThreshold(float thr) { mChargeThreshold = thr; }
void setTimeResolution(float res) { mTimeResolution = res; }
void setEfficiency(float eff) { mEfficiency = eff; }
void setEnergyToCharge(float e2c) { mEnergyToCharge = e2c; }

// Getters
float getChargeThreshold() const { return mChargeThreshold; }
float getTimeResolution() const { return mTimeResolution; }
float getEfficiency() const { return mEfficiency; }

private:
/// Process a single hit
void processHit(const o2::itsmft::Hit& hit, int evID, int srcID);

/// Apply time smearing to simulate detector resolution
double smearTime(double time) const;

/// Convert energy loss to charge
int energyToCharge(float energyLoss) const;

/// Check if the hit passes efficiency cut
bool isEfficient() const;

static constexpr float sec2ns = 1e9f; ///< seconds to nanoseconds conversion

const o2::iotof::GeometryTGeo* mGeometry = nullptr; ///< IOTOF geometry

std::vector<o2::iotof::Digit>* mDigits = nullptr; //! output digits
std::vector<o2::itsmft::ROFRecord>* mROFRecords = nullptr; //! output ROF records
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mMCLabels = nullptr; //! output labels

o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
bool mContinuous = true; ///< continuous readout mode

// Digitization parameters
float mChargeThreshold = 100.f; ///< charge threshold for digit creation (electrons)
float mTimeResolution = 0.020f; ///< time resolution sigma in ns (20 ps default)
float mEfficiency = 0.98f; ///< detection efficiency
float mEnergyToCharge = 3.6e-9f; ///< energy loss to electrons conversion (3.6 eV per e-h pair in Si)
};
} // namespace o2::iotof

#endif
Loading
Loading