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 reads the file PMD.digits.root(TreeD), //
20 // calls the Clustering algorithm and stores the //
21 // clustering output in PMD.RecPoints.root(TreeR) //
23 //-----------------------------------------------------//
25 #include <Riostream.h>
30 #include <TGeometry.h>
31 #include <TObjArray.h>
32 #include <TClonesArray.h>
35 #include <TParticle.h>
37 #include "AliPMDcluster.h"
38 #include "AliPMDclupid.h"
39 #include "AliPMDDiscriminator.h"
41 ClassImp(AliPMDDiscriminator)
43 AliPMDDiscriminator::AliPMDDiscriminator() :
48 // Default Constructor
52 // -----------------------------------------------------------------------
53 AliPMDDiscriminator::~AliPMDDiscriminator()
58 // -----------------------------------------------------------------------
60 void AliPMDDiscriminator::Discrimination(TObjArray *pmdcontin, TObjArray *pmdcontout)
62 // Does Photon/Hadron discrimination
66 EmpDiscrimination(pmdcontin, pmdcontout);
68 else if(fDiscrim == 1)
73 // -----------------------------------------------------------------------
75 void AliPMDDiscriminator::EmpDiscrimination(TObjArray *pmdcontin, TObjArray *pmdcontout)
77 // Does Photon/Hadron discrimination
78 // matching the clusters of CPV and PREshower plane
80 const Int_t kumperdet = 24;
81 static Int_t neibx[6]={1,0,-1,-1,0,1}, neiby[6]={0,1,1,0,-1,-1};
83 Int_t iprecount[24], icpvcount[24];
85 Float_t adc, ncell, rad;
88 for(Int_t i = 0; i < kumperdet; i++)
93 AliPMDcluster *pmdcl = 0;
94 AliPMDclupid *pmdclout = 0;
96 Int_t nentries1 = pmdcontin->GetEntries();
97 cout << " nentries1 = " << nentries1 << endl;
98 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
100 pmdcl = (AliPMDcluster*)pmdcontin->UncheckedAt(ient1);
102 det = pmdcl->GetDetector();
103 smn = pmdcl->GetSMN();
104 if(det == 0) iprecount[smn]++;
105 if(det == 1) icpvcount[smn]++;
106 } // Entries of TObjArray loop
109 Float_t edepcpv[48][96];
110 Int_t statuscpv[48][96];
112 for(Int_t i = 0; i < kumperdet; i++) // unit module
114 // Initialisation of the ADC of CPV (1UM)
115 for (Int_t ix = 0; ix < 48;ix++)
117 for (Int_t iy = 0; iy < 96;iy++)
119 edepcpv[ix][iy] = 0.;
120 statuscpv[ix][iy] = 0;
123 Int_t precounter = iprecount[i];
124 Int_t cpvcounter = icpvcount[i];
126 Float_t *xpadpre = new Float_t[precounter];
127 Float_t *ypadpre = new Float_t[precounter];
128 Float_t *adcpre = new Float_t[precounter];
129 Float_t *ncellpre = new Float_t[precounter];
130 Float_t *radpre = new Float_t[precounter];
131 Int_t *sortcoord = new Int_t[precounter];
132 Int_t *clupidpre = new Int_t[precounter];
134 Float_t *xpadcpv = new Float_t[cpvcounter];
135 Float_t *ypadcpv = new Float_t[cpvcounter];
136 Float_t *adccpv = new Float_t[cpvcounter];
137 Float_t *ncellcpv = new Float_t[cpvcounter];
138 Float_t *radcpv = new Float_t[cpvcounter];
142 for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
144 pmdcl = (AliPMDcluster*)pmdcontin->UncheckedAt(ient1);
146 det = pmdcl->GetDetector();
147 smn = pmdcl->GetSMN();
148 xpos = pmdcl->GetClusX();
149 ypos = pmdcl->GetClusY();
150 adc = pmdcl->GetClusADC();
151 ncell = pmdcl->GetClusCells();
152 rad = pmdcl->GetClusRadius();
154 if(det == 0 && smn == i)
159 ncellpre[ii] = ncell;
163 if(det == 1 && smn == i)
165 Int_t ix = (Int_t) (xpos+0.5);
166 Int_t iy = (Int_t) (ypos+0.5);
169 edepcpv[ix][iy] = adc;
173 ncellcpv[ij] = ncell;
177 } // Entries of TObjArray loop
178 // sorts from lowest ADC to highest ADC
179 // and returns the coordinates
180 Bool_t jsort = false;
181 TMath::Sort(precounter,adcpre,sortcoord,jsort);
184 for(Int_t jj=0; jj<precounter; jj++)
187 // PIDs for PRE clusters are 0(photon) and 1(hadron)
189 jjsort = sortcoord[jj];
191 Int_t ix = (Int_t) (xpadpre[jjsort]+0.5);
192 Int_t iy = (Int_t) (ypadpre[jjsort]+0.5);
196 for(Int_t jk=0; jk<6; jk++)
198 Int_t jd1 = ix + neibx[jk];
199 Int_t jd2 = iy + neiby[jk];
201 if(jd1 >47) jd1 = 47;
203 if(jd2 >47) jd2 = 47;
204 if(edepcpv[jd1][jd2] > 0.0 && statuscpv[jd1][jd2] == 0)
206 statuscpv[jd1][jd2] = 1;
207 clupidpre[jjsort] = 1;
214 clusdata[0] = xpadpre[jjsort];
215 clusdata[1] = ypadpre[jjsort];
216 clusdata[2] = adcpre[jjsort];
217 clusdata[3] = ncellpre[jjsort];
218 clusdata[4] = radpre[jjsort];
219 //PH clusdata[5] = (Float_t) clupidpre[jjsort];
221 // Temporary the cluster PID is set to 1 if the
222 // adc > 3MIP units which will be changed later on.
224 if (adcpre[jjsort] > 4500.)
232 pmdclout = new AliPMDclupid(idet,ismn,clusdata);
233 pmdcontout->Add(pmdclout);
236 for(Int_t jj=0; jj<cpvcounter; jj++)
239 // PID for CPV clusters is 1
243 clusdata[0] = xpadcpv[jj];
244 clusdata[1] = ypadcpv[jj];
245 clusdata[2] = adccpv[jj];
246 clusdata[3] = ncellcpv[jj];
247 clusdata[4] = radcpv[jj];
250 pmdclout = new AliPMDclupid(idet,ismn,clusdata);
251 pmdcontout->Add(pmdclout);
254 // delete all the pointers
269 // -----------------------------------------------------------------------
270 void AliPMDDiscriminator::NNDiscrimination()
272 // This method does discrimination using Neural Network technique
275 // -----------------------------------------------------------------------
276 void AliPMDDiscriminator::SetDiscrimination(Int_t idiscrim)
280 // -----------------------------------------------------------------------