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>
29 #include <TGeometry.h>
30 #include <TObjArray.h>
31 #include <TClonesArray.h>
34 #include <TParticle.h>
37 //#include "AliPMDcluster.h"
38 #include "AliPMDrecpoint1.h"
39 #include "AliPMDclupid.h"
40 #include "AliPMDDiscriminator.h"
41 #include "AliPMDEmpDiscriminator.h"
43 ClassImp(AliPMDEmpDiscriminator)
45 AliPMDEmpDiscriminator::AliPMDEmpDiscriminator()
48 // Default Constructor
51 // -----------------------------------------------------------------------
52 AliPMDEmpDiscriminator::~AliPMDEmpDiscriminator()
57 // -----------------------------------------------------------------------
59 void AliPMDEmpDiscriminator::Discrimination(TObjArray *pmdcontin, TObjArray *pmdcontout)
61 // Does Photon/Hadron discrimination
62 // matching the clusters of CPV and PREshower plane
64 const Int_t kumperdet = 24;
65 static Int_t neibx[6]={1,0,-1,-1,0,1}, neiby[6]={0,1,1,0,-1,-1};
67 Int_t iprecount[24], icpvcount[24];
69 Float_t adc, ncell, rad;
72 for(Int_t i = 0; i < kumperdet; i++)
77 AliPMDrecpoint1 *pmdcl = 0;
78 AliPMDclupid *pmdclout = 0;
80 Int_t nentries1 = pmdcontin->GetEntries();
82 AliDebug(1,Form("Number of total clusters from CPV PRE = %d",nentries1));
83 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
85 pmdcl = (AliPMDrecpoint1*)pmdcontin->UncheckedAt(ient1);
87 det = pmdcl->GetDetector();
88 smn = pmdcl->GetSMNumber();
89 if(det == 0) iprecount[smn]++;
90 if(det == 1) icpvcount[smn]++;
91 } // Entries of TObjArray loop
94 Float_t edepcpv[48][96];
95 Int_t statuscpv[48][96];
97 for(Int_t i = 0; i < kumperdet; i++) // unit module
99 // Initialisation of the ADC of CPV (1UM)
100 for (Int_t ix = 0; ix < 48;ix++)
102 for (Int_t iy = 0; iy < 96;iy++)
104 edepcpv[ix][iy] = 0.;
105 statuscpv[ix][iy] = 0;
108 Int_t precounter = iprecount[i];
109 Int_t cpvcounter = icpvcount[i];
111 Float_t *xpadpre = new Float_t[precounter];
112 Float_t *ypadpre = new Float_t[precounter];
113 Float_t *adcpre = new Float_t[precounter];
114 Float_t *ncellpre = new Float_t[precounter];
115 Float_t *radpre = new Float_t[precounter];
116 Int_t *sortcoord = new Int_t[precounter];
117 Int_t *clupidpre = new Int_t[precounter];
119 Float_t *xpadcpv = new Float_t[cpvcounter];
120 Float_t *ypadcpv = new Float_t[cpvcounter];
121 Float_t *adccpv = new Float_t[cpvcounter];
122 Float_t *ncellcpv = new Float_t[cpvcounter];
123 Float_t *radcpv = new Float_t[cpvcounter];
127 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
129 pmdcl = (AliPMDrecpoint1*)pmdcontin->UncheckedAt(ient1);
131 det = pmdcl->GetDetector();
132 smn = pmdcl->GetSMNumber();
133 xpos = pmdcl->GetClusX();
134 ypos = pmdcl->GetClusY();
135 adc = pmdcl->GetClusADC();
136 ncell = pmdcl->GetClusCells();
137 rad = pmdcl->GetClusSigmaX();
139 if(det == 0 && smn == i)
144 ncellpre[ii] = ncell;
148 if(det == 1 && smn == i)
150 Int_t ix = (Int_t) (xpos+0.5);
151 Int_t iy = (Int_t) (ypos+0.5);
154 edepcpv[ix][iy] = adc;
158 ncellcpv[ij] = ncell;
162 } // Entries of TObjArray loop
163 // sorts from lowest ADC to highest ADC
164 // and returns the coordinates
165 Bool_t jsort = false;
166 TMath::Sort(precounter,adcpre,sortcoord,jsort);
169 for(Int_t jj=0; jj<precounter; jj++)
172 // PIDs for PRE clusters are 0(photon) and 1(hadron)
174 jjsort = sortcoord[jj];
176 Int_t ix = (Int_t) (xpadpre[jjsort]+0.5);
177 Int_t iy = (Int_t) (ypadpre[jjsort]+0.5);
181 for(Int_t jk=0; jk<6; jk++)
183 Int_t jd1 = ix + neibx[jk];
184 Int_t jd2 = iy + neiby[jk];
186 if(jd1 >47) jd1 = 47;
188 if(jd2 >47) jd2 = 47;
189 if(edepcpv[jd1][jd2] > 0.0 && statuscpv[jd1][jd2] == 0)
191 statuscpv[jd1][jd2] = 1;
192 clupidpre[jjsort] = 1;
199 clusdata[0] = xpadpre[jjsort];
200 clusdata[1] = ypadpre[jjsort];
201 clusdata[2] = adcpre[jjsort];
202 clusdata[3] = ncellpre[jjsort];
203 clusdata[4] = radpre[jjsort];
204 //PH clusdata[5] = (Float_t) clupidpre[jjsort];
206 // Temporary the cluster PID is set to 1 if the
207 // adc > 3MIP units which will be changed later on.
209 if (adcpre[jjsort] > 300.)
217 pmdclout = new AliPMDclupid(idet,ismn,clusdata);
218 pmdcontout->Add(pmdclout);
221 for(Int_t jj=0; jj<cpvcounter; jj++)
224 // PID for CPV clusters is 1
228 clusdata[0] = xpadcpv[jj];
229 clusdata[1] = ypadcpv[jj];
230 clusdata[2] = adccpv[jj];
231 clusdata[3] = ncellcpv[jj];
232 clusdata[4] = radcpv[jj];
235 pmdclout = new AliPMDclupid(idet,ismn,clusdata);
236 pmdcontout->Add(pmdclout);
239 // delete all the pointers
254 // -----------------------------------------------------------------------