#include "AliTOFdigit.h"
#include "AliTOFGeometry.h"
#include "AliTOFrawData.h"
-//#include "AliTOFRawStream.h"
+
+#include "AliTOFDeltaBCOffset.h"
+#include "AliTOFCTPLatency.h"
+#include "AliTOFRunParams.h"
//extern TFile *gFile;
ClassImp(AliTOFClusterFinder)
AliTOFClusterFinder::AliTOFClusterFinder(AliTOFcalib *calib):
+ TNamed("AliTOFClusterFinder",""),
fRunLoader(0),
fTOFLoader(0),
fTreeD(0),
// Constructor
//
+ for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=0x0;
+
+ TString validity = (TString)fTOFcalib->GetOfflineValidity();
+ if (validity.CompareTo("valid")==0) {
+ AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
+ } else {
+ AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
+ }
+
}
//______________________________________________________________________________
AliTOFClusterFinder::AliTOFClusterFinder(AliRunLoader* runLoader, AliTOFcalib *calib):
+ TNamed("AliTOFClusterFinder",""),
fRunLoader(runLoader),
fTOFLoader(runLoader->GetLoader("TOFLoader")),
fTreeD(0),
// Constructor
//
+ for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=0x0;
+
+ TString validity = (TString)fTOFcalib->GetOfflineValidity();
+ if (validity.CompareTo("valid")==0) {
+ AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
+ } else {
+ AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
+ }
+
}
//------------------------------------------------------------------------
-AliTOFClusterFinder::AliTOFClusterFinder(const AliTOFClusterFinder &source)
- :TObject(source),
+AliTOFClusterFinder::AliTOFClusterFinder(const AliTOFClusterFinder &source) :
+ TNamed(source),
fRunLoader(0),
fTOFLoader(0),
fTreeD(0),
fTOFRawStream(source.fTOFRawStream)
{
// copy constructor
+
+ for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=source.fTofClusters[ii];
+
}
//------------------------------------------------------------------------
if (this == &source)
return *this;
- TObject::operator=(source);
+ TNamed::operator=(source);
fDigits=source.fDigits;
fRecPoints=source.fRecPoints;
fVerbose=source.fVerbose;
fDecoderVersion=source.fDecoderVersion;
fTOFcalib=source.fTOFcalib;
fTOFRawStream=source.fTOFRawStream;
+ for (Int_t ii=0; ii<kTofMaxCluster; ii++) fTofClusters[ii]=source.fTofClusters[ii];
+
return *this;
}
fRecPoints=0;
}
+ //if (fTofClusters || fNumberOfTofClusters) {
+ if (fNumberOfTofClusters) {
+ for (Int_t ii=0; ii<kTofMaxCluster; ii++) {
+ if (fTofClusters[ii]) fTofClusters[ii]->Delete();
+ delete fTofClusters[ii];
+ }
+ fNumberOfTofClusters=0;
+ }
+
}
//______________________________________________________________________________
fRunLoader->GetEvent(iEvent);
fTreeD = fTOFLoader->TreeD();
- if (fTreeD == 0x0)
- {
- AliFatal("AliTOFClusterFinder: Can not get TreeD");
- }
-
- TBranch *branch = fTreeD->GetBranch("TOF");
- if (!branch) {
- AliError("can't get the branch with the TOF digits !");
+ if (fTreeD == 0x0) {
+ AliFatal("AliTOFClusterFinder: Can not get TreeD");
return;
}
- TClonesArray staticdigits("AliTOFdigit",10000);
- staticdigits.Clear();
- TClonesArray *digits =&staticdigits;
- branch->SetAddress(&digits);
+ fDigits->Clear();
+ fTreeD->GetBranch("TOF")->SetAutoDelete(kFALSE);
+ fTreeD->SetBranchAddress("TOF",&fDigits);
ResetRecpoint();
fTreeR->Branch("TOF", &fRecPoints, bufsize);
fTreeD->GetEvent(0);
- Int_t nDigits = digits->GetEntriesFast();
+ Int_t nDigits = fDigits->GetEntriesFast();
AliDebug(2,Form("Number of TOF digits: %d",nDigits));
Int_t ii;
- Int_t dig[5]; //cluster detector indeces
- Int_t parTOF[5]; //The TOF signal parameters
+ Int_t dig[5]={-1,-1,-1,-1,-1}; //cluster detector indeces
+ Int_t parTOF[7]={0,0,0,0,0,0,0}; //The TOF signal parameters
Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
for (ii=0; ii<nDigits; ii++) {
- AliTOFdigit *d = (AliTOFdigit*)digits->UncheckedAt(ii);
+ AliTOFdigit *d = (AliTOFdigit*)fDigits->UncheckedAt(ii);
dig[0]=d->GetSector();
dig[1]=d->GetPlate();
dig[2]=d->GetStrip();
parTOF[2] = d->GetAdc(); // the adc charge
parTOF[3] = d->GetTdcND(); // non decalibrated sim time
parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
+ parTOF[5] = 0; // deltaBC
+ parTOF[6] = 0; // L0-L1 latency
Double_t posClus[3];
Double_t covClus[6];
UShort_t volIdClus=GetClusterVolIndex(dig);
Int_t inholes = 0;
- /// fRunLoader->GetEvent(iEvent);
-
- if (digitsTree == 0x0)
- {
- AliFatal("AliTOFClusterFinder: Can not get TreeD");
- }
-
- TBranch *branch = digitsTree->GetBranch("TOF");
- if (!branch) {
- AliError("can't get the branch with the TOF digits !");
+ if (digitsTree == 0x0) {
+ AliFatal("AliTOFClusterFinder: Can not get TreeD");
return;
}
- TClonesArray staticdigits("AliTOFdigit",10000);
- staticdigits.Clear();
- TClonesArray *digits = & staticdigits;
- branch->SetAddress(&digits);
+ fDigits->Clear();
+ digitsTree->GetBranch("TOF")->SetAutoDelete(kFALSE);
+ digitsTree->SetBranchAddress("TOF",&fDigits);
ResetRecpoint();
-
- fTreeR=clusterTree;
Int_t bufsize = 32000;
- fTreeR->Branch("TOF", &fRecPoints, bufsize);
+ clusterTree->Branch("TOF", &fRecPoints, bufsize);
digitsTree->GetEvent(0);
- Int_t nDigits = digits->GetEntriesFast();
+ Int_t nDigits = fDigits->GetEntriesFast();
AliDebug(2,Form("Number of TOF digits: %d",nDigits));
Int_t ii;
- Int_t dig[5]; //cluster detector indeces
- Int_t parTOF[5]; //The TOF signal parameters
+ Int_t dig[5]={-1,-1,-1,-1,-1}; //cluster detector indeces
+ Int_t parTOF[7]={0,0,0,0,0,0,0}; //The TOF signal parameters
Bool_t status=kTRUE; // assume all sim channels ok in the beginning...
for (ii=0; ii<nDigits; ii++) {
- AliTOFdigit *d = (AliTOFdigit*)digits->UncheckedAt(ii);
+ AliTOFdigit *d = (AliTOFdigit*)fDigits->UncheckedAt(ii);
dig[0]=d->GetSector();
dig[1]=d->GetPlate();
dig[2]=d->GetStrip();
parTOF[2] = d->GetAdc(); // the adc charge
parTOF[3] = d->GetTdcND(); // non decalibrated sim time
parTOF[4] = d->GetTdc(); // raw time, == Tdc time for the moment
+ parTOF[5] = 0; // deltaBC
+ parTOF[6] = 0; // L0-L1 latency
Double_t posClus[3];
Double_t covClus[6];
clustersTree->Branch("TOF", &fRecPoints, bufsize);
TClonesArray * clonesRawData;
-
Int_t dummy = -1;
Int_t detectorIndex[5];
- Int_t parTOF[5];
+ Int_t parTOF[7];
ofstream ftxt;
if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
- //AliTOFRawStream tofInput(rawReader);
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
-
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
+
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
parTOF[0] = tofRawDatum->GetTOF(); //TDC
parTOF[1] = tofRawDatum->GetTOT(); // TOT
parTOF[2] = tofRawDatum->GetTOT(); //ADC==TOF
- parTOF[3] = -1;//raw data: no track of undecalib sim time
+ parTOF[3] = 0;//raw data: no track of undecalib sim time
parTOF[4] = tofRawDatum->GetTOF(); // RAW time
+ parTOF[5] = tofRawDatum->GetDeltaBC(); // deltaBC
+ parTOF[6] = tofRawDatum->GetL0L1Latency(); // L0-L1 latency
Double_t posClus[3];
Double_t covClus[6];
UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
if (parTOF[0]<10) ftxt << " " << parTOF[0] << endl;
else if (parTOF[0]>=10 && parTOF[0]<100) ftxt << " " << parTOF[0] << endl;
else if (parTOF[0]>=100 && parTOF[0]<1000) ftxt << " " << parTOF[0] << endl;
- else ftxt << " " << parTOF[3] << endl;
+ else ftxt << " " << parTOF[0] << endl;
}
} // closed loop on TOF raw data per current DDL file
- clonesRawData->Clear();
+ clonesRawData->Clear("C");
} // closed loop on DDL index
AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters));
- CalibrateRecPoint();
+ CalibrateRecPoint(rawReader->GetTimestamp());
FillRecPoint();
clustersTree->Fill();
Int_t dummy = -1;
Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
- Int_t parTOF[5];
+ Int_t parTOF[7];
ofstream ftxt;
if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app);
- //AliTOFRawStream tofInput(rawReader);
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
parTOF[0] = tofRawDatum->GetTOF(); // TDC
parTOF[1] = tofRawDatum->GetTOT(); // TOT
parTOF[2] = tofRawDatum->GetTOT(); // raw data have ADC=TOT
- parTOF[3] = -1; //raw data: no track of the undecalib sim time
+ parTOF[3] = 0; //raw data: no track of the undecalib sim time
parTOF[4] = tofRawDatum->GetTOF(); // Raw time == TDC
+ parTOF[5] = tofRawDatum->GetDeltaBC(); // deltaBC
+ parTOF[6] = tofRawDatum->GetL0L1Latency(); // L0-L1 latency
Double_t posClus[3];
Double_t covClus[6];
UShort_t volIdClus=GetClusterVolIndex(detectorIndex);
if (parTOF[0]<10) ftxt << " " << parTOF[0] << endl;
else if (parTOF[0]>=10 && parTOF[0]<100) ftxt << " " << parTOF[0] << endl;
else if (parTOF[0]>=100 && parTOF[0]<1000) ftxt << " " << parTOF[0] << endl;
- else ftxt << " " << parTOF[3] << endl;
+ else ftxt << " " << parTOF[0] << endl;
}
} // closed loop on TOF raw data per current DDL file
- clonesRawData->Clear();
+ clonesRawData->Clear("C");
} // closed loop on DDL index
AliDebug(1,Form("Number of found clusters: %d for event: %d", fNumberOfTofClusters, iEvent));
- CalibrateRecPoint();
+ CalibrateRecPoint(rawReader->GetTimestamp());
FillRecPoint();
fTreeR->Fill();
fTOFLoader->MakeTree("D");
fTreeD = fTOFLoader->TreeD();
}
+ else {
+ AliFatal("Can not get TreeD");
+ return;
+ }
- TClonesArray *tofDigits = new TClonesArray("AliTOFdigit",10000);
Int_t bufsize = 32000;
- fTreeD->Branch("TOF", &tofDigits, bufsize);
+ fDigits->Clear();
+ fTreeD->Branch("TOF", &fDigits, bufsize);
fRunLoader->GetEvent(iEvent);
Int_t detectorIndex[5];
Int_t digit[4];
- //AliTOFRawStream tofInput(rawReader);
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
digit[0] = fTOFRawStream.GetTofBin();
digit[1] = fTOFRawStream.GetToTbin();
digit[2] = fTOFRawStream.GetToTbin();
- digit[3] = -1;
+ digit[3] = 0;
Int_t tracknum[3]={-1,-1,-1};
- TClonesArray &aDigits = *tofDigits;
- Int_t last=tofDigits->GetEntriesFast();
+ TClonesArray &aDigits = *fDigits;
+ Int_t last=fDigits->GetEntriesFast();
new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
} // while loop
- clonesRawData->Clear();
+ clonesRawData->Clear("C");
} // DDL Loop
fTOFLoader = fRunLoader->GetLoader("TOFLoader");
fTOFLoader->WriteDigits("OVERWRITE");
- delete tofDigits;
-
AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.2fs C:%.2fs",
stopwatch.RealTime(),stopwatch.CpuTime()));
return;
}
- TClonesArray *tofDigits = new TClonesArray("AliTOFdigit",10000);
Int_t bufsize = 32000;
- digitsTree->Branch("TOF", &tofDigits, bufsize);
+ digitsTree->Branch("TOF", &fDigits, bufsize);
TClonesArray * clonesRawData;
-
Int_t dummy = -1;
Int_t detectorIndex[5];
Int_t digit[4];
- //AliTOFRawStream tofInput(rawReader);
fTOFRawStream.Clear();
fTOFRawStream.SetRawReader(rawReader);
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
AliInfo("Using New Decoder");
+ }
+ else if (fDecoderVersion == 2) {
+ AliInfo("Using Enhanced Decoder");
+ }
+ else {
+ AliInfo("Using Old Decoder");
+ }
Int_t indexDDL = 0;
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
rawReader->Reset();
- if (fDecoderVersion)
+ if (fDecoderVersion == 1) {
fTOFRawStream.LoadRawDataBuffers(indexDDL,fVerbose);
- else fTOFRawStream.LoadRawData(indexDDL);
+ }
+ else if (fDecoderVersion == 2) {
+ fTOFRawStream.LoadRawDataBuffersV2(indexDDL,fVerbose);
+ }
+ else {
+ fTOFRawStream.LoadRawData(indexDDL);
+ }
clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
digit[0] = fTOFRawStream.GetTofBin();
digit[1] = fTOFRawStream.GetToTbin();
digit[2] = fTOFRawStream.GetToTbin();
- digit[3] = -1;
+ digit[3] = 0;
Int_t tracknum[3]={-1,-1,-1};
- TClonesArray &aDigits = *tofDigits;
- Int_t last=tofDigits->GetEntriesFast();
+ TClonesArray &aDigits = *fDigits;
+ Int_t last=fDigits->GetEntriesFast();
new (aDigits[last]) AliTOFdigit(tracknum, detectorIndex, digit);
} // while loop
- clonesRawData->Clear();
+ clonesRawData->Clear("C");
} // DDL Loop
digitsTree->Fill();
- delete tofDigits;
-
AliDebug(1, Form("Got %d digits: ", fDigits->GetEntries()));
AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs",
stopwatch.RealTime(),stopwatch.CpuTime()));
Int_t ii, jj;
Int_t detectorIndex[5];
- Int_t parTOF[5];
+ Int_t parTOF[7];
Int_t trackLabels[3];
Int_t digitIndex = -1;
Bool_t status=kTRUE;
parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT
parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND
parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW
+ parTOF[5] = fTofClusters[ii]->GetDeltaBC();//deltaBC
+ parTOF[6] = fTofClusters[ii]->GetL0L1Latency();//L0-L1 latency
status=fTofClusters[ii]->GetStatus();
Double_t posClus[3];
Double_t covClus[6];
}
//_________________________________________________________________________
-void AliTOFClusterFinder::CalibrateRecPoint()
+
+/*
+ * OLD CALIBRATE REC POINTS FUNCTION
+ */
+
+#if 0
+void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
{
//
// Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
Double_t tToT;
Double_t timeCorr;
Int_t tdcCorr;
+ Float_t tdcLatencyWindow;
AliDebug(1," Calibrating TOF Clusters");
AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();
AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();
TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
+
+ AliTOFDeltaBCOffset *deltaBCOffsetObj = fTOFcalib->GetDeltaBCOffset();
+ Int_t deltaBCOffset = deltaBCOffsetObj->GetDeltaBCOffset();
+ AliTOFCTPLatency *ctpLatencyObj = fTOFcalib->GetCTPLatency();
+ Float_t ctpLatency = ctpLatencyObj->GetCTPLatency();
+ AliTOFRunParams *runParamsObj = fTOFcalib->GetRunParams();
+ Float_t t0 = runParamsObj->EvalT0(timestamp);
TString validity = (TString)fTOFcalib->GetOfflineValidity();
Int_t calibration = -1;
if (validity.CompareTo("valid")==0) {
- AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
+ //AliInfo(Form(" validity = %s - Using offline calibration parameters",validity.Data()));
calibration = 1;
} else {
- AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
+ //AliInfo(Form(" validity = %s - Using online calibration parameters",validity.Data()));
calibration = 0 ;
}
UChar_t statusNoise=calStatus->GetNoiseStatus(index);
UChar_t statusHW=calStatus->GetHWStatus(index);
UChar_t status=calStatus->GetStatus(index);
-
+ tdcLatencyWindow = calStatus->GetLatencyWindow(index) * 1.e3; /* ns -> ps */
+
//check the status, also unknown is fine!!!!!!!
AliDebug(2, Form(" Status for channel %d = %d",index, (Int_t)status));
}
AliDebug(2,Form(" Calib Pars = %f, %f, %f, %f, %f, %f ",par[0],par[1],par[2],par[3],par[4],par[5]));
AliDebug(2,Form(" The ToT and Time, uncorr (counts) = %d , %d", fTofClusters[ii]->GetToT(),fTofClusters[ii]->GetTDC()));
- tToT = (Double_t)(fTofClusters[ii]->GetToT()*AliTOFGeometry::ToTBinWidth());
+ tToT = (Double_t)(fTofClusters[ii]->GetToT()*AliTOFGeometry::ToTBinWidth());
tToT*=1.E-3; //ToT in ns
+
+ /* check TOT limits and set new TOT in case */
+ if (tToT < AliTOFGeometry::SlewTOTMin()) tToT = AliTOFGeometry::SlewTOTMin();
+ if (tToT > AliTOFGeometry::SlewTOTMax()) tToT = AliTOFGeometry::SlewTOTMax();
+
AliDebug(2,Form(" The ToT and Time, uncorr (ns)= %e, %e",fTofClusters[ii]->GetTDC()*AliTOFGeometry::TdcBinWidth()*1.E-3,tToT));
timeCorr=par[0]+par[1]*tToT+par[2]*tToT*tToT+par[3]*tToT*tToT*tToT+par[4]*tToT*tToT*tToT*tToT+par[5]*tToT*tToT*tToT*tToT*tToT; // the time correction (ns)
}
timeCorr=(Double_t)(fTofClusters[ii]->GetTDC())*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time
timeCorr*=1.E3;
AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr ));
+
+ /* here timeCorr should be already corrected for calibration.
+ * we now go into further corrections keeping in mind that timeCorr
+ * is in ps.
+ *
+ * the following corrections are performed in this way:
+ *
+ * time = timeRaw - deltaBC + L0L1Latency + CTPLatency - TDCLatencyWindow - T0
+ *
+ */
+
+ AliDebug(2, Form("applying further corrections (DeltaBC): DeltaBC=%d (BC bins), DeltaBCoffset=%d (BC bins)", fTofClusters[ii]->GetDeltaBC(), deltaBCOffset));
+ AliDebug(2, Form("applying further corrections (L0L1Latency): L0L1Latency=%d (BC bins)", fTofClusters[ii]->GetL0L1Latency()));
+ AliDebug(2, Form("applying further corrections (CTPLatency): CTPLatency=%f (ps)", ctpLatency));
+ AliDebug(2, Form("applying further corrections (TDCLatencyWindow): TDCLatencyWindow=%f (ps)", tdcLatencyWindow));
+ AliDebug(2, Form("applying further corrections (T0): T0=%f (ps)", t0));
+
+ /* deltaBC correction (inhibited for the time being) */
+ // timeCorr -= (fTofClusters[ii]->GetDeltaBC() - deltaBCOffset) * AliTOFGeometry::BunchCrossingBinWidth();
+ /* L0L1-latency correction */
+ timeCorr += fTofClusters[ii]->GetL0L1Latency() * AliTOFGeometry::BunchCrossingBinWidth();
+ /* CTP-latency correction (from OCDB) */
+ timeCorr += ctpLatency;
+ /* TDC latency-window correction (from OCDB) */
+ timeCorr -= tdcLatencyWindow;
+ /* T0 correction (from OCDB) */
+ timeCorr -= t0;
+
+ /*
+ * end of furhter corrections
+ */
+
tdcCorr=(Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
fTofClusters[ii]->SetTDC(tdcCorr);
} // loop on clusters
}
+#endif
+
+//_________________________________________________________________________
+
+void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
+{
+ //
+ // Copy the global array of AliTOFcluster, i.e. fTofClusters (sorted
+ // in Z) in the global TClonesArray of AliTOFcluster,
+ // i.e. fRecPoints.
+ //
+
+ Int_t detectorIndex[5];
+ Double_t time, tot, corr;
+ Int_t deltaBC, l0l1, tdcBin;
+ for (Int_t ii = 0; ii < fNumberOfTofClusters; ii++) {
+ for(Int_t jj = 0; jj < 5; jj++) detectorIndex[jj] = fTofClusters[ii]->GetDetInd(jj);
+
+ Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
+
+ /* check channel enabled */
+ if (!fTOFcalib->IsChannelEnabled(index)) fTofClusters[ii]->SetStatus(kFALSE);
+
+ /* get cluster info */
+ time = fTofClusters[ii]->GetTDC() * AliTOFGeometry::TdcBinWidth(); /* ps */
+ tot = fTofClusters[ii]->GetToT() * AliTOFGeometry::ToTBinWidth() * 1.e-3; /* ns */
+ deltaBC = fTofClusters[ii]->GetDeltaBC();
+ l0l1 = fTofClusters[ii]->GetL0L1Latency();
+
+ /* get correction */
+ corr = fTOFcalib->GetTimeCorrection(index, tot, deltaBC, l0l1, timestamp); /* ps */
+ AliDebug(2, Form("calibrate index %d: time=%f (ps) tot=%f (ns) deltaBC=%d l0l1=%d timestamp=%d corr=%f (ps)", index, time, tot, deltaBC, l0l1, timestamp, corr));
+
+ /* apply time correction */
+ time -= corr;
+
+ /* convert in TDC bins and set cluster */
+ //tdcBin = (Int_t)(time / AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
+ tdcBin = TMath::Nint(time / AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts)
+ fTofClusters[ii]->SetTDC(tdcBin);
+
+ } // loop on clusters
+
+}
+
//______________________________________________________________________________
void AliTOFClusterFinder::ResetRecpoint()