Skip to content

Commit 359fdfd

Browse files
committed
ITSMFT: staggered digitization
Signed-off-by: Felix Schlepper <[email protected]>
1 parent b97cc9a commit 359fdfd

File tree

13 files changed

+470
-390
lines changed

13 files changed

+470
-390
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@
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>
13+
#include "DataFormatsITSMFT/ROFRecord.h"
14+
#include "Framework/Logger.h"
1415
#include "fmt/format.h"
1516

1617
using namespace o2::itsmft;
1718

1819
std::string ROFRecord::asString() const
1920
{
20-
return fmt::format("ROF: {} | {} entries starting from {}", mROFrame, getNEntries(), getFirstEntry());
21+
return fmt::format("ROF: {} | {} entries starting from {} | IR: {}", mROFrame, getNEntries(), getFirstEntry(), mBCData.asString());
2122
}
2223

2324
void ROFRecord::print() const
2425
{
25-
std::cout << this << "\n\t" << mBCData << std::endl;
26+
LOG(info) << asString() << "\n\t" << mBCData;
2627
}
2728

2829
std::ostream& operator<<(std::ostream& stream, ROFRecord const& rec)
@@ -38,7 +39,7 @@ std::string MC2ROFRecord::asString() const
3839

3940
void MC2ROFRecord::print() const
4041
{
41-
std::cout << this << std::endl;
42+
LOG(info) << asString();
4243
}
4344

4445
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: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,35 @@ 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 roFrameLayerRef = -1; ///< staggering reference ROF layer
47+
int roFrameLayerLengthInBC[getNLayers()] = {}; ///< staggering ROF length in BC for continuous mode per layer
48+
int roFrameLayerBiasInBC[getNLayers()] = {}; ///< staggering ROF bias in BC for continuous mode per layer
49+
50+
// test if staggering is on
51+
bool withStaggering() const noexcept { return roFrameLayerRef >= 0; }
52+
// get principal ROF length
53+
int getROFLengthInBC() const noexcept { return (withStaggering()) ? roFrameLayerLengthInBC[roFrameLayerRef] : roFrameLengthInBC; }
54+
// get ROF length for any layer
55+
int getROFLengthInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerLengthInBC[layer] : roFrameLengthInBC; }
56+
int getROFBiasInBC(int layer) const noexcept { return (withStaggering()) ? roFrameLayerBiasInBC[layer] : roFrameBiasInBC; }
57+
int getROFLayerRef() const noexcept { return (withStaggering()) ? roFrameLayerRef : 0; }
4058

4159
// boilerplate stuff + make principal key
4260
O2ParamDef(DPLAlpideParam, getParamName().data());
@@ -46,7 +64,7 @@ struct DPLAlpideParam : public o2::conf::ConfigurableParamHelper<DPLAlpideParam<
4664

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

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 [email protected]
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: 22 additions & 9 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,8 +53,8 @@ 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

5759
void setROFrameLength(float ns);
5860
float getROFrameLength() const { return mROFrameLength; }
@@ -62,13 +64,13 @@ class DigiParams
6264
float getStrobeDelay() const { return mStrobeDelay; }
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 addROFrameLayerLength(float f) { mROFrameLayerLength.push_back(f); }
105+
void addStrobeLength(float ns) { mStrobeLayerLength.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,7 +123,12 @@ 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)
119132

120133
o2::itsmft::AlpideSignalTrapezoid mSignalShape; ///< signal timeshape parameterization
121134

@@ -125,7 +138,7 @@ class DigiParams
125138
float mROFrameLengthInv = 0; ///< inverse length of RO frame in ns
126139
float mNSimStepsInv = 0; ///< its inverse
127140

128-
ClassDef(DigiParams, 2);
141+
ClassDef(DigiParams, 3);
129142
};
130143
} // namespace itsmft
131144
} // namespace o2

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class Digitizer : public TObject
6666
auto getChipResponse(int chipID);
6767

6868
/// Steer conversion of hits to digits
69-
void process(const std::vector<Hit>* hits, int evID, int srcID);
70-
void setEventTime(const o2::InteractionTimeRecord& irt);
69+
void process(const std::vector<Hit>* hits, int evID, int srcID, int layer = -1);
70+
void setEventTime(const o2::InteractionTimeRecord& irt, int layer = -1);
7171
double getEndTimeOfROFMax() const
7272
{
7373
///< return the time corresponding to end of the last reserved ROFrame : mROFrameMax
@@ -76,7 +76,7 @@ class Digitizer : public TObject
7676

7777
void setContinuous(bool v) { mParams.setContinuous(v); }
7878
bool isContinuous() const { return mParams.isContinuous(); }
79-
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
79+
void fillOutputContainer(uint32_t maxFrame = 0xffffffff, int layer = -1);
8080

8181
void setDigiParams(const o2::itsmft::DigiParams& par) { mParams = par; }
8282
const o2::itsmft::DigiParams& getDigitParams() const { return mParams; }
@@ -91,6 +91,12 @@ class Digitizer : public TObject
9191
mEventROFrameMin = 0xffffffff;
9292
mEventROFrameMax = 0;
9393
}
94+
void resetROFrameBounds()
95+
{
96+
mROFrameMin = 0;
97+
mROFrameMax = 0;
98+
mNewROFrame = 0;
99+
}
94100

95101
private:
96102
void processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID, int srcID);

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

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,22 @@ void DigiParams::setChargeThreshold(int v, float frac2Account)
5858
//______________________________________________
5959
void DigiParams::print() const
6060
{
61-
// print settings
62-
printf("Alpide digitization params:\n");
63-
printf("Continuous readout : %s\n", mIsContinuous ? "ON" : "OFF");
64-
printf("Readout Frame Length(ns) : %f\n", mROFrameLength);
65-
printf("Strobe delay (ns) : %f\n", mStrobeDelay);
66-
printf("Strobe length (ns) : %f\n", mStrobeLength);
67-
printf("Threshold (N electrons) : %d\n", mChargeThreshold);
68-
printf("Min N electrons to account : %d\n", mMinChargeToAccount);
69-
printf("Number of charge sharing steps : %d\n", mNSimSteps);
70-
printf("ELoss to N electrons factor : %e\n", mEnergyToNElectrons);
71-
printf("Noise level per pixel : %e\n", mNoisePerPixel);
72-
printf("Charge time-response:\n");
61+
LOGF(info, "Alpide digitization params:");
62+
LOGF(info, "Continuous readout : %s", mIsContinuous ? "ON" : "OFF");
63+
if (withStaggering()) {
64+
for (int i{0}; i < (int)mROFrameLayerLengthInBC.size(); ++i) {
65+
LOGF(info, " Layer:%d Length(ns)[BC] : %f [%d]", i, mROFrameLayerLength[i], mROFrameLayerLengthInBC[i]);
66+
}
67+
} else {
68+
LOGF(info, "Readout Frame Length(ns) : %f", mROFrameLength);
69+
}
70+
LOGF(info, "Strobe delay (ns) : %f", mStrobeDelay);
71+
LOGF(info, "Strobe length (ns) : %f", mStrobeLength);
72+
LOGF(info, "Threshold (N electrons) : %d", mChargeThreshold);
73+
LOGF(info, "Min N electrons to account : %d", mMinChargeToAccount);
74+
LOGF(info, "Number of charge sharing steps : %d", mNSimSteps);
75+
LOGF(info, "ELoss to N electrons factor : %e", mEnergyToNElectrons);
76+
LOGF(info, "Noise level per pixel : %e", mNoisePerPixel);
77+
LOGF(info, "Charge time-response:");
7378
mSignalShape.print();
7479
}

0 commit comments

Comments
 (0)