@@ -54,6 +54,10 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
5454 void initDigitizerTask (framework::InitContext& ic) override
5555 {
5656 mDisableQED = ic.options ().get <bool >(" disable-qed" );
57+ mEnableResponseFiles = ic.options ().get <bool >(" enable-response-files" );
58+ mLocalEfficiencyFile = ic.options ().get <std::string>(" local-efficiency-file" );
59+ mLocalTimeResoFile = ic.options ().get <std::string>(" local-timereso-file" );
60+ mLocalToAFile = ic.options ().get <std::string>(" local-toa-file" );
5761
5862 auto geom = GeometryTGeo::Instance ();
5963 geom->fillMatrixCache (o2::math_utils::bit2Mask (o2::math_utils::TransformType::L2G )); // make sure L2G matrices are loaded
@@ -163,10 +167,34 @@ class IOTOFDPLDigitizerTask : o2::base::BaseDPLDigitizer
163167 mFinished = true ;
164168 }
165169
170+ void finaliseCCDB (ConcreteDataMatcher& matcher, void * obj)
171+ {
172+ if (!mEnableResponseFiles ) {
173+ return ;
174+ }
175+ if (matcher == ConcreteDataMatcher (mOrigin , " MADPIXEFF" , 0 )) {
176+ if (mLocalEfficiencyFile .empty ()) {
177+ LOG (info) << " Using CCDB/MADPIX efficiency file" ;
178+ mDigitizer .loadEfficiencyMap ((const TH2D *)obj);
179+ } else {
180+ LOG (info) << " Response function will be loaded from local file: " << mLocalEfficiencyFile ;
181+ std::unique_ptr<TFile> file (TFile::Open (mLocalEfficiencyFile .data (), " READ" ));
182+ if (!file) {
183+ LOG (fatal) << " Cannot open response file " << mLocalEfficiencyFile .data ();
184+ }
185+ mDigitizer .loadEfficiencyMap ((const TH2D *)file->Get (" hEfficiencyMap" ));
186+ }
187+ }
188+ }
189+
166190 private:
167191 bool mDisableQED = false ;
192+ bool mEnableResponseFiles = false ;
168193 bool mWithMCTruth {true };
169194 bool mFinished {false };
195+ std::string mLocalEfficiencyFile {" " };
196+ std::string mLocalTimeResoFile {" " };
197+ std::string mLocalToAFile {" " };
170198 unsigned long mFirstOrbitTF = 0x0 ;
171199 const o2::detectors::DetID mID {o2::detectors::DetID::TF3 };
172200 const o2::header::DataOrigin mOrigin {o2::header::gDataOriginTF3 };
@@ -197,7 +225,9 @@ o2::framework::DataProcessorSpec getIOTOFDigitizerSpec(int channel, bool mctruth
197225{
198226 std::vector<o2::framework::InputSpec> inputs;
199227 inputs.emplace_back (" collisioncontext" , " SIM" , " COLLISIONCONTEXT" , static_cast <o2::header::DataHeader::SubSpecificationType>(channel), o2::framework::Lifetime::Timeframe);
200- inputs.emplace_back (" IOTOF_aptsresp" , " TF3" , " APTSRESP" , 0 , o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec (" IT3/Calib/APTSResponse" ));
228+ inputs.emplace_back (" madpixeff" , " TF3" , " MADPIXEFF" , 0 , o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec (" Users/g/glucia/tmp/ALICE3/IOTOF/pixelEfficiency" ));
229+ inputs.emplace_back (" madpixreso" , " TF3" , " MADPIXRESO" , 0 , o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec (" Users/g/glucia/tmp/ALICE3/IOTOF/pixelResolution" ));
230+ inputs.emplace_back (" madpixtoa" , " TF3" , " MADPIXTOA" , 0 , o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec (" Users/g/glucia/tmp/ALICE3/IOTOF/pixelTimeOfArrival" ));
201231
202232 const std::string detStr = o2::detectors::DetID::getName (o2::detectors::DetID::TF3 );
203233 return o2::framework::DataProcessorSpec{detStr + " Digitizer" ,
@@ -206,7 +236,10 @@ o2::framework::DataProcessorSpec getIOTOFDigitizerSpec(int channel, bool mctruth
206236 o2::framework::AlgorithmSpec{o2::framework::adaptFromTask<IOTOFDPLDigitizerTask>(mctruth)},
207237 o2::framework::Options{
208238 {" disable-qed" , o2::framework::VariantType::Bool, false , {" disable QED handling" }},
209- {" local-response-file" , o2::framework::VariantType::String, " " , {" use response file saved locally at this path/filename" }}}};
239+ {" enable-response-files" , o2::framework::VariantType::Bool, false , {" enable in-pixel response maps from data" }},
240+ {" local-efficiency-file" , o2::framework::VariantType::String, " " , {" use efficiency map saved locally at this path/filename" }},
241+ {" local-timereso-file" , o2::framework::VariantType::String, " " , {" use time resolution map saved locally at this path/filename" }},
242+ {" local-toa-file" , o2::framework::VariantType::String, " " , {" use ToA map saved locally at this path/filename" }}}};
210243}
211244
212245} // namespace o2::iotof
0 commit comments