X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TOF%2FAliTOFClusterFinderV1.cxx;h=285a7230cef1d911b89d33679aac9ca4a73cfd5d;hb=4637c72d8c7eedd7625b43ed811c277f75e40a6e;hp=f27e5dc9a59e417d329afdfbc067ce469c47d9c7;hpb=bafe290d39f885cd6b2597154086ac0973a21f5e;p=u%2Fmrichter%2FAliRoot.git diff --git a/TOF/AliTOFClusterFinderV1.cxx b/TOF/AliTOFClusterFinderV1.cxx index f27e5dc9a59..285a7230cef 100644 --- a/TOF/AliTOFClusterFinderV1.cxx +++ b/TOF/AliTOFClusterFinderV1.cxx @@ -44,6 +44,7 @@ Revision 0.01 2008/05/10 A. De Caro #include "AliDAQ.h" #include "AliLog.h" #include "AliRawReader.h" +#include "AliLoader.h" #include "AliRunLoader.h" #include "AliGeomManager.h" @@ -59,74 +60,127 @@ Revision 0.01 2008/05/10 A. De Caro #include "AliTOFReconstructor.h" #include "AliTOFRecoParam.h" +using std::endl; +using std::cout; +using std::ofstream; +using std::ios; ClassImp(AliTOFClusterFinderV1) //_____________________________________________________________________________ AliTOFClusterFinderV1::AliTOFClusterFinderV1(AliTOFcalib *calib): + TTask("AliTOFClusterFinderV1",""), fRunLoader(0), fDigits(new TClonesArray("AliTOFdigit", 4000)), fRecPoints(new TClonesArray("AliTOFcluster", 4000)), fNumberOfTofClusters(0), fNumberOfTofDigits(0), - fMaxDeltaTime(0), + fNumberOfTofTrgPads(0), + fkRecoParam(0),//AliTOFReconstructor::GetRecoParam()), + fMaxDeltaTime(0),//fkRecoParam->GetMaxDeltaTime()), fVerbose(0), fDecoderVersion(0), fTOFcalib(calib), fTOFdigitMap(new AliTOFDigitMap()), fTOFGeometry(new AliTOFGeometry()), - fTOFdigits(0), - fTOFRawStream(AliTOFRawStream()) + fTOFdigits(new TTree()), + fTOFRawStream(AliTOFRawStream()), + fCalibrateTOFtimes(1) { // // Constructor // - const AliTOFRecoParam *recoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER... - fMaxDeltaTime = recoParam->GetMaxDeltaTime(); + + for (Int_t ii=0; iiGetMaxDeltaTime(); + } + else + fMaxDeltaTime = 2; + + 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())); + } + } //_____________________________________________________________________________ AliTOFClusterFinderV1::AliTOFClusterFinderV1(AliRunLoader* runLoader, AliTOFcalib *calib): + TTask("AliTOFClusterFinderV1",""), fRunLoader(runLoader), fDigits(new TClonesArray("AliTOFdigit", 4000)), fRecPoints(new TClonesArray("AliTOFcluster", 4000)), fNumberOfTofClusters(0), fNumberOfTofDigits(0), - fMaxDeltaTime(0), + fNumberOfTofTrgPads(0), + fkRecoParam(0),//AliTOFReconstructor::GetRecoParam()), + fMaxDeltaTime(0),//fkRecoParam->GetMaxDeltaTime()), fVerbose(0), fDecoderVersion(0), fTOFcalib(calib), fTOFdigitMap(new AliTOFDigitMap()), fTOFGeometry(new AliTOFGeometry()), - fTOFdigits(0), - fTOFRawStream(AliTOFRawStream()) + fTOFdigits(new TTree()), + fTOFRawStream(AliTOFRawStream()), + fCalibrateTOFtimes(1) { // // Constructor // - const AliTOFRecoParam *recoParam = AliTOFReconstructor::GetRecoParam(); // instantiate reco param from STEER... - fMaxDeltaTime = recoParam->GetMaxDeltaTime(); + + for (Int_t ii=0; iiGetMaxDeltaTime(); + } + else + fMaxDeltaTime = 2; + + 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())); + } } //_____________________________________________________________________________ AliTOFClusterFinderV1::AliTOFClusterFinderV1(const AliTOFClusterFinderV1 &source) - :TObject(source), + :TTask(source), fRunLoader(0), fDigits(source.fDigits), fRecPoints(source.fRecPoints), fNumberOfTofClusters(0), fNumberOfTofDigits(0), - fMaxDeltaTime(2), + fNumberOfTofTrgPads(0), + fkRecoParam(0),//AliTOFReconstructor::GetRecoParam()), + fMaxDeltaTime(0),//fkRecoParam->GetMaxDeltaTime()), fVerbose(0), fDecoderVersion(source.fDecoderVersion), fTOFcalib(source.fTOFcalib), fTOFdigitMap(new AliTOFDigitMap()), fTOFGeometry(new AliTOFGeometry()), fTOFdigits(source.fTOFdigits), - fTOFRawStream(source.fTOFRawStream) - + fTOFRawStream(source.fTOFRawStream), + fCalibrateTOFtimes(1) { // copy constructor + + for (Int_t ii=0; iiGetMaxDeltaTime(); + } + else + fMaxDeltaTime = 2; + } //_____________________________________________________________________________ @@ -138,8 +192,12 @@ AliTOFClusterFinderV1& AliTOFClusterFinderV1::operator=(const AliTOFClusterFinde return *this; TObject::operator=(source); + for (Int_t ii=0; iiDelete(); + fNumberOfTofClusters = 0; + } + } //_____________________________________________________________________________ @@ -192,10 +258,15 @@ void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTr Int_t inholes = 0; + ResetRecpoint(); + + fDigits->Clear(); TClonesArray &aDigits = *fDigits; - if (digitsTree == 0x0) + if (digitsTree == 0x0) { AliFatal("Can not get TreeD for TOF"); + return; + } TBranch *branch = digitsTree->GetBranch("TOF"); if (!branch) { @@ -208,7 +279,7 @@ void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTr TClonesArray *digits = &staticDigits; branch->SetAddress(&digits); digitsTree->GetEvent(0); - AliInfo(Form("Number of TOF digits: %d", digits->GetEntriesFast())); + AliDebug(1,Form("Number of TOF digits: %d", digits->GetEntriesFast())); AliTOFdigit *tofDigit; @@ -225,11 +296,13 @@ void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTr Bool_t status = kTRUE; AliDebug(1," Calibrating TOF Digits"); + /* 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())); + */ Int_t ii = 0; for (ii=0; iiGetEntriesFast(); ii++) { @@ -247,6 +320,7 @@ void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTr } } + tdcCorr = tofDigit->GetTdc(); status = MakeSlewingCorrection(detectorIndex, tofDigit->GetToT(), tofDigit->GetTdc(), tdcCorr); for (jj=0; jj<4; jj++) info[jj] = -1; @@ -280,9 +354,9 @@ void AliTOFClusterFinderV1::Digits2RecPoints(TTree* digitsTree, TTree* clusterTr FillRecPoint(); clusterTree->Fill(); - AliInfo(Form("Number of found clusters: %d", fNumberOfTofClusters)); + AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters)); - ResetRecpoint(); +// ResetRecpoint(); fTOFdigitMap->Clear(); @@ -305,6 +379,7 @@ void AliTOFClusterFinderV1::Digits2RecPoints(AliRawReader *rawReader, TTree *clu TStopwatch stopwatch; stopwatch.Start(); + ResetRecpoint(); AliDebug(2, "TreeD re-creation"); //TTree *digitsTree = new TTree(); @@ -312,7 +387,7 @@ void AliTOFClusterFinderV1::Digits2RecPoints(AliRawReader *rawReader, TTree *clu Raw2Digits(rawReader, fTOFdigits); - AliDebug(2,Form("Number of TOF digits: %d", fNumberOfTofDigits)); + AliDebug(1,Form("Number of TOF digits: %d", fNumberOfTofDigits)); ResetRecpoint(); Int_t bufsize = 32000; @@ -321,9 +396,9 @@ void AliTOFClusterFinderV1::Digits2RecPoints(AliRawReader *rawReader, TTree *clu clustersTree->Fill(); - AliInfo(Form("Number of found clusters: %d", fNumberOfTofClusters)); + AliDebug(1,Form("Number of found clusters: %d", fNumberOfTofClusters)); - ResetRecpoint(); +// ResetRecpoint(); fTOFdigitMap->Clear(); @@ -374,11 +449,13 @@ void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTre Bool_t status = kTRUE; + /* 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())); + */ if (fDecoderVersion) AliInfo("Using New Decoder"); @@ -393,7 +470,7 @@ void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTre else fTOFRawStream.LoadRawData(indexDDL); clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData(); - if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast())); + if (clonesRawData->GetEntriesFast()!=0) AliDebug(2,Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast())); for (iRawData = 0; iRawDataGetEntriesFast(); iRawData++) { AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData); @@ -408,6 +485,8 @@ void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTre dummy = detectorIndex[3]; detectorIndex[3] = detectorIndex[4];//padz detectorIndex[4] = dummy;//padx + + tdcCorr = tofRawDatum->GetTOF(); status = MakeSlewingCorrection(detectorIndex, tofRawDatum->GetTOT(), tofRawDatum->GetTOF(), tdcCorr); digit[0] = tdcCorr; @@ -415,12 +494,24 @@ void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTre digit[2] = tofRawDatum->GetTOT(); digit[3] = -1;//tofRawDatum->GetTOF(); //tofND + // noferini + Float_t pos[3]; + AliTOFGeometry::GetPosPar(detectorIndex, pos); + Float_t length = 0.; + for (Int_t ic = 0; ic < 3; ic++) length += pos[ic] * pos[ic]; + length = TMath::Sqrt(length); + Float_t timealligned = tdcCorr*24.4 - length * 0.0333564095198152043; // subtract the minimal time in + + if(status && timealligned > -1000 && timealligned < 24000){ + fNumberOfTofTrgPads++; + } + dummy = detectorIndex[3]; detectorIndex[3] = detectorIndex[4];//padx detectorIndex[4] = dummy;//padz - /* check valid index */ - if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue; + /* check valid index */ + if (detectorIndex[0]==-1||detectorIndex[1]==-1||detectorIndex[2]==-1||detectorIndex[3]==-1||detectorIndex[4]==-1) continue; // Do not reconstruct anything in the holes if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes @@ -433,6 +524,7 @@ void AliTOFClusterFinderV1::Raw2Digits(AliRawReader *rawReader, TTree* digitsTre last = fDigits->GetEntriesFast(); new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, digit); if (status) fTOFdigitMap->AddDigit(detectorIndex, last); + if (fVerbose==2) { if (indexDDL<10) ftxt << " " << indexDDL; @@ -495,80 +587,103 @@ void AliTOFClusterFinderV1::FillRecPoint() // i.e. fRecPoints // - Int_t dummy4_1 = -1; - Int_t dummy3_1 = -1; - Int_t dummy2_1 = -1; - Int_t dummy = -1; + Int_t dummy4 = -1; + Int_t dummy3 = -1; + Int_t dummy2 = -1; + Int_t dummy = -1; for(Int_t iPlate=AliTOFGeometry::NPlates()-1; iPlate>=0; iPlate--) { for(Int_t iStrip=AliTOFGeometry::NStrip(iPlate)-1; iStrip>=0; iStrip--) { //for (Int_t iSector=AliTOFGeometry::NSectors()-1; iSector>=0; iSector--) { for (Int_t iSector=0; iSectorStripDigitCheck(iSector,iPlate,iStrip)) + AliDebug(1,Form(" Number of TOF digits in (%2d,%1d,%2d) -> %d", + iSector,iPlate,iStrip,fTOFdigitMap->FilledCellsInStrip(iSector,iPlate,iStrip))); + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; FindClustersWithoutTOT(iSector, iPlate, iStrip); // clusters coming from digits without TOT measurement + if (fMaxDeltaTime>0) { - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + //if (fTOFdigitMap->FilledCellsInStrip(iSector,iPlate,iStrip)>=4) + FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy4_1 = fNumberOfTofClusters; - FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters - if (fNumberOfTofClusters!=dummy4_1) - AliDebug(2, Form(" (4): n1= %5d, n2 = %5", dummy4_1, fNumberOfTofClusters)); + dummy4 = fNumberOfTofClusters; + FindClustersPerStrip(iSector, iPlate, iStrip, 4); // 4 pads clusters + if (fNumberOfTofClusters!=dummy4) + AliDebug(2, Form(" (4): n1= %5d, n2 = %5d", dummy4, fNumberOfTofClusters)); - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy3_1 = fNumberOfTofClusters; - FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters - if (fNumberOfTofClusters!=dummy3_1) - AliDebug(2, Form(" (3): n1= %5d, n2 = %5", dummy3_1, fNumberOfTofClusters)); + dummy3 = fNumberOfTofClusters; + FindClustersPerStrip(iSector, iPlate, iStrip, 3); // 3 pads clusters + if (fNumberOfTofClusters!=dummy3) + AliDebug(2, Form(" (3): n1= %5d, n2 = %5d", dummy3, fNumberOfTofClusters)); - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy2_1 = fNumberOfTofClusters; - FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters - if (fNumberOfTofClusters!=dummy2_1) - AliDebug(2, Form(" (2): n1= %5d, n2 =%5", dummy2_1, fNumberOfTofClusters)); + dummy2 = fNumberOfTofClusters; + FindClustersPerStrip(iSector, iPlate, iStrip, 2); // 2 pads clusters + if (fNumberOfTofClusters!=dummy2) + AliDebug(2, Form(" (2): n1= %5d, n2 =%5d", dummy2, fNumberOfTofClusters)); - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy = fNumberOfTofClusters; - FindClusters34(iSector, iPlate, iStrip); // 3 pads clusters between 4 hit pads - if (fNumberOfTofClusters!=dummy) - AliDebug(2, Form(" (3 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + dummy = fNumberOfTofClusters; + FindClusters34(iSector, iPlate, iStrip); // 3 pads clusters between 4 hit pads + if (fNumberOfTofClusters!=dummy) + AliDebug(2, Form(" (3 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy = fNumberOfTofClusters; - FindClusters23(iSector, iPlate, iStrip); // 2 pads clusters between 3 hit pads - if (fNumberOfTofClusters!=dummy) - AliDebug(2, Form(" (2 between 3): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + dummy = fNumberOfTofClusters; + FindClusters23(iSector, iPlate, iStrip); // 2 pads clusters between 3 hit pads + if (fNumberOfTofClusters!=dummy) + AliDebug(2, Form(" (2 between 3): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy = fNumberOfTofClusters; - FindClusters24(iSector, iPlate, iStrip); // 2 pads clusters between 4 hit pads - if (fNumberOfTofClusters!=dummy) - AliDebug(2, Form(" (2 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + dummy = fNumberOfTofClusters; + FindClusters24(iSector, iPlate, iStrip); // 2 pads clusters between 4 hit pads + if (fNumberOfTofClusters!=dummy) + AliDebug(2, Form(" (2 between 4): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); - if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; - dummy = fNumberOfTofClusters; - FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters - if (fNumberOfTofClusters!=dummy) - AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + dummy = fNumberOfTofClusters; + FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters + if (fNumberOfTofClusters!=dummy) + AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); + + if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0) + AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-", + fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip), + iSector, iPlate, iStrip)); + + } + else { + if (!(fTOFdigitMap->StripDigitCheck(iSector,iPlate,iStrip))) continue; + dummy = fNumberOfTofClusters; + FindOnePadClusterPerStrip(iSector, iPlate, iStrip); // 1 pad clusters + if (fNumberOfTofClusters!=dummy) + AliDebug(2,Form(" (1): n1 = %5d, n2 = %5d", fNumberOfTofClusters, dummy)); + + if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0) + AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-", + fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip), + iSector, iPlate, iStrip)); + + } - if (fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip)>0) - AliDebug(2, Form(" (1): number of clusters = %5d (remaining digit %2d), -%2d %1d %2d-", - fNumberOfTofClusters, fTOFdigitMap->DigitInStrip(iSector,iPlate,iStrip), - iSector, iPlate, iStrip)); } } @@ -581,8 +696,8 @@ void AliTOFClusterFinderV1::FillRecPoint() Int_t detectorIndex[5]; for (jj=0; jj<5; jj++) detectorIndex[jj] = -1; - Int_t parTOF[5]; - for (jj=0; jj<5; jj++) parTOF[jj] = -1; + Int_t parTOF[7]; + for (jj=0; jj<7; jj++) parTOF[jj] = -1; Int_t trackLabels[3]; for (jj=0; jj<3; jj++) trackLabels[jj] = -1; Int_t digitIndex = -1; @@ -605,6 +720,8 @@ void AliTOFClusterFinderV1::FillRecPoint() parTOF[2] = fTofClusters[ii]->GetADC(); // ADC=TOT parTOF[3] = fTofClusters[ii]->GetTDCND(); // TDCND parTOF[4] = fTofClusters[ii]->GetTDCRAW();//RAW + parTOF[5] = 0; + parTOF[6] = 0; status = fTofClusters[ii]->GetStatus(); posClus[0] = fTofClusters[ii]->GetX(); @@ -681,13 +798,13 @@ void AliTOFClusterFinderV1::FindOnePadClusterPerStrip(Int_t nSector, Double_t covClus[6]; for (jj=0; jj<6; jj++) covClus[jj] = 0.; - Int_t parTOF[5]; - for (jj=0; jj<5; jj++) parTOF[jj] = 0; + Int_t parTOF[7]; + for (jj=0; jj<7; jj++) parTOF[jj] = 0; Bool_t status = kTRUE; //assume all sim channels ok in the beginning... Int_t tracks[kMaxNumberOfTracksPerDigit]; - for (jj=0; jj<3; jj++) tracks[jj] = -1; + for (jj=0; jjGetAdc()); parTOF[3] = Int_t(digitInteresting->GetTdcND()); parTOF[4] = Int_t(digitInteresting->GetTdc()); + parTOF[5] = 0; + parTOF[6] = 0; volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]); //volIdClus = GetClusterVolIndex(det); @@ -802,12 +921,12 @@ void AliTOFClusterFinderV1::FindClustersWithoutTOT(Int_t nSector, Double_t covClus[6]; for (jj=0; jj<6; jj++) covClus[jj] = 0.; - Int_t parTOF[5]; - for (jj=0; jj<5; jj++) parTOF[jj] = 0; + Int_t parTOF[7]; + for (jj=0; jj<7; jj++) parTOF[jj] = 0; Bool_t status = kTRUE; //assume all sim channels ok in the beginning... Int_t tracks[kMaxNumberOfTracksPerDigit]; - for (jj=0; jj<3; jj++) tracks[jj] = -1; + for (jj=0; jjGetAdc()); parTOF[3] = Int_t(digitInteresting->GetTdcND()); parTOF[4] = Int_t(digitInteresting->GetTdc()); + parTOF[5] = 0; + parTOF[6] = 0; volIdClus = fTOFGeometry->GetAliSensVolIndex(det[0],det[1],det[2]); //volIdClus = GetClusterVolIndex(det); @@ -956,8 +1077,8 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, Int_t iPadX = -1; Int_t iPadZ = -1; - Int_t parTOF[5]; - for (jj=0; jj<5; jj++) parTOF[jj] = 0; + Int_t parTOF[7]; + for (jj=0; jj<7; jj++) parTOF[jj] = 0; Double_t posClus[3]; for (jj=0; jj<3; jj++) posClus[jj] = 0.; Int_t det[5]; @@ -970,7 +1091,7 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, Double_t covClus[6]; for (jj=0; jj<6; jj++) covClus[jj] = 0.; Int_t tracks[kMaxNumberOfTracksPerDigit]; - for (jj=0; jj<3; jj++) tracks[jj] = -1; + for (jj=0; jjGetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1069,7 +1190,7 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1102,7 +1223,7 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1135,7 +1256,7 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1247,6 +1368,7 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, for (jj=0; jj<3; jj++) indDet[jj][4] = padsCluster[2*jj+1+3]; GetClusterPars(/*check,*/ 3, indDet, interestingWeight, posClus, covClus); for (jj=0; jj<3; jj++) delete [] indDet[jj]; + delete [] indDet; // To fill the track index array dummyCounter=-1; @@ -1344,12 +1466,16 @@ void AliTOFClusterFinderV1::FindClusters34(Int_t nSector, } // loop on iPad - for (ii=0; iiGetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1528,7 +1654,7 @@ void AliTOFClusterFinderV1::FindClusters23(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1560,7 +1686,7 @@ void AliTOFClusterFinderV1::FindClusters23(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1592,7 +1718,7 @@ void AliTOFClusterFinderV1::FindClusters23(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1677,6 +1803,7 @@ void AliTOFClusterFinderV1::FindClusters23(Int_t nSector, for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3]; GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus); for (jj=0; jj<2; jj++) delete [] indDet[jj]; + delete [] indDet; // To fill the track index array dummyCounter=-1; @@ -1746,12 +1873,16 @@ void AliTOFClusterFinderV1::FindClusters23(Int_t nSector, } // loop on iPad - for (ii=0; iiGetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1930,7 +2061,7 @@ void AliTOFClusterFinderV1::FindClusters24(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1962,7 +2093,7 @@ void AliTOFClusterFinderV1::FindClusters24(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -1994,7 +2125,7 @@ void AliTOFClusterFinderV1::FindClusters24(Int_t nSector, if (digitInteresting->GetToT()<=0) continue; // AdC digitIndexLocal++; // AdC - AliDebug(1,Form(" %2d %1d %2d %1d %2d %f %f %f %f %5d %5d %5d %5d", + AliDebug(1,Form(" %2d %1d %2d %1d %2d %d %d %d %d %5d %5d %5d %5d", vol[0], vol[1], vol[2] ,vol[4], vol[3], digitInteresting->GetTdc(), digitInteresting->GetAdc(), digitInteresting->GetToT(), digitInteresting->GetToT()*digitInteresting->GetToT(), @@ -2080,6 +2211,7 @@ void AliTOFClusterFinderV1::FindClusters24(Int_t nSector, for (jj=0; jj<2; jj++) indDet[jj][4] = padsCluster[2*jj+1+3]; GetClusterPars(/*check,*/ 2, indDet, interestingWeight, posClus, covClus); for (jj=0; jj<2; jj++) delete [] indDet[jj]; + delete [] indDet; // To fill the track index array dummyCounter=-1; @@ -2149,12 +2281,16 @@ void AliTOFClusterFinderV1::FindClusters24(Int_t nSector, } // loop on iPad - for (ii=0; iiGetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) continue; + if (TMath::Abs(selectedDigit[adesso1][firstIndex]->GetTDC()-selectedDigit[adesso2][secondIndex]->GetTDC())>fMaxDeltaTime) { + AliDebug(1,Form(" selD1[%d][%d]->GetTDC()=%d selD2[%d][%d]->GetTDC()=%d -- %d ", + adesso1,firstIndex,(Int_t)selectedDigit[adesso1][firstIndex]->GetTDC(), + adesso2,secondIndex,(Int_t)selectedDigit[adesso2][secondIndex]->GetTDC(), + fMaxDeltaTime)); + continue; + } - AliDebug(1, Form(" %1d %1d (0x%x) %1d %1d (0x%x)", adesso1, firstIndex,selectedDigit[adesso1][firstIndex], + AliDebug(1, Form(" %1d %1d (0x%p) %1d %1d (0x%p)", adesso1, firstIndex,selectedDigit[adesso1][firstIndex], adesso2, secondIndex,selectedDigit[adesso2][secondIndex])); interestingTOF[0] = selectedDigit[adesso1][firstIndex]->GetTDC(); @@ -2512,6 +2661,7 @@ void AliTOFClusterFinderV1::FindClustersPerStrip(Int_t nSector, for (jj=0; jjClear(); } @@ -3085,6 +3247,7 @@ void AliTOFClusterFinderV1::ResetDigits() // fNumberOfTofDigits = 0; + fNumberOfTofTrgPads = 0; if (fDigits) fDigits->Clear(); } @@ -3481,6 +3644,9 @@ Bool_t AliTOFClusterFinderV1::MakeSlewingCorrection(Int_t *detectorIndex, else AliDebug(2, Form(" Good Status for channel %d",index)); + + if (fCalibrateTOFtimes) { // AdC + // Get Rough channel online equalization Double_t roughDelay = (Double_t)calDelay->GetDelay(index); // in ns AliDebug(2,Form(" channel delay (ns) = %f", roughDelay)); @@ -3507,8 +3673,11 @@ Bool_t AliTOFClusterFinderV1::MakeSlewingCorrection(Int_t *detectorIndex, timeCorr = (Double_t)(tofDigitTdc)*AliTOFGeometry::TdcBinWidth()*1.E-3-timeCorr;//redefine the time timeCorr *= 1.E3; AliDebug(2,Form(" The channel time, corr (ps)= %e",timeCorr )); - tdcCorr = (Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts) + //tdcCorr = (Int_t)(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts) + tdcCorr = TMath::Nint(timeCorr/AliTOFGeometry::TdcBinWidth()); //the corrected time (tdc counts) + } // AdC + return output; } @@ -3528,8 +3697,10 @@ void AliTOFClusterFinderV1::Digits2RecPoints(Int_t iEvent) AliLoader *localTOFLoader = (AliLoader*)fRunLoader->GetLoader("TOFLoader"); TTree * localTreeD = (TTree*)localTOFLoader->TreeD(); - if (localTreeD == 0x0) + if (localTreeD == 0x0) { AliFatal("Can not get TreeD"); + return; + } TBranch *branch = localTreeD->GetBranch("TOF"); if (!branch) { @@ -3623,7 +3794,8 @@ void AliTOFClusterFinderV1::AverageCalculations(Int_t number, Float_t *interesti Int_t *parTOF, Double_t *posClus, Bool_t &check) { // - // + // Calculates the mean values for cluster position (x,y,z), + // TOF charge and time // Double_t tofAverage = 0.; @@ -3660,5 +3832,7 @@ void AliTOFClusterFinderV1::AverageCalculations(Int_t number, Float_t *interesti parTOF[2] = Int_t(adcAverage); parTOF[3] = Int_t(tofAverage);//tofND parTOF[4] = Int_t(tofAverage);//tofRAW + parTOF[5] = 0; + parTOF[6] = 0; }