Skip to content

Commit dcfcd42

Browse files
committed
ITSMFT: staggered digitization
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 1bcfeed commit dcfcd42

File tree

13 files changed

+615
-445
lines changed

13 files changed

+615
-445
lines changed

DataFormats/Detectors/ITSMFT/common/src/ROFRecord.cxx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12-
#include "DataFormatsITSMFT/ROFRecord.h"
1312
#include <iostream>
14-
#include "fmt/format.h"
13+
#include <format>
14+
15+
#include "DataFormatsITSMFT/ROFRecord.h"
16+
#include "Framework/Logger.h"
1517

1618
using namespace o2::itsmft;
1719

1820
std::string ROFRecord::asString() const
1921
{
20-
return fmt::format("ROF: {} | {} entries starting from {}", mROFrame, getNEntries(), getFirstEntry());
22+
return std::format("ROF: {} | {} entries starting from {} | IR: {}", mROFrame, getNEntries(), getFirstEntry(), mBCData.asString());
2123
}
2224

2325
void ROFRecord::print() const
2426
{
25-
std::cout << this << "\n\t" << mBCData << std::endl;
27+
LOG(info) << asString();
2628
}
2729

2830
std::ostream& operator<<(std::ostream& stream, ROFRecord const& rec)
@@ -33,12 +35,12 @@ std::ostream& operator<<(std::ostream& stream, ROFRecord const& rec)
3335

3436
std::string MC2ROFRecord::asString() const
3537
{
36-
return fmt::format("MCEventID: {} ROFs: {}-{} Entry in ROFRecords: {}", eventRecordID, minROF, maxROF, rofRecordID);
38+
return std::format("MCEventID: {} ROFs: {}-{} Entry in ROFRecords: {}", eventRecordID, minROF, maxROF, rofRecordID);
3739
}
3840

3941
void MC2ROFRecord::print() const
4042
{
41-
std::cout << this << std::endl;
43+
LOG(info) << asString();
4244
}
4345

4446
std::ostream& operator<<(std::ostream& stream, MC2ROFRecord const& rec)

Detectors/ITSMFT/ITS/base/include/ITSBase/GeometryTGeo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
176176
bool getChipId(int index, int& lay, int& hba, int& sta, int& ssta, int& mod, int& chip) const;
177177

178178
/// Get chip layer, from 0
179-
int getLayer(int index) const;
179+
int getLayer(int index) const final;
180180

181181
/// Get chip half barrel, from 0
182182
int getHalfBarrel(int index) const;
@@ -216,7 +216,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
216216
return getSymbolicName(getChipIndex(lay, hba, sta, det));
217217
}
218218

219-
/// Get the transformation matrix for a given chip (NOT A SENSOR!!!) 'index' by quering the TGeoManager
219+
/// Get the transformation matrix for a given chip (NOT A SENSOR!!!) 'index' by querying the TGeoManager
220220
TGeoHMatrix* getMatrix(int index) const { return o2::base::GeometryManager::getMatrix(getDetID(), index); }
221221
TGeoHMatrix* getMatrix(int lay, int hba, int sta, int sens) const { return getMatrix(getChipIndex(lay, hba, sta, sens)); }
222222
bool getOriginalMatrix(int index, TGeoHMatrix& m) const
@@ -336,7 +336,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
336336
TString getMatrixPath(int index) const;
337337

338338
/// Get the transformation matrix of the SENSOR (not necessary the same as the chip)
339-
/// for a given chip 'index' by quering the TGeoManager
339+
/// for a given chip 'index' by querying the TGeoManager
340340
TGeoHMatrix* extractMatrixSensor(int index) const;
341341

342342
// create matrix for transformation from sensor local frame to global one
@@ -407,7 +407,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
407407
std::vector<int> mNumberOfChipsPerStave; ///< number of chips per stave
408408
std::vector<int> mNumberOfChipsPerHalfBarrel; ///< number of chips per halfbarrel
409409
std::vector<int> mNumberOfChipsPerLayer; ///< number of chips per stave
410-
std::vector<int> mLastChipIndex; ///< max ID of the detctor in the layer
410+
std::vector<int> mLastChipIndex; ///< max ID of the detector in the layer
411411
std::array<bool, MAXLAYERS> mIsLayerITS3; ///< flag with the information of the ITS version (ITS2 or ITS3)
412412
std::array<char, MAXLAYERS> mLayerToWrapper; ///< Layer to wrapper correspondence
413413

Detectors/ITSMFT/MFT/base/include/MFTBase/GeometryTGeo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
9595
Int_t getSensorIndex(Int_t half, Int_t disk, Int_t ladder, Int_t sensor) const;
9696

9797
/// get layer index (0:9) from the chip index
98-
Int_t getLayer(Int_t index) const;
98+
Int_t getLayer(Int_t index) const final;
9999

100100
/// This routine computes the half, disk, ladder and sensor number
101101
/// given the sensor index number
@@ -122,7 +122,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
122122
{
123123
return extractNumberOfDisks(half);
124124
}
125-
/// Returns the number of halfs MFT
125+
/// Returns the number of halves MFT
126126
Int_t getNumberOfHalfs()
127127
{
128128
return extractNumberOfHalves();
@@ -181,7 +181,7 @@ class GeometryTGeo : public o2::itsmft::GeometryTGeo
181181
Int_t extractVolumeCopy(const Char_t* name, const Char_t* prefix) const;
182182

183183
/// Get the transformation matrix of the sensor [...]
184-
/// for a given sensor 'index' by quering the TGeoManager
184+
/// for a given sensor 'index' by querying the TGeoManager
185185
TGeoHMatrix* extractMatrixSensor(Int_t index) const;
186186

187187
// Create matrix for transformation from sensor local frame to global one

Detectors/ITSMFT/common/base/include/ITSMFTBase/DPLAlpideParam.h

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,45 @@ constexpr float DEFStrobeDelay = o2::constants::lhc::LHCBunchSpacingNS * 4; // ~
2626

2727
template <int N>
2828
struct DPLAlpideParam : public o2::conf::ConfigurableParamHelper<DPLAlpideParam<N>> {
29+
static constexpr int getNLayers()
30+
{
31+
return N == o2::detectors::DetID::ITS ? 7 : 10;
32+
}
2933

3034
static constexpr std::string_view getParamName()
3135
{
3236
return N == o2::detectors::DetID::ITS ? ParamName[0] : ParamName[1];
3337
}
34-
int roFrameLengthInBC = DEFROFLengthBC(); ///< ROF length in BC for continuos mode
35-
float roFrameLengthTrig = DEFROFLengthTrig(); ///< length of RO frame in ns for triggered mode
36-
float strobeDelay = DEFStrobeDelay; ///< strobe start (in ns) wrt ROF start
37-
float strobeLengthCont = -1.; ///< if < 0, full ROF length - delay
38-
float strobeLengthTrig = 100.; ///< length of the strobe in ns (sig. over threshold checked in this window only)
39-
int roFrameBiasInBC = DEFROFBiasInBC(); ///< bias of the start of ROF wrt orbit start: t_irof = (irof*roFrameLengthInBC + roFrameBiasInBC)*BClengthMUS
38+
39+
public:
40+
int roFrameLengthInBC = DEFROFLengthBC(); ///< ROF length in BC for continuous mode
41+
float roFrameLengthTrig = DEFROFLengthTrig(); ///< length of RO frame in ns for triggered mode
42+
float strobeDelay = DEFStrobeDelay; ///< strobe start (in ns) wrt ROF start
43+
float strobeLengthCont = -1.; ///< if < 0, full ROF length - delay
44+
float strobeLengthTrig = 100.; ///< length of the strobe in ns (sig. over threshold checked in this window only)
45+
int roFrameBiasInBC = DEFROFBiasInBC(); ///< bias of the start of ROF wrt orbit start: t_irof = (irof*roFrameLengthInBC + roFrameBiasInBC)*BClengthMUS
46+
int roFrameLayerLengthInBC[getNLayers()] = {}; ///< staggering ROF length in BC for continuous mode per layer
47+
int roFrameLayerBiasInBC[getNLayers()] = {}; ///< staggering ROF bias in BC for continuous mode per layer
48+
int roFrameLayerDelayInBC[getNLayers()] = {}; ///< staggering ROF delay in BC for continuous mode per layer
49+
50+
static constexpr bool supportsStaggering() noexcept { return (N == o2::detectors::DetID::ITS) ? false : false; }
51+
// test if staggering is on
52+
bool withStaggering() const noexcept
53+
{
54+
if constexpr (!supportsStaggering()) {
55+
return false;
56+
}
57+
for (int i{0}; i < getNLayers(); ++i) {
58+
if (roFrameLayerLengthInBC[i] != 0) {
59+
return true;
60+
}
61+
}
62+
return false;
63+
}
64+
// get ROF length for any layer
65+
int getROFLengthInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerLengthInBC[layer] : roFrameLengthInBC; }
66+
int getROFBiasInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerBiasInBC[layer] : roFrameBiasInBC; }
67+
int getROFDelayInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerDelayInBC[layer] : 0; }
4068

4169
// boilerplate stuff + make principal key
4270
O2ParamDef(DPLAlpideParam, getParamName().data());
@@ -46,7 +74,7 @@ struct DPLAlpideParam : public o2::conf::ConfigurableParamHelper<DPLAlpideParam<
4674

4775
static constexpr int DEFROFLengthBC()
4876
{
49-
// default ROF length in BC for continuos mode
77+
// default ROF length in BC for continuous mode
5078
// allowed values: 1,2,3,4,6,9,11,12,18,22,27,33,36
5179
return N == o2::detectors::DetID::ITS ? o2::constants::lhc::LHCMaxBunches / 4 : o2::constants::lhc::LHCMaxBunches / 18;
5280
}

Detectors/ITSMFT/common/base/include/ITSMFTBase/GeometryTGeo.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/// \file GeometryTGeo.h
1313
/// \brief Definition of the GeometryTGeo class : common part for ITS and MFT
14-
/// \brief collects ITS and MFT common methods to acces matrices
14+
/// \brief collects ITS and MFT common methods to access matrices
1515

1616
/// \author ruben.shahoyan@cern.ch
1717
#ifndef ALICEO2_ITSMFT_GEOMETRYTGEO_H_
@@ -37,7 +37,8 @@ class GeometryTGeo : public o2::detectors::DetMatrixCache
3737
~GeometryTGeo() override = default;
3838

3939
Int_t getNumberOfChips() const { return mSize; }
40-
/// build detector layout data, must be overriden by detector
40+
virtual Int_t getLayer(Int_t index) const { return -1; };
41+
/// build detector layout data, must be overridden by detector
4142
virtual void Build(int loadTrans) = 0;
4243

4344
bool isOwner() const { return mOwner; }

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

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
#ifndef ALICEO2_ITSMFT_DIGIPARAMS_H
1616
#define ALICEO2_ITSMFT_DIGIPARAMS_H
1717

18+
#include <vector>
19+
#include <algorithm>
1820
#include <Rtypes.h>
19-
#include <ITSMFTSimulation/AlpideSignalTrapezoid.h>
21+
#include "ITSMFTSimulation/AlpideSignalTrapezoid.h"
2022
#include "ITSMFTBase/DPLAlpideParam.h"
2123

2224
////////////////////////////////////////////////////////////
@@ -51,24 +53,24 @@ class DigiParams
5153
void setContinuous(bool v) { mIsContinuous = v; }
5254
bool isContinuous() const { return mIsContinuous; }
5355

54-
int getROFrameLengthInBC() const { return mROFrameLengthInBC; }
55-
void setROFrameLengthInBC(int n) { mROFrameLengthInBC = n; }
56+
int getROFrameLengthInBC(int layer = -1) const { return layer < 0 ? mROFrameLengthInBC : mROFrameLayerLengthInBC[layer]; }
57+
void setROFrameLengthInBC(int n, int layer = -1) { layer < 0 ? mROFrameLengthInBC = n : mROFrameLayerLengthInBC[layer] = n; }
5658

57-
void setROFrameLength(float ns);
58-
float getROFrameLength() const { return mROFrameLength; }
59-
float getROFrameLengthInv() const { return mROFrameLengthInv; }
59+
void setROFrameLength(float ns, int layer = -1);
60+
float getROFrameLength(int layer = -1) const { return layer < 0 ? mROFrameLength : mROFrameLayerLength[layer]; }
61+
float getROFrameLengthInv(int layer = -1) const { return layer < 0 ? mROFrameLengthInv : mROFrameLayerLengthInv[layer]; }
6062

6163
void setStrobeDelay(float ns) { mStrobeDelay = ns; }
62-
float getStrobeDelay() const { return mStrobeDelay; }
64+
float getStrobeDelay(int layer = -1) const { return layer < 0 ? mStrobeDelay : mStrobeLayerDelay[layer]; }
6365

6466
void setStrobeLength(float ns) { mStrobeLength = ns; }
65-
float getStrobeLength() const { return mStrobeLength; }
67+
float getStrobeLength(int layer = -1) const { return layer < 0 ? mStrobeLength : mStrobeLayerLength[layer]; }
6668

6769
void setTimeOffset(double sec) { mTimeOffset = sec; }
6870
double getTimeOffset() const { return mTimeOffset; }
6971

70-
void setROFrameBiasInBC(int n) { mROFrameBiasInBC = n; }
71-
int getROFrameBiasInBC() const { return mROFrameBiasInBC; }
72+
void setROFrameBiasInBC(int n, int layer = -1) { layer < 0 ? mROFrameBiasInBC = n : mROFrameLayerBiasInBC[layer] = n; }
73+
int getROFrameBiasInBC(int layer = -1) const { return layer < 0 ? mROFrameBiasInBC : mROFrameLayerBiasInBC[layer]; }
7274

7375
void setChargeThreshold(int v, float frac2Account = 0.1);
7476
void setNSimSteps(int v);
@@ -96,13 +98,19 @@ class DigiParams
9698
const SignalShape& getSignalShape() const { return mSignalShape; }
9799
SignalShape& getSignalShape() { return (SignalShape&)mSignalShape; }
98100

101+
bool withStaggering() const noexcept { return !mROFrameLayerLength.empty(); }
102+
void addROFrameLayerLengthInBC(int len) { mROFrameLayerLengthInBC.push_back(len); }
103+
void addROFrameLayerBiasInBC(int len) { mROFrameLayerBiasInBC.push_back(len); }
104+
void addStrobeLength(float ns) { mStrobeLayerLength.push_back(ns); }
105+
void addStrobeDelay(float ns) { mStrobeLayerDelay.push_back(ns); }
106+
99107
virtual void print() const;
100108

101109
private:
102110
static constexpr double infTime = 1e99;
103111
bool mIsContinuous = false; ///< flag for continuous simulation
104112
float mNoisePerPixel = 1.e-8; ///< ALPIDE Noise per chip
105-
int mROFrameLengthInBC = 0; ///< ROF length in BC for continuos mode
113+
int mROFrameLengthInBC = 0; ///< ROF length in BC for continuous mode
106114
float mROFrameLength = 0; ///< length of RO frame in ns
107115
float mStrobeDelay = 0.; ///< strobe start (in ns) wrt ROF start
108116
float mStrobeLength = 0; ///< length of the strobe in ns (sig. over threshold checked in this window only)
@@ -115,17 +123,24 @@ class DigiParams
115123

116124
float mVbb = 0.0; ///< back bias absolute value for MFT (in Volt)
117125
float mIBVbb = 0.0; ///< back bias absolute value for ITS Inner Barrel (in Volt)
118-
float mOBVbb = 0.0; ///< back bias absolute value for ITS Outter Barrel (in Volt)
126+
float mOBVbb = 0.0; ///< back bias absolute value for ITS Outer Barrel (in Volt)
127+
128+
std::vector<int> mROFrameLayerLengthInBC; ///< staggering ROF length in BC for continuous mode per layer
129+
std::vector<int> mROFrameLayerBiasInBC; ///< staggering ROF bias in BC for continuous mode per layer
130+
std::vector<float> mROFrameLayerLength; ///< staggering ROF length in ns for continuous mode per layer
131+
std::vector<float> mStrobeLayerLength; ///< staggering length of the strobe in ns (sig. over threshold checked in this window only)
132+
std::vector<float> mStrobeLayerDelay; ///< staggering delay of the strobe in ns
119133

120134
o2::itsmft::AlpideSignalTrapezoid mSignalShape; ///< signal timeshape parameterization
121135

122136
const o2::itsmft::AlpideSimResponse* mAlpSimResponse = nullptr; //!< pointer on external response
123137

124138
// auxiliary precalculated parameters
125-
float mROFrameLengthInv = 0; ///< inverse length of RO frame in ns
126-
float mNSimStepsInv = 0; ///< its inverse
139+
float mROFrameLengthInv = 0; ///< inverse length of RO frame in ns
140+
std::vector<float> mROFrameLayerLengthInv; // inverse length of RO frame in ns per layer
141+
float mNSimStepsInv = 0; ///< its inverse
127142

128-
ClassDef(DigiParams, 2);
143+
ClassDef(DigiParams, 3);
129144
};
130145
} // namespace itsmft
131146
} // namespace o2

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,16 @@ class Digitizer : public TObject
4949

5050
public:
5151
Digitizer() = default;
52+
Digitizer(Digitizer&&) = delete;
53+
Digitizer& operator=(Digitizer&&) = delete;
5254
~Digitizer() override = default;
5355
Digitizer(const Digitizer&) = delete;
5456
Digitizer& operator=(const Digitizer&) = delete;
5557

5658
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
5759
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
5860
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
59-
o2::itsmft::DigiParams& getParams() { return (o2::itsmft::DigiParams&)mParams; }
61+
o2::itsmft::DigiParams& getParams() { return mParams; }
6062
const o2::itsmft::DigiParams& getParams() const { return mParams; }
6163
void setNoiseMap(const o2::itsmft::NoiseMap* mp) { mNoiseMap = mp; }
6264
void setDeadChannelsMap(const o2::itsmft::NoiseMap* mp) { mDeadChanMap = mp; }
@@ -67,17 +69,17 @@ class Digitizer : public TObject
6769
auto getChipResponse(int chipID);
6870

6971
/// Steer conversion of hits to digits
70-
void process(const std::vector<Hit>* hits, int evID, int srcID);
71-
void setEventTime(const o2::InteractionTimeRecord& irt);
72+
void process(const std::vector<Hit>* hits, int evID, int srcID, int layer = -1);
73+
void setEventTime(const o2::InteractionTimeRecord& irt, int layer = -1);
7274
double getEndTimeOfROFMax() const
7375
{
7476
///< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
75-
return mParams.getROFrameLength() * (mROFrameMax + 1) + mParams.getTimeOffset();
77+
return (mParams.getROFrameLength() * (double)(mROFrameMax + 1)) + mParams.getTimeOffset();
7678
}
7779

7880
void setContinuous(bool v) { mParams.setContinuous(v); }
7981
bool isContinuous() const { return mParams.isContinuous(); }
80-
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
82+
void fillOutputContainer(uint32_t maxFrame = 0xffffffff, int layer = -1);
8183

8284
void setDigiParams(const o2::itsmft::DigiParams& par) { mParams = par; }
8385
const o2::itsmft::DigiParams& getDigitParams() const { return mParams; }
@@ -92,11 +94,17 @@ class Digitizer : public TObject
9294
mEventROFrameMin = 0xffffffff;
9395
mEventROFrameMax = 0;
9496
}
97+
void resetROFrameBounds()
98+
{
99+
mROFrameMin = 0;
100+
mROFrameMax = 0;
101+
mNewROFrame = 0;
102+
}
95103

96104
private:
97-
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);
105+
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID, int lay);
98106
void registerDigits(ChipDigitsContainer& chip, uint32_t roFrame, float tInROF, int nROF,
99-
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl);
107+
uint16_t row, uint16_t col, int nEle, o2::MCCompLabel& lbl, int lay);
100108

101109
ExtraDig* getExtraDigBuffer(uint32_t roFrame)
102110
{
@@ -115,7 +123,7 @@ class Digitizer : public TObject
115123
o2::itsmft::DigiParams mParams; ///< digitization parameters
116124
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
117125
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
118-
double mCollisionTimeWrtROF;
126+
double mCollisionTimeWrtROF{};
119127
uint32_t mROFrameMin = 0; ///< lowest RO frame of current digits
120128
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
121129
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time

0 commit comments

Comments
 (0)