1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 //-----------------------------------------------------//
18 // Date : August 05 2003 //
19 // This does photon hadron discrimination on the //
20 // of matching a PMD cluster with a CPV cluster //
22 //-----------------------------------------------------//
24 #include <Riostream.h>
27 #include <TObjArray.h>
28 #include <TClonesArray.h>
31 #include <TParticle.h>
34 #include "AliPMDrecpoint1.h"
35 #include "AliPMDclupid.h"
36 #include "AliPMDDiscriminator.h"
37 #include "AliPMDEmpDiscriminator.h"
39 ClassImp(AliPMDEmpDiscriminator)
41 AliPMDEmpDiscriminator::AliPMDEmpDiscriminator()
44 // Default Constructor
47 // -----------------------------------------------------------------------
48 AliPMDEmpDiscriminator::~AliPMDEmpDiscriminator()
53 // -----------------------------------------------------------------------
55 void AliPMDEmpDiscriminator::Discrimination(TObjArray *pmdcontin, TObjArray *pmdcontout)
57 // Does Photon/Hadron discrimination
58 // matching the clusters of CPV and PREshower plane
60 const Int_t kumperdet = 24;
61 static Int_t neibx[6]={1,0,-1,-1,0,1}, neiby[6]={0,1,1,0,-1,-1};
63 Int_t iprecount[24], icpvcount[24];
65 Float_t adc, ncell, rad;
68 for(Int_t i = 0; i < kumperdet; i++)
73 AliPMDrecpoint1 *pmdcl = 0;
74 AliPMDclupid *pmdclout = 0;
76 Int_t nentries1 = pmdcontin->GetEntries();
78 AliDebug(1,Form("Number of total clusters from CPV PRE = %d",nentries1));
79 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
81 pmdcl = (AliPMDrecpoint1*)pmdcontin->UncheckedAt(ient1);
83 det = pmdcl->GetDetector();
84 smn = pmdcl->GetSMNumber();
85 if(det == 0) iprecount[smn]++;
86 if(det == 1) icpvcount[smn]++;
87 } // Entries of TObjArray loop
90 Float_t edepcpv[48][96];
91 Int_t statuscpv[48][96];
93 for(Int_t i = 0; i < kumperdet; i++) // unit module
95 // Initialisation of the ADC of CPV (1UM)
96 for (Int_t ix = 0; ix < 48;ix++)
98 for (Int_t iy = 0; iy < 96;iy++)
100 edepcpv[ix][iy] = 0.;
101 statuscpv[ix][iy] = 0;
104 Int_t precounter = iprecount[i];
105 Int_t cpvcounter = icpvcount[i];
107 Float_t *xpadpre = new Float_t[precounter];
108 Float_t *ypadpre = new Float_t[precounter];
109 Float_t *adcpre = new Float_t[precounter];
110 Float_t *ncellpre = new Float_t[precounter];
111 Float_t *radpre = new Float_t[precounter];
112 Int_t *sortcoord = new Int_t[precounter];
113 Int_t *clupidpre = new Int_t[precounter];
115 Float_t *xpadcpv = new Float_t[cpvcounter];
116 Float_t *ypadcpv = new Float_t[cpvcounter];
117 Float_t *adccpv = new Float_t[cpvcounter];
118 Float_t *ncellcpv = new Float_t[cpvcounter];
119 Float_t *radcpv = new Float_t[cpvcounter];
123 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
125 pmdcl = (AliPMDrecpoint1*)pmdcontin->UncheckedAt(ient1);
127 det = pmdcl->GetDetector();
128 smn = pmdcl->GetSMNumber();
129 xpos = pmdcl->GetClusX();
130 ypos = pmdcl->GetClusY();
131 adc = pmdcl->GetClusADC();
132 ncell = pmdcl->GetClusCells();
133 rad = pmdcl->GetClusSigmaX();
135 if(det == 0 && smn == i)
140 ncellpre[ii] = ncell;
144 if(det == 1 && smn == i)
146 Int_t ix = (Int_t) (xpos+0.5);
147 Int_t iy = (Int_t) (ypos+0.5);
150 edepcpv[ix][iy] = adc;
154 ncellcpv[ij] = ncell;
158 } // Entries of TObjArray loop
159 // sorts from lowest ADC to highest ADC
160 // and returns the coordinates
161 Bool_t jsort = false;
162 TMath::Sort(precounter,adcpre,sortcoord,jsort);
165 for(Int_t jj=0; jj<precounter; jj++)
168 // PIDs for PRE clusters are 0(photon) and 1(hadron)
170 jjsort = sortcoord[jj];
172 Int_t ix = (Int_t) (xpadpre[jjsort]+0.5);
173 Int_t iy = (Int_t) (ypadpre[jjsort]+0.5);
177 for(Int_t jk=0; jk<6; jk++)
179 Int_t jd1 = ix + neibx[jk];
180 Int_t jd2 = iy + neiby[jk];
182 if(jd1 >47) jd1 = 47;
184 if(jd2 >47) jd2 = 47;
185 if(edepcpv[jd1][jd2] > 0.0 && statuscpv[jd1][jd2] == 0)
187 statuscpv[jd1][jd2] = 1;
188 clupidpre[jjsort] = 1;
195 clusdata[0] = xpadpre[jjsort];
196 clusdata[1] = ypadpre[jjsort];
197 clusdata[2] = adcpre[jjsort];
198 clusdata[3] = ncellpre[jjsort];
199 clusdata[4] = radpre[jjsort];
200 //PH clusdata[5] = (Float_t) clupidpre[jjsort];
202 // Temporary the cluster PID is set to 1 if the
203 // adc > 3MIP units which will be changed later on.
205 if (adcpre[jjsort] > 300.)
213 pmdclout = new AliPMDclupid(idet,ismn,clusdata);
214 pmdcontout->Add(pmdclout);
217 for(Int_t jj=0; jj<cpvcounter; jj++)
220 // PID for CPV clusters is 1
224 clusdata[0] = xpadcpv[jj];
225 clusdata[1] = ypadcpv[jj];
226 clusdata[2] = adccpv[jj];
227 clusdata[3] = ncellcpv[jj];
228 clusdata[4] = radcpv[jj];
231 pmdclout = new AliPMDclupid(idet,ismn,clusdata);
232 pmdcontout->Add(pmdclout);
235 // delete all the pointers
251 // -----------------------------------------------------------------------