]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFClusterFinder.cxx
corrected warnings with gcc 4.3
[u/mrichter/AliRoot.git] / TOF / AliTOFClusterFinder.cxx
index bf2947c47740a8e95d78755e38f7bb5187e9812a..6b4c7eecf4a660b95ac7b2685869a3fbe8b1c03b 100644 (file)
@@ -28,7 +28,9 @@ Revision 1.28  2007/05/31 16:06:05  arcelli
 move instance of AliRawStream outside loop on DDL
 
 Revision 1.27  2007/05/02 16:31:49  arcelli
-Add methods to handle single event reconstruction. retrieval of Calib info moved to AliTOFReconstructor ctor, and passed via a pointer to AliTOFcalib
+Add methods to handle single event reconstruction.  retrieval of Calib
+info moved to AliTOFReconstructor ctor, and passed via a pointer to
+AliTOFcalib
 
 Revision 1.26  2007/04/30 19:02:24  arcelli
 hopefully the last refinements for correct type conversion in calibration
@@ -40,7 +42,8 @@ Revision 1.24  2007/04/27 11:19:31  arcelli
 updates for the new decoder
 
 Revision 1.23  2007/04/23 16:51:39  decaro
-Digits-to-raw_data conversion: correction for a more real description (A.De Caro, R.Preghenella)
+Digits-to-raw_data conversion: correction for a more real description
+(A.De Caro, R.Preghenella)
 
 Revision 1.22  2007/04/19 17:26:32  arcelli
 Fix a bug (add some debug printout
@@ -58,7 +61,8 @@ Revision 1.18  2007/03/06 16:31:20  arcelli
 Add Uncorrected TOF Time signal
 
 Revision 1.17  2007/02/28 18:09:11  arcelli
-Add protection against failed retrieval of the CDB cal object, now Reconstruction exits with AliFatal
+Add protection against failed retrieval of the CDB cal object,
+now Reconstruction exits with AliFatal
 
 Revision 1.16  2007/02/20 15:57:00  decaro
 Raw data update: to read the TOF raw data defined in UNPACKED mode
@@ -117,8 +121,8 @@ Revision 0.01  2005/07/25 A. De Caro
 #include <AliGeomManager.h>
 
 #include "AliTOFcalib.h"
-#include "AliTOFChannelOnline.h"
-#include "AliTOFChannelOnlineStatus.h"
+#include "AliTOFChannelOnlineArray.h"
+#include "AliTOFChannelOnlineStatusArray.h"
 #include "AliTOFChannelOffline.h"
 #include "AliTOFClusterFinder.h"
 #include "AliTOFcluster.h"
@@ -236,6 +240,8 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
   TStopwatch stopwatch;
   stopwatch.Start();
 
+  Int_t inholes = 0;
+
   fRunLoader->GetEvent(iEvent);
 
   fTreeD = fTOFLoader->TreeD();
@@ -250,7 +256,9 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
     return;
   }
 
-  TClonesArray *digits = new TClonesArray("AliTOFdigit",10000);
+  TClonesArray staticdigits("AliTOFdigit",10000);
+  staticdigits.Clear();
+  TClonesArray *digits =&staticdigits;
   branch->SetAddress(&digits);
 
   ResetRecpoint();
@@ -281,6 +289,14 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
     dig[3]=d->GetPadz();
     dig[4]=d->GetPadx();
 
+    // Do not reconstruct anything in the holes
+    if (dig[0]==13 || dig[0]==14 || dig[0]==15 ) { // sectors with holes
+      if (dig[1]==2) { // plate with holes
+       inholes++;
+       continue;
+      }
+    }
+
     //    AliDebug(2,Form(" %2i  %1i  %2i  %1i  %2i ",dig[0],dig[1],dig[2],dig[3],dig[4]));
 
     parTOF[0] = d->GetTdc(); //the TDC signal
@@ -310,9 +326,8 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent)
 
   AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
               stopwatch.RealTime(),stopwatch.CpuTime()));
+  if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
 
-  digits->Delete();
-  delete digits;
 }
 
 //______________________________________________________________________________
@@ -326,6 +341,8 @@ void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree
   TStopwatch stopwatch;
   stopwatch.Start();
 
+  Int_t inholes = 0;
+
   ///  fRunLoader->GetEvent(iEvent);
 
   if (digitsTree == 0x0)
@@ -339,7 +356,9 @@ void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree
     return;
   }
 
-  TClonesArray *digits = new TClonesArray("AliTOFdigit",10000);
+  TClonesArray staticdigits("AliTOFdigit",10000);
+  staticdigits.Clear();
+  TClonesArray *digits = & staticdigits;
   branch->SetAddress(&digits);
 
   ResetRecpoint();
@@ -364,6 +383,14 @@ void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree
     dig[3]=d->GetPadz();
     dig[4]=d->GetPadx();
 
+    // Do not reconstruct anything in the holes
+    if (dig[0]==13 || dig[0]==14 || dig[0]==15 ) { // sectors with holes
+      if (dig[1]==2) { // plate with holes
+       inholes++;
+       continue;
+      }
+    }
+
     //    AliDebug(2,Form(" %2i  %1i  %2i  %1i  %2i ",dig[0],dig[1],dig[2],dig[3],dig[4]));
 
     parTOF[0] = d->GetTdc(); //the TDC signal
@@ -391,9 +418,8 @@ void AliTOFClusterFinder::Digits2RecPoints(TTree* digitsTree, TTree* clusterTree
 
   AliInfo(Form("Execution time to read TOF digits and to write TOF clusters : R:%.4fs C:%.4fs",
               stopwatch.RealTime(),stopwatch.CpuTime()));
+  if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
 
-  digits->Delete();
-  delete digits;
 }
 //______________________________________________________________________________
 
@@ -407,6 +433,8 @@ void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
   TStopwatch stopwatch;
   stopwatch.Start();
 
+  Int_t inholes = 0;
+
   //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
   const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
 
@@ -443,7 +471,8 @@ void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
 
       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
 
-      if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+      //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+      if (tofRawDatum->GetTOF()==-1) continue;
 
       if (fVerbose==2) {
        if (indexDDL<10) ftxt << "  " << indexDDL;
@@ -473,6 +502,14 @@ void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
        else              ftxt << " " << detectorIndex[4];
       }
 
+      // Do not reconstruct anything in the holes
+      if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
+       if (detectorIndex[1]==2) { // plate with holes
+         inholes++;
+         continue;
+       }
+      }
+
       parTOF[0] = tofRawDatum->GetTOF(); //TDC
       parTOF[1] = tofRawDatum->GetTOT(); // TOT
       parTOF[2] = tofRawDatum->GetTOT(); //ADC==TOF
@@ -516,6 +553,7 @@ void AliTOFClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
 
   AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
                   stopwatch.RealTime(),stopwatch.CpuTime()));
+  if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
 
 }
 //______________________________________________________________________________
@@ -529,6 +567,8 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
   TStopwatch stopwatch;
   stopwatch.Start();
 
+  Int_t inholes = 0;
+
   //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
   const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
 
@@ -573,7 +613,8 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
 
       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
 
-      if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+      //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
+      if (tofRawDatum->GetTOF()==-1) continue;
 
       if (fVerbose==2) {
        if (indexDDL<10) ftxt << "  " << indexDDL;
@@ -603,6 +644,14 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
        else              ftxt << " " << detectorIndex[4];
       }
 
+      // Do not reconstruct anything in the holes
+      if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes
+       if (detectorIndex[1]==2) { // plate with holes
+         inholes++;
+         continue;
+       }
+      }
+
       parTOF[0] = tofRawDatum->GetTOF(); // TDC
       parTOF[1] = tofRawDatum->GetTOT(); // TOT
       parTOF[2] = tofRawDatum->GetTOT(); // raw data have ADC=TOT
@@ -648,6 +697,7 @@ void AliTOFClusterFinder::Digits2RecPoints(Int_t iEvent, AliRawReader *rawReader
   
   AliDebug(1, Form("Execution time to read TOF raw data and to write TOF clusters : R:%.4fs C:%.4fs",
               stopwatch.RealTime(),stopwatch.CpuTime()));
+  if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes));
 
 }
 //______________________________________________________________________________
@@ -710,7 +760,8 @@ void AliTOFClusterFinder::Raw2Digits(Int_t iEvent, AliRawReader *rawReader)
 
       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
 
-      if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+      //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+      if (tofRawDatum->GetTOF()==-1) continue;
 
       tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
                                    tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
@@ -798,7 +849,8 @@ void AliTOFClusterFinder::Raw2Digits(AliRawReader *rawReader, TTree* digitsTree)
 
       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
 
-      if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+      //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+      if (tofRawDatum->GetTOF()==-1) continue;
 
       tofInput.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
                                    tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
@@ -909,6 +961,19 @@ void AliTOFClusterFinder::FillRecPoint()
     GetClusterPars(detectorIndex,posClus,covClus);
     new(lRecPoints[ii]) AliTOFcluster(volIdClus,posClus[0],posClus[1],posClus[2],covClus[0],covClus[1],covClus[2],covClus[3],covClus[4],covClus[5],trackLabels,detectorIndex, parTOF,status,digitIndex);
 
+    AliDebug(2, Form(" %4i  %4i  %f %f %f  %f %f %f %f %f %f  %3i %3i %3i  %2i %1i %2i %1i %2i  %4i %3i %3i %4i %4i  %1i  %4i", 
+                    ii, volIdClus, posClus[0], posClus[1], posClus[2],
+                    fTofClusters[ii]->GetSigmaX2(),
+                    fTofClusters[ii]->GetSigmaXY(),
+                    fTofClusters[ii]->GetSigmaXZ(),
+                    fTofClusters[ii]->GetSigmaY2(),
+                    fTofClusters[ii]->GetSigmaYZ(),
+                    fTofClusters[ii]->GetSigmaZ2(),
+                    trackLabels[0], trackLabels[1], trackLabels[2],
+                    detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[3], detectorIndex[4],
+                    parTOF[0], parTOF[1], parTOF[2], parTOF[3], parTOF[4],
+                    status, digitIndex));
+
   } // loop on clusters
 
 }
@@ -931,10 +996,8 @@ void AliTOFClusterFinder::CalibrateRecPoint()
   Int_t   tdcCorr;
   AliInfo(" Calibrating TOF Clusters: ")
   
-  TObjArray *calTOFArrayOnline = fTOFcalib->GetTOFCalArrayOnline();  
-  TObjArray *calTOFArrayOnlinePulser = fTOFcalib->GetTOFCalArrayOnlinePulser();  
-  TObjArray *calTOFArrayOnlineNoise = fTOFcalib->GetTOFCalArrayOnlineNoise();  
-  TObjArray *calTOFArrayOnlineHW = fTOFcalib->GetTOFCalArrayOnlineHW();  
+  AliTOFChannelOnlineArray *calDelay = fTOFcalib->GetTOFOnlineDelay();  
+  AliTOFChannelOnlineStatusArray *calStatus = fTOFcalib->GetTOFOnlineStatus();  
   TObjArray *calTOFArrayOffline = fTOFcalib->GetTOFCalArrayOffline();
   TString validity = (TString)fTOFcalib->GetOfflineValidity();
   AliInfo(Form(" validity = %s",validity.Data()));
@@ -953,33 +1016,23 @@ void AliTOFClusterFinder::CalibrateRecPoint()
 
     Int_t index = AliTOFGeometry::GetIndex(detectorIndex);
      
-    AliTOFChannelOnlineStatus * calChannelOnlineStPulser = (AliTOFChannelOnlineStatus* )calTOFArrayOnlinePulser->At(index);
-    AliTOFChannelOnlineStatus * calChannelOnlineStNoise = (AliTOFChannelOnlineStatus* )calTOFArrayOnlineNoise->At(index);
-    AliTOFChannelOnlineStatus * calChannelOnlineStHW = (AliTOFChannelOnlineStatus* )calTOFArrayOnlineHW->At(index);
-
-    // Get channel status 
-    UChar_t statusPulser=calChannelOnlineStPulser->GetStatus();
-    UChar_t statusNoise=calChannelOnlineStNoise->GetStatus();
-    UChar_t statusHW=calChannelOnlineStHW->GetStatus();
-
-    //check the status, also unknow is fine!!!!!!!
-
-    UChar_t status = 0x0;
-    status |= statusPulser;
-    status |= statusNoise;
-    status |= statusHW;
-    // set status of the cluster to false if at least one of the three status (Pulser/Noise/HW) is bad
-    if((statusPulser & AliTOFChannelOnlineStatus::kTOFPulserBad)==(AliTOFChannelOnlineStatus::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatus::kTOFNoiseBad)==(AliTOFChannelOnlineStatus::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatus::kTOFHWBad)==(AliTOFChannelOnlineStatus::kTOFHWBad)){
+    UChar_t statusPulser=calStatus->GetPulserStatus(index);
+    UChar_t statusNoise=calStatus->GetNoiseStatus(index);
+    UChar_t statusHW=calStatus->GetHWStatus(index);
+    UChar_t status=calStatus->GetStatus(index);
+
+    //check the status, also unknown is fine!!!!!!!
+
+    AliDebug(2, Form(" Status for channel %i = %i",index, (Int_t)status));
+    if((statusPulser & AliTOFChannelOnlineStatusArray::kTOFPulserBad)==(AliTOFChannelOnlineStatusArray::kTOFPulserBad)||(statusNoise & AliTOFChannelOnlineStatusArray::kTOFNoiseBad)==(AliTOFChannelOnlineStatusArray::kTOFNoiseBad)||(statusHW & AliTOFChannelOnlineStatusArray::kTOFHWBad)==(AliTOFChannelOnlineStatusArray::kTOFHWBad)){
       AliDebug(2, Form(" Bad Status for channel %i",index));
       fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
     }
     else {
       AliDebug(2, Form(" Good Status for channel %i",index));
     }
-    //    if((status & AliTOFChannelOnlineStatus::kTOFOnlineOk)!=(AliTOFChannelOnline::kTOFOnlineOk))fTofClusters[ii]->SetStatus(kFALSE); //odd convention, to avoid conflict with calibration objects currently in the db (temporary solution).
     // Get Rough channel online equalization 
-    AliTOFChannelOnline * calChannelOnline = (AliTOFChannelOnline* )calTOFArrayOnline->At(index);
-    Double_t roughDelay=(Double_t)calChannelOnline->GetDelay();  // in ns
+    Double_t roughDelay=(Double_t)calDelay->GetDelay(index);  // in ns
     AliDebug(2,Form(" channel delay (ns) = %f", roughDelay));
     // Get Refined channel offline calibration parameters
     if (calibration ==1){