Skip to content

Commit 6d555e5

Browse files
committed
ALICE3-TRK: added possibility to use a local response file during digitization
1 parent 9ca7f3a commit 6d555e5

File tree

5 files changed

+58
-8
lines changed

5 files changed

+58
-8
lines changed

Detectors/Upgrades/ALICE3/TRK/base/include/TRKBase/Specs.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ constexpr double responseYShift{15.5 * mu};
131131
constexpr double thickness{45 * mu};
132132
} // namespace apts
133133

134+
namespace alice3resp /// parameters for the alice3 chip response
135+
{
136+
constexpr double pitchX{10.0 * mu};
137+
constexpr double pitchZ{10.0 * mu};
138+
constexpr double responseYShift{5 * mu}; /// center of the epitaxial layer
139+
constexpr double thickness{20 * mu};
140+
} // namespace alice3resp
141+
134142
} // namespace o2::trk::constants
135143

136144
#endif

Detectors/Upgrades/ALICE3/TRK/simulation/include/TRKSimulation/Digitizer.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Digitizer
4545
void setDigits(std::vector<o2::itsmft::Digit>* dig) { mDigits = dig; }
4646
void setMCLabels(o2::dataformats::MCTruthContainer<o2::MCCompLabel>* mclb) { mMCLabels = mclb; }
4747
void setROFRecords(std::vector<o2::itsmft::ROFRecord>* rec) { mROFRecords = rec; }
48+
void setResponseName(const std::string& name) { mRespName = name; }
4849

4950
o2::trk::DigiParams& getParams() { return (o2::trk::DigiParams&)mParams; }
5051
const o2::trk::DigiParams& getParams() const { return mParams; }
@@ -136,6 +137,8 @@ class Digitizer
136137
uint32_t mROFrameMax = 0; ///< highest RO frame of current digits
137138
uint32_t mNewROFrame = 0; ///< ROFrame corresponding to provided time
138139

140+
bool mIsBeforeFirstRO = false;
141+
139142
uint32_t mEventROFrameMin = 0xffffffff; ///< lowest RO frame for processed events (w/o automatic noise ROFs)
140143
uint32_t mEventROFrameMax = 0; ///< highest RO frame forfor processed events (w/o automatic noise ROFs)
141144

@@ -145,6 +148,8 @@ class Digitizer
145148
const o2::trk::ChipSimResponse* mChipSimRespVD = nullptr; // simulated response for VD chips
146149
const o2::trk::ChipSimResponse* mChipSimRespMLOT = nullptr; // simulated response for ML/OT chips
147150

151+
std::string mRespName; /// APTS or ALICE3, depending on the response to be used
152+
148153
bool mSimRespOrientation{false}; // wether the orientation in the response function is flipped
149154
float mSimRespVDShift{0.f}; // adjusting the Y-shift in the APTS response function to match sensor local coord.
150155
float mSimRespVDScaleX{1.f}; // scale x-local coordinate to response function x-coordinate

Detectors/Upgrades/ALICE3/TRK/simulation/src/DigiParams.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ void DigiParams::print() const
7474

7575
void DigiParams::setAlpSimResponse(const o2::itsmft::AlpideSimResponse* resp)
7676
{
77+
LOG(debug) << "Response function data path: " << resp->getDataPath();
78+
LOG(debug) << "Response function info: ";
79+
// resp->print();
7780
if (!resp) {
7881
LOGP(fatal, "cannot set response function from null");
7982
}

Detectors/Upgrades/ALICE3/TRK/simulation/src/Digitizer.cxx

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void Digitizer::init()
4949
}
5050
}
5151

52-
// setting the correct response function (for the moment, for both VD and MLOT the APTS response function is udes)
52+
// setting the correct response function (for the moment, for both VD and MLOT the same response function is used)
5353
mChipSimResp = mParams.getAlpSimResponse();
5454
mChipSimRespVD = mChipSimResp; /// for the moment considering the same response
5555
mChipSimRespMLOT = mChipSimResp; /// for the moment considering the same response
@@ -65,11 +65,24 @@ void Digitizer::init()
6565
float thicknessVD = 0.0095; // cm --- hardcoded based on geometry currently present
6666
float thicknessMLOT = o2::trk::SegmentationChip::SiliconThicknessMLOT; // 0.01 cm = 100 um --- based on geometry currently present
6767

68-
mSimRespVDScaleX = o2::trk::constants::apts::pitchX / o2::trk::SegmentationChip::PitchRowVD;
69-
mSimRespVDScaleZ = o2::trk::constants::apts::pitchZ / o2::trk::SegmentationChip::PitchColVD;
70-
mSimRespVDShift = mChipSimRespVD->getDepthMax(); // the curved, rescaled, sensors have a width from 0 to -45. Must add 10 um (= max depth) to match the APTS response.
71-
mSimRespMLOTScaleX = o2::trk::constants::apts::pitchX / o2::trk::SegmentationChip::PitchRowMLOT;
72-
mSimRespMLOTScaleZ = o2::trk::constants::apts::pitchZ / o2::trk::SegmentationChip::PitchColMLOT;
68+
LOG(info) << "Using response name: " << mRespName;
69+
70+
if (mRespName == "APTS") {
71+
mSimRespVDScaleX = o2::trk::constants::apts::pitchX / o2::trk::SegmentationChip::PitchRowVD;
72+
mSimRespVDScaleZ = o2::trk::constants::apts::pitchZ / o2::trk::SegmentationChip::PitchColVD;
73+
mSimRespVDShift = mChipSimRespVD->getDepthMax(); // the curved, rescaled, sensors have a width from 0 to -45. Must add ~10 um (= max depth) to match the APTS response.
74+
mSimRespMLOTScaleX = o2::trk::constants::apts::pitchX / o2::trk::SegmentationChip::PitchRowMLOT;
75+
mSimRespMLOTScaleZ = o2::trk::constants::apts::pitchZ / o2::trk::SegmentationChip::PitchColMLOT;
76+
} else if (mRespName == "ALICE3") {
77+
mSimRespVDScaleX = o2::trk::constants::alice3resp::pitchX / o2::trk::SegmentationChip::PitchRowVD;
78+
mSimRespVDScaleZ = o2::trk::constants::alice3resp::pitchZ / o2::trk::SegmentationChip::PitchColVD;
79+
mSimRespVDShift = mChipSimRespVD->getDepthMax(); // the curved, rescaled, sensors have a width from 0 to -95 um. Must align the start of epi layer with the response function.
80+
mSimRespMLOTScaleX = o2::trk::constants::alice3resp::pitchX / o2::trk::SegmentationChip::PitchRowMLOT;
81+
mSimRespMLOTScaleZ = o2::trk::constants::alice3resp::pitchZ / o2::trk::SegmentationChip::PitchColMLOT;
82+
} else {
83+
LOG(fatal) << "Unknown response name: " << mRespName;
84+
}
85+
7386
mSimRespMLOTShift = mChipSimRespMLOT->getDepthMax() - thicknessMLOT / 2.f; // the shift should be done considering the rescaling done to adapt to the wrong silicon thickness. TODO: remove the scaling factor for the depth when the silicon thickness match the simulated response
7487
mSimRespOrientation = false;
7588

Steer/DigitizerWorkflow/src/TRKDigitizerSpec.cxx

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer
6868
void initDigitizerTask(framework::InitContext& ic) override
6969
{
7070
mDisableQED = ic.options().get<bool>("disable-qed");
71+
mLocalRespFile = ic.options().get<std::string>("local-response-file");
7172
}
7273

7374
void run(framework::ProcessingContext& pc)
@@ -200,6 +201,15 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer
200201
mFinished = true;
201202
}
202203

204+
void setLocalResponseFunction()
205+
{
206+
auto file = TFile::Open(mLocalRespFile.data());
207+
if (!file) {
208+
LOG(fatal) << "Cannot open response file " << mLocalRespFile;
209+
}
210+
mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)file->Get("response1"));
211+
}
212+
203213
void updateTimeDependentParams(ProcessingContext& pc)
204214
{
205215
static bool initOnce{false};
@@ -267,14 +277,23 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer
267277
// }
268278
if (matcher == ConcreteDataMatcher(mOrigin, "APTSRESP", 0)) {
269279
LOG(info) << mID.getName() << " loaded APTSResponseData";
270-
mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)obj);
280+
if (mLocalRespFile.empty()) {
281+
LOG(info) << "Using CCDB/APTS response file";
282+
mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)obj);
283+
mDigitizer.setResponseName("APTS");
284+
} else {
285+
LOG(info) << "Response function will be loaded from local file: " << mLocalRespFile;
286+
setLocalResponseFunction();
287+
mDigitizer.setResponseName("ALICE3");
288+
}
271289
}
272290
}
273291

274292
private:
275293
bool mWithMCTruth{true};
276294
bool mFinished{false};
277295
bool mDisableQED{false};
296+
std::string mLocalRespFile{""};
278297
const o2::detectors::DetID mID{o2::detectors::DetID::TRK};
279298
const o2::header::DataOrigin mOrigin{o2::header::gDataOriginTRK};
280299
o2::trk::Digitizer mDigitizer{};
@@ -307,7 +326,9 @@ DataProcessorSpec getTRKDigitizerSpec(int channel, bool mctruth)
307326
return DataProcessorSpec{detStr + "Digitizer",
308327
inputs, makeOutChannels(detOrig, mctruth),
309328
AlgorithmSpec{adaptFromTask<TRKDPLDigitizerTask>(mctruth)},
310-
Options{{"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}}};
329+
Options{
330+
{"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}},
331+
{"local-response-file", o2::framework::VariantType::String, "", {"use response file saved locally at this path/filename"}}}};
311332
}
312333

313334
} // namespace o2::trk

0 commit comments

Comments
 (0)