]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
d72dfbc3 | 18 | /* $Log: |
19 | 1 October 2000. Yuri Kharlov: | |
20 | AreNeighbours() | |
21 | PPSD upper layer is considered if number of layers>1 | |
22 | ||
23 | 18 October 2000. Yuri Kharlov: | |
24 | AliPHOSClusterizerv1() | |
25 | CPV clusterizing parameters added | |
26 | ||
27 | MakeClusters() | |
28 | After first PPSD digit remove EMC digits only once | |
29 | */ | |
30 | ||
d15a28e7 | 31 | //_________________________________________________________________________ |
b2a60966 | 32 | // Implementation version 1 of the clusterization algorithm |
33 | // | |
34 | //*-- Author: Yves Schutz (SUBATECH) | |
d15a28e7 | 35 | ////////////////////////////////////////////////////////////////////////////// |
36 | ||
ed4205d8 | 37 | #include <assert.h> |
38 | ||
d15a28e7 | 39 | // --- ROOT system --- |
40 | ||
41 | #include "TMath.h" | |
42 | ||
43 | // --- Standard library --- | |
44 | ||
de9ec31b | 45 | #include <iostream.h> |
d15a28e7 | 46 | |
47 | // --- AliRoot header files --- | |
48 | ||
49 | #include "AliPHOSClusterizerv1.h" | |
50 | #include "AliPHOSDigit.h" | |
51 | #include "AliPHOSEmcRecPoint.h" | |
52 | #include "AliPHOSPpsdRecPoint.h" | |
0b06c60d | 53 | #include "AliPHOSCpvRecPoint.h" |
d15a28e7 | 54 | #include "AliPHOSv0.h" |
55 | #include "AliRun.h" | |
56 | ||
57 | ClassImp(AliPHOSClusterizerv1) | |
58 | ||
59 | //____________________________________________________________________________ | |
60 | AliPHOSClusterizerv1::AliPHOSClusterizerv1() | |
61 | { | |
b2a60966 | 62 | // default ctor (to be used) |
63 | ||
d15a28e7 | 64 | fA = 0.; |
65 | fB = 0.01 ; | |
6b9b768e | 66 | fGeom = AliPHOSGeometry::GetInstance(); |
d15a28e7 | 67 | fNumberOfEmcClusters = 0 ; |
68 | fNumberOfPpsdClusters = 0 ; | |
69 | fEmcClusteringThreshold = 0.1; | |
70 | fEmcEnergyThreshold = 0.01; | |
d72dfbc3 | 71 | fPpsdClusteringThreshold = 0.0; |
72 | fPpsdEnergyThreshold = 0.1; | |
ed4205d8 | 73 | fCpvClusteringThreshold = 0.0; |
74 | fCpvEnergyThreshold = 0.1; | |
d15a28e7 | 75 | fW0 = 4.5 ; |
76 | fLocMaxCut = 0.06 ; | |
d72dfbc3 | 77 | fW0CPV = 4.5 ; |
78 | fLocMaxCutCPV = 0.06 ; | |
d15a28e7 | 79 | } |
80 | ||
81 | //____________________________________________________________________________ | |
82 | Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2) | |
83 | { | |
b2a60966 | 84 | // Gives the neighbourness of two digits = 0 are not neighbour but continue searching |
85 | // = 1 are neighbour | |
86 | // = 2 are not neighbour but do not continue searching | |
87 | // neighbours are defined as digits having at least common vertex | |
88 | // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster | |
89 | // which is compared to a digit (d2) not yet in a cluster | |
90 | ||
d15a28e7 | 91 | Int_t rv = 0 ; |
92 | ||
d15a28e7 | 93 | Int_t relid1[4] ; |
6b9b768e | 94 | fGeom->AbsToRelNumbering(d1->GetId(), relid1) ; |
d15a28e7 | 95 | |
96 | Int_t relid2[4] ; | |
6b9b768e | 97 | fGeom->AbsToRelNumbering(d2->GetId(), relid2) ; |
d15a28e7 | 98 | |
99 | if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module | |
92862013 | 100 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; |
101 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
d15a28e7 | 102 | |
92862013 | 103 | if (( coldiff <= 1 ) && ( rowdiff <= 1 )){ |
d15a28e7 | 104 | rv = 1 ; |
105 | } | |
106 | else { | |
107 | if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) | |
108 | rv = 2; // Difference in row numbers is too large to look further | |
109 | } | |
110 | ||
111 | } | |
112 | else { | |
113 | ||
114 | if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) ) | |
115 | rv=2 ; | |
116 | ||
117 | } | |
d72dfbc3 | 118 | |
119 | //Do NOT clusterize upper PPSD | |
ed4205d8 | 120 | if( IsInPpsd(d1) && IsInPpsd(d2) && |
121 | relid1[1] > 0 && | |
d72dfbc3 | 122 | relid1[1] < fGeom->GetNumberOfPadsPhi()*fGeom->GetNumberOfPadsPhi() ) rv = 2 ; |
123 | ||
d15a28e7 | 124 | return rv ; |
125 | } | |
126 | ||
127 | //____________________________________________________________________________ | |
128 | void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl) | |
129 | { | |
b2a60966 | 130 | // Copies the digits with energy above thershold and sorts the list |
d15a28e7 | 131 | // according to increasing Id number |
132 | ||
d15a28e7 | 133 | TIter next(dl) ; |
134 | AliPHOSDigit * digit ; | |
135 | ||
136 | while ( (digit = (AliPHOSDigit *)next()) ) { | |
d15a28e7 | 137 | Float_t ene = Calibrate(digit->GetAmp()) ; |
f2bc1b87 | 138 | if ( IsInEmc (digit) && ene > fEmcEnergyThreshold ) |
139 | tl->Add(digit) ; | |
140 | else if ( IsInPpsd (digit) && ene > fPpsdEnergyThreshold ) | |
141 | tl->Add(digit) ; | |
142 | else if ( IsInCpv (digit) && ene > fCpvEnergyThreshold ) | |
143 | tl->Add(digit) ; | |
d15a28e7 | 144 | } |
145 | tl->Sort() ; | |
146 | } | |
147 | ||
148 | //____________________________________________________________________________ | |
149 | void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb) | |
150 | { | |
b2a60966 | 151 | // Fills numb with the number of EMC (numb[0]) clusters found |
152 | // PPSD (numb[1]) clusters found | |
153 | ||
154 | numb[0] = fNumberOfEmcClusters ; | |
155 | numb[1] = fNumberOfPpsdClusters ; | |
d15a28e7 | 156 | } |
157 | ||
158 | //____________________________________________________________________________ | |
159 | Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) | |
160 | { | |
b2a60966 | 161 | // Tells if (true) or not (false) the digit is in a PHOS-EMC module |
162 | ||
9f616d61 | 163 | Bool_t rv = kFALSE ; |
d15a28e7 | 164 | |
d15a28e7 | 165 | Int_t relid[4] ; |
6b9b768e | 166 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; |
d15a28e7 | 167 | |
ed4205d8 | 168 | if ( relid[1] == 0 ) rv = kTRUE; |
169 | ||
170 | return rv ; | |
171 | } | |
172 | ||
173 | //____________________________________________________________________________ | |
174 | Bool_t AliPHOSClusterizerv1::IsInPpsd(AliPHOSDigit * digit) | |
175 | { | |
fad3e5b9 | 176 | // Tells if (true) or not (false) the digit is in a PHOS-PPSD module |
ed4205d8 | 177 | |
178 | Bool_t rv = kFALSE ; | |
179 | ||
180 | Int_t relid[4] ; | |
181 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
182 | ||
183 | if ( relid[1] > 0 && relid[0] > fGeom->GetNCPVModules() ) rv = kTRUE; | |
184 | ||
185 | return rv ; | |
186 | } | |
187 | ||
188 | //____________________________________________________________________________ | |
189 | Bool_t AliPHOSClusterizerv1::IsInCpv(AliPHOSDigit * digit) | |
190 | { | |
fad3e5b9 | 191 | // Tells if (true) or not (false) the digit is in a PHOS-CPV module |
ed4205d8 | 192 | |
193 | Bool_t rv = kFALSE ; | |
194 | ||
195 | Int_t relid[4] ; | |
196 | fGeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
197 | ||
198 | if ( relid[1] > 0 && relid[0] <= fGeom->GetNCPVModules() ) rv = kTRUE; | |
d15a28e7 | 199 | |
200 | return rv ; | |
201 | } | |
202 | ||
203 | //____________________________________________________________________________ | |
88714635 | 204 | void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl, |
205 | AliPHOSRecPoint::RecPointsList * emcl, | |
fad3e5b9 | 206 | AliPHOSRecPoint::RecPointsList * ppsdl) |
d15a28e7 | 207 | { |
b2a60966 | 208 | // Steering method to construct the clusters stored in a list of Reconstructed Points |
209 | // A cluster is defined as a list of neighbour digits | |
c161df70 | 210 | |
b73f246d | 211 | fNumberOfEmcClusters = 0 ; |
c161df70 | 212 | fNumberOfPpsdClusters = 0 ; |
b73f246d | 213 | fNumberOfCpvClusters = 0 ; |
c161df70 | 214 | |
d15a28e7 | 215 | // Fill and sort the working digits list |
92862013 | 216 | TObjArray tempodigitslist( dl->GetEntries() ) ; |
217 | FillandSort(dl, &tempodigitslist) ; | |
d15a28e7 | 218 | |
219 | // Clusterization starts | |
92862013 | 220 | TIter nextdigit(&tempodigitslist) ; |
d15a28e7 | 221 | AliPHOSDigit * digit ; |
92862013 | 222 | Bool_t notremoved = kTRUE ; |
6ad0bfa0 | 223 | |
d15a28e7 | 224 | while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits |
225 | AliPHOSRecPoint * clu ; | |
c161df70 | 226 | |
83974468 | 227 | AliPHOSDigit ** clusterdigitslist = new AliPHOSDigit*[dl->GetEntries()] ; |
d15a28e7 | 228 | Int_t index ; |
f2bc1b87 | 229 | |
b73f246d | 230 | if (( IsInEmc (digit) && Calibrate(digit->GetAmp()) > fEmcClusteringThreshold ) || |
231 | ( IsInPpsd(digit) && Calibrate(digit->GetAmp()) > fPpsdClusteringThreshold ) || | |
232 | ( IsInCpv (digit) && Calibrate(digit->GetAmp()) > fCpvClusteringThreshold ) ) { | |
f2bc1b87 | 233 | |
d15a28e7 | 234 | Int_t iDigitInCluster = 0 ; |
235 | ||
6ad0bfa0 | 236 | if ( IsInEmc(digit) ) { |
83974468 | 237 | // start a new EMC RecPoint |
d72dfbc3 | 238 | if(fNumberOfEmcClusters >= emcl->GetSize()) emcl->Expand(2*fNumberOfEmcClusters+1) ; |
83974468 | 239 | (*emcl)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint(fW0, fLocMaxCut) ; |
6b9b768e | 240 | clu = (AliPHOSEmcRecPoint *) emcl->At(fNumberOfEmcClusters) ; |
9f616d61 | 241 | fNumberOfEmcClusters++ ; |
242 | clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ; | |
83974468 | 243 | clusterdigitslist[iDigitInCluster] = digit ; |
9f616d61 | 244 | iDigitInCluster++ ; |
92862013 | 245 | tempodigitslist.Remove(digit) ; |
ca77b032 | 246 | |
d72dfbc3 | 247 | } else { |
83974468 | 248 | |
fad3e5b9 | 249 | // start a new PPSD/CPV cluster |
d72dfbc3 | 250 | if(fNumberOfPpsdClusters >= ppsdl->GetSize()) ppsdl->Expand(2*fNumberOfPpsdClusters+1); |
fad3e5b9 | 251 | if (IsInPpsd(digit)) |
d72dfbc3 | 252 | (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSPpsdRecPoint() ; |
fad3e5b9 | 253 | else |
254 | (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSCpvRecPoint(fW0CPV, fLocMaxCutCPV) ; | |
255 | clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ; | |
256 | fNumberOfPpsdClusters++ ; | |
257 | ||
6ad0bfa0 | 258 | clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ; |
83974468 | 259 | clusterdigitslist[iDigitInCluster] = digit ; |
9f616d61 | 260 | iDigitInCluster++ ; |
92862013 | 261 | tempodigitslist.Remove(digit) ; |
d15a28e7 | 262 | nextdigit.Reset() ; |
263 | ||
9f616d61 | 264 | // Here we remove resting EMC digits, which cannot make cluster |
fad3e5b9 | 265 | |
92862013 | 266 | if( notremoved ) { |
9f616d61 | 267 | while( ( digit = (AliPHOSDigit *)nextdigit() ) ) { |
9f616d61 | 268 | if( IsInEmc(digit) ) |
92862013 | 269 | tempodigitslist.Remove(digit) ; |
d15a28e7 | 270 | else |
271 | break ; | |
d72dfbc3 | 272 | } |
273 | notremoved = kFALSE ; | |
274 | } | |
d15a28e7 | 275 | |
276 | } // else | |
277 | ||
278 | nextdigit.Reset() ; | |
fad3e5b9 | 279 | |
d15a28e7 | 280 | AliPHOSDigit * digitN ; |
281 | index = 0 ; | |
9f616d61 | 282 | while (index < iDigitInCluster){ // scan over digits already in cluster |
83974468 | 283 | digit = clusterdigitslist[index] ; |
9f616d61 | 284 | index++ ; |
d15a28e7 | 285 | while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits |
d72dfbc3 | 286 | Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!! |
d15a28e7 | 287 | switch (ineb ) { |
9f616d61 | 288 | case 0 : // not a neighbour |
d72dfbc3 | 289 | break ; |
9f616d61 | 290 | case 1 : // are neighbours |
83974468 | 291 | clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ; |
292 | clusterdigitslist[iDigitInCluster] = digitN ; | |
9f616d61 | 293 | iDigitInCluster++ ; |
92862013 | 294 | tempodigitslist.Remove(digitN) ; |
d15a28e7 | 295 | break ; |
9f616d61 | 296 | case 2 : // too far from each other |
d15a28e7 | 297 | goto endofloop; |
298 | } // switch | |
299 | ||
300 | } // while digitN | |
fad3e5b9 | 301 | |
d15a28e7 | 302 | endofloop: ; |
303 | nextdigit.Reset() ; | |
304 | ||
305 | } // loop over cluster | |
d72dfbc3 | 306 | } //below energy theshold |
307 | ||
31aa6d6c | 308 | delete[] clusterdigitslist ; |
309 | ||
d15a28e7 | 310 | } // while digit |
311 | ||
92862013 | 312 | tempodigitslist.Clear() ; |
83974468 | 313 | |
c161df70 | 314 | ppsdl->Sort() ; |
315 | Int_t index ; | |
316 | for(index = 0; index < ppsdl->GetEntries(); index++) | |
317 | ((AliPHOSPpsdRecPoint *)ppsdl->At(index))->SetIndexInList(index) ; | |
d15a28e7 | 318 | } |
319 | ||
320 | //____________________________________________________________________________ | |
321 | void AliPHOSClusterizerv1::PrintParameters() | |
322 | { | |
b2a60966 | 323 | // Print the energy thresholds |
324 | ||
d15a28e7 | 325 | cout << "PHOS Clusterizer version 1 :" << endl |
326 | << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl | |
327 | << " EMC Energy threshold = " << fEmcEnergyThreshold << endl | |
328 | << " PPSD Clustering threshold = " << fPpsdClusteringThreshold << endl | |
ed4205d8 | 329 | << " PPSD Energy threshold = " << fPpsdEnergyThreshold << endl |
330 | << " CPV Clustering threshold = " << fCpvClusteringThreshold << endl | |
331 | << " CPV Energy threshold = " << fCpvEnergyThreshold << endl ; | |
d15a28e7 | 332 | } |