|
34 | 34 | #include <TChain.h> |
35 | 35 | #include <TStopwatch.h> |
36 | 36 |
|
| 37 | +#include <memory> |
37 | 38 | #include <string> |
38 | 39 |
|
39 | 40 | using namespace o2::framework; |
@@ -68,6 +69,7 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer |
68 | 69 | void initDigitizerTask(framework::InitContext& ic) override |
69 | 70 | { |
70 | 71 | mDisableQED = ic.options().get<bool>("disable-qed"); |
| 72 | + mLocalRespFile = ic.options().get<std::string>("local-response-file"); |
71 | 73 | } |
72 | 74 |
|
73 | 75 | void run(framework::ProcessingContext& pc) |
@@ -200,6 +202,15 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer |
200 | 202 | mFinished = true; |
201 | 203 | } |
202 | 204 |
|
| 205 | + void setLocalResponseFunction() |
| 206 | + { |
| 207 | + std::unique_ptr<TFile> file(TFile::Open(mLocalRespFile.data(), "READ")); |
| 208 | + if (!file) { |
| 209 | + LOG(fatal) << "Cannot open response file " << mLocalRespFile; |
| 210 | + } |
| 211 | + mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)file->Get("response1")); |
| 212 | + } |
| 213 | + |
203 | 214 | void updateTimeDependentParams(ProcessingContext& pc) |
204 | 215 | { |
205 | 216 | static bool initOnce{false}; |
@@ -267,14 +278,23 @@ class TRKDPLDigitizerTask : BaseDPLDigitizer |
267 | 278 | // } |
268 | 279 | if (matcher == ConcreteDataMatcher(mOrigin, "APTSRESP", 0)) { |
269 | 280 | LOG(info) << mID.getName() << " loaded APTSResponseData"; |
270 | | - mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)obj); |
| 281 | + if (mLocalRespFile.empty()) { |
| 282 | + LOG(info) << "Using CCDB/APTS response file"; |
| 283 | + mDigitizer.getParams().setAlpSimResponse((const o2::itsmft::AlpideSimResponse*)obj); |
| 284 | + mDigitizer.setResponseName("APTS"); |
| 285 | + } else { |
| 286 | + LOG(info) << "Response function will be loaded from local file: " << mLocalRespFile; |
| 287 | + setLocalResponseFunction(); |
| 288 | + mDigitizer.setResponseName("ALICE3"); |
| 289 | + } |
271 | 290 | } |
272 | 291 | } |
273 | 292 |
|
274 | 293 | private: |
275 | 294 | bool mWithMCTruth{true}; |
276 | 295 | bool mFinished{false}; |
277 | 296 | bool mDisableQED{false}; |
| 297 | + std::string mLocalRespFile{""}; |
278 | 298 | const o2::detectors::DetID mID{o2::detectors::DetID::TRK}; |
279 | 299 | const o2::header::DataOrigin mOrigin{o2::header::gDataOriginTRK}; |
280 | 300 | o2::trk::Digitizer mDigitizer{}; |
@@ -307,7 +327,9 @@ DataProcessorSpec getTRKDigitizerSpec(int channel, bool mctruth) |
307 | 327 | return DataProcessorSpec{detStr + "Digitizer", |
308 | 328 | inputs, makeOutChannels(detOrig, mctruth), |
309 | 329 | AlgorithmSpec{adaptFromTask<TRKDPLDigitizerTask>(mctruth)}, |
310 | | - Options{{"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}}}; |
| 330 | + Options{ |
| 331 | + {"disable-qed", o2::framework::VariantType::Bool, false, {"disable QED handling"}}, |
| 332 | + {"local-response-file", o2::framework::VariantType::String, "", {"use response file saved locally at this path/filename"}}}}; |
311 | 333 | } |
312 | 334 |
|
313 | 335 | } // namespace o2::trk |
0 commit comments