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 "AliPHOSv0.h"
54 ClassImp(AliPHOSClusterizerv1)
56 //____________________________________________________________________________
57 AliPHOSClusterizerv1::AliPHOSClusterizerv1()
59 // default ctor (to be used)
63 fGeom = AliPHOSGeometry::GetInstance();
64 fNumberOfEmcClusters = 0 ;
65 fNumberOfPpsdClusters = 0 ;
66 fEmcClusteringThreshold = 0.1;
67 fEmcEnergyThreshold = 0.01;
68 fPpsdClusteringThreshold = 0.0;
69 fPpsdEnergyThreshold = 0.1;
73 fLocMaxCutCPV = 0.06 ;
76 //____________________________________________________________________________
77 Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
79 // Gives the neighbourness of two digits = 0 are not neighbour but continue searching
81 // = 2 are not neighbour but do not continue searching
82 // neighbours are defined as digits having at least common vertex
83 // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster
84 // which is compared to a digit (d2) not yet in a cluster
89 fGeom->AbsToRelNumbering(d1->GetId(), relid1) ;
92 fGeom->AbsToRelNumbering(d2->GetId(), relid2) ;
94 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
95 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
96 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
98 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
102 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
103 rv = 2; // Difference in row numbers is too large to look further
109 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )
114 //Do NOT clusterize upper PPSD
115 if(fGeom->GetNumberOfCPVLayers() > 1 &&
117 relid1[1] < fGeom->GetNumberOfPadsPhi()*fGeom->GetNumberOfPadsPhi() ) rv = 2 ;
122 //____________________________________________________________________________
123 void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
125 // Copies the digits with energy above thershold and sorts the list
126 // according to increasing Id number
131 AliPHOSDigit * digit ;
133 while ( (digit = (AliPHOSDigit *)next()) ) {
135 // cout << " clusterizerv1 " << endl ;
136 // int nprim = digit->GetNprimary() ;
137 // int * aprim = digit->GetPrimary() ;
138 // for ( int ii = 0 ; ii < nprim ; ii++)
139 // cout << ii << " prim = " << aprim[ii] << endl ;
141 Int_t id = digit->GetId() ;
142 Float_t ene = Calibrate(digit->GetAmp()) ;
143 fGeom->AbsToRelNumbering(id, relid) ;
144 if(relid[1]==0){ // EMC
145 if ( ene > fEmcEnergyThreshold )
150 if ( ene > fPpsdEnergyThreshold )
158 //____________________________________________________________________________
159 void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb)
161 // Fills numb with the number of EMC (numb[0]) clusters found
162 // PPSD (numb[1]) clusters found
164 numb[0] = fNumberOfEmcClusters ;
165 numb[1] = fNumberOfPpsdClusters ;
168 //____________________________________________________________________________
169 Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit)
171 // Tells if (true) or not (false) the digit is in a PHOS-EMC module
176 fGeom->AbsToRelNumbering(digit->GetId(), relid) ;
184 //____________________________________________________________________________
185 void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl,
186 AliPHOSRecPoint::RecPointsList * emcl,
187 AliPHOSRecPoint::RecPointsList * ppsdl)
189 // Steering method to construct the clusters stored in a list of Reconstructed Points
190 // A cluster is defined as a list of neighbour digits
192 fNumberOfEmcClusters = 0 ;
193 fNumberOfPpsdClusters = 0 ;
195 // Fill and sort the working digits list
196 TObjArray tempodigitslist( dl->GetEntries() ) ;
197 FillandSort(dl, &tempodigitslist) ;
199 // Clusterization starts
200 TIter nextdigit(&tempodigitslist) ;
201 AliPHOSDigit * digit ;
202 Bool_t notremoved = kTRUE ;
204 while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
205 AliPHOSRecPoint * clu ;
207 AliPHOSDigit ** clusterdigitslist = new AliPHOSDigit*[dl->GetEntries()] ;
209 if (( ( IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fEmcClusteringThreshold ) ) ||
210 ( ( !IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fPpsdClusteringThreshold ) ) ) {
212 Int_t iDigitInCluster = 0 ;
214 if ( IsInEmc(digit) ) {
215 // start a new EMC RecPoint
216 if(fNumberOfEmcClusters >= emcl->GetSize()) emcl->Expand(2*fNumberOfEmcClusters+1) ;
217 (*emcl)[fNumberOfEmcClusters] = new AliPHOSEmcRecPoint(fW0, fLocMaxCut) ;
218 clu = (AliPHOSEmcRecPoint *) emcl->At(fNumberOfEmcClusters) ;
219 fNumberOfEmcClusters++ ;
220 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
221 clusterdigitslist[iDigitInCluster] = digit ;
223 tempodigitslist.Remove(digit) ;
227 // start a new PPSD cluster
228 if(fNumberOfPpsdClusters >= ppsdl->GetSize()) ppsdl->Expand(2*fNumberOfPpsdClusters+1);
229 if (strcmp(fGeom->GetName(),"GPS2") == 0) {
230 (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSPpsdRecPoint() ;
231 clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
233 else if (strcmp(fGeom->GetName(),"IHEP") == 0) {
234 (*ppsdl)[fNumberOfPpsdClusters] = new AliPHOSEmcRecPoint(fW0CPV, fLocMaxCutCPV) ;
235 clu = (AliPHOSEmcRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
237 fNumberOfPpsdClusters++ ;
238 clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
239 clusterdigitslist[iDigitInCluster] = digit ;
241 tempodigitslist.Remove(digit) ;
244 // Here we remove resting EMC digits, which cannot make cluster
247 while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
249 tempodigitslist.Remove(digit) ;
253 notremoved = kFALSE ;
260 AliPHOSDigit * digitN ;
262 while (index < iDigitInCluster){ // scan over digits already in cluster
263 digit = clusterdigitslist[index] ;
265 while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
266 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
268 case 0 : // not a neighbour
270 case 1 : // are neighbours
271 clu->AddDigit(*digitN, Calibrate( digitN->GetAmp() ) ) ;
272 clusterdigitslist[iDigitInCluster] = digitN ;
274 tempodigitslist.Remove(digitN) ;
276 case 2 : // too far from each other
285 } // loop over cluster
286 } //below energy theshold
288 delete[] clusterdigitslist ;
292 tempodigitslist.Clear() ;
296 for(index = 0; index < ppsdl->GetEntries(); index++)
297 ((AliPHOSPpsdRecPoint *)ppsdl->At(index))->SetIndexInList(index) ;
300 //____________________________________________________________________________
301 void AliPHOSClusterizerv1::PrintParameters()
303 // Print the energy thresholds
305 cout << "PHOS Clusterizer version 1 :" << endl
306 << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl
307 << " EMC Energy threshold = " << fEmcEnergyThreshold << endl
308 << " PPSD Clustering threshold = " << fPpsdClusteringThreshold << endl
309 << " PPSD Energy threshold = " << fPpsdEnergyThreshold << endl ;