Skip to content

Commit 92f7d3b

Browse files
shahor02davidrohr
authored andcommitted
ITS/MFT digitizer builds ROFs from 1st IR of TF containing HBFUtils.orbitFirstSampled
1 parent 97a563e commit 92f7d3b

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/Digitizer.h

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <deque>
1818
#include <memory>
1919

20-
#include "Rtypes.h" // for Digitizer::Class, Double_t, ClassDef, etc
20+
#include "Rtypes.h" // for Digitizer::Class
2121
#include "TObject.h" // for TObject
2222

2323
#include "ITSMFTSimulation/ChipDigitsContainer.h"
@@ -71,28 +71,28 @@ class Digitizer : public TObject
7171

7272
void setContinuous(bool v) { mParams.setContinuous(v); }
7373
bool isContinuous() const { return mParams.isContinuous(); }
74-
void fillOutputContainer(UInt_t maxFrame = 0xffffffff);
74+
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
7575

7676
void setDigiParams(const o2::itsmft::DigiParams& par) { mParams = par; }
7777
const o2::itsmft::DigiParams& getDigitParams() const { return mParams; }
7878

7979
// provide the common itsmft::GeometryTGeo to access matrices and segmentation
8080
void setGeometry(const o2::itsmft::GeometryTGeo* gm) { mGeometry = gm; }
8181

82-
UInt_t getEventROFrameMin() const { return mEventROFrameMin; }
83-
UInt_t getEventROFrameMax() const { return mEventROFrameMax; }
82+
uint32_t getEventROFrameMin() const { return mEventROFrameMin; }
83+
uint32_t getEventROFrameMax() const { return mEventROFrameMax; }
8484
void resetEventROFrames()
8585
{
8686
mEventROFrameMin = 0xffffffff;
8787
mEventROFrameMax = 0;
8888
}
8989

9090
private:
91-
void processHit(const o2::itsmft::Hit& hit, UInt_t& maxFr, int evID, int srcID);
92-
void registerDigits(ChipDigitsContainer& chip, UInt_t roFrame, float tInROF, int nROF,
93-
UShort_t row, UShort_t col, int nEle, o2::MCCompLabel& lbl);
91+
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
92+
void registerDigits(ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
93+
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
9494

95-
ExtraDig* getExtraDigBuffer(UInt_t roFrame)
95+
ExtraDig* getExtraDigBuffer(uint32_t roFrame)
9696
{
9797
if (mROFrameMin > roFrame) {
9898
return nullptr; // nothing to do
@@ -108,13 +108,14 @@ class Digitizer : public TObject
108108

109109
o2::itsmft::DigiParams mParams; ///< digitization parameters
110110
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
111+
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
111112
double mCollisionTimeWrtROF;
112-
UInt_t mROFrameMin = 0; ///< lowest RO frame of current digits
113-
UInt_t mROFrameMax = 0; ///< highest RO frame of current digits
114-
UInt_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
113+
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
114+
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
115+
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
115116

116-
UInt_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
117-
UInt_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
117+
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
118+
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
118119

119120
std::unique_ptr<o2::itsmft::AlpideSimResponse> mAlpSimResp; // simulated response
120121

Detectors/ITSMFT/common/simulation/src/Digitizer.cxx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "ITSMFTSimulation/Digitizer.h"
1717
#include "MathUtils/Cartesian.h"
1818
#include "SimulationDataFormat/MCTruthContainer.h"
19+
#include "DetectorsRaw/HBFUtils.h"
1920

2021
#include <TRandom.h>
2122
#include <climits>
@@ -44,6 +45,7 @@ void Digitizer::init()
4445
mParams.setAlpSimResponse(mAlpSimResp.get());
4546
}
4647
mParams.print();
48+
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
4749
}
4850

4951
//_______________________________________________________________________
@@ -92,7 +94,7 @@ void Digitizer::setEventTime(const o2::InteractionTimeRecord& irt)
9294
// RO frame corresponding to provided time
9395
mCollisionTimeWrtROF = mEventTime.timeInBCNS; // in triggered mode the ROF starts at BC (is there a delay?)
9496
if (mParams.isContinuous()) {
95-
auto nbc = mEventTime.toLong();
97+
auto nbc = mEventTime.differenceInBC(mIRFirstSampledTF);
9698
if (mCollisionTimeWrtROF < 0 && nbc > 0) {
9799
nbc--;
98100
}
@@ -114,7 +116,7 @@ void Digitizer::setEventTime(const o2::InteractionTimeRecord& irt)
114116
}
115117

116118
//_______________________________________________________________________
117-
void Digitizer::fillOutputContainer(UInt_t frameLast)
119+
void Digitizer::fillOutputContainer(uint32_t frameLast)
118120
{
119121
// fill output with digits from min.cached up to requested frame, generating the noise beforehand
120122
if (frameLast > mROFrameMax) {
@@ -164,7 +166,7 @@ void Digitizer::fillOutputContainer(UInt_t frameLast)
164166
// finalize ROF record
165167
rcROF.setNEntries(mDigits->size() - rcROF.getFirstEntry()); // number of digits
166168
if (isContinuous()) {
167-
rcROF.getBCData().setFromLong(mROFrameMin * mParams.getROFrameLengthInBC());
169+
rcROF.getBCData().setFromLong(mIRFirstSampledTF.toLong() + mROFrameMin * mParams.getROFrameLengthInBC());
168170
} else {
169171
rcROF.getBCData() = mEventTime; // RSTODO do we need to add trigger delay?
170172
}
@@ -179,7 +181,7 @@ void Digitizer::fillOutputContainer(UInt_t frameLast)
179181
}
180182

181183
//_______________________________________________________________________
182-
void Digitizer::processHit(const o2::itsmft::Hit& hit, UInt_t& maxFr, int evID, int srcID)
184+
void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID)
183185
{
184186
// convert single hit to digits
185187
float timeInROF = hit.GetTime() * sec2ns;
@@ -203,9 +205,9 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, UInt_t& maxFr, int evID,
203205
// frame of the hit signal start wrt event ROFrame
204206
int roFrameRel = int(timeInROF * mParams.getROFrameLengthInv());
205207
// frame of the hit signal end wrt event ROFrame: in the triggered mode we read just 1 frame
206-
UInt_t roFrameRelMax = mParams.isContinuous() ? (timeInROF + tTot) * mParams.getROFrameLengthInv() : roFrameRel;
208+
uint32_t roFrameRelMax = mParams.isContinuous() ? (timeInROF + tTot) * mParams.getROFrameLengthInv() : roFrameRel;
207209
int nFrames = roFrameRelMax + 1 - roFrameRel;
208-
UInt_t roFrameMax = mNewROFrame + roFrameRelMax;
210+
uint32_t roFrameMax = mNewROFrame + roFrameRelMax;
209211
if (roFrameMax > maxFr) {
210212
maxFr = roFrameMax; // if signal extends beyond current maxFrame, increase the latter
211213
}
@@ -325,7 +327,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, UInt_t& maxFr, int evID,
325327
auto& chip = mChips[hit.GetDetectorID()];
326328
auto roFrameAbs = mNewROFrame + roFrameRel;
327329
for (int irow = rowSpan; irow--;) {
328-
UShort_t rowIS = irow + rowS;
330+
uint16_t rowIS = irow + rowS;
329331
for (int icol = colSpan; icol--;) {
330332
float nEleResp = respMatrix[irow][icol];
331333
if (!nEleResp) {
@@ -336,24 +338,24 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, UInt_t& maxFr, int evID,
336338
if (nEle < mParams.getMinChargeToAccount()) {
337339
continue;
338340
}
339-
UShort_t colIS = icol + colS;
341+
uint16_t colIS = icol + colS;
340342
//
341343
registerDigits(chip, roFrameAbs, timeInROF, nFrames, rowIS, colIS, nEle, lbl);
342344
}
343345
}
344346
}
345347

346348
//________________________________________________________________________________
347-
void Digitizer::registerDigits(ChipDigitsContainer& chip, UInt_t roFrame, float tInROF, int nROF,
348-
UShort_t row, UShort_t col, int nEle, o2::MCCompLabel& lbl)
349+
void Digitizer::registerDigits(ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
350+
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl)
349351
{
350352
// Register digits for given pixel, accounting for the possible signal contribution to
351353
// multiple ROFrame. The signal starts at time tInROF wrt the start of provided roFrame
352354
// In every ROFrame we check the collected signal during strobe
353355

354356
float tStrobe = mParams.getStrobeDelay() - tInROF; // strobe start wrt signal start
355357
for (int i = 0; i < nROF; i++) {
356-
UInt_t roFr = roFrame + i;
358+
uint32_t roFr = roFrame + i;
357359
int nEleROF = mParams.getSignalShape().getCollectedCharge(nEle, tStrobe, tStrobe + mParams.getStrobeLength());
358360
tStrobe += mParams.getROFrameLength(); // for the next ROF
359361

0 commit comments

Comments
 (0)