]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDclusterizer.cxx
Update of the VZERO offline trigger: 1. New slewing correction with only 2 parameters...
[u/mrichter/AliRoot.git] / TRD / AliTRDclusterizer.cxx
index ec5c0b8cdddc510ee3459204f14574aaad8e7c43..3f06fa88c265d2d6e46589c11095b471c4e79bf0 100644 (file)
@@ -453,23 +453,29 @@ Bool_t AliTRDclusterizer::WriteClusters(Int_t det)
       ioArray->AddLast(c);
     }
     fClusterTree->Fill();
+    ioArray->Clear();
   } else {
-    
-    Int_t detOld = -1;
+    Int_t detOld = -1, nw(0);
     for (Int_t i = 0; i < nRecPoints; i++) {
       AliTRDcluster *c = (AliTRDcluster *) RecPoints()->UncheckedAt(i);
       if(c->GetDetector() != detOld){
+        nw += ioArray->GetEntriesFast();
         fClusterTree->Fill();
         ioArray->Clear();
         detOld = c->GetDetector();
       } 
       ioArray->AddLast(c);
     }
+    if(ioArray->GetEntriesFast()){
+      nw += ioArray->GetEntriesFast();
+      fClusterTree->Fill();
+      ioArray->Clear();
+    }
+    AliDebug(2, Form("Clusters FOUND[%d] WRITTEN[%d] STATUS[%s]", nRecPoints, nw, nw==nRecPoints?"OK":"FAILED"));
   }
   delete ioArray;
 
   return kTRUE;  
-
 }
 
 //_____________________________________________________________________________
@@ -610,6 +616,7 @@ Bool_t AliTRDclusterizer::MakeClusters()
     fDigitsManager->RemoveDictionaries(i);      
     fDigitsManager->ClearIndexes(i);  
   }
+  fReconstructor->SetDigitsParam(fDigitsManager->GetDigitsParam());
   
   if(fReconstructor->IsWritingClusters()) WriteClusters(-1);
 
@@ -660,10 +667,12 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
   else
     fRawStream->SetReader(rawReader);
 
-  if(fReconstructor->IsHLT())
+  if(fReconstructor->IsHLT()){
     fRawStream->SetSharedPadReadout(kFALSE);
+    fRawStream->SetNoErrorWarning();
+  }
 
-  AliInfo(Form("Stream version: %s", fRawStream->IsA()->GetName()));
+  AliDebug(1,Form("Stream version: %s", fRawStream->IsA()->GetName()));
   
   Int_t det    = 0;
   while ((det = fRawStream->NextChamber(fDigitsManager,fTrackletContainer)) >= 0){
@@ -677,6 +686,7 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
     if (!fReconstructor->IsWritingTracklets()) continue;
     if (*(fTrackletContainer[0]) > 0 || *(fTrackletContainer[1]) > 0) WriteTracklets(det);
   }
+  fReconstructor->SetDigitsParam(fDigitsManager->GetDigitsParam());
   
   if (fTrackletContainer){
     delete [] fTrackletContainer[0];
@@ -690,6 +700,8 @@ Bool_t AliTRDclusterizer::Raw2ClustersChamber(AliRawReader *rawReader)
   if(!TestBit(knewDM)){
     delete fDigitsManager;
     fDigitsManager = NULL;
+    delete fRawStream;
+    fRawStream = NULL;
   }
 
   AliInfo(Form("Number of found clusters : %d", fNoOfClusters)); 
@@ -791,6 +803,8 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
     return kFALSE;
   }
 
+  AliDebug(2, Form("Det[%d] @ Sec[%d] Stk[%d] Ly[%d]", fDet, isector, istack, fLayer));
+
   // TRD space point transformation
   fTransform->SetDetector(det);
 
@@ -805,6 +819,14 @@ Bool_t AliTRDclusterizer::MakeClusters(Int_t det)
   //Int_t nRowMax    = fDigits->GetNrow();
   fTimeTotal = fDigits->GetNtime();
 
+  // Check consistency between OCDB and raw data
+  Int_t nTimeOCDB = calibration->GetNumberOfTimeBinsDCS();
+  if ((nTimeOCDB  >         -1) &&
+      (fTimeTotal != nTimeOCDB)) {
+    AliError(Form("Number of timebins does not match OCDB value (RAW[%d] OCDB[%d])"
+                ,fTimeTotal,calibration->GetNumberOfTimeBinsDCS()));
+  }
+
   // Detector wise calibration object for the gain factors
   const AliTRDCalDet *calGainFactorDet = calibration->GetGainFactorDet();
   // Calibration object with pad wise values for the gain factors
@@ -1224,18 +1246,20 @@ void AliTRDclusterizer::TailCancelation()
   Double_t *inADC = new Double_t[fTimeTotal];  // ADC data before tail cancellation
   Double_t *outADC = new Double_t[fTimeTotal];  // ADC data after tail cancellation
 
-  fIndexes->ResetCounters();
   TTreeSRedirector *fDebugStream = fReconstructor->GetDebugStream(AliTRDrecoParam::kClusterizer);
+  Bool_t debugStreaming = fReconstructor->GetRecoParam()->GetStreamLevel(AliTRDrecoParam::kClusterizer) > 7 && fReconstructor->IsDebugStreaming();
   while(fIndexes->NextRCIndex(iRow, iCol))
     {
       Bool_t corrupted = kFALSE;
       if (fCalPadStatusROC->GetStatus(iCol, iRow)) corrupted = kTRUE;
 
+      // Save data into the temporary processing array and substract the baseline,
+      // since DeConvExp does not expect a baseline
       for (iTime = 0; iTime < fTimeTotal; iTime++) 
-       inADC[iTime]   = fDigits->GetData(iRow,iCol,iTime);
+       inADC[iTime]   = fDigits->GetData(iRow,iCol,iTime)-fBaseline;
           
-      for (iTime = 0; iTime < fTimeTotal; iTime++) 
-       if(fReconstructor->GetRecoParam()->GetStreamLevel(AliTRDrecoParam::kClusterizer) > 7 && fReconstructor->IsDebugStreaming()){
+      if(debugStreaming){
+       for (iTime = 0; iTime < fTimeTotal; iTime++) 
          (*fDebugStream) << "TailCancellation"
                          << "col="  << iCol
                          << "row="  << iRow
@@ -1244,7 +1268,7 @@ void AliTRDclusterizer::TailCancelation()
                          << "outADC=" << outADC[iTime]
                          << "corrupted=" << corrupted
                          << "\n";
-       }
+      }
       
       if (!corrupted)
         {
@@ -1254,8 +1278,9 @@ void AliTRDclusterizer::TailCancelation()
         }
       else memcpy(&outADC[0],&inADC[0],fTimeTotal*sizeof(inADC[0]));
 
+      // Save tailcancalled data and add the baseline
       for(iTime = 0; iTime < fTimeTotal; iTime++)
-       fDigits->SetData(iRow,iCol,iTime,TMath::Nint(outADC[iTime]));
+       fDigits->SetData(iRow,iCol,iTime,(Short_t)(outADC[iTime] + fBaseline + 0.5));
       
     } // while irow icol