]>
Commit | Line | Data |
---|---|---|
0bc3b8ed | 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 | **************************************************************************/ | |
0bc3b8ed | 15 | |
803d1ab0 | 16 | /* $Id$ */ |
17 | ||
0bc3b8ed | 18 | ////////////////////////////////////////////////////////////////////////////// |
19 | // Clusterization class for IHEP reconstruction. | |
20 | // Performs clusterization (collects neighbouring active cells) | |
21 | // It differs from AliPHOSClusterizerv1 in neighbour definition only | |
803d1ab0 | 22 | //*-- Author: Boris Polichtchouk, IHEP |
0bc3b8ed | 23 | |
cbd576a6 | 24 | // --- ROOT system --- |
25 | #include "TBenchmark.h" | |
cbd576a6 | 26 | |
27 | // --- Standard library --- | |
cbd576a6 | 28 | |
29 | // --- AliRoot header files --- | |
351dd634 | 30 | #include "AliLog.h" |
cbd576a6 | 31 | #include "AliPHOSClusterizerv2.h" |
32 | #include "AliPHOSGetter.h" | |
33 | #include "TFolder.h" | |
34 | #include "AliPHOSEvalRecPoint.h" | |
35 | #include "AliPHOSRecCpvManager.h" | |
36 | #include "AliPHOSRecEmcManager.h" | |
e957fea8 | 37 | #include "AliPHOSGeometry.h" |
cbd576a6 | 38 | |
39 | ClassImp(AliPHOSClusterizerv2) | |
40 | ||
88cb7938 | 41 | //____________________________________________________________________________ |
cbd576a6 | 42 | AliPHOSClusterizerv2::AliPHOSClusterizerv2() : AliPHOSClusterizerv1() |
43 | {} | |
44 | ||
88cb7938 | 45 | //____________________________________________________________________________ |
46 | AliPHOSClusterizerv2::AliPHOSClusterizerv2(const char * headerFile, const char * name): | |
47 | AliPHOSClusterizerv1(headerFile,name) | |
cbd576a6 | 48 | {} |
49 | ||
88cb7938 | 50 | //____________________________________________________________________________ |
51 | AliPHOSClusterizerv2::AliPHOSClusterizerv2(const AliPHOSClusterizerv2 & clu): | |
52 | AliPHOSClusterizerv1(clu) | |
53 | {} | |
54 | ||
55 | //____________________________________________________________________________ | |
cbd576a6 | 56 | void AliPHOSClusterizerv2::GetNumberOfClustersFound(int* numb) const |
57 | { | |
0bc3b8ed | 58 | // Returns the number of found EMC and CPV rec.points |
cbd576a6 | 59 | |
88cb7938 | 60 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
cbd576a6 | 61 | numb[0] = gime->EmcRecPoints()->GetEntries(); |
62 | numb[1] = gime->CpvRecPoints()->GetEntries(); | |
63 | } | |
64 | ||
88cb7938 | 65 | //____________________________________________________________________________ |
cbd576a6 | 66 | void AliPHOSClusterizerv2::Exec(Option_t* option) |
67 | { | |
0bc3b8ed | 68 | // Steering method |
cbd576a6 | 69 | |
70 | if(strstr(option,"tim")) | |
71 | gBenchmark->Start("PHOSClusterizer"); | |
72 | ||
73 | if(strstr(option,"print")) | |
88cb7938 | 74 | Print() ; |
cbd576a6 | 75 | |
88cb7938 | 76 | AliPHOSGetter * gime = AliPHOSGetter::Instance() ; |
cbd576a6 | 77 | |
88cb7938 | 78 | TFolder* wPoolF = gime->PhosLoader()->GetDetectorDataFolder(); |
fbf811ec | 79 | |
cbd576a6 | 80 | TObjArray* wPool = new TObjArray(400); |
81 | wPool->SetName("SmartPoints"); | |
82 | wPoolF->Add(wPool); | |
83 | wPoolF->Add(this); | |
84 | ||
88cb7938 | 85 | Int_t nevents = gime->MaxEvent() ; |
cbd576a6 | 86 | Int_t ievent ; |
87 | ||
88 | for(ievent = 0; ievent<nevents; ievent++) { | |
89 | ||
cbd576a6 | 90 | gime->Event(ievent,"D") ; |
cbd576a6 | 91 | |
351dd634 | 92 | AliInfo(Form("MakeClusters invoked..")) ; |
cbd576a6 | 93 | MakeClusters() ; |
351dd634 | 94 | AliInfo(Form("MakeClusters done.")) ; |
cbd576a6 | 95 | |
96 | ||
97 | //SmartRecPoints will communicate with wPool. | |
98 | ||
99 | AliPHOSEvalRecPoint* rp=0; | |
100 | ||
101 | // CPV reconstruction | |
102 | ||
103 | AliPHOSRecCpvManager* recCpv = new AliPHOSRecCpvManager(); | |
104 | wPoolF->Add(recCpv); | |
105 | ||
c9eeb00e | 106 | Int_t iPoint; //loop variable |
107 | ||
108 | for(iPoint=0; iPoint<gime->CpvRecPoints()->GetEntriesFast(); iPoint++) { | |
88cb7938 | 109 | rp = new AliPHOSEvalRecPoint(iPoint, kTRUE); |
cbd576a6 | 110 | rp->MakeJob(); |
111 | } | |
112 | ||
113 | AliPHOSEvalRecPoint pt; | |
114 | pt.UpdateWorkingPool(); | |
115 | ||
116 | TObjArray * cpvRecPoints = gime->CpvRecPoints() ; | |
117 | Int_t nOldCpv = cpvRecPoints->GetEntries(); | |
118 | cpvRecPoints->Delete(); | |
119 | cpvRecPoints->Compress(); | |
120 | ||
c9eeb00e | 121 | Int_t i; //loop variable |
122 | ||
123 | for(i=0; i<wPool->GetEntries(); i++) | |
cbd576a6 | 124 | cpvRecPoints->Add(wPool->At(i)); |
125 | ||
126 | wPool->Clear(); | |
127 | wPool->Compress(); | |
128 | ||
129 | wPoolF->Remove(recCpv); | |
130 | delete recCpv; | |
131 | ||
351dd634 | 132 | AliInfo(Form(" %d", gime->CpvRecPoints()->GetEntries() )) ; |
133 | AliInfo(Form(" %d cpvRecPoints", cpvRecPoints->GetEntries() )) ; | |
cbd576a6 | 134 | |
135 | ||
136 | // Now Emc reconstruction | |
137 | ||
138 | AliPHOSRecEmcManager* recEmc = new AliPHOSRecEmcManager(); | |
139 | wPoolF->Add(recEmc); | |
140 | ||
c9eeb00e | 141 | for(iPoint=0; iPoint<gime->EmcRecPoints()->GetEntriesFast(); iPoint++) { |
88cb7938 | 142 | rp = new AliPHOSEvalRecPoint(iPoint, kFALSE); |
cbd576a6 | 143 | rp->MakeJob(); |
144 | } | |
145 | ||
146 | pt.UpdateWorkingPool(); | |
147 | ||
148 | TObjArray * emcRecPoints = gime->EmcRecPoints() ; | |
149 | Int_t nOldEmc = emcRecPoints->GetEntries(); | |
150 | emcRecPoints->Delete(); | |
151 | emcRecPoints->Compress(); | |
152 | ||
c9eeb00e | 153 | for(i=0; i<wPool->GetEntries(); i++) |
cbd576a6 | 154 | emcRecPoints->Add(wPool->At(i)); |
155 | ||
156 | wPool->Clear(); | |
157 | wPool->Compress(); | |
158 | ||
159 | wPoolF->Remove(recEmc); | |
160 | delete recEmc; | |
161 | ||
21cd0c07 | 162 | TString message ; |
163 | message = " %d OLD cpvRecPoints\n" ; | |
164 | message += " %d\n" ; | |
165 | message += " %d cpvRecPoints\n" ; | |
cbd576a6 | 166 | |
21cd0c07 | 167 | message += " %d OLD emcRecPoints " ; |
168 | message += " %d\n" ; | |
169 | message += " %d emcRecPoints\n" ; | |
170 | ||
351dd634 | 171 | AliInfo(Form("%s", message.Data(), |
21cd0c07 | 172 | nOldCpv, |
173 | gime->CpvRecPoints()->GetEntries(),cpvRecPoints->GetEntries(), | |
174 | nOldEmc, | |
351dd634 | 175 | gime->EmcRecPoints()->GetEntries(), emcRecPoints->GetEntries() )); |
cbd576a6 | 176 | |
88cb7938 | 177 | WriteRecPoints(); |
cbd576a6 | 178 | |
179 | ||
180 | } // loop over events | |
181 | ||
182 | if(strstr(option,"tim")) { | |
183 | gBenchmark->Stop("PHOSClusterizer"); | |
351dd634 | 184 | AliInfo(Form("took %f seconds for Clusterizing", gBenchmark->GetCpuTime("PHOSClusterizer") )) ; |
cbd576a6 | 185 | } |
cbd576a6 | 186 | } |
88cb7938 | 187 | |
188 | //____________________________________________________________________________ | |
cbd576a6 | 189 | Int_t AliPHOSClusterizerv2::AreNeighbours(AliPHOSDigit* d1, AliPHOSDigit* d2) const |
190 | { | |
191 | // Points are neighbours if they have common edge. | |
192 | // Points with common vertex are NOT neighbours. | |
193 | // This treatment of neighbourship is the part of | |
194 | // IHEP algorithm of clusterization. | |
195 | ||
196 | // Gives the neighbourness of two digits = 0 are not neighbour but continue searching | |
197 | // = 1 are neighbour | |
198 | // = 2 are not neighbour but do not continue searching | |
199 | // The order of d1 and d2 is important: first (d1) should be a digit already in a cluster | |
200 | // which is compared to a digit (d2) not yet in a cluster | |
201 | ||
88cb7938 | 202 | const AliPHOSGeometry * geom = AliPHOSGetter::Instance()->PHOSGeometry(); |
cbd576a6 | 203 | |
204 | Int_t rv = 0 ; | |
205 | ||
206 | Int_t relid1[4] ; | |
207 | geom->AbsToRelNumbering(d1->GetId(), relid1) ; | |
208 | ||
209 | Int_t relid2[4] ; | |
210 | geom->AbsToRelNumbering(d2->GetId(), relid2) ; | |
211 | ||
212 | if ( (relid1[0] == relid2[0]) && (relid1[1]==relid2[1]) ) { // inside the same PHOS module and the same PPSD Module | |
213 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; | |
214 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
215 | ||
216 | if ( ( (coldiff < 1) && (rowdiff <= 1) ) || ( ( coldiff <= 1 ) && ( rowdiff < 1 ) ) ){ | |
217 | rv = 1 ; | |
218 | } | |
219 | else { | |
220 | if((relid2[2] > relid1[2]) && (relid2[3] > relid1[3]+1)) | |
221 | rv = 2; // Difference in row numbers is too large to look further | |
222 | } | |
223 | ||
224 | } | |
225 | else { | |
226 | ||
227 | if( (relid1[0] < relid2[0]) || (relid1[1] < relid2[1]) ) | |
228 | rv=2 ; | |
229 | ||
230 | } | |
231 | ||
cbd576a6 | 232 | return rv ; |
233 | ||
234 | } |