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 **************************************************************************/
19 1 October 2000. Yuri Kharlov:
21 PPSD upper layer is considered if number of layers>1
23 18 October 2000. Yuri Kharlov:
24 AliPHOSClusterizerv1()
25 CPV clusterizing parameters added
28 After first PPSD digit remove EMC digits only once
31 //_________________________________________________________________________
32 // Implementation version 1 of the clusterization algorithm
34 //*-- Author: Yves Schutz (SUBATECH)
35 //////////////////////////////////////////////////////////////////////////////
39 // --- ROOT system ---
43 // --- Standard library ---
47 // --- AliRoot header files ---
49 #include "AliPHOSClusterizerv1.h"
50 #include "AliPHOSDigit.h"
51 #include "AliPHOSEmcRecPoint.h"
52 #include "AliPHOSPpsdRecPoint.h"
53 #include "AliPHOSCpvRecPoint.h"
54 #include "AliPHOSv0.h"
57 ClassImp(AliPHOSClusterizerv1)
59 //____________________________________________________________________________
60 AliPHOSClusterizerv1::AliPHOSClusterizerv1()
62 // default ctor (to be used)
66 fGeom = AliPHOSGeometry::GetInstance();
67 fNumberOfEmcClusters = 0 ;
68 fNumberOfPpsdClusters = 0 ;
69 fEmcClusteringThreshold = 0.1;
70 fEmcEnergyThreshold = 0.01;
71 fPpsdClusteringThreshold = 0.0;
72 fPpsdEnergyThreshold = 0.1;
73 fCpvClusteringThreshold = 0.0;
74 fCpvEnergyThreshold = 0.1;
78 fLocMaxCutCPV = 0.06 ;
81 //____________________________________________________________________________
82 Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
84 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
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
94 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
97 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
99 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
100 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
101 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
103 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
107 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
108 rv = 2; // Difference in row numbers is too large to look further
114 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )
119 //Do NOT clusterize upper PPSD
120 if( IsInPpsd(d1) && IsInPpsd(d2) &&
122 relid1[1] < fGeom->GetNumberOfPadsPhi()*fGeom->GetNumberOfPadsPhi() ) rv = 2 ;
127 //____________________________________________________________________________
128 void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
130 // Copies the digits with energy above thershold and sorts the list
131 // according to increasing Id number
136 AliPHOSDigit * digit ;
138 while ( (digit = (AliPHOSDigit *)next()) ) {
140 // cout << " clusterizerv1 " << endl ;
141 // int nprim = digit->GetNprimary() ;
142 // int * aprim = digit->GetPrimary() ;
143 // for ( int ii = 0 ; ii < nprim ; ii++)
144 // cout << ii << " prim = " << aprim[ii] << endl ;
146 Int_t id = digit->GetId() ;
147 Float_t ene = Calibrate(digit->GetAmp()) ;
148 fGeom->AbsToRelNumbering(id, relid) ;
149 if(relid[1]==0){ // EMC
150 if ( ene > fEmcEnergyThreshold )
155 if ( ene > fPpsdEnergyThreshold )
163 //____________________________________________________________________________
164 void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb)
166 // Fills numb with the number of EMC (numb[0]) clusters found
167 // PPSD (numb[1]) clusters found
169 numb[0] = fNumberOfEmcClusters ;
170 numb[1] = fNumberOfPpsdClusters ;
173 //____________________________________________________________________________
174 Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit)
176 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
181 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
183 if ( relid[1] == 0 ) rv = kTRUE;
188 //____________________________________________________________________________
189 Bool_t AliPHOSClusterizerv1::IsInPpsd(AliPHOSDigit * digit)
191 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
196 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
198 if ( relid[1] > 0 && relid[0] > fGeom->GetNCPVModules() ) rv = kTRUE;
203 //____________________________________________________________________________
204 Bool_t AliPHOSClusterizerv1::IsInCpv(AliPHOSDigit * digit)
206 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
211 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
213 if ( relid[1] > 0 && relid[0] <= fGeom->GetNCPVModules() ) rv = kTRUE;
218 //____________________________________________________________________________
219 void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl,
220 AliPHOSRecPoint::RecPointsList * emcl,
221 AliPHOSRecPoint::RecPointsList * ppsdl,
222 AliPHOSRecPoint::RecPointsList * cpvl)
224 // Steering method to construct the clusters stored in a list of Reconstructed Points
225 // A cluster is defined as a list of neighbour digits
227 fNumberOfEmcClusters = 0 ;
228 fNumberOfPpsdClusters = 0 ;
229 fNumberOfCpvClusters = 0 ;
231 // Fill and sort the working digits list
232 TObjArray tempodigitslist( dl->GetEntries() ) ;
233 FillandSort(dl, &tempodigitslist) ;
235 // Clusterization starts
236 TIter nextdigit(&tempodigitslist) ;
237 AliPHOSDigit * digit ;
238 Bool_t notremoved = kTRUE ;
240 while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
241 AliPHOSRecPoint * clu ;
243 AliPHOSDigit ** clusterdigitslist = new AliPHOSDigit*[dl->GetEntries()] ;
245 if (( IsInEmc (digit) && Calibrate(digit->GetAmp()) > fEmcClusteringThreshold ) ||
246 ( IsInPpsd(digit) && Calibrate(digit->GetAmp()) > fPpsdClusteringThreshold ) ||
247 ( IsInCpv (digit) && Calibrate(digit->GetAmp()) > fCpvClusteringThreshold ) ) {
249 Int_t iDigitInCluster = 0 ;
251 if ( IsInEmc(digit) ) {
252 // start a new EMC RecPoint
253 if(fNumberOfEmcClusters >= emcl->GetSize()) emcl->Expand(2*fNumberOfEmcClusters+1) ;
254 (*emcl)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint(fW0, fLocMaxCut) ;
255 clu = (AliPHOSEmcRecPoint *) emcl->At(fNumberOfEmcClusters) ;
256 fNumberOfEmcClusters++ ;
257 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
258 clusterdigitslist[iDigitInCluster] = digit ;
260 tempodigitslist.Remove(digit) ;
264 // start a new PPSD cluster
265 if(fNumberOfPpsdClusters >= ppsdl->GetSize()) ppsdl->Expand(2*fNumberOfPpsdClusters+1);
266 if(fNumberOfCpvClusters >= cpvl ->GetSize()) cpvl ->Expand(2*fNumberOfCpvClusters +1);
267 if (IsInPpsd(digit)) {
268 (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSPpsdRecPoint() ;
269 clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
270 fNumberOfPpsdClusters++ ;
272 else if (IsInCpv(digit) ) {
273 (*cpvl) [fNumberOfCpvClusters] = new AliPHOSCpvRecPoint(fW0CPV, fLocMaxCutCPV) ;
274 clu = (AliPHOSCpvRecPoint *) cpvl ->At(fNumberOfCpvClusters) ;
275 fNumberOfCpvClusters++ ;
278 cout << "AliPHOSClusterizerv1::MakeClusters: unknown configuration " << fGeom->GetName() << endl;
281 clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
282 clusterdigitslist[iDigitInCluster] = digit ;
284 tempodigitslist.Remove(digit) ;
287 // Here we remove resting EMC digits, which cannot make cluster
290 while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
292 tempodigitslist.Remove(digit) ;
296 notremoved = kFALSE ;
303 AliPHOSDigit * digitN ;
305 while (index < iDigitInCluster){ // scan over digits already in cluster
306 digit = clusterdigitslist[index] ;
308 while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
309 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
311 case 0 : // not a neighbour
313 case 1 : // are neighbours
314 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ;
315 clusterdigitslist[iDigitInCluster] = digitN ;
317 tempodigitslist.Remove(digitN) ;
319 case 2 : // too far from each other
328 } // loop over cluster
329 } //below energy theshold
331 delete[] clusterdigitslist ;
335 tempodigitslist.Clear() ;
339 for(index = 0; index < ppsdl->GetEntries(); index++)
340 ((AliPHOSPpsdRecPoint *)ppsdl->At(index))->SetIndexInList(index) ;
343 //____________________________________________________________________________
344 void AliPHOSClusterizerv1::PrintParameters()
346 // Print the energy thresholds
348 cout << "PHOS Clusterizer version 1 :" << endl
349 << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl
350 << " EMC Energy threshold = " << fEmcEnergyThreshold << endl
351 << " PPSD Clustering threshold = " << fPpsdClusteringThreshold << endl
352 << " PPSD Energy threshold = " << fPpsdEnergyThreshold << endl
353 << " CPV Clustering threshold = " << fCpvClusteringThreshold << endl
354 << " CPV Energy threshold = " << fCpvEnergyThreshold << endl ;