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