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 //////////////////////////////////////////////////////////////////////////////
37 // --- ROOT system ---
41 // --- Standard library ---
45 // --- AliRoot header files ---
47 #include "AliPHOSClusterizerv1.h"
48 #include "AliPHOSDigit.h"
49 #include "AliPHOSEmcRecPoint.h"
50 #include "AliPHOSPpsdRecPoint.h"
51 #include "AliPHOSCpvRecPoint.h"
52 #include "AliPHOSv0.h"
55 ClassImp(AliPHOSClusterizerv1)
57 //____________________________________________________________________________
58 AliPHOSClusterizerv1::AliPHOSClusterizerv1()
60 // default ctor (to be used)
64 fGeom = AliPHOSGeometry::GetInstance();
65 fNumberOfEmcClusters = 0 ;
66 fNumberOfPpsdClusters = 0 ;
67 fEmcClusteringThreshold = 0.1;
68 fEmcEnergyThreshold = 0.01;
69 fPpsdClusteringThreshold = 0.0;
70 fPpsdEnergyThreshold = 0.1;
74 fLocMaxCutCPV = 0.06 ;
77 //____________________________________________________________________________
78 Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
80 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
82 // = 2 are not neighbour but do not continue searching
83 // neighbours are defined as digits having at least common vertex
84 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
85 // which is compared to a digit (d2) not yet in a cluster
90 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
93 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
95 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
96 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
97 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
99 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
103 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
104 rv = 2; // Difference in row numbers is too large to look further
110 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )
115 //Do NOT clusterize upper PPSD
116 if(fGeom->GetNumberOfCPVLayers() > 1 &&
118 relid1[1] < fGeom->GetNumberOfPadsPhi()*fGeom->GetNumberOfPadsPhi() ) rv = 2 ;
123 //____________________________________________________________________________
124 void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
126 // Copies the digits with energy above thershold and sorts the list
127 // according to increasing Id number
132 AliPHOSDigit * digit ;
134 while ( (digit = (AliPHOSDigit *)next()) ) {
136 // cout << " clusterizerv1 " << endl ;
137 // int nprim = digit->GetNprimary() ;
138 // int * aprim = digit->GetPrimary() ;
139 // for ( int ii = 0 ; ii < nprim ; ii++)
140 // cout << ii << " prim = " << aprim[ii] << endl ;
142 Int_t id = digit->GetId() ;
143 Float_t ene = Calibrate(digit->GetAmp()) ;
144 fGeom->AbsToRelNumbering(id, relid) ;
145 if(relid[1]==0){ // EMC
146 if ( ene > fEmcEnergyThreshold )
151 if ( ene > fPpsdEnergyThreshold )
159 //____________________________________________________________________________
160 void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb)
162 // Fills numb with the number of EMC (numb[0]) clusters found
163 // PPSD (numb[1]) clusters found
165 numb[0] = fNumberOfEmcClusters ;
166 numb[1] = fNumberOfPpsdClusters ;
169 //____________________________________________________________________________
170 Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit)
172 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
177 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
185 //____________________________________________________________________________
186 void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl,
187 AliPHOSRecPoint::RecPointsList * emcl,
188 AliPHOSRecPoint::RecPointsList * ppsdl)
190 // Steering method to construct the clusters stored in a list of Reconstructed Points
191 // A cluster is defined as a list of neighbour digits
193 fNumberOfEmcClusters = 0 ;
194 fNumberOfPpsdClusters = 0 ;
196 // Fill and sort the working digits list
197 TObjArray tempodigitslist( dl->GetEntries() ) ;
198 FillandSort(dl, &tempodigitslist) ;
200 // Clusterization starts
201 TIter nextdigit(&tempodigitslist) ;
202 AliPHOSDigit * digit ;
203 Bool_t notremoved = kTRUE ;
205 while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
206 AliPHOSRecPoint * clu ;
208 AliPHOSDigit ** clusterdigitslist = new AliPHOSDigit*[dl->GetEntries()] ;
210 if (( ( IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fEmcClusteringThreshold ) ) ||
211 ( ( !IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fPpsdClusteringThreshold ) ) ) {
213 Int_t iDigitInCluster = 0 ;
215 if ( IsInEmc(digit) ) {
216 // start a new EMC RecPoint
217 if(fNumberOfEmcClusters >= emcl->GetSize()) emcl->Expand(2*fNumberOfEmcClusters+1) ;
218 (*emcl)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint(fW0, fLocMaxCut) ;
219 clu = (AliPHOSEmcRecPoint *) emcl->At(fNumberOfEmcClusters) ;
220 fNumberOfEmcClusters++ ;
221 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
222 clusterdigitslist[iDigitInCluster] = digit ;
224 tempodigitslist.Remove(digit) ;
228 // start a new PPSD cluster
229 if(fNumberOfPpsdClusters >= ppsdl->GetSize()) ppsdl->Expand(2*fNumberOfPpsdClusters+1);
230 if (strcmp(fGeom->GetName(),"GPS2") == 0) {
231 (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSPpsdRecPoint() ;
232 clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
234 else if (strcmp(fGeom->GetName(),"IHEP") == 0) {
235 (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSCpvRecPoint(fW0CPV, fLocMaxCutCPV) ;
236 clu = (AliPHOSCpvRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
238 fNumberOfPpsdClusters++ ;
239 clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
240 clusterdigitslist[iDigitInCluster] = digit ;
242 tempodigitslist.Remove(digit) ;
245 // Here we remove resting EMC digits, which cannot make cluster
248 while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
250 tempodigitslist.Remove(digit) ;
254 notremoved = kFALSE ;
261 AliPHOSDigit * digitN ;
263 while (index < iDigitInCluster){ // scan over digits already in cluster
264 digit = clusterdigitslist[index] ;
266 while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
267 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
269 case 0 : // not a neighbour
271 case 1 : // are neighbours
272 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ;
273 clusterdigitslist[iDigitInCluster] = digitN ;
275 tempodigitslist.Remove(digitN) ;
277 case 2 : // too far from each other
286 } // loop over cluster
287 } //below energy theshold
289 delete[] clusterdigitslist ;
293 tempodigitslist.Clear() ;
297 for(index = 0; index < ppsdl->GetEntries(); index++)
298 ((AliPHOSPpsdRecPoint *)ppsdl->At(index))->SetIndexInList(index) ;
301 //____________________________________________________________________________
302 void AliPHOSClusterizerv1::PrintParameters()
304 // Print the energy thresholds
306 cout << "PHOS Clusterizer version 1 :" << endl
307 << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl
308 << " EMC Energy threshold = " << fEmcEnergyThreshold << endl
309 << " PPSD Clustering threshold = " << fPpsdClusteringThreshold << endl
310 << " PPSD Energy threshold = " << fPpsdEnergyThreshold << endl ;