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