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 **************************************************************************/
16 //_________________________________________________________________________
17 // A brief description of the class
18 //*-- Author : Yves Schutz SUBATECH
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
25 // --- Standard library ---
29 // --- AliRoot header files ---
31 #include "AliPHOSClusterizerv1.h"
32 #include "AliPHOSDigit.h"
33 #include "AliPHOSEmcRecPoint.h"
34 #include "AliPHOSPpsdRecPoint.h"
35 #include "AliPHOSv0.h"
38 ClassImp(AliPHOSClusterizerv1)
40 //____________________________________________________________________________
41 AliPHOSClusterizerv1::AliPHOSClusterizerv1()
45 fNumberOfEmcClusters = 0 ;
46 fNumberOfPpsdClusters = 0 ;
47 fEmcClusteringThreshold = 0.1;
48 fEmcEnergyThreshold = 0.01;
49 fPpsdClusteringThreshold = 0.00000015;
50 fPpsdEnergyThreshold = 0.0000001;
55 //____________________________________________________________________________
56 Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2)
58 // neigbours are defined as digits having at least common vertex
59 // The order of A and B in AreNeighbours(A,B) is important: first (A) should be digit
60 // in cluster, which compared with digits not clusterized yet
63 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
66 geom->AbsToRelNumbering(d1->GetId(), relid1) ;
69 geom->AbsToRelNumbering(d2->GetId(), relid2) ;
71 if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module
72 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
73 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
75 if (( coldiff <= 1 ) && ( rowdiff <= 1 )){
79 if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1))
80 rv = 2; // Difference in row numbers is too large to look further
86 if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) )
94 //____________________________________________________________________________
95 void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl)
97 // copies the digits with energy above thershold and sorts the list
98 // according to increasing Id number
100 cout << "HOLA 1" << endl;
101 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
105 AliPHOSDigit * digit ;
109 while ( (digit = (AliPHOSDigit *)next()) ) {
111 // cout << " clusterizerv1 " << endl ;
112 // int nprim = digit->GetNprimary() ;
113 // int * aprim = digit->GetPrimary() ;
114 // for ( int ii = 0 ; ii < nprim ; ii++)
115 // cout << ii << " prim = " << aprim[ii] << endl ;
117 Int_t id = digit->GetId() ;
118 Float_t ene = Calibrate(digit->GetAmp()) ;
119 geom->AbsToRelNumbering(id, relid) ;
120 if(relid[1]==0){ // EMC
121 if ( ene > fEmcEnergyThreshold )
126 if ( ene > fPpsdEnergyThreshold )
133 TIter next2(tl) ; Int_t iii=0;
134 cout << "Entries is " << tl->GetEntries() << tl->GetLast() << endl;
135 while ( (digit = (AliPHOSDigit *)next2()) ) {
136 cout << iii++ << " " << digit << " Amplitud is " << digit->GetAmp() << endl;
138 cout << "HOLA de nuevo " << tl << endl;
140 cout << "sort" << endl ;
144 //____________________________________________________________________________
145 void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb)
147 numb[0] = fNumberOfEmcClusters ;
148 numb[1] = fNumberOfPpsdClusters ;
151 //____________________________________________________________________________
152 Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit)
156 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
159 geom->AbsToRelNumbering(digit->GetId(), relid) ;
167 //____________________________________________________________________________
168 void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl, RecPointsList * emcl, RecPointsList * ppsdl)
170 // Fill and sort the working digits list
171 TObjArray tempodigitslist( dl->GetEntries() ) ;
172 FillandSort(dl, &tempodigitslist) ;
174 // Clusterization starts
175 TIter nextdigit(&tempodigitslist) ;
176 AliPHOSDigit * digit ;
177 Bool_t notremoved = kTRUE ;
179 while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits
180 AliPHOSRecPoint * clu ;
182 int * clusterdigitslist[dl->GetEntries()] ;
184 if (( ( IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fEmcClusteringThreshold ) ) ||
185 ( ( !IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fPpsdClusteringThreshold ) ) ) {
187 Int_t iDigitInCluster = 0 ;
189 if ( IsInEmc(digit) ) {
190 new ((*emcl)[fNumberOfEmcClusters]) AliPHOSEmcRecPoint(fW0, fLocMaxCut) ; // start a new EMC RecPoint
191 clu = (AliPHOSEmcRecPoint *) (*emcl)[fNumberOfEmcClusters] ;
192 fNumberOfEmcClusters++ ;
193 clu->AddDigit(*digit, Calibrate(digit->GetAmp())) ;
195 clusterdigitslist[iDigitInCluster] = (int* ) digit ;
197 tempodigitslist.Remove(digit) ;
201 new ((*ppsdl)[fNumberOfPpsdClusters]) AliPHOSPpsdRecPoint() ; // start a new PPSD cluster
202 clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ;
203 fNumberOfPpsdClusters++ ;
204 clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ;
205 clusterdigitslist[iDigitInCluster] = (int* ) digit ;
207 tempodigitslist.Remove(digit) ;
210 // Here we remove resting EMC digits, which cannot make cluster
214 while( ( digit = (AliPHOSDigit *)nextdigit() ) ) {
217 tempodigitslist.Remove(digit) ;
229 AliPHOSDigit * digitN ;
231 while (index < iDigitInCluster){ // scan over digits already in cluster
232 digit = (AliPHOSDigit *) clusterdigitslist[index] ;
234 while ( (digitN = (AliPHOSDigit *)nextdigit()) ) { // scan over the reduced list of digits
235 Int_t ineb = AreNeighbours(digit, digitN); // call (digit,digitN) in THAT oder !!!!!
237 case 0 : // not a neighbour
239 case 1 : // are neighbours
240 clu->AddDigit( *digitN, Calibrate( digitN->GetAmp() ) ) ;
241 clusterdigitslist[iDigitInCluster] =(int*) digitN ;
243 tempodigitslist.Remove(digitN) ;
245 case 2 : // too far from each other
254 } // loop over cluster
256 } //below energy theshold
260 tempodigitslist.Clear() ;
263 //____________________________________________________________________________
264 void AliPHOSClusterizerv1::PrintParameters()
266 cout << "PHOS Clusterizer version 1 :" << endl
267 << " EMC Clustering threshold = " << fEmcClusteringThreshold << endl
268 << " EMC Energy threshold = " << fEmcEnergyThreshold << endl
269 << " PPSD Clustering threshold = " << fPpsdClusteringThreshold << endl
270 << " PPSD Energy threshold = " << fPpsdEnergyThreshold << endl ;