@@ -73,6 +73,26 @@ void Digitizer::init()
7373 LOG (info) << " No efficiency map provided, using uniform efficiency: " << digitizerParams.efficiency * 100 << " %" ;
7474 }
7575
76+ if (!digitizerParams.resolutionCcdbPath .empty ()) {
77+ LOG (info) << " Loading resolution map from CCDB: " << digitizerParams.resolutionCcdbPath ;
78+ loadMapFromCCDB (mResolutionMap , digitizerParams.resolutionCcdbPath );
79+ } else if (!digitizerParams.resolutionFilePath .empty ()) {
80+ LOG (info) << " Loading resolution map from file: " << digitizerParams.resolutionFilePath ;
81+ loadMap (mResolutionMap , digitizerParams.resolutionFilePath , " hResolutionMap" );
82+ } else {
83+ LOG (info) << " No resolution map provided, using uniform time resolution: " << digitizerParams.timeResolution * 1e3 << " ps" ;
84+ }
85+
86+ if (!digitizerParams.timeOfArrivalCcdbPath .empty ()) {
87+ LOG (info) << " Loading time of arrival map from CCDB: " << digitizerParams.timeOfArrivalCcdbPath ;
88+ loadMapFromCCDB (mTimeOfArrivalMap , digitizerParams.timeOfArrivalCcdbPath );
89+ } else if (!digitizerParams.timeOfArrivalFilePath .empty ()) {
90+ LOG (info) << " Loading time of arrival map from file: " << digitizerParams.timeOfArrivalFilePath ;
91+ loadMap (mTimeOfArrivalMap , digitizerParams.timeOfArrivalFilePath , " hTimeOfArrivalMap" );
92+ } else {
93+ LOG (info) << " No time of arrival map provided" ;
94+ }
95+
7696 sSegmentation = o2::iotof::Segmentation::Instance ();
7797}
7898
@@ -171,6 +191,7 @@ void Digitizer::processHit(const o2::itsmft::Hit& hit, int evID, int srcID)
171191 LOG (debug) << " Hit rejected by efficiency cut at pixel (row,col) = (" << rowIS << " , " << colIS << " )" ;
172192 continue ;
173193 }
194+ double smearedTime = smearTime (hitTimeWrtBC, avgHitLocalX[irow][icol], avgHitLocalZ[irow][icol]);
174195
175196 const int nElectronsSampled = gRandom ->Poisson (electronsPerStep * nEleResp);
176197 // Noise can be added here if needed
@@ -324,12 +345,22 @@ void Digitizer::stepping(const o2::itsmft::Hit& hit, float**& respMatrix, float*
324345}
325346
326347// _______________________________________________________________________
327- double Digitizer::smearTime (double time) const
348+ double Digitizer::smearTime (double time, const float x, const float y ) const
328349{
329350 // Apply Gaussian smearing to simulate detector time resolution
330351 const auto & digitizerParams = o2::iotof::DPLDigitizerParam::Instance ();
352+
353+ float resolutionScaling = 1 .;
354+ if (mResolutionMap ) {
355+ const float minimumResolution = mResolutionMap ->GetMinimum ();
356+ int bin = mResolutionMap ->FindBin (x * o2::iotof::Digitizer::cm2um, y * o2::iotof::Digitizer::cm2um);
357+ resolutionScaling = mResolutionMap ->GetBinContent (bin) / minimumResolution;
358+ LOG (debug) << " Time resolution map check: x=" << x * o2::iotof::Digitizer::cm2um << " , y=" << y * o2::iotof::Digitizer::cm2um << " , bin=" << bin << " , resolution=" << minimumResolution;
359+ LOG (debug) << " Time resolution scaling: " << resolutionScaling;
360+ }
361+
331362 if (digitizerParams.timeResolution > 0 ) {
332- return time + gRandom ->Gaus (0 , digitizerParams.timeResolution );
363+ return time + gRandom ->Gaus (0 , digitizerParams.timeResolution * resolutionScaling );
333364 }
334365 return time;
335366}
0 commit comments