Skip to content

Commit ac7b071

Browse files
committed
conditional loading of maps + fetch time reso and toa maps
1 parent b399aae commit ac7b071

3 files changed

Lines changed: 40 additions & 29 deletions

File tree

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/include/IOTOFSimulation/Digitizer.h‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ class Digitizer : public TObject
7575
// Provide the common iotof::GeometryTGeo to access matrices and segmentation
7676
void setGeometry(const o2::iotof::GeometryTGeo* gm) { mGeometry = gm; }
7777

78-
void loadEfficiencyMap(const TH2D* map);
79-
80-
void loadResolutionMap(const TH2D* map);
81-
82-
void loadTimeOfArrivalMap(const TH2D* map);
78+
void loadEfficiencyMap(TH2D* map) { mEfficiencyMap = map; }
79+
void loadResolutionMap(TH2D* map) { mResolutionMap = map; }
80+
void loadTimeOfArrivalMap(TH2D* map) { mTimeOfArrivalMap = map; }
8381

8482
void prepareScaledResolutionMap();
8583

‎Detectors/Upgrades/ALICE3/IOTOF/simulation/src/Digitizer.cxx‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -358,25 +358,6 @@ int Digitizer::energyToCharge(float energyLoss) const
358358
}
359359

360360
//_______________________________________________________________________
361-
362-
void Digitizer::loadEfficiencyMap(const TH2D* map)
363-
{
364-
mEfficiencyMap = dynamic_cast<TH2D*>(map->Clone());
365-
mEfficiencyMap->SetDirectory(nullptr);
366-
}
367-
368-
void Digitizer::loadResolutionMap(const TH2D* map)
369-
{
370-
mResolutionMap = dynamic_cast<TH2D*>(map->Clone());
371-
mResolutionMap->SetDirectory(nullptr);
372-
}
373-
374-
void Digitizer::loadTimeOfArrivalMap(const TH2D* map)
375-
{
376-
mTimeOfArrivalMap = dynamic_cast<TH2D*>(map->Clone());
377-
mTimeOfArrivalMap->SetDirectory(nullptr);
378-
}
379-
380361
void Digitizer::prepareScaledResolutionMap()
381362
{
382363
if (!mResolutionMap) {

‎Steer/DigitizerWorkflow/src/IOTOFDigitizerSpec.cxx‎

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
7373
if (mFinished) {
7474
return;
7575
}
76+
77+
if (mEnableResponseFiles) {
78+
pc.inputs().get<TH2D*>("madpixeff");
79+
pc.inputs().get<TH2D*>("madpixreso");
80+
pc.inputs().get<TH2D*>("madpixtoa");
81+
}
82+
7683
mFirstOrbitTF = pc.services().get<o2::framework::TimingInfo>().firstTForbit;
7784
const o2::InteractionRecord firstIR(0, mFirstOrbitTF);
7885

@@ -169,20 +176,45 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
169176

170177
void finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
171178
{
172-
if (!mEnableResponseFiles) {
173-
return;
174-
}
175179
if (matcher == ConcreteDataMatcher(mOrigin, "MADPIXEFF", 0)) {
176180
if (mLocalEfficiencyFile.empty()) {
177181
LOG(info) << "Using CCDB/MADPIX efficiency file";
178-
mDigitizer.loadEfficiencyMap((const TH2D*)obj);
182+
mDigitizer.loadEfficiencyMap((TH2D*)obj);
179183
} else {
180184
LOG(info) << "Response function will be loaded from local file: " << mLocalEfficiencyFile;
181185
std::unique_ptr<TFile> file(TFile::Open(mLocalEfficiencyFile.data(), "READ"));
182186
if (!file) {
183187
LOG(fatal) << "Cannot open response file " << mLocalEfficiencyFile.data();
184188
}
185-
mDigitizer.loadEfficiencyMap((const TH2D*)file->Get("hEfficiencyMap"));
189+
mDigitizer.loadEfficiencyMap((TH2D*)file->Get("hEfficiencyMap"));
190+
}
191+
return;
192+
}
193+
if (matcher == ConcreteDataMatcher(mOrigin, "MADPIXRESO", 0)) {
194+
if (mLocalTimeResoFile.empty()) {
195+
LOG(info) << "Using CCDB/MADPIX time resolution file";
196+
mDigitizer.loadResolutionMap((TH2D*)obj);
197+
} else {
198+
LOG(info) << "Response function will be loaded from local file: " << mLocalTimeResoFile;
199+
std::unique_ptr<TFile> file(TFile::Open(mLocalTimeResoFile.data(), "READ"));
200+
if (!file) {
201+
LOG(fatal) << "Cannot open response file " << mLocalTimeResoFile.data();
202+
}
203+
mDigitizer.loadResolutionMap((TH2D*)file->Get("hSigmaPixel"));
204+
}
205+
return;
206+
}
207+
if (matcher == ConcreteDataMatcher(mOrigin, "MADPIXTOA", 0)) {
208+
if (mLocalToAFile.empty()) {
209+
LOG(info) << "Using CCDB/MADPIX time-of-arrival file";
210+
mDigitizer.loadTimeOfArrivalMap((TH2D*)obj);
211+
} else {
212+
LOG(info) << "Response function will be loaded from local file: " << mLocalToAFile;
213+
std::unique_ptr<TFile> file(TFile::Open(mLocalToAFile.data(), "READ"));
214+
if (!file) {
215+
LOG(fatal) << "Cannot open response file " << mLocalToAFile.data();
216+
}
217+
mDigitizer.loadTimeOfArrivalMap((TH2D*)file->Get("toa_pixel"));
186218
}
187219
}
188220
}

0 commit comments

Comments
 (0)