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 **************************************************************************/
18 //_________________________________________________________________________
19 // Implementation version 1 of the clusterization algorithm
21 //*-- Author: Yves Schutz (SUBATECH)
22 //////////////////////////////////////////////////////////////////////////////
24 // --- ROOT system ---
28 // --- Standard library ---
32 // --- AliRoot header files ---
34 #include "AliPHOSClusterizerv1.h"
35 #include "AliPHOSDigit.h"
36 #include "AliPHOSEmcRecPoint.h"
37 #include "AliPHOSPpsdRecPoint.h"
38 #include "AliPHOSv0.h"
41 ClassImp(AliPHOSClusterizerv1)
43 //____________________________________________________________________________
44 AliPHOSClusterizerv1::AliPHOSClusterizerv1()
46 // default ctor (to be used)
50 fGeom = AliPHOSGeometry::GetInstance();
51 fNumberOfEmcClusters = 0 ;
52 fNumberOfPpsdClusters = 0 ;
53 fEmcClusteringThreshold = 0.1;
54 fEmcEnergyThreshold = 0.01;
55 fPpsdClusteringThreshold = 0.00000015;
56 fPpsdEnergyThreshold = 0.0000001;
61 //____________________________________________________________________________
62 Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
64 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
66 // = 2 are not neighbour but do not continue searching
67 // neighbours are defined as digits having at least common vertex
68 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
69 // which is compared to a digit (d2) not yet in a cluster
74 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
77 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
79 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
80 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
81 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
83 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
87 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
88 rv = 2; // Difference in row numbers is too large to look further
94 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )
102 //____________________________________________________________________________
103 void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
105 // Copies the digits with energy above thershold and sorts the list
106 // according to increasing Id number
111 AliPHOSDigit * digit ;
116 while ( (digit = (AliPHOSDigit *)next()) ) {
118 // cout << " clusterizerv1 " << endl ;
119 // int nprim = digit->GetNprimary() ;
120 // int * aprim = digit->GetPrimary() ;
121 // for ( int ii = 0 ; ii < nprim ; ii++)
122 // cout << ii << " prim = " << aprim[ii] << endl ;
124 Int_t id = digit->GetId() ;
125 Float_t ene = Calibrate(digit->GetAmp()) ;
126 fGeom->AbsToRelNumbering(id, relid) ;
127 if(relid[1]==0){ // EMC
128 if ( ene > fEmcEnergyThreshold )
133 if ( ene > fPpsdEnergyThreshold )
141 //____________________________________________________________________________
142 void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb)
144 // Fills numb with the number of EMC (numb[0]) clusters found
145 // PPSD (numb[1]) clusters found
147 numb[0] = fNumberOfEmcClusters ;
148 numb[1] = fNumberOfPpsdClusters ;
151 //____________________________________________________________________________
152 Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit)
154 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
159 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
167 //____________________________________________________________________________
168 void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl,
169 AliPHOSRecPoint::RecPointsList * emcl,
170 AliPHOSRecPoint::RecPointsList * ppsdl)
172 // Steering method to construct the clusters stored in a list of Reconstructed Points
173 // A cluster is defined as a list of neighbour digits
175 // Fill and sort the working digits list
176 TObjArray tempodigitslist( dl->GetEntries() ) ;
177 FillandSort(dl, &tempodigitslist) ;
179 // Clusterization starts
180 TIter nextdigit(&tempodigitslist) ;
181 AliPHOSDigit * digit ;
182 Bool_t notremoved = kTRUE ;
184 while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
185 AliPHOSRecPoint * clu ;
187 AliPHOSDigit ** clusterdigitslist = new AliPHOSDigit*[dl->GetEntries()] ;
189 if (( ( IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fEmcClusteringThreshold ) ) ||
190 ( ( !IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fPpsdClusteringThreshold ) ) ) {
192 Int_t iDigitInCluster = 0 ;
194 if ( IsInEmc(digit) ) {
195 // start a new EMC RecPoint
196 // new ((*emcl)[fNumberOfEmcClusters]) AliPHOSEmcRecPoint(fW0, fLocMaxCut) ; if TClonesArray
197 (*emcl)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint(fW0, fLocMaxCut) ;
199 clu = (AliPHOSEmcRecPoint *) emcl->At(fNumberOfEmcClusters) ;
200 fNumberOfEmcClusters++ ;
201 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
202 clusterdigitslist[iDigitInCluster] = digit ;
204 tempodigitslist.Remove(digit) ;
210 // start a new PPSD cluster
211 // new ((*ppsdl)[fNumberOfPpsdClusters]) AliPHOSPpsdRecPoint() ; if TClonesArray
212 (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSPpsdRecPoint() ;
214 clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
215 fNumberOfPpsdClusters++ ;
216 clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
217 clusterdigitslist[iDigitInCluster] = digit ;
219 tempodigitslist.Remove(digit) ;
222 // Here we remove resting EMC digits, which cannot make cluster
226 while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
229 tempodigitslist.Remove(digit) ;
241 AliPHOSDigit * digitN ;
243 while (index < iDigitInCluster){ // scan over digits already in cluster
244 digit = clusterdigitslist[index] ;
246 while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
247 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
249 case 0 : // not a neighbour
251 case 1 : // are neighbours
252 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ;
253 clusterdigitslist[iDigitInCluster] = digitN ;
255 tempodigitslist.Remove(digitN) ;
257 case 2 : // too far from each other
266 } // loop over cluster
268 } //below energy theshold
270 delete[] clusterdigitslist ;
274 tempodigitslist.Clear() ;
278 //____________________________________________________________________________
279 void AliPHOSClusterizerv1::PrintParameters()
281 // Print the energy thresholds
283 cout << "PHOS Clusterizer version 1 :" << endl
284 << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl
285 << " EMC Energy threshold = " << fEmcEnergyThreshold << endl
286 << " PPSD Clustering threshold = " << fPpsdClusteringThreshold << endl
287 << " PPSD Energy threshold = " << fPpsdEnergyThreshold << endl ;