]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | //_________________________________________________________________________ | |
17 | // A brief description of the class | |
18 | //*-- Author : Yves Schutz SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | #include "TMath.h" | |
24 | ||
25 | // --- Standard library --- | |
26 | ||
9f616d61 | 27 | #include <iostream> |
d15a28e7 | 28 | |
29 | // --- AliRoot header files --- | |
30 | ||
31 | #include "AliPHOSClusterizerv1.h" | |
32 | #include "AliPHOSDigit.h" | |
33 | #include "AliPHOSEmcRecPoint.h" | |
34 | #include "AliPHOSPpsdRecPoint.h" | |
35 | #include "AliPHOSv0.h" | |
36 | #include "AliRun.h" | |
37 | ||
38 | ClassImp(AliPHOSClusterizerv1) | |
39 | ||
40 | //____________________________________________________________________________ | |
41 | AliPHOSClusterizerv1::AliPHOSClusterizerv1() | |
42 | { | |
43 | fA = 0.; | |
44 | fB = 0.01 ; | |
45 | fNumberOfEmcClusters = 0 ; | |
46 | fNumberOfPpsdClusters = 0 ; | |
47 | fEmcClusteringThreshold = 0.1; | |
48 | fEmcEnergyThreshold = 0.01; | |
49 | fPpsdClusteringThreshold = 0.00000015; | |
50 | fPpsdEnergyThreshold = 0.0000001; | |
51 | fW0 = 4.5 ; | |
52 | fLocMaxCut = 0.06 ; | |
53 | } | |
54 | ||
55 | //____________________________________________________________________________ | |
56 | Int_t AliPHOSClusterizerv1::AreNeighbours(AliPHOSDigit * d1, AliPHOSDigit * d2) | |
57 | { | |
9f616d61 | 58 | // neigbours are defined as digits having at least common vertex |
d15a28e7 | 59 | // The order of A and B in AreNeighbours(A,B) is important: first (A) should be digit |
9f616d61 | 60 | // in cluster, which compared with digits not clusterized yet |
d15a28e7 | 61 | Int_t rv = 0 ; |
62 | ||
63 | AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ; | |
64 | ||
65 | Int_t relid1[4] ; | |
66 | geom->AbsToRelNumbering(d1->GetId(), relid1) ; | |
67 | ||
68 | Int_t relid2[4] ; | |
69 | geom->AbsToRelNumbering(d2->GetId(), relid2) ; | |
70 | ||
71 | if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module | |
92862013 | 72 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; |
73 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
d15a28e7 | 74 | |
92862013 | 75 | if (( coldiff <= 1 ) && ( rowdiff <= 1 )){ |
d15a28e7 | 76 | rv = 1 ; |
77 | } | |
78 | else { | |
79 | if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) | |
80 | rv = 2; // Difference in row numbers is too large to look further | |
81 | } | |
82 | ||
83 | } | |
84 | else { | |
85 | ||
86 | if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) ) | |
87 | rv=2 ; | |
88 | ||
89 | } | |
90 | ||
91 | return rv ; | |
92 | } | |
93 | ||
94 | //____________________________________________________________________________ | |
95 | void AliPHOSClusterizerv1::FillandSort(const DigitsList * dl, TObjArray * tl) | |
96 | { | |
97 | // copies the digits with energy above thershold and sorts the list | |
98 | // according to increasing Id number | |
99 | ||
6a3f1304 | 100 | cout << "HOLA 1" << endl; |
d15a28e7 | 101 | AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ; |
102 | Int_t relid[4] ; | |
103 | ||
104 | TIter next(dl) ; | |
105 | AliPHOSDigit * digit ; | |
106 | ||
6a3f1304 | 107 | |
108 | ||
d15a28e7 | 109 | while ( (digit = (AliPHOSDigit *)next()) ) { |
cf239357 | 110 | |
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 ; | |
116 | ||
d15a28e7 | 117 | Int_t id = digit->GetId() ; |
118 | Float_t ene = Calibrate(digit->GetAmp()) ; | |
119 | geom->AbsToRelNumbering(id, relid) ; | |
d15a28e7 | 120 | if(relid[1]==0){ // EMC |
6a3f1304 | 121 | if ( ene > fEmcEnergyThreshold ) |
d15a28e7 | 122 | tl->Add(digit) ; |
123 | } | |
124 | ||
125 | else { //Ppsd | |
126 | if ( ene > fPpsdEnergyThreshold ) | |
6a3f1304 | 127 | tl->Add(digit) ; |
d15a28e7 | 128 | } |
129 | ||
130 | } | |
6a3f1304 | 131 | cout << tl << endl; |
132 | ||
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; | |
137 | } | |
138 | cout << "HOLA de nuevo " << tl << endl; | |
139 | tl->Print(); | |
140 | cout << "sort" << endl ; | |
d15a28e7 | 141 | tl->Sort() ; |
142 | } | |
143 | ||
144 | //____________________________________________________________________________ | |
145 | void AliPHOSClusterizerv1:: GetNumberOfClustersFound(Int_t * numb) | |
146 | { | |
147 | numb[0] = fNumberOfEmcClusters ; | |
148 | numb[1] = fNumberOfPpsdClusters ; | |
149 | } | |
150 | ||
151 | //____________________________________________________________________________ | |
152 | Bool_t AliPHOSClusterizerv1::IsInEmc(AliPHOSDigit * digit) | |
153 | { | |
9f616d61 | 154 | Bool_t rv = kFALSE ; |
d15a28e7 | 155 | |
156 | AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ; | |
157 | ||
158 | Int_t relid[4] ; | |
159 | geom->AbsToRelNumbering(digit->GetId(), relid) ; | |
160 | ||
161 | if ( relid[1] == 0 ) | |
162 | rv = kTRUE; | |
163 | ||
164 | return rv ; | |
165 | } | |
166 | ||
167 | //____________________________________________________________________________ | |
168 | void AliPHOSClusterizerv1::MakeClusters(const DigitsList * dl, RecPointsList * emcl, RecPointsList * ppsdl) | |
169 | { | |
d15a28e7 | 170 | // Fill and sort the working digits list |
92862013 | 171 | TObjArray tempodigitslist( dl->GetEntries() ) ; |
172 | FillandSort(dl, &tempodigitslist) ; | |
d15a28e7 | 173 | |
174 | // Clusterization starts | |
92862013 | 175 | TIter nextdigit(&tempodigitslist) ; |
d15a28e7 | 176 | AliPHOSDigit * digit ; |
92862013 | 177 | Bool_t notremoved = kTRUE ; |
6ad0bfa0 | 178 | |
d15a28e7 | 179 | while ( (digit = (AliPHOSDigit *)nextdigit()) ) { // scan over the list of digits |
180 | AliPHOSRecPoint * clu ; | |
9f616d61 | 181 | |
92862013 | 182 | int * clusterdigitslist[dl->GetEntries()] ; |
d15a28e7 | 183 | Int_t index ; |
9f616d61 | 184 | if (( ( IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fEmcClusteringThreshold ) ) || |
185 | ( ( !IsInEmc(digit) ) && ( Calibrate(digit->GetAmp() ) > fPpsdClusteringThreshold ) ) ) { | |
d15a28e7 | 186 | |
187 | Int_t iDigitInCluster = 0 ; | |
188 | ||
6ad0bfa0 | 189 | if ( IsInEmc(digit) ) { |
9f616d61 | 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())) ; | |
d15a28e7 | 194 | |
92862013 | 195 | clusterdigitslist[iDigitInCluster] = (int* ) digit ; |
9f616d61 | 196 | iDigitInCluster++ ; |
92862013 | 197 | tempodigitslist.Remove(digit) ; |
d15a28e7 | 198 | } |
199 | ||
200 | else { | |
9f616d61 | 201 | new ((*ppsdl)[fNumberOfPpsdClusters]) AliPHOSPpsdRecPoint() ; // start a new PPSD cluster |
202 | clu = (AliPHOSPpsdRecPoint *) ppsdl->At(fNumberOfPpsdClusters) ; | |
203 | fNumberOfPpsdClusters++ ; | |
6ad0bfa0 | 204 | clu->AddDigit(*digit, Calibrate(digit->GetAmp()) ) ; |
92862013 | 205 | clusterdigitslist[iDigitInCluster] = (int* ) digit ; |
9f616d61 | 206 | iDigitInCluster++ ; |
92862013 | 207 | tempodigitslist.Remove(digit) ; |
d15a28e7 | 208 | nextdigit.Reset() ; |
209 | ||
9f616d61 | 210 | // Here we remove resting EMC digits, which cannot make cluster |
211 | ||
92862013 | 212 | if( notremoved ) { |
d15a28e7 | 213 | |
9f616d61 | 214 | while( ( digit = (AliPHOSDigit *)nextdigit() ) ) { |
d15a28e7 | 215 | |
9f616d61 | 216 | if( IsInEmc(digit) ) |
92862013 | 217 | tempodigitslist.Remove(digit) ; |
d15a28e7 | 218 | else |
219 | break ; | |
9f616d61 | 220 | |
221 | } // while digit | |
d15a28e7 | 222 | |
92862013 | 223 | } // if notremoved |
d15a28e7 | 224 | |
225 | } // else | |
226 | ||
227 | nextdigit.Reset() ; | |
228 | ||
229 | AliPHOSDigit * digitN ; | |
230 | index = 0 ; | |
9f616d61 | 231 | while (index < iDigitInCluster){ // scan over digits already in cluster |
92862013 | 232 | digit = (AliPHOSDigit *) clusterdigitslist[index] ; |
9f616d61 | 233 | index++ ; |
d15a28e7 | 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 !!!!! | |
236 | switch (ineb ) { | |
9f616d61 | 237 | case 0 : // not a neighbour |
d15a28e7 | 238 | break ; |
9f616d61 | 239 | case 1 : // are neighbours |
240 | clu->AddDigit( *digitN, Calibrate( digitN->GetAmp() ) ) ; | |
92862013 | 241 | clusterdigitslist[iDigitInCluster] =(int*) digitN ; |
9f616d61 | 242 | iDigitInCluster++ ; |
92862013 | 243 | tempodigitslist.Remove(digitN) ; |
d15a28e7 | 244 | break ; |
9f616d61 | 245 | case 2 : // too far from each other |
d15a28e7 | 246 | goto endofloop; |
247 | } // switch | |
248 | ||
249 | } // while digitN | |
250 | ||
251 | endofloop: ; | |
252 | nextdigit.Reset() ; | |
253 | ||
254 | } // loop over cluster | |
255 | ||
256 | } //below energy theshold | |
257 | ||
258 | } // while digit | |
259 | ||
92862013 | 260 | tempodigitslist.Clear() ; |
d15a28e7 | 261 | } |
262 | ||
263 | //____________________________________________________________________________ | |
264 | void AliPHOSClusterizerv1::PrintParameters() | |
265 | { | |
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 ; | |
271 | } |