]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusterFinder.cxx
New set of classes for B->J/psi->ee analysis and fit a la CDF (Carmelo, Giuseppe)
[u/mrichter/AliRoot.git] / PMD / AliPMDClusterFinder.cxx
index 0b5a604c08ce37728f86aaaa2733e948d4e1aecc..0185c3b565b20e21d73512eba26e42c282f137d6 100644 (file)
@@ -134,6 +134,7 @@ AliPMDClusterFinder::~AliPMDClusterFinder()
     {
       fRechits->Clear();
     }
+
 }
 // ------------------------------------------------------------------------- //
 
@@ -197,7 +198,12 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
          xpos   = pmddigit->GetRow();
          ypos   = pmddigit->GetColumn();
          adc    = pmddigit->GetADC();
-         
+         if(xpos < 0 || xpos > 48 || ypos < 0 || ypos > 96)
+           {
+             AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
+                             xpos, ypos));
+             continue; 
+           }
          // CALIBRATION
          Float_t gain = fCalibGain->GetGainFact(det,smn,xpos,ypos);
          // printf("adc = %d gain = %f\n",adc,gain);
@@ -264,6 +270,7 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
   // Converts digits to recpoints after running clustering
   // algorithm on CPV plane and PREshower plane
   //
+  // This algorithm is called during the reconstruction from digits
 
   Int_t    det = 0,smn = 0;
   Int_t    xpos,ypos;
@@ -272,6 +279,8 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
   Int_t    idet;
   Float_t  clusdata[6];
 
+  AliPMDcluster *pmdcl = 0x0;
+
   TObjArray *pmdcont = new TObjArray();
   AliPMDClustering *pmdclust = new AliPMDClusteringV1();
 
@@ -291,6 +300,8 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
 
   for (Int_t imodule = 0; imodule < nmodules; imodule++)
     {
+
+      Int_t totADCMod = 0;
       ResetCellADC();
       digitsTree->GetEntry(imodule); 
       Int_t nentries = fDigits->GetLast();
@@ -303,10 +314,16 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
          xpos   = pmddigit->GetRow();
          ypos   = pmddigit->GetColumn();
          adc    = pmddigit->GetADC();
-
+         if(xpos < 0 || xpos > 48 || ypos < 0 || ypos > 96)
+           {
+             AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
+                           xpos, ypos));
+             continue; 
+           }
+         
          // Pedestal Subtraction
          Int_t   pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,xpos,ypos);
-         Int_t   pedrms1    = (Int_t) pedmeanrms%1000;
+         Int_t   pedrms1    = (Int_t) pedmeanrms%100;
          Float_t pedrms     = (Float_t)pedrms1/10.;
          Float_t pedmean    = (Float_t) (pedmeanrms - pedrms1)/1000.0;
          //printf("%f %f\n",pedmean, pedrms);
@@ -321,10 +338,16 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
 
          //Int_t trno   = pmddigit->GetTrackNumber();
          fCellADC[xpos][ypos] = (Double_t) adc;
+
+         totADCMod += (Int_t) adc;
+
        }
 
       idet = det;
       ismn = smn;
+
+      if (totADCMod <= 0) continue;
+
       pmdclust->DoClust(idet,ismn,fCellADC,pmdcont);
       
       Int_t nentries1 = pmdcont->GetEntries();
@@ -333,7 +356,7 @@ void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
 
       for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
        {
-         AliPMDcluster *pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
+           pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
          idet        = pmdcl->GetDetector();
          ismn        = pmdcl->GetSMN();
          clusdata[0] = pmdcl->GetClusX();
@@ -377,13 +400,18 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
   // Converts RAW data to recpoints after running clustering
   // algorithm on CPV and PREshower plane
   //
-  // This method is called at the time of reconstruction
+  // This method is called at the time of reconstruction from RAW data
+
+
+    AliPMDddldata *pmdddl = 0x0;
+    AliPMDcluster *pmdcl  = 0x0;
 
 
   Float_t  clusdata[6];
   TObjArray pmdddlcont;
 
   TObjArray *pmdcont = new TObjArray();
+
   AliPMDClustering *pmdclust = new AliPMDClusteringV1();
 
   pmdclust->SetEdepCut(fEcut);
@@ -437,7 +465,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
       Int_t ientries = pmdddlcont.GetEntries();
       for (Int_t ient = 0; ient < ientries; ient++)
        {
-         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
+           pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
          
          Int_t det = pmdddl->GetDetector();
          Int_t smn = pmdddl->GetSMN();
@@ -447,9 +475,21 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
          Int_t col = pmdddl->GetColumn();
          Int_t sig = pmdddl->GetSignal();
 
+         if(smn == -1)
+           {
+             AliError(Form("*MODULE NUMBER WRONG %d *",smn));
+             continue; 
+           }
+         if(row < 0 || row > 48 || col < 0 || col > 96)
+           {
+             AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
+                           row, col));
+             continue; 
+           }
+
          // Pedestal Subtraction
          Int_t   pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
-         Int_t   pedrms1    = (Int_t) pedmeanrms%1000;
+         Int_t   pedrms1    = (Int_t) pedmeanrms%100;
          Float_t pedrms     = (Float_t)pedrms1/10.;
          Float_t pedmean    = (Float_t) (pedmeanrms - pedrms1)/1000.0;
 
@@ -501,19 +541,22 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
          precpvADC[indexsmn][row][col] = sig;
        }
       
-      //pmdddlcont.Clear();
       pmdddlcont.Delete();
 
+      Int_t totAdcMod = 0;
+
       Int_t ismn = 0;
       for (indexsmn = 0; indexsmn < iSMN; indexsmn++)
        {
          ResetCellADC();
+         totAdcMod = 0;
          for (Int_t irow = 0; irow < kRow; irow++)
            {
              for (Int_t icol = 0; icol < kCol; icol++)
                {
                  fCellADC[irow][icol] = 
                    (Double_t) precpvADC[indexsmn][irow][icol];
+                 totAdcMod += precpvADC[indexsmn][irow][icol];
                } // row
            }     // col
          
@@ -547,6 +590,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
              idet = 1;
            }
 
+         if (totAdcMod <= 0) continue;
          pmdclust->DoClust(idet,ismn,fCellADC,pmdcont);
          Int_t nentries1 = pmdcont->GetEntries();
 
@@ -554,8 +598,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
 
          for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
            {
-             AliPMDcluster *pmdcl = 
-               (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
+               pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
              idet        = pmdcl->GetDetector();
              ismn        = pmdcl->GetSMN();
              clusdata[0] = pmdcl->GetClusX();
@@ -591,7 +634,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
          for (Int_t j=0; j<kRow; j++) delete [] precpvADC[i][j];
        }
       for (Int_t i=0; i<iSMN; i++) delete [] precpvADC[i];
-      delete precpvADC;
+      delete [] precpvADC;
 
     } // DDL Loop
   
@@ -684,10 +727,15 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
          Int_t row = pmdddl->GetRow();
          Int_t col = pmdddl->GetColumn();
          Int_t sig = pmdddl->GetSignal();
-
+         if(row < 0 || row > 48 || col < 0 || col > 96)
+           {
+             AliError(Form("*Row %d and Column NUMBER %d NOT Valid *",
+                             row, col));
+             continue; 
+           }
          // Pedestal Subtraction
          Int_t   pedmeanrms = fCalibPed->GetPedMeanRms(det,smn,row,col);
-         Int_t   pedrms1    = (Int_t) pedmeanrms%1000;
+         Int_t   pedrms1    = (Int_t) pedmeanrms%100;
          Float_t pedrms     = (Float_t)pedrms1/10.;
          Float_t pedmean    = (Float_t) (pedmeanrms - pedrms1)/1000.0;