27#include <fairlogger/Logger.h>
37 LOG(info) <<
"Initializing IOTOF digitizer";
38 LOG(info) <<
" Time resolution: " << mTimeResolution * 1e3 <<
" ps";
39 LOG(info) <<
" Charge threshold: " << mChargeThreshold <<
" electrons";
40 LOG(info) <<
" Detection efficiency: " << mEfficiency * 100 <<
" %";
41 LOG(info) <<
" Continuous mode: " << (mContinuous ?
"ON" :
"OFF");
42 sSegmentation = o2::iotof::Segmentation::Instance();
49 LOG(
debug) <<
"Digitizing IOTOF hits: " << hits->size() <<
" hits from event " << evID <<
" source " << srcID;
51 if (!hits || hits->empty()) {
56 std::vector<int> hitIdx(hits->size());
57 std::iota(hitIdx.begin(), hitIdx.end(), 0);
58 std::sort(hitIdx.begin(), hitIdx.end(),
59 [hits](
int lhs,
int rhs) {
60 return (*hits)[lhs].GetDetectorID() < (*hits)[rhs].GetDetectorID();
64 for (
int i : hitIdx) {
65 processHit((*hits)[
i], evID, srcID);
75void Digitizer::processHit(
const o2::itsmft::Hit& hit,
int evID,
int srcID)
81 LOG(
debug) <<
"Hit rejected by efficiency cut";
90 int charge = energyToCharge(energyLoss);
93 if (
charge < mChargeThreshold) {
94 LOG(
debug) <<
"Hit rejected by charge threshold: " <<
charge <<
" < " << mChargeThreshold;
100 double hitTime = hit.
GetTime() * sec2ns;
101 double eventTimeNS = mEventTime.
getTimeNS();
102 double absoluteTime = hitTime + eventTimeNS;
103 double smearedTime = smearTime(absoluteTime);
107 uint16_t chipIndex =
static_cast<uint16_t
>(detID);
110 LOG(
debug) <<
"Invalid detector ID: " << detID;
115 math_utils::Vector3D<float> xyzPositionStart(matrix ^ (hit.
GetPosStart()));
122 LOG(
debug) <<
"Hit position out of bounds for detector ID " << detID;
127 int digID = mDigits->size();
128 mDigits->emplace_back(chipIndex,
static_cast<uint16_t
>(
row),
static_cast<uint16_t
>(
col),
charge, smearedTime);
130 LOG(
debug) <<
"Created digit #" << digID <<
" chip=" << chipIndex
131 <<
" charge=" <<
charge <<
" time=" << smearedTime <<
" ns";
141double Digitizer::smearTime(
double time)
const
144 if (mTimeResolution > 0) {
145 return time + gRandom->Gaus(0, mTimeResolution);
151int Digitizer::energyToCharge(
float energyLoss)
const
156 return static_cast<int>(energyLoss / mEnergyToCharge);
160bool Digitizer::isEfficient()
const
163 return gRandom->Uniform() < mEfficiency;
170 if (mROFRecords && mDigits && !mDigits->empty()) {
175 mROFRecords->push_back(rof);
176 LOG(
debug) <<
"Created ROF record with " << mDigits->size() <<
" digits";
Definition of the ALICE3 TOF digitizer.
unsigned short GetDetectorID() const
const Mat3D & getMatrixL2G(int sensID) const
void init()
Initialize the digitizer.
void fillOutputContainer()
Flush the output container.
void process(const std::vector< o2::itsmft::Hit > *hits, int evID, int srcID)
Steer conversion of hits to digits.
int getIOTOFLayer(int index) const
bool localToDetector(float x, float z, int &iRow, int &iCol, const int subDetectorID)
math_utils::Point3D< Float_t > GetPosStart() const
void setBCData(const BCData &bc)
void setFirstEntry(int idx)
double getTimeNS() const
get time in ns from orbit=0/bc=0
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"