Fix compilation
[u/mrichter/AliRoot.git] / VZERO / AliVZEROReconstructor.cxx
CommitLineData
b0d2c2d3 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19/// //
20/// class for VZERO reconstruction //
21/// //
22///////////////////////////////////////////////////////////////////////////////
23
b44c933e 24#include <TH1F.h>
25#include <TF1.h>
b6fd9c4a 26#include <TParameter.h>
b44c933e 27
35b120ff 28#include "AliRunLoader.h"
2eb38194 29#include "AliRawReader.h"
fe0adf2a 30#include "AliGRPObject.h"
31#include "AliCDBManager.h"
32#include "AliCDBStorage.h"
33#include "AliCDBEntry.h"
b0d2c2d3 34#include "AliVZEROReconstructor.h"
2eb38194 35#include "AliVZERORawStream.h"
b44c933e 36#include "AliVZEROConst.h"
b14e6eb4 37#include "AliESDEvent.h"
a055ee24 38#include "AliVZEROTriggerMask.h"
b090e6a3 39#include "AliESDfriend.h"
40#include "AliESDVZEROfriend.h"
fad64858 41#include "AliVZEROdigit.h"
e58b4e66 42#include "AliVZEROCalibData.h"
75b6bc77 43#include "AliRunInfo.h"
b44c933e 44#include "AliCTPTimeParams.h"
30d5d647 45#include "AliLHCClockPhase.h"
b0d2c2d3 46
b0d2c2d3 47ClassImp(AliVZEROReconstructor)
48
ce7090f5 49//_____________________________________________________________________________
cb2228e6 50AliVZEROReconstructor:: AliVZEROReconstructor(): AliReconstructor(),
fe0adf2a 51 fESDVZERO(0x0),
52 fESD(0x0),
53 fESDVZEROfriend(0x0),
b44c933e 54 fCalibData(NULL),
55 fTimeSlewing(NULL),
fe0adf2a 56 fCollisionMode(0),
dbf24214 57 fBeamEnergy(0.),
58 fDigitsArray(0)
ce7090f5 59{
60 // Default constructor
ce7090f5 61 // Get calibration data
62
b44c933e 63 fCalibData = GetCalibData();
64
65 AliCDBEntry *entry = AliCDBManager::Instance()->Get("GRP/CTP/CTPtiming");
66 if (!entry) AliFatal("CTP timing parameters are not found in OCDB !");
67 AliCTPTimeParams *ctpParams = (AliCTPTimeParams*)entry->GetObject();
68 Float_t l1Delay = (Float_t)ctpParams->GetDelayL1L0()*25.0;
69
7905581c 70 AliCDBEntry *entry1 = AliCDBManager::Instance()->Get("GRP/CTP/TimeAlign");
71 if (!entry1) AliFatal("CTP time-alignment is not found in OCDB !");
72 AliCTPTimeParams *ctpTimeAlign = (AliCTPTimeParams*)entry1->GetObject();
73 l1Delay += ((Float_t)ctpTimeAlign->GetDelayL1L0()*25.0);
74
b44c933e 75 AliCDBEntry *entry2 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeDelays");
76 if (!entry2) AliFatal("VZERO time delays are not found in OCDB !");
77 TH1F *delays = (TH1F*)entry2->GetObject();
78
79 AliCDBEntry *entry3 = AliCDBManager::Instance()->Get("VZERO/Calib/TimeSlewing");
80 if (!entry3) AliFatal("VZERO time slewing function is not found in OCDB !");
81 fTimeSlewing = (TF1*)entry3->GetObject();
82
30d5d647 83 AliCDBEntry *entry4 = AliCDBManager::Instance()->Get("GRP/Calib/LHCClockPhase");
84 if (!entry4) AliFatal("LHC clock-phase shift is not found in OCDB !");
85 AliLHCClockPhase *phase = (AliLHCClockPhase*)entry4->GetObject();
86
b44c933e 87 for(Int_t i = 0 ; i < 64; ++i) {
88 Int_t board = AliVZEROCalibData::GetBoardNumber(i);
89 fTimeOffset[i] = (((Float_t)fCalibData->GetTriggerCountOffset(board)-
90 (Float_t)fCalibData->GetRollOver(board))*25.0+
7905581c 91 fCalibData->GetTimeOffset(i)-
30d5d647 92 l1Delay-
93 phase->GetMeanPhase()+
b44c933e 94 delays->GetBinContent(i+1)+
95 kV0Offset);
96 }
ce7090f5 97}
98
99
100//_____________________________________________________________________________
101AliVZEROReconstructor& AliVZEROReconstructor::operator =
102 (const AliVZEROReconstructor& /*reconstructor*/)
103{
104// assignment operator
105
106 Fatal("operator =", "assignment operator not implemented");
107 return *this;
108}
109
110//_____________________________________________________________________________
111AliVZEROReconstructor::~AliVZEROReconstructor()
112{
113// destructor
44b6212f 114
829852e8 115 if(fESDVZERO)
116 delete fESDVZERO;
117 if(fESDVZEROfriend)
b090e6a3 118 delete fESDVZEROfriend;
829852e8 119 if(fDigitsArray)
dbf24214 120 delete fDigitsArray;
35b120ff 121}
122
123//_____________________________________________________________________________
d76c31f4 124void AliVZEROReconstructor::Init()
35b120ff 125{
ef314913 126// initializer
ce7090f5 127
35b120ff 128 fESDVZERO = new AliESDVZERO;
b090e6a3 129 fESDVZEROfriend = new AliESDVZEROfriend;
fe0adf2a 130
131 GetCollisionMode(); // fCollisionMode =1 for Pb-Pb simulated data
35b120ff 132}
133
134//______________________________________________________________________
2e0ee64a 135void AliVZEROReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
35b120ff 136{
75b6bc77 137// converts RAW to digits
ef314913 138
2e0ee64a 139 if (!digitsTree) {
140 AliError("No digits tree!");
141 return;
142 }
35b120ff 143
dbf24214 144 if (!fDigitsArray)
145 fDigitsArray = new TClonesArray("AliVZEROdigit", 64);
146 digitsTree->Branch("VZERODigit", &fDigitsArray);
2e0ee64a 147
b090e6a3 148 fESDVZEROfriend->Reset();
149
2e0ee64a 150 rawReader->Reset();
151 AliVZERORawStream rawStream(rawReader);
75b6bc77 152 if (rawStream.Next()) {
1d51e5e5 153
154 Int_t aBBflagsV0A = 0;
155 Int_t aBBflagsV0C = 0;
156 Int_t aBGflagsV0A = 0;
157 Int_t aBGflagsV0C = 0;
158
159 for(Int_t iChannel=0; iChannel < 64; ++iChannel) {
160 Int_t offlineCh = rawStream.GetOfflineChannel(iChannel);
161 // ADC charge samples
162 Short_t chargeADC[AliVZEROdigit::kNClocks];
163 for(Int_t iClock=0; iClock < AliVZEROdigit::kNClocks; ++iClock) {
164 chargeADC[iClock] = rawStream.GetPedestal(iChannel,iClock);
165 }
166 // Integrator flag
167 Bool_t integrator = rawStream.GetIntegratorFlag(iChannel,AliVZEROdigit::kNClocks/2);
168 // Beam-beam and beam-gas flags
169 if(offlineCh<32) {
170 if (rawStream.GetBBFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBBflagsV0C |= (1 << offlineCh);
171 if (rawStream.GetBGFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBGflagsV0C |= (1 << offlineCh);
172 } else {
173 if (rawStream.GetBBFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBBflagsV0A |= (1 << (offlineCh-32));
174 if (rawStream.GetBGFlag(iChannel,AliVZEROdigit::kNClocks/2)) aBGflagsV0A |= (1 << (offlineCh-32));
175 }
176 // HPTDC data (leading time and width)
177 Int_t board = AliVZEROCalibData::GetBoardNumber(offlineCh);
178 Float_t time = rawStream.GetTime(iChannel)*fCalibData->GetTimeResolution(board);
179 Float_t width = rawStream.GetWidth(iChannel)*fCalibData->GetWidthResolution(board);
180 // Add a digit
181 if(!fCalibData->IsChannelDead(iChannel)){
182 new ((*fDigitsArray)[fDigitsArray->GetEntriesFast()])
b47d88ce 183 AliVZEROdigit(offlineCh, time,
1d51e5e5 184 width,integrator,
185 chargeADC);
186 }
187
188 // Filling the part of esd friend object that is available only for raw data
189 fESDVZEROfriend->SetBBScalers(offlineCh,rawStream.GetBBScalers(iChannel));
190 fESDVZEROfriend->SetBGScalers(offlineCh,rawStream.GetBGScalers(iChannel));
191 for (Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++) {
192 fESDVZEROfriend->SetChargeMB(offlineCh,iBunch,rawStream.GetChargeMB(iChannel,iBunch));
193 fESDVZEROfriend->SetIntMBFlag(offlineCh,iBunch,rawStream.GetIntMBFlag(iChannel,iBunch));
194 fESDVZEROfriend->SetBBMBFlag(offlineCh,iBunch,rawStream.GetBBMBFlag(iChannel,iBunch));
195 fESDVZEROfriend->SetBGMBFlag(offlineCh,iBunch,rawStream.GetBGMBFlag(iChannel,iBunch));
196 }
197
198 }
199
200 // Filling the global part of esd friend object that is available only for raw data
201 fESDVZEROfriend->SetTriggerInputs(rawStream.GetTriggerInputs());
202 fESDVZEROfriend->SetTriggerInputsMask(rawStream.GetTriggerInputsMask());
203
204 for(Int_t iScaler = 0; iScaler < AliESDVZEROfriend::kNScalers; iScaler++)
205 fESDVZEROfriend->SetTriggerScalers(iScaler,rawStream.GetTriggerScalers(iScaler));
206
207 for(Int_t iBunch = 0; iBunch < AliESDVZEROfriend::kNBunches; iBunch++)
208 fESDVZEROfriend->SetBunchNumbersMB(iBunch,rawStream.GetBunchNumbersMB(iBunch));
b090e6a3 209
1d51e5e5 210 // Store the BB and BG flags in the digits tree (user info)
211 digitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0A",aBBflagsV0A));
212 digitsTree->GetUserInfo()->Add(new TParameter<int>("BBflagsV0C",aBBflagsV0C));
213 digitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0A",aBGflagsV0A));
214 digitsTree->GetUserInfo()->Add(new TParameter<int>("BGflagsV0C",aBGflagsV0C));
b090e6a3 215
1d51e5e5 216 digitsTree->Fill();
2e0ee64a 217 }
dbf24214 218
219 fDigitsArray->Clear();
1d51e5e5 220}
2e0ee64a 221
222//______________________________________________________________________
223void AliVZEROReconstructor::FillESD(TTree* digitsTree, TTree* /*clustersTree*/,
b14e6eb4 224 AliESDEvent* esd) const
2e0ee64a 225{
75b6bc77 226// fills multiplicities to the ESD - pedestal is now subtracted
fe0adf2a 227
2e0ee64a 228 if (!digitsTree) {
fe0adf2a 229 AliError("No digits tree!");
230 return;
2e0ee64a 231 }
a055ee24 232
2e0ee64a 233 TBranch* digitBranch = digitsTree->GetBranch("VZERODigit");
dbf24214 234 digitBranch->SetAddress(&fDigitsArray);
35b120ff 235
44b6212f 236 Float_t mult[64];
db0db003 237 Float_t adc[64];
238 Float_t time[64];
239 Float_t width[64];
b6fd9c4a 240 Bool_t aBBflag[64];
241 Bool_t aBGflag[64];
d0502ab2 242
35b120ff 243 for (Int_t i=0; i<64; i++){
db0db003 244 adc[i] = 0.0;
d0502ab2 245 mult[i] = 0.0;
b44c933e 246 time[i] = kInvalidTime;
db0db003 247 width[i] = 0.0;
b6fd9c4a 248 aBBflag[i] = kFALSE;
249 aBGflag[i] = kFALSE;
a055ee24 250 }
35b120ff 251
b6fd9c4a 252 Int_t aBBflagsV0A = 0;
253 Int_t aBBflagsV0C = 0;
254 Int_t aBGflagsV0A = 0;
255 Int_t aBGflagsV0C = 0;
256
257 if (digitsTree->GetUserInfo()->FindObject("BBflagsV0A")) {
258 aBBflagsV0A = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BBflagsV0A"))->GetVal();
259 }
260 else
261 AliWarning("V0A beam-beam flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!");
262
263 if (digitsTree->GetUserInfo()->FindObject("BBflagsV0C")) {
264 aBBflagsV0C = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BBflagsV0C"))->GetVal();
265 }
266 else
267 AliWarning("V0C beam-beam flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!");
268
269 if (digitsTree->GetUserInfo()->FindObject("BGflagsV0A")) {
270 aBGflagsV0A = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BGflagsV0A"))->GetVal();
271 }
272 else
273 AliWarning("V0A beam-gas flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!");
274
275 if (digitsTree->GetUserInfo()->FindObject("BGflagsV0C")) {
276 aBGflagsV0C = ((TParameter<int>*)digitsTree->GetUserInfo()->FindObject("BGflagsV0C"))->GetVal();
277 }
278 else
279 AliWarning("V0C beam-gas flags not found in digits tree UserInfo! The flags will not be written to the raw-data stream!");
280
1d51e5e5 281 // Beam-beam and beam-gas flags (hardware)
282 for (Int_t iChannel = 0; iChannel < 64; ++iChannel) {
283 if(iChannel < 32) {
284 aBBflag[iChannel] = (aBBflagsV0C >> iChannel) & 0x1;
285 aBGflag[iChannel] = (aBGflagsV0C >> iChannel) & 0x1;
286 }
287 else {
288 aBBflag[iChannel] = (aBBflagsV0A >> (iChannel-32)) & 0x1;
289 aBGflag[iChannel] = (aBGflagsV0A >> (iChannel-32)) & 0x1;
290 }
291 }
b6fd9c4a 292
2e0ee64a 293 Int_t nEntries = (Int_t)digitsTree->GetEntries();
35b120ff 294 for (Int_t e=0; e<nEntries; e++) {
2e0ee64a 295 digitsTree->GetEvent(e);
35b120ff 296
dbf24214 297 Int_t nDigits = fDigitsArray->GetEntriesFast();
35b120ff 298
299 for (Int_t d=0; d<nDigits; d++) {
dbf24214 300 AliVZEROdigit* digit = (AliVZEROdigit*) fDigitsArray->At(d);
1d51e5e5 301 Int_t pmNumber = digit->PMNumber();
302
303 // Pedestal retrieval and suppression
304 Bool_t integrator = digit->Integrator();
305 Float_t maxadc = 0;
306 Int_t imax = -1;
307 Float_t adcPedSub[AliVZEROdigit::kNClocks];
308 for(Int_t iClock=0; iClock < AliVZEROdigit::kNClocks; ++iClock) {
309 Short_t charge = digit->ChargeADC(iClock);
310 Bool_t iIntegrator = (iClock%2 == 0) ? integrator : !integrator;
311 Int_t k = pmNumber + 64*iIntegrator;
312 adcPedSub[iClock] = (Float_t)charge - fCalibData->GetPedestal(k);
313 if(adcPedSub[iClock] <= GetRecoParam()->GetNSigmaPed()*fCalibData->GetSigma(k)) {
314 adcPedSub[iClock] = 0;
315 continue;
316 }
317 if(iClock < GetRecoParam()->GetStartClock() || iClock > GetRecoParam()->GetEndClock()) continue;
318 if(adcPedSub[iClock] > maxadc) {
319 maxadc = adcPedSub[iClock];
320 imax = iClock;
321 }
b6fd9c4a 322 }
1d51e5e5 323
324 if (imax != -1) {
325 Int_t start = imax - GetRecoParam()->GetNPreClocks();
326 if (start < 0) start = 0;
327 Int_t end = imax + GetRecoParam()->GetNPostClocks();
328 if (end > 20) end = 20;
329 for(Int_t iClock = start; iClock <= end; iClock++) {
330 adc[pmNumber] += adcPedSub[iClock];
331 }
b6fd9c4a 332 }
333
1d51e5e5 334 // HPTDC leading time and width
335 // Correction for slewing and various time delays
336 time[pmNumber] = CorrectLeadingTime(pmNumber,digit->Time(),adc[pmNumber]);
337 width[pmNumber] = digit->Width();
338
829852e8 339 if (adc[pmNumber] > 0) {
340 AliDebug(1,Form("PM = %d ADC = %f TDC %f (%f) Int %d (%d %d %d %d %d) %f %f %f %f %d %d",pmNumber, adc[pmNumber],
341 digit->Time(),time[pmNumber],
342 integrator,
343 digit->ChargeADC(8),digit->ChargeADC(9),digit->ChargeADC(10),
344 digit->ChargeADC(11),digit->ChargeADC(12),
345 fCalibData->GetPedestal(pmNumber),fCalibData->GetSigma(pmNumber),
346 fCalibData->GetPedestal(pmNumber+64),fCalibData->GetSigma(pmNumber+64),
347 aBBflag[pmNumber],aBGflag[pmNumber]));
348 };
75b6bc77 349
1d51e5e5 350 mult[pmNumber] = adc[pmNumber]*fCalibData->GetMIPperADC(pmNumber);
351
352 // Fill ESD friend object
353 for (Int_t iEv = 0; iEv < AliESDVZEROfriend::kNEvOfInt; iEv++) {
354 fESDVZEROfriend->SetPedestal(pmNumber,iEv,(Float_t)digit->ChargeADC(iEv));
355 fESDVZEROfriend->SetIntegratorFlag(pmNumber,iEv,(iEv%2 == 0) ? integrator : !integrator);
356 fESDVZEROfriend->SetBBFlag(pmNumber,iEv,aBBflag[pmNumber]);
357 fESDVZEROfriend->SetBGFlag(pmNumber,iEv,aBGflag[pmNumber]);
358 }
359 fESDVZEROfriend->SetTime(pmNumber,digit->Time());
360 fESDVZEROfriend->SetWidth(pmNumber,digit->Width());
361
35b120ff 362 } // end of loop over digits
35b120ff 363 } // end of loop over events in digits tree
6c6d6114 364
b44c933e 365 fESDVZERO->SetBit(AliESDVZERO::kCorrectedLeadingTime,kTRUE);
6c6d6114 366 fESDVZERO->SetMultiplicity(mult);
28fdf12c 367 fESDVZERO->SetADC(adc);
368 fESDVZERO->SetTime(time);
d0502ab2 369 fESDVZERO->SetWidth(width);
89a39339 370 fESDVZERO->SetBit(AliESDVZERO::kOnlineBitsFilled,kTRUE);
b6fd9c4a 371 fESDVZERO->SetBBFlag(aBBflag);
372 fESDVZERO->SetBGFlag(aBGflag);
a055ee24 373
b44c933e 374 // now fill the V0 decision and channel flags
375 {
376 AliVZEROTriggerMask triggerMask;
377 triggerMask.FillMasks(fESDVZERO, fCalibData, fTimeSlewing);
378 }
a055ee24 379
2e0ee64a 380 if (esd) {
44b6212f 381 AliDebug(1, Form("Writing VZERO data to ESD tree"));
382 esd->SetVZEROData(fESDVZERO);
2e0ee64a 383 }
b090e6a3 384
385 if (esd) {
fe0adf2a 386 AliESDfriend *fr = (AliESDfriend*)esd->FindListObject("AliESDfriend");
387 if (fr) {
388 AliDebug(1, Form("Writing VZERO friend data to ESD tree"));
389 fr->SetVZEROfriend(fESDVZEROfriend);
b090e6a3 390 }
391 }
dbf24214 392
393 fDigitsArray->Clear();
35b120ff 394}
395
ce7090f5 396//_____________________________________________________________________________
397AliCDBStorage* AliVZEROReconstructor::SetStorage(const char *uri)
398{
ef314913 399// Sets the storage
400
ce7090f5 401 Bool_t deleteManager = kFALSE;
402
403 AliCDBManager *manager = AliCDBManager::Instance();
404 AliCDBStorage *defstorage = manager->GetDefaultStorage();
405
406 if(!defstorage || !(defstorage->Contains("VZERO"))){
407 AliWarning("No default storage set or default storage doesn't contain VZERO!");
408 manager->SetDefaultStorage(uri);
409 deleteManager = kTRUE;
410 }
411
412 AliCDBStorage *storage = manager->GetDefaultStorage();
413
414 if(deleteManager){
44b6212f 415 AliCDBManager::Instance()->UnsetDefaultStorage();
416 defstorage = 0; // the storage is killed by AliCDBManager::Instance()->Destroy()
ce7090f5 417 }
418
419 return storage;
420}
421
fe0adf2a 422//____________________________________________________________________________
423void AliVZEROReconstructor::GetCollisionMode()
424{
75b6bc77 425 // Retrieval of collision mode
fe0adf2a 426
75b6bc77 427 TString beamType = GetRunInfo()->GetBeamType();
fe0adf2a 428 if(beamType==AliGRPObject::GetInvalidString()){
75b6bc77 429 AliError("VZERO cannot retrieve beam type");
fe0adf2a 430 return;
431 }
432
75b6bc77 433 if( (beamType.CompareTo("P-P") ==0) || (beamType.CompareTo("p-p") ==0) ){
434 fCollisionMode=0;
435 }
436 else if( (beamType.CompareTo("Pb-Pb") ==0) || (beamType.CompareTo("A-A") ==0) ){
437 fCollisionMode=1;
fe0adf2a 438 }
fe0adf2a 439
75b6bc77 440 fBeamEnergy = GetRunInfo()->GetBeamEnergy();
fe0adf2a 441 if(fBeamEnergy==AliGRPObject::GetInvalidFloat()) {
75b6bc77 442 AliError("Missing value for the beam energy ! Using 0");
fe0adf2a 443 fBeamEnergy = 0.;
444 }
445
75b6bc77 446 AliDebug(1,Form("\n ++++++ Beam type and collision mode retrieved as %s %d @ %1.3f GeV ++++++\n\n",beamType.Data(), fCollisionMode, fBeamEnergy));
fe0adf2a 447
448}
449
ce7090f5 450//_____________________________________________________________________________
451AliVZEROCalibData* AliVZEROReconstructor::GetCalibData() const
452{
ef314913 453 // Gets calibration object for VZERO set
ce7090f5 454
c0b82b5a 455 AliCDBManager *man = AliCDBManager::Instance();
ce7090f5 456
c0b82b5a 457 AliCDBEntry *entry=0;
458
459 entry = man->Get("VZERO/Calib/Data");
460
c0b82b5a 461 AliVZEROCalibData *calibdata = 0;
462
463 if (entry) calibdata = (AliVZEROCalibData*) entry->GetObject();
94a600a1 464 if (!calibdata) AliFatal("No calibration data from calibration database !");
ce7090f5 465
466 return calibdata;
467}
44b6212f 468
b44c933e 469Float_t AliVZEROReconstructor::CorrectLeadingTime(Int_t i, Float_t time, Float_t adc) const
470{
471 // Correct the leading time
472 // for slewing effect and
473 // misalignment of the channels
474 if (time < 1e-6) return kInvalidTime;
475
476 // Channel alignment and general offset subtraction
477 if (i < 32) time -= kV0CDelayCables;
478 time -= fTimeOffset[i];
479
480 // In case of pathological signals
481 if (adc < 1e-6) return time;
482
483 // Slewing correction
484 Float_t thr = fCalibData->GetDiscriThr(i);
485 time -= fTimeSlewing->Eval(adc/thr);
486
487 return time;
488}