@@ -192,55 +192,15 @@ std::unique_ptr<TPCFastTransform> TPCFastTransformHelperO2::create(Long_t TimeSt
192192 fastTransform.finishConstruction ();
193193 }
194194
195+ fillSpaceChargeCorrectionFromMap (fastTransform.getCorrection ());
195196 updateCalibration (fastTransform, TimeStamp);
196197
197198 return std::move (fastTransformPtr);
198199}
199200
200- int TPCFastTransformHelperO2::updateCalibration (TPCFastTransform& fastTransform, Long_t TimeStamp, float vDriftFactor, float vDriftRef, float driftTimeOffset )
201+ void TPCFastTransformHelperO2::fillSpaceChargeCorrectionFromMap (TPCFastSpaceChargeCorrection& correction )
201202{
202- // Update the calibration with the new time stamp
203- LOGP (debug, " Updating calibration: timestamp:{} vdriftFactor:{} vdriftRef:{}" , TimeStamp, vDriftFactor, vDriftRef);
204- if (!mIsInitialized ) {
205- init ();
206- }
207-
208- if (TimeStamp < 0 ) {
209- return 0 ;
210- }
211-
212- // search for the calibration database ...
213-
214- auto & detParam = ParameterDetector::Instance ();
215- auto & gasParam = ParameterGas::Instance ();
216- auto & elParam = ParameterElectronics::Instance ();
217- // start the initialization
218-
219- fastTransform.setTimeStamp (TimeStamp);
220- if (vDriftRef == 0 ) {
221- vDriftRef = ParameterGas::Instance ().DriftV ;
222- }
223- const double vDrift = elParam.ZbinWidth * vDriftRef * vDriftFactor; // cm/timebin
224-
225- // fast transform formula:
226- // L = (t-t0)*(mVdrift + mVdriftCorrY*yLab ) + mLdriftCorr
227- // Z = Z(L) + tpcAlignmentZ
228- // spline corrections for xyz
229- // Time-of-flight correction: ldrift += dist-to-vtx*tofCorr
230-
231- const double t0 = (driftTimeOffset + elParam.getAverageShapingTime ()) / elParam.ZbinWidth ;
232-
233- const double vdCorrY = 0 .;
234- const double ldCorr = 0 .;
235- const double tofCorr = 0 .;
236- const double primVtxZ = 0 .;
237-
238- fastTransform.setCalibration (TimeStamp, t0, vDrift, vdCorrY, ldCorr, tofCorr, primVtxZ);
239-
240203 // now calculate correction map: dx,du,dv = ( origTransform() -> x,u,v) - fastTransformNominal:x,u,v
241-
242- TPCFastSpaceChargeCorrection& correction = fastTransform.getCorrection ();
243-
244204 // for the future: switch TOF correction off for a while
245205
246206 if (mCorrectionMap .isInitialized ()) {
@@ -285,7 +245,50 @@ int TPCFastTransformHelperO2::updateCalibration(TPCFastTransform& fastTransform,
285245 } else {
286246 correction.setNoCorrection ();
287247 }
248+ }
249+
250+ int TPCFastTransformHelperO2::updateCalibration (TPCFastTransform& fastTransform, Long_t TimeStamp, float vDriftFactor, float vDriftRef, float driftTimeOffset)
251+ {
252+ // Update the calibration with the new time stamp
253+ LOGP (debug, " Updating calibration: timestamp:{} vdriftFactor:{} vdriftRef:{}" , TimeStamp, vDriftFactor, vDriftRef);
254+ if (!mIsInitialized ) {
255+ init ();
256+ }
257+
258+ if (TimeStamp < 0 ) {
259+ return 0 ;
260+ }
261+
262+ // search for the calibration database ...
263+
264+ auto & detParam = ParameterDetector::Instance ();
265+ auto & gasParam = ParameterGas::Instance ();
266+ auto & elParam = ParameterElectronics::Instance ();
267+ // start the initialization
268+
269+ fastTransform.setTimeStamp (TimeStamp);
270+ if (vDriftRef == 0 ) {
271+ vDriftRef = ParameterGas::Instance ().DriftV ;
272+ }
273+ const double vDrift = elParam.ZbinWidth * vDriftRef * vDriftFactor; // cm/timebin
274+
275+ // fast transform formula:
276+ // L = (t-t0)*(mVdrift + mVdriftCorrY*yLab ) + mLdriftCorr
277+ // Z = Z(L) + tpcAlignmentZ
278+ // spline corrections for xyz
279+ // Time-of-flight correction: ldrift += dist-to-vtx*tofCorr
280+
281+ const double t0 = (driftTimeOffset + elParam.getAverageShapingTime ()) / elParam.ZbinWidth ;
282+
283+ const double vdCorrY = 0 .;
284+ const double ldCorr = 0 .;
285+ const double tofCorr = 0 .;
286+ const double primVtxZ = 0 .;
287+
288+ fastTransform.setCalibration (TimeStamp, t0, vDrift, vdCorrY, ldCorr, tofCorr, primVtxZ);
288289
290+ // The next line should not be needed
291+ // fastTransform.getCorrection().initInverse();
289292 // for the future: set back the time-of-flight correction
290293
291294 return 0 ;
0 commit comments