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
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Digitizer : public TObject
}

private:
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay);
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay, std::vector<float>& respMatrix);
void registerDigits(ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl, int lay);

Expand Down
12 changes: 6 additions & 6 deletions Detectors/ITSMFT/common/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ void Digitizer::process(const std::vector<Hit>* hits, int evID, int srcID, int l
std::sort(hitIdx.begin(), hitIdx.end(), [hits](auto lhs, auto rhs) {
return (*hits)[lhs].GetDetectorID() < (*hits)[rhs].GetDetectorID();
});
std::vector<float> respMatrix; // the hits' charge response, reused from hit to hit within the event
for (int i : hitIdx | std::views::filter([&](int idx) {
if (layer < 0) {
return true;
}
return mGeometry->getLayer((*hits)[idx].GetDetectorID()) == layer;
})) {
processHit((*hits)[i], mROFrameMax, evID, srcID, layer);
processHit((*hits)[i], mROFrameMax, evID, srcID, layer, respMatrix);
}

// in the triggered mode store digits after every MC event
Expand Down Expand Up @@ -256,7 +257,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast, int layer)
}

//_______________________________________________________________________
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay)
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay, std::vector<float>& respMatrix)
{
// convert single hit to digits
auto chipID = hit.GetDetectorID();
Expand Down Expand Up @@ -347,8 +348,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
}
int rowSpan = rowE - rowS + 1, colSpan = colE - colS + 1; // size of plaquet where some response is expected

float respMatrix[rowSpan][colSpan]; // response accumulated here
std::fill(&respMatrix[0][0], &respMatrix[0][0] + rowSpan * colSpan, 0.f);
respMatrix.assign(static_cast<size_t>(rowSpan) * colSpan, 0.f); // response accumulated here, row by row

float nElectrons = hit.GetEnergyLoss() * mParams.getEnergyToNElectrons(); // total number of deposited electrons
nElectrons *= nStepsInv; // N electrons injected per step
Expand Down Expand Up @@ -397,7 +397,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
if (colDest < 0 || colDest >= colSpan) {
continue;
}
respMatrix[rowDest][colDest] += rspmat->getValue(irow, icol, flipRow, flipCol);
respMatrix[rowDest * colSpan + colDest] += rspmat->getValue(irow, icol, flipRow, flipCol);
}
}
}
Expand All @@ -409,7 +409,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
for (int irow = rowSpan; irow--;) {
uint16_t rowIS = irow + rowS;
for (int icol = colSpan; icol--;) {
float nEleResp = respMatrix[irow][icol];
float nEleResp = respMatrix[irow * colSpan + icol];
if (!nEleResp) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Digitizer
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }

private:
void processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, int evID, int srcID, int rofLayer);
void processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, int evID, int srcID, int rofLayer, std::vector<float>& respMatrix);
void registerDigits(o2::trkft3::ChipDigitsContainer& chip, uint32_t roFrame, float toaInROF, int nROF,
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl, int layer);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,14 @@ void Digitizer<DetID>::process(const std::vector<Hit>* hits, int evID, int srcID
return (*hits)[lhs].GetDetectorID() < (*hits)[rhs].GetDetectorID();
});
LOG(info) << "Processing " << nHits << " hits";
std::vector<float> respMatrix; // the hits' charge response, reused from hit to hit within the event
for (int i : hitIdx | std::views::filter([&](int idx) {
if (layer < 0) {
return true;
}
return getROFLayer((*hits)[idx].GetDetectorID()) == layer;
})) {
processHit((*hits)[i], mROFrameMax, evID, srcID, layer);
processHit((*hits)[i], mROFrameMax, evID, srcID, layer, respMatrix);
}
}

Expand Down Expand Up @@ -253,7 +254,7 @@ void Digitizer<DetID>::fillOutputContainer(uint32_t frameLast, int layer)

//_______________________________________________________________________
template <int DetID>
void Digitizer<DetID>::processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, int evID, int srcID, int rofLayer)
void Digitizer<DetID>::processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, int evID, int srcID, int rofLayer, std::vector<float>& respMatrix)
{
int chipID = hit.GetDetectorID(); //// the chip ID at the moment is not referred to the chip but to a wider detector element (e.g. quarter of layer or disk in VD, stave in ML, half stave in OT)
int subDetID = mGeometry->getSubDetID(chipID);
Expand Down Expand Up @@ -394,8 +395,7 @@ void Digitizer<DetID>::processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, i
}
int rowSpan = rowE - rowS + 1, colSpan = colE - colS + 1; // size of plaquet where some response is expected

float respMatrix[rowSpan][colSpan]; // response accumulated here
std::fill(&respMatrix[0][0], &respMatrix[0][0] + rowSpan * colSpan, 0.f);
respMatrix.assign(static_cast<size_t>(rowSpan) * colSpan, 0.f); // response accumulated here, row by row

float nElectrons = hit.GetEnergyLoss() * mParams.getEnergyToNElectrons(); // total number of deposited electrons
nElectrons *= nStepsInv; // N electrons injected per step
Expand Down Expand Up @@ -463,7 +463,7 @@ void Digitizer<DetID>::processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, i
if (colDest < 0 || colDest >= colSpan) {
continue;
}
respMatrix[rowDest][colDest] += rspmat->getValue(irow, icol, mSimRespOrientation ? !flipRow : flipRow, flipCol);
respMatrix[rowDest * colSpan + colDest] += rspmat->getValue(irow, icol, mSimRespOrientation ? !flipRow : flipRow, flipCol);
}
}
}
Expand All @@ -475,7 +475,7 @@ void Digitizer<DetID>::processHit(const o2::trkft3::Hit& hit, uint32_t& maxFr, i
for (int irow = rowSpan; irow--;) { // irow ranging from 4 to 0
uint16_t rowIS = irow + rowS; // row distant irow from the row of the hit start
for (int icol = colSpan; icol--;) { // icol ranging from 4 to 0
float nEleResp = respMatrix[irow][icol]; // value of the probability of the response in this pixel
float nEleResp = respMatrix[irow * colSpan + icol]; // value of the probability of the response in this pixel
if (nEleResp <= 1.e-36) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Digitizer : public TObject
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }

private:
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int layer);
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int layer, std::vector<float>& respMatrix);
void registerDigits(o2::its3::ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl, int layer);

Expand Down
12 changes: 6 additions & 6 deletions Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ void Digitizer::process(const std::vector<itsmft::Hit>* hits, int evID, int srcI
[hits](auto lhs, auto rhs) {
return (*hits)[lhs].GetDetectorID() < (*hits)[rhs].GetDetectorID();
});
std::vector<float> respMatrix; // the hits' charge response, reused from hit to hit within the event
for (int i : hitIdx | std::views::filter([&](int idx) {
if (layer < 0) {
return true;
}
return mGeometry->getLayer((*hits)[idx].GetDetectorID()) == layer;
})) {
processHit((*hits)[i], mROFrameMax, evID, srcID, layer);
processHit((*hits)[i], mROFrameMax, evID, srcID, layer, respMatrix);
}
// in the triggered mode store digits after every MC event
// TODO: in the real triggered mode this will not be needed, this is actually for the
Expand Down Expand Up @@ -218,7 +219,7 @@ void Digitizer::fillOutputContainer(uint32_t frameLast, int layer)
}
}

void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay)
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay, std::vector<float>& respMatrix)
{
// convert single hit to digits
auto chipID = hit.GetDetectorID();
Expand Down Expand Up @@ -336,8 +337,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
colE = std::min(colE, maxNcols - 1);

int rowSpan = rowE - rowS + 1, colSpan = colE - colS + 1; // size of plaquet where some response is expected
float respMatrix[rowSpan][colSpan]; // response accumulated here
std::fill(&respMatrix[0][0], &respMatrix[0][0] + rowSpan * colSpan, 0.f);
respMatrix.assign(static_cast<size_t>(rowSpan) * colSpan, 0.f); // response accumulated here, row by row

float nElectrons = hit.GetEnergyLoss() * mParams.getEnergyToNElectrons(); // total number of deposited electrons
nElectrons *= nStepsInv; // N electrons injected per step
Expand Down Expand Up @@ -401,7 +401,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
if (colDest < 0 || colDest >= colSpan) {
continue;
}
respMatrix[rowDest][colDest] += rspmat->getValue(irow, icol, ((chip.isIB() && mSimRespIBOrientation) ? !flipRow : flipRow), flipCol);
respMatrix[rowDest * colSpan + colDest] += rspmat->getValue(irow, icol, ((chip.isIB() && mSimRespIBOrientation) ? !flipRow : flipRow), flipCol);
}
}
}
Expand All @@ -413,7 +413,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
for (int irow = rowSpan; irow--;) {
uint16_t rowIS = irow + rowS;
for (int icol = colSpan; icol--;) {
float nEleResp = respMatrix[irow][icol];
float nEleResp = respMatrix[irow * colSpan + icol];
if (nEleResp <= 1.e-36) {
continue;
}
Expand Down
Loading