AliDebug(2,Form("Number of TOF digits: %d",nDigits));
Int_t ii;
- Int_t dig[5]; //cluster detector indeces
- Int_t parTOF[7]; //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);
AliDebug(2,Form("Number of TOF digits: %d",nDigits));
Int_t ii;
- Int_t dig[5]; //cluster detector indeces
- Int_t parTOF[7]; //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);
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++) {
AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(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
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
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};
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};
}
//_________________________________________________________________________
+
+/*
+ * OLD CALIBRATE REC POINTS FUNCTION
+ */
+
+#if 0
void AliTOFClusterFinder::CalibrateRecPoint(UInt_t timestamp)
{
//
}
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 */
} // 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()