Skip to content

Commit a290d1e

Browse files
committed
ITS3: Digitizer option to pick response function
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 89508a8 commit a290d1e

File tree

3 files changed

+56
-23
lines changed

3 files changed

+56
-23
lines changed

Detectors/Upgrades/ITS3/base/include/ITS3Base/ITS3Params.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ struct ITS3Params : public o2::conf::ConfigurableParamHelper<ITS3Params> {
2525
bool misalignmentHitsUseProp{false}; // Use propagtor for mis-alignment
2626
std::string globalGeoMisAlignerMacro{"${O2_ROOT}/share/macro/MisAlignGeoITS3.C"}; // Path to macro for global geometry mis-alignment
2727
// Chip studies
28-
bool useDeadChannelMap{false}; // Query for a dead channel map to study disabling individual tiles
28+
bool useDeadChannelMap{false}; // Query for a dead channel map to study disabling individual tiles
29+
std::string chipResponseFunction{"APTS"}; // Chip response function one of "Alpide", "APTS" or "Mosaix" (not yet available)
30+
std::string responseFunctionIB{"response0"}; // Chip response function name for IB
31+
std::string responseFunctionOB{"response1"}; // Chip response function name for 0B
2932

3033
O2ParamDef(ITS3Params, "ITS3Params");
3134
};

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/Digitizer.h

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
#include <deque>
1919
#include <memory>
2020

21-
#include "Rtypes.h" // for Digitizer::Class
22-
#include "TObject.h" // for TObject
21+
#include "Rtypes.h"
22+
#include "TObject.h"
2323

2424
#include "ITSMFTSimulation/ChipDigitsContainer.h"
2525
#include "ITSMFTSimulation/AlpideSimResponse.h"
26-
#include "ITSMFTSimulation/DigiParams.h"
2726
#include "ITSMFTSimulation/Hit.h"
2827
#include "ITSBase/GeometryTGeo.h"
2928
#include "ITS3Base/SegmentationSuperAlpide.h"
29+
#include "ITS3Simulation/DigiParams.h"
3030
#include "DataFormatsITSMFT/Digit.h"
3131
#include "DataFormatsITSMFT/ROFRecord.h"
3232
#include "CommonDataFormat/InteractionRecord.h"
@@ -35,6 +35,7 @@
3535

3636
namespace o2::its3
3737
{
38+
3839
class Digitizer : public TObject
3940
{
4041
using ExtraDig = std::vector<itsmft::PreDigitLabelRef>; ///< container for extra contributions to PreDigits
@@ -44,8 +45,8 @@ class Digitizer : public TObject
4445
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
4546
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
4647

47-
o2::itsmft::DigiParams& getParams() { return (o2::itsmft::DigiParams&)mParams; }
48-
const o2::itsmft::DigiParams& getParams() const { return mParams; }
48+
o2::its3::DigiParams& getParams() { return mParams; }
49+
const o2::its3::DigiParams& getParams() const { return mParams; }
4950

5051
void init();
5152

@@ -62,9 +63,6 @@ class Digitizer : public TObject
6263
bool isContinuous() const { return mParams.isContinuous(); }
6364
void fillOutputContainer(uint32_t maxFrame = 0xffffffff);
6465

65-
void setDigiParams(const o2::itsmft::DigiParams& par) { mParams = par; }
66-
const o2::itsmft::DigiParams& getDigitParams() const { return mParams; }
67-
6866
// provide the common itsmft::GeometryTGeo to access matrices and segmentation
6967
void setGeometry(const o2::its::GeometryTGeo* gm) { mGeometry = gm; }
7068

@@ -97,7 +95,7 @@ class Digitizer : public TObject
9795

9896
static constexpr float sec2ns = 1e9;
9997

100-
o2::itsmft::DigiParams mParams; ///< digitization parameters
98+
o2::its3::DigiParams mParams; ///< digitization parameters
10199
o2::InteractionTimeRecord mEventTime; ///< global event time and interaction record
102100
o2::InteractionRecord mIRFirstSampledTF; ///< IR of the 1st sampled IR, noise-only ROFs will be inserted till this IR only
103101
double mCollisionTimeWrtROF{};
@@ -110,7 +108,10 @@ class Digitizer : public TObject
110108

111109
const std::array<o2::its3::SegmentationSuperAlpide, 3> mSuperSegmentations{0, 1, 2};
112110

113-
o2::itsmft::AlpideSimResponse* mAlpSimResp = nullptr; // simulated response
111+
o2::itsmft::AlpideSimResponse* mSimRespIB = nullptr; // simulated response for IB
112+
o2::itsmft::AlpideSimResponse* mSimRespOB = nullptr; // simulated response for OB
113+
float mSimRespIBShift{0.}; // adjusting the Y-shift in the IB response function to match sensor local coord.
114+
float mSimRespOBShift{0.}; // adjusting the Y-shift in the OB response function to match sensor local coord.
114115

115116
const o2::its::GeometryTGeo* mGeometry = nullptr; ///< ITS3 geometry
116117

@@ -123,8 +124,9 @@ class Digitizer : public TObject
123124

124125
const o2::itsmft::NoiseMap* mDeadChanMap = nullptr;
125126

126-
ClassDef(Digitizer, 4);
127+
ClassDef(Digitizer, 5);
127128
};
129+
128130
} // namespace o2::its3
129131

130132
#endif /* ALICEO2_ITS3_DIGITIZER_H */

Detectors/Upgrades/ITS3/simulation/src/Digitizer.cxx

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "ITSMFTBase/SegmentationAlpide.h"
1616
#include "ITS3Simulation/Digitizer.h"
17+
#include "ITS3Base/ITS3Params.h"
1718
#include "MathUtils/Cartesian.h"
1819
#include "SimulationDataFormat/MCTruthContainer.h"
1920
#include "DetectorsRaw/HBFUtils.h"
@@ -43,12 +44,39 @@ void Digitizer::init()
4344
}
4445
}
4546

46-
if (mParams.getAlpSimResponse() == nullptr) {
47-
std::string responseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
48-
LOGP(info, "Loading AlpideSimRespnse from file: {}", responseFile);
49-
auto file = TFile::Open(responseFile.data());
50-
mAlpSimResp = (o2::itsmft::AlpideSimResponse*)file->Get("response0"); // We use by default the alpide response for Vbb=0V
51-
mParams.setAlpSimResponse(mAlpSimResp);
47+
if (!mParams.hasResponseFunctions()) {
48+
auto loadSetResponseFunc = [&](const char* fileIB, const char* fileOB, const char* name) {
49+
const auto& nameIB = ITS3Params::Instance().responseFunctionIB;
50+
const auto& nameOB = ITS3Params::Instance().responseFunctionOB;
51+
LOGP(info, "Loading response function for {}: IB={}:{} / OB={}:{}", name, nameIB, fileIB, nameOB, fileOB);
52+
auto fIB = TFile::Open(fileIB);
53+
if (fIB->IsZombie() || !fIB->IsOpen()) {
54+
LOGP(fatal, "Cannot open file {}", fileIB);
55+
}
56+
auto fOB = TFile::Open(fileIB);
57+
if (fOB->IsZombie() || !fOB->IsOpen()) {
58+
LOGP(fatal, "Cannot open file {}", fileOB);
59+
}
60+
mParams.setIBSimResponse(mSimRespIB = fIB->Get<o2::itsmft::AlpideSimResponse>(nameIB.c_str()));
61+
mParams.setOBSimResponse(mSimRespOB = fOB->Get<o2::itsmft::AlpideSimResponse>(nameOB.c_str()));
62+
fIB->Close();
63+
fOB->Close();
64+
};
65+
66+
if (const auto& func = ITS3Params::Instance().chipResponseFunction; func == "Alpide") {
67+
constexpr const char* responseFile = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
68+
loadSetResponseFunc(responseFile, responseFile, "Alpide");
69+
mSimRespIBShift = mSimRespIB->getDepthMax() - SegmentationSuperAlpide::mSensorLayerThickness / 2.f;
70+
mSimRespOBShift = mSimRespOB->getDepthMax() - Segmentation::SensorLayerThickness / 2.f;
71+
} else if (func == "APTS") {
72+
constexpr const char* responseFileIB = "$(O2_ROOT)/share/Detectors/Upgrades/ITS3/data/ITS3ChipResponseData/APTSResponseData.root";
73+
constexpr const char* responseFileOB = "$(O2_ROOT)/share/Detectors/ITSMFT/data/AlpideResponseData/AlpideResponseData.root";
74+
loadSetResponseFunc(responseFileIB, responseFileOB, "APTS");
75+
mSimRespIBShift = mSimRespIB->getDepthMax() - 10.e-4f;
76+
mSimRespOBShift = mSimRespOB->getDepthMax() - Segmentation::SensorLayerThickness / 2.f;
77+
} else {
78+
LOGP(fatal, "ResponseFunction '{}' not implemented!", func);
79+
}
5280
}
5381
mParams.print();
5482
mIRFirstSampledTF = o2::raw::HBFUtils::Instance().getFirstSampledTFIR();
@@ -326,8 +354,8 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
326354
// take into account that the AlpideSimResponse depth defintion has different min/max boundaries
327355
// although the max should coincide with the surface of the epitaxial layer, which in the chip
328356
// local coordinates has Y = +SensorLayerThickness/2
329-
float thickness = innerBarrel ? SegmentationSuperAlpide::mSensorLayerThickness : Segmentation::SensorLayerThickness;
330-
xyzLocS.SetY(xyzLocS.Y() + mAlpSimResp->getDepthMax() - thickness / 2.);
357+
xyzLocS.SetY(xyzLocS.Y() + ((innerBarrel) ? mSimRespIBShift : mSimRespOBShift));
358+
331359
// collect charge in evey pixel which might be affected by the hit
332360
for (int iStep = nSteps; iStep--;) {
333361
// Get the pixel ID
@@ -349,9 +377,9 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, uint32_t& maxFr, int evID
349377
}
350378
bool flipCol = false, flipRow = false;
351379
// note that response needs coordinates along column row (locX) (locZ) then depth (locY)
352-
double rowMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchRow : Segmentation::PitchRow)};
353-
double colMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchCol : Segmentation::PitchCol)};
354-
auto rspmat = mAlpSimResp->getResponse(xyzLocS.X() - cRowPix, xyzLocS.Z() - cColPix, xyzLocS.Y(), flipRow, flipCol, rowMax, colMax);
380+
float rowMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchRow : Segmentation::PitchRow)};
381+
float colMax{0.5f * (innerBarrel ? SegmentationSuperAlpide::mPitchCol : Segmentation::PitchCol)};
382+
auto rspmat = ((innerBarrel) ? mSimRespIB : mSimRespOB)->getResponse(xyzLocS.X() - cRowPix, xyzLocS.Z() - cColPix, xyzLocS.Y(), flipRow, flipCol, rowMax, colMax);
355383

356384
xyzLocS += step;
357385
if (rspmat == nullptr) {

0 commit comments

Comments
 (0)