]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDEmpDiscriminator.cxx
sincronize with last developments
[u/mrichter/AliRoot.git] / PMD / AliPMDEmpDiscriminator.cxx
index 1f5de06438e401239a560d1dafbfaa5cecd1a686..541b9c5cb860348efc98a13163d932045329e2b4 100644 (file)
 
 #include <Riostream.h>
 #include <TMath.h>
-#include <TBRIK.h>
-#include <TNode.h>
 #include <TTree.h>
-#include <TGeometry.h>
 #include <TObjArray.h>
 #include <TClonesArray.h>
 #include <TFile.h>
@@ -34,8 +31,7 @@
 #include <TParticle.h>
 
 #include "AliLog.h"
-//#include "AliPMDcluster.h"
-#include "AliPMDrecpoint1.h"
+#include "AliPMDrecdata.h"
 #include "AliPMDclupid.h"
 #include "AliPMDDiscriminator.h"
 #include "AliPMDEmpDiscriminator.h"
@@ -61,195 +57,48 @@ void AliPMDEmpDiscriminator::Discrimination(TObjArray *pmdcontin, TObjArray *pmd
   // Does Photon/Hadron discrimination
   // matching the clusters of CPV and PREshower plane
   //
-  const  Int_t kumperdet = 24;
-  static Int_t neibx[6]={1,0,-1,-1,0,1}, neiby[6]={0,1,1,0,-1,-1}; 
-  Int_t   det,smn;
-  Int_t   iprecount[24], icpvcount[24];
-  Float_t xpos,ypos;
-  Float_t adc, ncell, rad;
-  Float_t clusdata[6];
-
-  for(Int_t i = 0; i < kumperdet; i++)
-    {
-      iprecount[i] = 0;
-      icpvcount[i] = 0;
-    }
-  AliPMDrecpoint1  *pmdcl    = 0;
+
+  Int_t   det = 0,smn = 0, trno = 0, trpid = 0, mstatus = 0;
+  Float_t clusdata[7] = {0.,0.,0.,0.,0.,0.,0.};
+
+  AliPMDrecdata  *pmdcl    = 0;
   AliPMDclupid   *pmdclout = 0;
 
   Int_t nentries1 = pmdcontin->GetEntries();
 
   AliDebug(1,Form("Number of total clusters from CPV PRE = %d",nentries1));
-  for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
-    {
-      pmdcl = (AliPMDrecpoint1*)pmdcontin->UncheckedAt(ient1);
-
-      det   = pmdcl->GetDetector();
-      smn   = pmdcl->GetSMNumber();
-      if(det == 0) iprecount[smn]++;
-      if(det == 1) icpvcount[smn]++;
-    } // Entries of TObjArray loop
 
-  Int_t   idet, ismn;
-  Float_t edepcpv[48][96];
-  Int_t   statuscpv[48][96];
 
-  for(Int_t i = 0; i < kumperdet; i++) // unit module
+  for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
     {
-      // Initialisation of the ADC of CPV (1UM)
-      for (Int_t ix = 0; ix < 48;ix++)
-       {
-         for (Int_t iy = 0; iy < 96;iy++)
-           {
-             edepcpv[ix][iy]   = 0.;
-             statuscpv[ix][iy] = 0;
-           }
-       }
-      Int_t precounter   = iprecount[i];
-      Int_t cpvcounter   = icpvcount[i];
+      pmdcl = (AliPMDrecdata*)pmdcontin->UncheckedAt(ient1);
       
-      Float_t *xpadpre   = new Float_t[precounter];
-      Float_t *ypadpre   = new Float_t[precounter];
-      Float_t *adcpre    = new Float_t[precounter];
-      Float_t *ncellpre  = new Float_t[precounter];
-      Float_t *radpre    = new Float_t[precounter];
-      Int_t   *sortcoord = new Int_t[precounter];
-      Int_t   *clupidpre = new Int_t[precounter];
-
-      Float_t *xpadcpv   = new Float_t[cpvcounter];
-      Float_t *ypadcpv   = new Float_t[cpvcounter];
-      Float_t *adccpv    = new Float_t[cpvcounter];
-      Float_t *ncellcpv  = new Float_t[cpvcounter];
-      Float_t *radcpv    = new Float_t[cpvcounter];
-
-      Int_t ii = 0;
-      Int_t ij = 0;
-      for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
+      det         = pmdcl->GetDetector();
+      smn         = pmdcl->GetSMNumber();
+      trno        = pmdcl->GetClusTrackNo();
+      trpid       = pmdcl->GetClusTrackPid();
+      clusdata[0] = pmdcl->GetClusX();
+      clusdata[1] = pmdcl->GetClusY();
+      clusdata[2] = pmdcl->GetClusADC();
+      clusdata[3] = pmdcl->GetClusCells();
+      clusdata[4] = pmdcl->GetClusSigmaX();
+      clusdata[5] = pmdcl->GetClusSigmaY();
+
+      if (det == 0 && clusdata[2] > 300.)
        {
-         pmdcl = (AliPMDrecpoint1*)pmdcontin->UncheckedAt(ient1);
-         
-         det   = pmdcl->GetDetector();
-         smn   = pmdcl->GetSMNumber();
-         xpos  = pmdcl->GetClusX();
-         ypos  = pmdcl->GetClusY();
-         adc   = pmdcl->GetClusADC();
-         ncell = pmdcl->GetClusCells();
-         rad   = pmdcl->GetClusSigmaX();
-
-         if(det == 0 && smn == i)
-           {
-             xpadpre[ii]  = xpos;
-             ypadpre[ii]  = ypos;
-             adcpre[ii]   = adc;
-             ncellpre[ii] = ncell;
-             radpre[ii]   = rad;
-             ii++;
-           }
-         if(det == 1 && smn == i)
-           {
-             Int_t ix = (Int_t) (xpos+0.5);
-             Int_t iy = (Int_t) (ypos+0.5);
-             if(ix > 47) ix = 47;
-             if(iy > 95) iy = 95;
-             edepcpv[ix][iy] = adc;
-             xpadcpv[ij]  = xpos;
-             ypadcpv[ij]  = ypos;
-             adccpv[ij]   = adc;
-             ncellcpv[ij] = ncell;
-             radcpv[ij]   = rad;
-             ij++;
-           }
-       } // Entries of TObjArray loop
-      // sorts from lowest ADC to highest ADC
-      // and returns the coordinates
-      Bool_t jsort = false;
-      TMath::Sort(precounter,adcpre,sortcoord,jsort);
-
-      Int_t jjsort = 0;
-      for(Int_t jj=0; jj<precounter; jj++)
-       {
-         // PRE information
-         // PIDs for PRE clusters are 0(photon) and 1(hadron)
-
-         jjsort = sortcoord[jj];
-
-         Int_t ix = (Int_t) (xpadpre[jjsort]+0.5);
-         Int_t iy = (Int_t) (ypadpre[jjsort]+0.5);
-         if(ix > 47) ix = 47;
-         if(iy > 95) iy = 95;
-
-         for(Int_t jk=0; jk<6; jk++)
-           {
-             Int_t jd1 = ix + neibx[jk]; 
-             Int_t jd2 = iy + neiby[jk];
-             if(jd1 <0 ) jd1 = 0;
-             if(jd1 >47) jd1 = 47;
-             if(jd2 <0 ) jd2 = 0;
-             if(jd2 >47) jd2 = 47;
-             if(edepcpv[jd1][jd2] > 0.0 && statuscpv[jd1][jd2] == 0)
-               {
-                 statuscpv[jd1][jd2] = 1;
-                 clupidpre[jjsort]   = 1;
-                 break;
-               }
-           }
-
-         idet        = 0;
-         ismn        = i;
-         clusdata[0] = xpadpre[jjsort];
-         clusdata[1] = ypadpre[jjsort];
-         clusdata[2] = adcpre[jjsort];
-         clusdata[3] = ncellpre[jjsort];
-         clusdata[4] = radpre[jjsort];
-         //PH    clusdata[5] = (Float_t) clupidpre[jjsort];
-
-         // Temporary the cluster PID is set to 1 if the
-         // adc > 3MIP units which will be changed later on.
-
-         if (adcpre[jjsort] > 300.)
-           {
-             clusdata[5] = 1.0;
-           }
-         else
-           {
-             clusdata[5] = 0.0;
-           }
-         pmdclout = new AliPMDclupid(idet,ismn,clusdata);
-         pmdcontout->Add(pmdclout);
-       } // jj loop
-
-      for(Int_t jj=0; jj<cpvcounter; jj++)
+         clusdata[6] = 1;     // photon
+       }
+      else
        {
-         // CPV information
-         // PID for CPV clusters is 1
-
-         idet        = 1;
-         ismn        = i;
-         clusdata[0] = xpadcpv[jj];
-         clusdata[1] = ypadcpv[jj];
-         clusdata[2] = adccpv[jj];
-         clusdata[3] = ncellcpv[jj];
-         clusdata[4] = radcpv[jj];
-         clusdata[5] = 0.;
-
-         pmdclout = new AliPMDclupid(idet,ismn,clusdata);
-         pmdcontout->Add(pmdclout);
+         clusdata[6] = 8;     // hadron
        }
 
-      // delete all the pointers
-      delete [] xpadpre;
-      delete [] ypadpre;
-      delete [] adcpre;
-      delete [] ncellpre;
-      delete [] radpre;
-      delete [] sortcoord;
-      delete [] clupidpre;
-      delete [] xpadcpv;
-      delete [] ypadcpv;
-      delete [] adccpv;
-      delete [] ncellcpv;
-      delete [] radcpv;
-    } // i loop
+      mstatus = 0;             // at this moment matching is not done
+
+      pmdclout = new AliPMDclupid(det,smn,trno,trpid,mstatus,clusdata);
+      pmdcontout->Add(pmdclout);
+      
+    } // Entries of TObjArray loop
 
 }
 // -----------------------------------------------------------------------