]>
Commit | Line | Data |
---|---|---|
a9e2aefa | 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 | **************************************************************************/ | |
70479d0e | 15 | |
88cb7938 | 16 | /* $Id$ */ |
a9e2aefa | 17 | |
30178c30 | 18 | #include <TMinuit.h> |
19 | #include <TF1.h> | |
fed772f3 | 20 | #include <TMinuit.h> |
21 | #include <Riostream.h> | |
30178c30 | 22 | |
a9e2aefa | 23 | #include "AliMUONClusterFinderVS.h" |
5289cf2f | 24 | #include "AliMpPlaneType.h" |
25 | #include "AliMpVSegmentation.h" | |
a9e2aefa | 26 | #include "AliMUONDigit.h" |
27 | #include "AliMUONRawCluster.h" | |
fed772f3 | 28 | #include "AliMUONGeometrySegmentation.h" |
7e4a628d | 29 | #include "AliMUONMathieson.h" |
c1a185bf | 30 | #include "AliMUONClusterInput.h" |
5289cf2f | 31 | #include "AliMUONDigitMapA1.h" |
8c343c7c | 32 | #include "AliLog.h" |
a9e2aefa | 33 | |
34 | //_____________________________________________________________________ | |
a9e2aefa | 35 | // This function is minimized in the double-Mathieson fit |
36 | void fcnS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag); | |
37 | void fcnS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag); | |
38 | void fcnCombiS1(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag); | |
39 | void fcnCombiS2(Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag); | |
40 | ||
41 | ClassImp(AliMUONClusterFinderVS) | |
42 | ||
4da78c65 | 43 | AliMUONClusterFinderVS::AliMUONClusterFinderVS() |
30178c30 | 44 | : TObject() |
a9e2aefa | 45 | { |
46 | // Default constructor | |
30aaba74 | 47 | fInput=AliMUONClusterInput::Instance(); |
5289cf2f | 48 | fDigitMap[0] = 0; |
49 | fDigitMap[1] = 0; | |
a9e2aefa | 50 | fTrack[0]=fTrack[1]=-1; |
07cfabcf | 51 | fGhostChi2Cut = 1e6; // nothing done by default |
fed772f3 | 52 | fSeg2[0] = 0; |
53 | fSeg2[1] = 0; | |
54 | ||
3f5cf0b3 | 55 | for(Int_t i=0; i<100; i++) { |
56 | for (Int_t j=0; j<2; j++) { | |
57 | fDig[i][j] = 0; | |
58 | } | |
4da78c65 | 59 | } |
60 | fRawClusters = new TClonesArray("AliMUONRawCluster",1000); | |
61 | fNRawClusters = 0; | |
4da78c65 | 62 | } |
63 | //____________________________________________________________________________ | |
64 | AliMUONClusterFinderVS::~AliMUONClusterFinderVS() | |
65 | { | |
66 | // Reset tracks information | |
67 | fNRawClusters = 0; | |
86b48c39 | 68 | if (fRawClusters) { |
69 | fRawClusters->Delete(); | |
70 | delete fRawClusters; | |
71 | } | |
a9e2aefa | 72 | } |
73 | ||
e3cba86e | 74 | AliMUONClusterFinderVS::AliMUONClusterFinderVS(const AliMUONClusterFinderVS & clusterFinder):TObject(clusterFinder) |
a9e2aefa | 75 | { |
30178c30 | 76 | // Protected copy constructor |
77 | ||
8c343c7c | 78 | AliFatal("Not implemented."); |
a9e2aefa | 79 | } |
4da78c65 | 80 | //____________________________________________________________________________ |
81 | void AliMUONClusterFinderVS::ResetRawClusters() | |
82 | { | |
83 | // Reset tracks information | |
84 | fNRawClusters = 0; | |
85 | if (fRawClusters) fRawClusters->Clear(); | |
86 | } | |
87 | //____________________________________________________________________________ | |
a9e2aefa | 88 | void AliMUONClusterFinderVS::Decluster(AliMUONRawCluster *cluster) |
89 | { | |
90 | // Decluster by local maxima | |
91 | SplitByLocalMaxima(cluster); | |
92 | } | |
4da78c65 | 93 | //____________________________________________________________________________ |
a9e2aefa | 94 | void AliMUONClusterFinderVS::SplitByLocalMaxima(AliMUONRawCluster *c) |
95 | { | |
b137f8b9 | 96 | // Split complex cluster by local maxima |
a9e2aefa | 97 | Int_t cath, i; |
9825400f | 98 | |
30aaba74 | 99 | fInput->SetCluster(c); |
9825400f | 100 | |
9e993f2a | 101 | fMul[0]=c->GetMultiplicity(0); |
102 | fMul[1]=c->GetMultiplicity(1); | |
a9e2aefa | 103 | |
104 | // | |
105 | // dump digit information into arrays | |
106 | // | |
9825400f | 107 | |
f0d86bc4 | 108 | Float_t qtot; |
a9e2aefa | 109 | |
110 | for (cath=0; cath<2; cath++) { | |
faef62a9 | 111 | qtot=0; |
112 | ||
113 | for (i=0; i<fMul[cath]; i++) { | |
114 | // pointer to digit | |
115 | fDig[i][cath]=fInput->Digit(cath, c->GetIndex(i, cath)); | |
116 | // pad coordinates | |
117 | fIx[i][cath]= fDig[i][cath]->PadX(); | |
118 | fIy[i][cath]= fDig[i][cath]->PadY(); | |
119 | // pad charge | |
120 | fQ[i][cath] = fDig[i][cath]->Signal(); | |
121 | // pad centre coordinates | |
faef62a9 | 122 | fSeg2[cath]-> |
123 | GetPadC(fInput->DetElemId(), fIx[i][cath], fIy[i][cath], fX[i][cath], fY[i][cath], fZ[i][cath]); | |
124 | } // loop over cluster digits | |
125 | ||
a9e2aefa | 126 | } // loop over cathodes |
127 | ||
128 | ||
129 | FindLocalMaxima(c); | |
130 | ||
131 | // | |
132 | // Initialise and perform mathieson fits | |
133 | Float_t chi2, oldchi2; | |
134 | // ++++++++++++++++++*************+++++++++++++++++++++ | |
135 | // (1) No more than one local maximum per cathode plane | |
136 | // +++++++++++++++++++++++++++++++*************++++++++ | |
137 | if ((fNLocal[0]==1 && (fNLocal[1]==0 || fNLocal[1]==1)) || | |
138 | (fNLocal[0]==0 && fNLocal[1]==1)) { | |
a9e2aefa | 139 | // Perform combined single Mathieson fit |
140 | // Initial values for coordinates (x,y) | |
141 | ||
142 | // One local maximum on cathodes 1 and 2 (X->cathode 2, Y->cathode 1) | |
143 | if (fNLocal[0]==1 && fNLocal[1]==1) { | |
ba12c242 | 144 | fXInit[0]=c->GetX(1); |
145 | fYInit[0]=c->GetY(0); | |
a9e2aefa | 146 | // One local maximum on cathode 1 (X,Y->cathode 1) |
147 | } else if (fNLocal[0]==1) { | |
ba12c242 | 148 | fXInit[0]=c->GetX(0); |
149 | fYInit[0]=c->GetY(0); | |
a9e2aefa | 150 | // One local maximum on cathode 2 (X,Y->cathode 2) |
151 | } else { | |
ba12c242 | 152 | fXInit[0]=c->GetX(1); |
153 | fYInit[0]=c->GetY(1); | |
a9e2aefa | 154 | } |
8c343c7c | 155 | AliDebug(1,"cas (1) CombiSingleMathiesonFit(c)"); |
a9e2aefa | 156 | chi2=CombiSingleMathiesonFit(c); |
157 | // Int_t ndf = fgNbins[0]+fgNbins[1]-2; | |
158 | // Float_t prob = TMath::Prob(Double_t(chi2),ndf); | |
159 | // prob1->Fill(prob); | |
160 | // chi2_1->Fill(chi2); | |
161 | oldchi2=chi2; | |
8c343c7c | 162 | AliDebug(1,Form(" chi2 %f ",chi2)); |
a9e2aefa | 163 | |
ba12c242 | 164 | c->SetX(0, fXFit[0]); |
165 | c->SetY(0, fYFit[0]); | |
a9e2aefa | 166 | |
ba12c242 | 167 | c->SetX(1,fXFit[0]); |
168 | c->SetY(1,fYFit[0]); | |
3b5272e3 | 169 | c->SetChi2(0,chi2); |
170 | c->SetChi2(1,chi2); | |
07cfabcf | 171 | // Force on anod |
002920d1 | 172 | |
173 | c->SetX(0, fSeg2[0]->GetAnod(fInput->DetElemId(), c->GetX(0))); | |
174 | c->SetX(1, fSeg2[1]->GetAnod(fInput->DetElemId(), c->GetX(1))); | |
175 | ||
6570c14d | 176 | // c->SetDetElemId(fInput->DetElemId()); |
b137f8b9 | 177 | // If reasonable chi^2 add result to the list of rawclusters |
a9e2aefa | 178 | if (chi2 < 0.3) { |
179 | AddRawCluster(*c); | |
b137f8b9 | 180 | // If not try combined double Mathieson Fit |
a9e2aefa | 181 | } else { |
c4a97bcd | 182 | AliDebug(1," MAUVAIS CHI2 !!!\n"); |
a9e2aefa | 183 | if (fNLocal[0]==1 && fNLocal[1]==1) { |
184 | fXInit[0]=fX[fIndLocal[0][1]][1]; | |
185 | fYInit[0]=fY[fIndLocal[0][0]][0]; | |
186 | fXInit[1]=fX[fIndLocal[0][1]][1]; | |
187 | fYInit[1]=fY[fIndLocal[0][0]][0]; | |
188 | } else if (fNLocal[0]==1) { | |
189 | fXInit[0]=fX[fIndLocal[0][0]][0]; | |
190 | fYInit[0]=fY[fIndLocal[0][0]][0]; | |
191 | fXInit[1]=fX[fIndLocal[0][0]][0]; | |
192 | fYInit[1]=fY[fIndLocal[0][0]][0]; | |
193 | } else { | |
194 | fXInit[0]=fX[fIndLocal[0][1]][1]; | |
195 | fYInit[0]=fY[fIndLocal[0][1]][1]; | |
196 | fXInit[1]=fX[fIndLocal[0][1]][1]; | |
197 | fYInit[1]=fY[fIndLocal[0][1]][1]; | |
198 | } | |
199 | ||
200 | // Initial value for charge ratios | |
201 | fQrInit[0]=0.5; | |
202 | fQrInit[1]=0.5; | |
c4a97bcd | 203 | AliDebug(1,"\n cas (1) CombiDoubleMathiesonFit(c)\n"); |
a9e2aefa | 204 | chi2=CombiDoubleMathiesonFit(c); |
205 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
206 | // Float_t prob = TMath::Prob(chi2,ndf); | |
207 | // prob2->Fill(prob); | |
208 | // chi2_2->Fill(chi2); | |
209 | ||
210 | // Was this any better ?? | |
8c343c7c | 211 | AliDebug(1,Form(" Old and new chi2 %f %f ", oldchi2, chi2)); |
a9e2aefa | 212 | if (fFitStat!=0 && chi2>0 && (2.*chi2 < oldchi2)) { |
8c343c7c | 213 | AliDebug(1,"Split"); |
a9e2aefa | 214 | // Split cluster into two according to fit result |
215 | Split(c); | |
216 | } else { | |
8c343c7c | 217 | AliDebug(1,"Do not Split"); |
a9e2aefa | 218 | // Don't split |
b137f8b9 | 219 | AddRawCluster(*c); |
a9e2aefa | 220 | } |
221 | } | |
222 | ||
223 | // +++++++++++++++++++++++++++++++++++++++ | |
224 | // (2) Two local maxima per cathode plane | |
225 | // +++++++++++++++++++++++++++++++++++++++ | |
226 | } else if (fNLocal[0]==2 && fNLocal[1]==2) { | |
227 | // | |
228 | // Let's look for ghosts first | |
05c39730 | 229 | |
a9e2aefa | 230 | Float_t xm[4][2], ym[4][2]; |
231 | Float_t dpx, dpy, dx, dy; | |
232 | Int_t ixm[4][2], iym[4][2]; | |
233 | Int_t isec, im1, im2, ico; | |
234 | // | |
235 | // Form the 2x2 combinations | |
236 | // 0-0, 0-1, 1-0, 1-1 | |
237 | ico=0; | |
238 | for (im1=0; im1<2; im1++) { | |
239 | for (im2=0; im2<2; im2++) { | |
240 | xm[ico][0]=fX[fIndLocal[im1][0]][0]; | |
241 | ym[ico][0]=fY[fIndLocal[im1][0]][0]; | |
242 | xm[ico][1]=fX[fIndLocal[im2][1]][1]; | |
243 | ym[ico][1]=fY[fIndLocal[im2][1]][1]; | |
244 | ||
245 | ixm[ico][0]=fIx[fIndLocal[im1][0]][0]; | |
246 | iym[ico][0]=fIy[fIndLocal[im1][0]][0]; | |
247 | ixm[ico][1]=fIx[fIndLocal[im2][1]][1]; | |
248 | iym[ico][1]=fIy[fIndLocal[im2][1]][1]; | |
249 | ico++; | |
250 | } | |
251 | } | |
252 | // ico = 0 : first local maximum on cathodes 1 and 2 | |
253 | // ico = 1 : fisrt local maximum on cathode 1 and second on cathode 2 | |
254 | // ico = 2 : second local maximum on cathode 1 and first on cathode 1 | |
255 | // ico = 3 : second local maximum on cathodes 1 and 2 | |
256 | ||
257 | // Analyse the combinations and keep those that are possible ! | |
258 | // For each combination check consistency in x and y | |
05c39730 | 259 | Int_t iacc; |
260 | Bool_t accepted[4]; | |
261 | Float_t dr[4] = {1.e4, 1.e4, 1.e4, 1.e4}; | |
a9e2aefa | 262 | iacc=0; |
05c39730 | 263 | |
264 | // In case of staggering maxima are displaced by exactly half the pad-size in y. | |
265 | // We have to take into account the numerical precision in the consistency check; | |
266 | Float_t eps = 1.e-5; | |
267 | // | |
a9e2aefa | 268 | for (ico=0; ico<4; ico++) { |
269 | accepted[ico]=kFALSE; | |
270 | // cathode one: x-coordinate | |
002920d1 | 271 | isec=fSeg2[0]->Sector(fInput->DetElemId(), ixm[ico][0], iym[ico][0]); |
272 | dpx=fSeg2[0]->Dpx(fInput->DetElemId(), isec)/2.; | |
273 | ||
a9e2aefa | 274 | dx=TMath::Abs(xm[ico][0]-xm[ico][1]); |
275 | // cathode two: y-coordinate | |
002920d1 | 276 | |
277 | isec=fSeg2[1]->Sector(fInput->DetElemId(), ixm[ico][1], iym[ico][1]); | |
278 | dpy=fSeg2[1]->Dpy(fInput->DetElemId(), isec)/2.; | |
279 | ||
a9e2aefa | 280 | dy=TMath::Abs(ym[ico][0]-ym[ico][1]); |
c4a97bcd | 281 | AliDebug(2,Form("\n %i %f %f %f %f %f %f \n", ico, ym[ico][0], ym[ico][1], dy, dpy, dx, dpx )); |
05c39730 | 282 | if ((dx <= dpx) && (dy <= dpy+eps)) { |
a9e2aefa | 283 | // consistent |
284 | accepted[ico]=kTRUE; | |
05c39730 | 285 | dr[ico] = TMath::Sqrt(dx*dx+dy*dy); |
a9e2aefa | 286 | iacc++; |
287 | } else { | |
288 | // reject | |
289 | accepted[ico]=kFALSE; | |
290 | } | |
291 | } | |
c4a97bcd | 292 | AliDebug(1,Form("\n iacc= %d:\n", iacc)); |
05c39730 | 293 | if (iacc == 3) { |
294 | if (accepted[0] && accepted[1]) { | |
295 | if (dr[0] >= dr[1]) { | |
296 | accepted[0]=kFALSE; | |
297 | } else { | |
298 | accepted[1]=kFALSE; | |
299 | } | |
300 | } | |
a9e2aefa | 301 | |
05c39730 | 302 | if (accepted[2] && accepted[3]) { |
303 | if (dr[2] >= dr[3]) { | |
304 | accepted[2]=kFALSE; | |
305 | } else { | |
306 | accepted[3]=kFALSE; | |
307 | } | |
308 | } | |
309 | /* | |
310 | // eliminate one candidate | |
311 | Float_t drmax = 0; | |
312 | Int_t icobad = -1; | |
313 | ||
314 | for (ico=0; ico<4; ico++) { | |
315 | if (accepted[ico] && dr[ico] > drmax) { | |
316 | icobad = ico; | |
317 | drmax = dr[ico]; | |
318 | } | |
319 | } | |
320 | ||
321 | accepted[icobad] = kFALSE; | |
322 | */ | |
323 | iacc = 2; | |
324 | } | |
325 | ||
326 | ||
c4a97bcd | 327 | AliDebug(1,Form("\n iacc= %d:\n", iacc)); |
328 | if (iacc==2) { | |
329 | AliDebug(1,"\n iacc=2: No problem ! \n"); | |
330 | } else if (iacc==4) { | |
331 | AliDebug(1,"\n iacc=4: Ok, but ghost problem !!! \n"); | |
332 | } else if (iacc==0) { | |
333 | AliDebug(1,"\n iacc=0: I don't know what to do with this !!!!!!!!! \n"); | |
a9e2aefa | 334 | } |
335 | ||
336 | // Initial value for charge ratios | |
337 | fQrInit[0]=Float_t(fQ[fIndLocal[0][0]][0])/ | |
338 | Float_t(fQ[fIndLocal[0][0]][0]+fQ[fIndLocal[1][0]][0]); | |
339 | fQrInit[1]=Float_t(fQ[fIndLocal[0][1]][1])/ | |
340 | Float_t(fQ[fIndLocal[0][1]][1]+fQ[fIndLocal[1][1]][1]); | |
341 | ||
342 | // ******* iacc = 0 ******* | |
343 | // No combinations found between the 2 cathodes | |
344 | // We keep the center of gravity of the cluster | |
345 | if (iacc==0) { | |
b137f8b9 | 346 | AddRawCluster(*c); |
a9e2aefa | 347 | } |
348 | ||
349 | // ******* iacc = 1 ******* | |
350 | // Only one combination found between the 2 cathodes | |
351 | if (iacc==1) { | |
a9e2aefa | 352 | // Initial values for the 2 maxima (x,y) |
353 | ||
354 | // 1 maximum is initialised with the maximum of the combination found (X->cathode 2, Y->cathode 1) | |
355 | // 1 maximum is initialised with the other maximum of the first cathode | |
356 | if (accepted[0]){ | |
8c343c7c | 357 | AliDebug(1,"ico=0"); |
a9e2aefa | 358 | fXInit[0]=xm[0][1]; |
359 | fYInit[0]=ym[0][0]; | |
360 | fXInit[1]=xm[3][0]; | |
361 | fYInit[1]=ym[3][0]; | |
362 | } else if (accepted[1]){ | |
8c343c7c | 363 | AliDebug(1,"ico=1"); |
a9e2aefa | 364 | fXInit[0]=xm[1][1]; |
365 | fYInit[0]=ym[1][0]; | |
366 | fXInit[1]=xm[2][0]; | |
367 | fYInit[1]=ym[2][0]; | |
368 | } else if (accepted[2]){ | |
8c343c7c | 369 | AliDebug(1,"ico=2"); |
a9e2aefa | 370 | fXInit[0]=xm[2][1]; |
371 | fYInit[0]=ym[2][0]; | |
372 | fXInit[1]=xm[1][0]; | |
373 | fYInit[1]=ym[1][0]; | |
374 | } else if (accepted[3]){ | |
8c343c7c | 375 | AliDebug(1,"ico=3"); |
a9e2aefa | 376 | fXInit[0]=xm[3][1]; |
377 | fYInit[0]=ym[3][0]; | |
378 | fXInit[1]=xm[0][0]; | |
379 | fYInit[1]=ym[0][0]; | |
380 | } | |
8c343c7c | 381 | AliDebug(1,"cas (2) CombiDoubleMathiesonFit(c)"); |
a9e2aefa | 382 | chi2=CombiDoubleMathiesonFit(c); |
383 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
384 | // Float_t prob = TMath::Prob(chi2,ndf); | |
385 | // prob2->Fill(prob); | |
386 | // chi2_2->Fill(chi2); | |
8c343c7c | 387 | AliDebug(1,Form(" chi2 %f\n",chi2)); |
a9e2aefa | 388 | |
389 | // If reasonable chi^2 add result to the list of rawclusters | |
390 | if (chi2<10) { | |
391 | Split(c); | |
392 | ||
393 | } else { | |
394 | // 1 maximum is initialised with the maximum of the combination found (X->cathode 2, Y->cathode 1) | |
395 | // 1 maximum is initialised with the other maximum of the second cathode | |
396 | if (accepted[0]){ | |
8c343c7c | 397 | AliDebug(1,"ico=0"); |
a9e2aefa | 398 | fXInit[0]=xm[0][1]; |
399 | fYInit[0]=ym[0][0]; | |
400 | fXInit[1]=xm[3][1]; | |
401 | fYInit[1]=ym[3][1]; | |
402 | } else if (accepted[1]){ | |
8c343c7c | 403 | AliDebug(1,"ico=1"); |
a9e2aefa | 404 | fXInit[0]=xm[1][1]; |
405 | fYInit[0]=ym[1][0]; | |
406 | fXInit[1]=xm[2][1]; | |
407 | fYInit[1]=ym[2][1]; | |
408 | } else if (accepted[2]){ | |
8c343c7c | 409 | AliDebug(1,"ico=2"); |
a9e2aefa | 410 | fXInit[0]=xm[2][1]; |
411 | fYInit[0]=ym[2][0]; | |
412 | fXInit[1]=xm[1][1]; | |
413 | fYInit[1]=ym[1][1]; | |
414 | } else if (accepted[3]){ | |
8c343c7c | 415 | AliDebug(1,"ico=3"); |
a9e2aefa | 416 | fXInit[0]=xm[3][1]; |
417 | fYInit[0]=ym[3][0]; | |
418 | fXInit[1]=xm[0][1]; | |
419 | fYInit[1]=ym[0][1]; | |
420 | } | |
8c343c7c | 421 | AliDebug(1,"\n cas (2) CombiDoubleMathiesonFit(c)\n"); |
a9e2aefa | 422 | chi2=CombiDoubleMathiesonFit(c); |
423 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
424 | // Float_t prob = TMath::Prob(chi2,ndf); | |
425 | // prob2->Fill(prob); | |
426 | // chi2_2->Fill(chi2); | |
c4a97bcd | 427 | AliDebug(1,Form(" chi2 %f\n",chi2)); |
a9e2aefa | 428 | |
429 | // If reasonable chi^2 add result to the list of rawclusters | |
430 | if (chi2<10) { | |
431 | Split(c); | |
432 | } else { | |
433 | //We keep only the combination found (X->cathode 2, Y->cathode 1) | |
434 | for (Int_t ico=0; ico<2; ico++) { | |
435 | if (accepted[ico]) { | |
436 | AliMUONRawCluster cnew; | |
437 | Int_t cath; | |
438 | for (cath=0; cath<2; cath++) { | |
ba12c242 | 439 | cnew.SetX(cath, Float_t(xm[ico][1])); |
440 | cnew.SetY(cath, Float_t(ym[ico][0])); | |
441 | cnew.SetZ(cath, fZPlane); | |
9e993f2a | 442 | cnew.SetMultiplicity(cath,c->GetMultiplicity(cath)); |
a9e2aefa | 443 | for (i=0; i<fMul[cath]; i++) { |
fed772f3 | 444 | cnew.SetIndex(i, cath, c->GetIndex(i,cath)); |
002920d1 | 445 | fSeg2[cath]->SetPad(fInput->DetElemId(), fIx[i][cath], fIy[i][cath]); |
a9e2aefa | 446 | } |
c4a97bcd | 447 | AliDebug(1,Form("\nRawCluster %d cath %d\n",ico,cath)); |
448 | AliDebug(1,Form("mult_av %d\n",c->GetMultiplicity(cath))); | |
9825400f | 449 | FillCluster(&cnew,cath); |
a9e2aefa | 450 | } |
9e993f2a | 451 | cnew.SetClusterType(cnew.PhysicsContribution()); |
a9e2aefa | 452 | AddRawCluster(cnew); |
453 | fNPeaks++; | |
454 | } | |
455 | } | |
456 | } | |
457 | } | |
458 | } | |
9825400f | 459 | |
a9e2aefa | 460 | // ******* iacc = 2 ******* |
461 | // Two combinations found between the 2 cathodes | |
462 | if (iacc==2) { | |
a9e2aefa | 463 | // Was the same maximum taken twice |
9825400f | 464 | if ((accepted[0]&&accepted[1]) || (accepted[2]&&accepted[3])) { |
c4a97bcd | 465 | AliDebug(1,"\n Maximum taken twice !!!\n"); |
a9e2aefa | 466 | |
05c39730 | 467 | // Have a try !! with that |
9825400f | 468 | if (accepted[0]&&accepted[3]) { |
469 | fXInit[0]=xm[0][1]; | |
470 | fYInit[0]=ym[0][0]; | |
471 | fXInit[1]=xm[1][1]; | |
472 | fYInit[1]=ym[1][0]; | |
473 | } else { | |
474 | fXInit[0]=xm[2][1]; | |
475 | fYInit[0]=ym[2][0]; | |
476 | fXInit[1]=xm[3][1]; | |
477 | fYInit[1]=ym[3][0]; | |
478 | } | |
c4a97bcd | 479 | AliDebug(1,"\n cas (2) CombiDoubleMathiesonFit(c)\n"); |
9825400f | 480 | chi2=CombiDoubleMathiesonFit(c); |
a9e2aefa | 481 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; |
482 | // Float_t prob = TMath::Prob(chi2,ndf); | |
483 | // prob2->Fill(prob); | |
484 | // chi2_2->Fill(chi2); | |
9825400f | 485 | Split(c); |
486 | ||
487 | } else { | |
a9e2aefa | 488 | // No ghosts ! No Problems ! - Perform one fit only ! |
9825400f | 489 | if (accepted[0]&&accepted[3]) { |
490 | fXInit[0]=xm[0][1]; | |
491 | fYInit[0]=ym[0][0]; | |
492 | fXInit[1]=xm[3][1]; | |
493 | fYInit[1]=ym[3][0]; | |
494 | } else { | |
495 | fXInit[0]=xm[1][1]; | |
496 | fYInit[0]=ym[1][0]; | |
497 | fXInit[1]=xm[2][1]; | |
498 | fYInit[1]=ym[2][0]; | |
499 | } | |
c4a97bcd | 500 | AliDebug(1,"\n cas (2) CombiDoubleMathiesonFit(c)\n"); |
9825400f | 501 | chi2=CombiDoubleMathiesonFit(c); |
a9e2aefa | 502 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; |
503 | // Float_t prob = TMath::Prob(chi2,ndf); | |
504 | // prob2->Fill(prob); | |
505 | // chi2_2->Fill(chi2); | |
c4a97bcd | 506 | AliDebug(1,Form(" chi2 %f\n",chi2)); |
9825400f | 507 | Split(c); |
508 | } | |
509 | ||
a9e2aefa | 510 | // ******* iacc = 4 ******* |
511 | // Four combinations found between the 2 cathodes | |
512 | // Ghost !! | |
9825400f | 513 | } else if (iacc==4) { |
a9e2aefa | 514 | // Perform fits for the two possibilities !! |
07cfabcf | 515 | // Accept if charges are compatible on both cathodes |
516 | // If none are compatible, keep everything | |
9825400f | 517 | fXInit[0]=xm[0][1]; |
518 | fYInit[0]=ym[0][0]; | |
519 | fXInit[1]=xm[3][1]; | |
520 | fYInit[1]=ym[3][0]; | |
c4a97bcd | 521 | AliDebug(1,"\n cas (2) CombiDoubleMathiesonFit(c)\n"); |
9825400f | 522 | chi2=CombiDoubleMathiesonFit(c); |
a9e2aefa | 523 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; |
524 | // Float_t prob = TMath::Prob(chi2,ndf); | |
525 | // prob2->Fill(prob); | |
526 | // chi2_2->Fill(chi2); | |
c4a97bcd | 527 | AliDebug(1,Form(" chi2 %f\n",chi2)); |
07cfabcf | 528 | // store results of fit and postpone decision |
529 | Double_t sXFit[2],sYFit[2],sQrFit[2]; | |
530 | Float_t sChi2[2]; | |
531 | for (Int_t i=0;i<2;i++) { | |
532 | sXFit[i]=fXFit[i]; | |
533 | sYFit[i]=fYFit[i]; | |
534 | sQrFit[i]=fQrFit[i]; | |
535 | sChi2[i]=fChi2[i]; | |
536 | } | |
9825400f | 537 | fXInit[0]=xm[1][1]; |
538 | fYInit[0]=ym[1][0]; | |
539 | fXInit[1]=xm[2][1]; | |
540 | fYInit[1]=ym[2][0]; | |
c4a97bcd | 541 | AliDebug(1,"\n cas (2) CombiDoubleMathiesonFit(c)\n"); |
9825400f | 542 | chi2=CombiDoubleMathiesonFit(c); |
a9e2aefa | 543 | // ndf = fgNbins[0]+fgNbins[1]-6; |
544 | // prob = TMath::Prob(chi2,ndf); | |
545 | // prob2->Fill(prob); | |
546 | // chi2_2->Fill(chi2); | |
c4a97bcd | 547 | AliDebug(1,Form(" chi2 %f\n",chi2)); |
07cfabcf | 548 | // We have all informations to perform the decision |
549 | // Compute the chi2 for the 2 possibilities | |
550 | Float_t chi2fi,chi2si,chi2f,chi2s; | |
551 | ||
552 | chi2f = (TMath::Log(fInput->TotalCharge(0)*fQrFit[0] | |
553 | / (fInput->TotalCharge(1)*fQrFit[1]) ) | |
7e4a628d | 554 | / fInput->ChargeCorrel() ); |
07cfabcf | 555 | chi2f *=chi2f; |
556 | chi2fi = (TMath::Log(fInput->TotalCharge(0)*(1-fQrFit[0]) | |
557 | / (fInput->TotalCharge(1)*(1-fQrFit[1])) ) | |
7e4a628d | 558 | / fInput->ChargeCorrel() ); |
07cfabcf | 559 | chi2f += chi2fi*chi2fi; |
560 | ||
561 | chi2s = (TMath::Log(fInput->TotalCharge(0)*sQrFit[0] | |
562 | / (fInput->TotalCharge(1)*sQrFit[1]) ) | |
7e4a628d | 563 | / fInput->ChargeCorrel() ); |
07cfabcf | 564 | chi2s *=chi2s; |
565 | chi2si = (TMath::Log(fInput->TotalCharge(0)*(1-sQrFit[0]) | |
566 | / (fInput->TotalCharge(1)*(1-sQrFit[1])) ) | |
7e4a628d | 567 | / fInput->ChargeCorrel() ); |
07cfabcf | 568 | chi2s += chi2si*chi2si; |
569 | ||
570 | // usefull to store the charge matching chi2 in the cluster | |
571 | // fChi2[0]=sChi2[1]=chi2f; | |
572 | // fChi2[1]=sChi2[0]=chi2s; | |
573 | ||
574 | if (chi2f<=fGhostChi2Cut && chi2s<=fGhostChi2Cut) | |
3b5272e3 | 575 | c->SetGhost(1); |
07cfabcf | 576 | if (chi2f>fGhostChi2Cut && chi2s>fGhostChi2Cut) { |
577 | // we keep the ghost | |
3b5272e3 | 578 | c->SetGhost(2); |
07cfabcf | 579 | chi2s=-1; |
580 | chi2f=-1; | |
581 | } | |
582 | if (chi2f<=fGhostChi2Cut) | |
583 | Split(c); | |
584 | if (chi2s<=fGhostChi2Cut) { | |
585 | // retreive saved values | |
586 | for (Int_t i=0;i<2;i++) { | |
587 | fXFit[i]=sXFit[i]; | |
588 | fYFit[i]=sYFit[i]; | |
589 | fQrFit[i]=sQrFit[i]; | |
590 | fChi2[i]=sChi2[i]; | |
591 | } | |
592 | Split(c); | |
593 | } | |
3b5272e3 | 594 | c->SetGhost(0); |
9825400f | 595 | } |
a9e2aefa | 596 | |
9825400f | 597 | } else if (fNLocal[0]==2 && fNLocal[1]==1) { |
a9e2aefa | 598 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
599 | // (3) Two local maxima on cathode 1 and one maximum on cathode 2 | |
600 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
601 | // | |
602 | Float_t xm[4][2], ym[4][2]; | |
603 | Float_t dpx, dpy, dx, dy; | |
604 | Int_t ixm[4][2], iym[4][2]; | |
605 | Int_t isec, im1, ico; | |
606 | // | |
607 | // Form the 2x2 combinations | |
608 | // 0-0, 0-1, 1-0, 1-1 | |
609 | ico=0; | |
610 | for (im1=0; im1<2; im1++) { | |
9825400f | 611 | xm[ico][0]=fX[fIndLocal[im1][0]][0]; |
612 | ym[ico][0]=fY[fIndLocal[im1][0]][0]; | |
613 | xm[ico][1]=fX[fIndLocal[0][1]][1]; | |
614 | ym[ico][1]=fY[fIndLocal[0][1]][1]; | |
615 | ||
616 | ixm[ico][0]=fIx[fIndLocal[im1][0]][0]; | |
617 | iym[ico][0]=fIy[fIndLocal[im1][0]][0]; | |
618 | ixm[ico][1]=fIx[fIndLocal[0][1]][1]; | |
619 | iym[ico][1]=fIy[fIndLocal[0][1]][1]; | |
620 | ico++; | |
a9e2aefa | 621 | } |
622 | // ico = 0 : first local maximum on cathodes 1 and 2 | |
623 | // ico = 1 : second local maximum on cathode 1 and first on cathode 2 | |
624 | ||
625 | // Analyse the combinations and keep those that are possible ! | |
626 | // For each combination check consistency in x and y | |
627 | Int_t iacc; | |
628 | Bool_t accepted[4]; | |
629 | iacc=0; | |
05c39730 | 630 | // In case of staggering maxima are displaced by exactly half the pad-size in y. |
375c469b | 631 | // We have to take into account the numerical precision in the consistency check; |
632 | ||
05c39730 | 633 | Float_t eps = 1.e-5; |
634 | ||
a9e2aefa | 635 | for (ico=0; ico<2; ico++) { |
002920d1 | 636 | isec=fSeg2[0]->Sector(fInput->DetElemId(), ixm[ico][0], iym[ico][0]); |
637 | dpx=fSeg2[0]->Dpx(fInput->DetElemId(), isec)/2.; | |
638 | ||
a9e2aefa | 639 | dx=TMath::Abs(xm[ico][0]-xm[ico][1]); |
002920d1 | 640 | isec=fSeg2[1]->Sector(fInput->DetElemId(), ixm[ico][1], iym[ico][1]); |
641 | dpy=fSeg2[1]->Dpy(fInput->DetElemId(), isec)/2.; | |
642 | ||
a9e2aefa | 643 | dy=TMath::Abs(ym[ico][0]-ym[ico][1]); |
c4a97bcd | 644 | AliDebug(2,Form("\n %i %f %f %f %f \n", ico, ym[ico][0], ym[ico][1], dy, dpy )); |
05c39730 | 645 | if ((dx <= dpx) && (dy <= dpy+eps)) { |
a9e2aefa | 646 | // consistent |
647 | accepted[ico]=kTRUE; | |
648 | iacc++; | |
649 | } else { | |
650 | // reject | |
651 | accepted[ico]=kFALSE; | |
652 | } | |
653 | } | |
9825400f | 654 | |
a9e2aefa | 655 | Float_t chi21 = 100; |
656 | Float_t chi22 = 100; | |
05c39730 | 657 | Float_t chi23 = 100; |
658 | ||
659 | // Initial value for charge ratios | |
660 | fQrInit[0]=Float_t(fQ[fIndLocal[0][0]][0])/ | |
661 | Float_t(fQ[fIndLocal[0][0]][0]+fQ[fIndLocal[1][0]][0]); | |
662 | fQrInit[1]=fQrInit[0]; | |
9825400f | 663 | |
05c39730 | 664 | if (accepted[0] && accepted[1]) { |
665 | ||
666 | fXInit[0]=0.5*(xm[0][1]+xm[0][0]); | |
667 | fYInit[0]=ym[0][0]; | |
668 | fXInit[1]=0.5*(xm[0][1]+xm[1][0]); | |
669 | fYInit[1]=ym[1][0]; | |
670 | fQrInit[0]=0.5; | |
671 | fQrInit[1]=0.5; | |
672 | chi23=CombiDoubleMathiesonFit(c); | |
673 | if (chi23<10) { | |
674 | Split(c); | |
675 | Float_t yst; | |
676 | yst = fYFit[0]; | |
677 | fYFit[0] = fYFit[1]; | |
678 | fYFit[1] = yst; | |
679 | Split(c); | |
680 | } | |
681 | } else if (accepted[0]) { | |
a9e2aefa | 682 | fXInit[0]=xm[0][1]; |
683 | fYInit[0]=ym[0][0]; | |
684 | fXInit[1]=xm[1][0]; | |
685 | fYInit[1]=ym[1][0]; | |
686 | chi21=CombiDoubleMathiesonFit(c); | |
687 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
688 | // Float_t prob = TMath::Prob(chi2,ndf); | |
689 | // prob2->Fill(prob); | |
690 | // chi2_2->Fill(chi21); | |
c4a97bcd | 691 | AliDebug(1,Form(" chi2 %f\n",chi21)); |
a9e2aefa | 692 | if (chi21<10) Split(c); |
693 | } else if (accepted[1]) { | |
694 | fXInit[0]=xm[1][1]; | |
695 | fYInit[0]=ym[1][0]; | |
696 | fXInit[1]=xm[0][0]; | |
697 | fYInit[1]=ym[0][0]; | |
698 | chi22=CombiDoubleMathiesonFit(c); | |
699 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
700 | // Float_t prob = TMath::Prob(chi2,ndf); | |
701 | // prob2->Fill(prob); | |
702 | // chi2_2->Fill(chi22); | |
c4a97bcd | 703 | AliDebug(1,Form(" chi2 %f\n",chi22)); |
a9e2aefa | 704 | if (chi22<10) Split(c); |
705 | } | |
706 | ||
375c469b | 707 | if (chi21 > 10 && chi22 > 10 && chi23 > 10) { |
a9e2aefa | 708 | // We keep only the combination found (X->cathode 2, Y->cathode 1) |
709 | for (Int_t ico=0; ico<2; ico++) { | |
710 | if (accepted[ico]) { | |
711 | AliMUONRawCluster cnew; | |
712 | Int_t cath; | |
713 | for (cath=0; cath<2; cath++) { | |
ba12c242 | 714 | cnew.SetX(cath, Float_t(xm[ico][1])); |
715 | cnew.SetY(cath, Float_t(ym[ico][0])); | |
716 | cnew.SetZ(cath, fZPlane); | |
9e993f2a | 717 | cnew.SetMultiplicity(cath, c->GetMultiplicity(cath)); |
a9e2aefa | 718 | for (i=0; i<fMul[cath]; i++) { |
0164904a | 719 | cnew.SetIndex(i, cath, c->GetIndex(i, cath)); |
002920d1 | 720 | fSeg2[cath]->SetPad(fInput->DetElemId(), fIx[i][cath], fIy[i][cath]); |
fed772f3 | 721 | |
a9e2aefa | 722 | } |
c4a97bcd | 723 | AliDebug(1,Form("\nRawCluster %d cath %d\n",ico,cath)); |
724 | AliDebug(1,Form("mult_av %d\n",c->GetMultiplicity(cath))); | |
725 | ||
a9e2aefa | 726 | FillCluster(&cnew,cath); |
727 | } | |
9e993f2a | 728 | cnew.SetClusterType(cnew.PhysicsContribution()); |
a9e2aefa | 729 | AddRawCluster(cnew); |
730 | fNPeaks++; | |
731 | } | |
732 | } | |
733 | } | |
9825400f | 734 | |
a9e2aefa | 735 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
736 | // (3') One local maximum on cathode 1 and two maxima on cathode 2 | |
737 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
738 | } else if (fNLocal[0]==1 && fNLocal[1]==2) { | |
a9e2aefa | 739 | Float_t xm[4][2], ym[4][2]; |
740 | Float_t dpx, dpy, dx, dy; | |
741 | Int_t ixm[4][2], iym[4][2]; | |
742 | Int_t isec, im1, ico; | |
743 | // | |
744 | // Form the 2x2 combinations | |
745 | // 0-0, 0-1, 1-0, 1-1 | |
746 | ico=0; | |
747 | for (im1=0; im1<2; im1++) { | |
9825400f | 748 | xm[ico][0]=fX[fIndLocal[0][0]][0]; |
749 | ym[ico][0]=fY[fIndLocal[0][0]][0]; | |
750 | xm[ico][1]=fX[fIndLocal[im1][1]][1]; | |
751 | ym[ico][1]=fY[fIndLocal[im1][1]][1]; | |
752 | ||
753 | ixm[ico][0]=fIx[fIndLocal[0][0]][0]; | |
754 | iym[ico][0]=fIy[fIndLocal[0][0]][0]; | |
755 | ixm[ico][1]=fIx[fIndLocal[im1][1]][1]; | |
756 | iym[ico][1]=fIy[fIndLocal[im1][1]][1]; | |
757 | ico++; | |
a9e2aefa | 758 | } |
759 | // ico = 0 : first local maximum on cathodes 1 and 2 | |
760 | // ico = 1 : first local maximum on cathode 1 and second on cathode 2 | |
761 | ||
762 | // Analyse the combinations and keep those that are possible ! | |
763 | // For each combination check consistency in x and y | |
764 | Int_t iacc; | |
765 | Bool_t accepted[4]; | |
766 | iacc=0; | |
05c39730 | 767 | // In case of staggering maxima are displaced by exactly half the pad-size in y. |
768 | // We have to take into account the numerical precision in the consistency check; | |
769 | Float_t eps = 1.e-5; | |
770 | ||
a9e2aefa | 771 | |
772 | for (ico=0; ico<2; ico++) { | |
773 | accepted[ico]=kFALSE; | |
002920d1 | 774 | isec=fSeg2[0]->Sector(fInput->DetElemId(), ixm[ico][0], iym[ico][0]); |
775 | dpx=fSeg2[0]->Dpx(fInput->DetElemId(), isec)/2.; | |
776 | ||
a9e2aefa | 777 | dx=TMath::Abs(xm[ico][0]-xm[ico][1]); |
002920d1 | 778 | isec=fSeg2[1]->Sector(fInput->DetElemId(), ixm[ico][1], iym[ico][1]); |
779 | dpy=fSeg2[1]->Dpy(fInput->DetElemId(), isec)/2.; | |
780 | ||
a9e2aefa | 781 | dy=TMath::Abs(ym[ico][0]-ym[ico][1]); |
c4a97bcd | 782 | AliDebug(1,Form("\n %i %f %f %f %f \n", ico, ym[ico][0], ym[ico][1], dy, dpy )); |
05c39730 | 783 | if ((dx <= dpx) && (dy <= dpy+eps)) { |
a9e2aefa | 784 | // consistent |
785 | accepted[ico]=kTRUE; | |
c4a97bcd | 786 | AliDebug(1,Form("ico %d\n",ico)); |
a9e2aefa | 787 | iacc++; |
788 | } else { | |
789 | // reject | |
790 | accepted[ico]=kFALSE; | |
791 | } | |
792 | } | |
793 | ||
794 | Float_t chi21 = 100; | |
795 | Float_t chi22 = 100; | |
05c39730 | 796 | Float_t chi23 = 100; |
797 | ||
798 | fQrInit[1]=Float_t(fQ[fIndLocal[0][1]][1])/ | |
799 | Float_t(fQ[fIndLocal[0][1]][1]+fQ[fIndLocal[1][1]][1]); | |
800 | ||
801 | fQrInit[0]=fQrInit[1]; | |
a9e2aefa | 802 | |
05c39730 | 803 | |
804 | if (accepted[0] && accepted[1]) { | |
805 | fXInit[0]=xm[0][1]; | |
806 | fYInit[0]=0.5*(ym[0][0]+ym[0][1]); | |
807 | fXInit[1]=xm[1][1]; | |
808 | fYInit[1]=0.5*(ym[0][0]+ym[1][1]); | |
809 | fQrInit[0]=0.5; | |
810 | fQrInit[1]=0.5; | |
811 | chi23=CombiDoubleMathiesonFit(c); | |
812 | if (chi23<10) { | |
813 | Split(c); | |
814 | Float_t yst; | |
815 | yst = fYFit[0]; | |
816 | fYFit[0] = fYFit[1]; | |
817 | fYFit[1] = yst; | |
818 | Split(c); | |
819 | } | |
820 | } else if (accepted[0]) { | |
a9e2aefa | 821 | fXInit[0]=xm[0][0]; |
822 | fYInit[0]=ym[0][1]; | |
823 | fXInit[1]=xm[1][1]; | |
824 | fYInit[1]=ym[1][1]; | |
825 | chi21=CombiDoubleMathiesonFit(c); | |
826 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
827 | // Float_t prob = TMath::Prob(chi2,ndf); | |
828 | // prob2->Fill(prob); | |
829 | // chi2_2->Fill(chi21); | |
c4a97bcd | 830 | AliDebug(1,Form(" chi2 %f\n",chi21)); |
a9e2aefa | 831 | if (chi21<10) Split(c); |
832 | } else if (accepted[1]) { | |
833 | fXInit[0]=xm[1][0]; | |
834 | fYInit[0]=ym[1][1]; | |
835 | fXInit[1]=xm[0][1]; | |
836 | fYInit[1]=ym[0][1]; | |
837 | chi22=CombiDoubleMathiesonFit(c); | |
838 | // Int_t ndf = fgNbins[0]+fgNbins[1]-6; | |
839 | // Float_t prob = TMath::Prob(chi2,ndf); | |
840 | // prob2->Fill(prob); | |
841 | // chi2_2->Fill(chi22); | |
c4a97bcd | 842 | AliDebug(1,Form(" chi2 %f\n",chi22)); |
a9e2aefa | 843 | if (chi22<10) Split(c); |
844 | } | |
845 | ||
05c39730 | 846 | if (chi21 > 10 && chi22 > 10 && chi23 > 10) { |
a9e2aefa | 847 | //We keep only the combination found (X->cathode 2, Y->cathode 1) |
848 | for (Int_t ico=0; ico<2; ico++) { | |
849 | if (accepted[ico]) { | |
850 | AliMUONRawCluster cnew; | |
851 | Int_t cath; | |
852 | for (cath=0; cath<2; cath++) { | |
ba12c242 | 853 | cnew.SetX(cath, Float_t(xm[ico][1])); |
854 | cnew.SetY(cath, Float_t(ym[ico][0])); | |
855 | cnew.SetZ(cath, fZPlane); | |
9e993f2a | 856 | cnew.SetMultiplicity(cath, c->GetMultiplicity(cath)); |
a9e2aefa | 857 | for (i=0; i<fMul[cath]; i++) { |
002920d1 | 858 | cnew.SetIndex(i, cath, c->GetIndex(i, cath)); |
859 | fSeg2[cath]->SetPad(fInput->DetElemId(), fIx[i][cath], fIy[i][cath]); | |
a9e2aefa | 860 | } |
c4a97bcd | 861 | AliDebug(1,Form("\nRawCluster %d cath %d\n",ico,cath)); |
862 | AliDebug(1,Form("mult_av %d\n",c->GetMultiplicity(cath))); | |
a9e2aefa | 863 | FillCluster(&cnew,cath); |
864 | } | |
9e993f2a | 865 | cnew.SetClusterType(cnew.PhysicsContribution()); |
a9e2aefa | 866 | AddRawCluster(cnew); |
867 | fNPeaks++; | |
868 | } | |
869 | } | |
870 | } | |
871 | ||
872 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
873 | // (4) At least three local maxima on cathode 1 or on cathode 2 | |
874 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
875 | } else if (fNLocal[0]>2 || fNLocal[1]>2) { | |
a9e2aefa | 876 | Int_t param = fNLocal[0]*fNLocal[1]; |
f8ffca81 | 877 | Int_t ii; |
9825400f | 878 | |
39e6d319 | 879 | Float_t ** xm = new Float_t * [param]; |
880 | for (ii=0; ii<param; ii++) xm[ii]=new Float_t [2]; | |
881 | Float_t ** ym = new Float_t * [param]; | |
882 | for (ii=0; ii<param; ii++) ym[ii]=new Float_t [2]; | |
883 | Int_t ** ixm = new Int_t * [param]; | |
884 | for (ii=0; ii<param; ii++) ixm[ii]=new Int_t [2]; | |
885 | Int_t ** iym = new Int_t * [param]; | |
886 | for (ii=0; ii<param; ii++) iym[ii]=new Int_t [2]; | |
f8ffca81 | 887 | |
a9e2aefa | 888 | Int_t isec, ico; |
889 | Float_t dpx, dpy, dx, dy; | |
890 | ||
891 | ico=0; | |
892 | for (Int_t im1=0; im1<fNLocal[0]; im1++) { | |
893 | for (Int_t im2=0; im2<fNLocal[1]; im2++) { | |
894 | xm[ico][0]=fX[fIndLocal[im1][0]][0]; | |
895 | ym[ico][0]=fY[fIndLocal[im1][0]][0]; | |
896 | xm[ico][1]=fX[fIndLocal[im2][1]][1]; | |
897 | ym[ico][1]=fY[fIndLocal[im2][1]][1]; | |
898 | ||
899 | ixm[ico][0]=fIx[fIndLocal[im1][0]][0]; | |
900 | iym[ico][0]=fIy[fIndLocal[im1][0]][0]; | |
901 | ixm[ico][1]=fIx[fIndLocal[im2][1]][1]; | |
902 | iym[ico][1]=fIy[fIndLocal[im2][1]][1]; | |
903 | ico++; | |
904 | } | |
905 | } | |
9825400f | 906 | |
a9e2aefa | 907 | Int_t nIco = ico; |
c4a97bcd | 908 | AliDebug(1,Form("nIco %d\n",nIco)); |
a9e2aefa | 909 | for (ico=0; ico<nIco; ico++) { |
c4a97bcd | 910 | AliDebug(1,Form("ico = %d\n",ico)); |
002920d1 | 911 | isec=fSeg2[0]->Sector(fInput->DetElemId(), ixm[ico][0], iym[ico][0]); |
912 | dpx=fSeg2[0]->Dpx(fInput->DetElemId(), isec)/2.; | |
913 | ||
a9e2aefa | 914 | dx=TMath::Abs(xm[ico][0]-xm[ico][1]); |
002920d1 | 915 | isec=fSeg2[1]->Sector(fInput->DetElemId(), ixm[ico][1], iym[ico][1]); |
916 | dpy=fSeg2[1]->Dpy(fInput->DetElemId(), isec)/2.; | |
917 | ||
a9e2aefa | 918 | dy=TMath::Abs(ym[ico][0]-ym[ico][1]); |
c4a97bcd | 919 | AliDebug(1,Form("dx %f dpx %f dy %f dpy %f\n",dx,dpx,dy,dpy)); |
920 | AliDebug(1,Form(" X %f Y %f\n",xm[ico][1],ym[ico][0])); | |
a9e2aefa | 921 | if ((dx <= dpx) && (dy <= dpy)) { |
c4a97bcd | 922 | AliDebug(1,"ok\n"); |
a9e2aefa | 923 | Int_t cath; |
924 | AliMUONRawCluster cnew; | |
925 | for (cath=0; cath<2; cath++) { | |
ba12c242 | 926 | cnew.SetX(cath, Float_t(xm[ico][1])); |
927 | cnew.SetY(cath, Float_t(ym[ico][0])); | |
928 | cnew.SetZ(cath, fZPlane); | |
9e993f2a | 929 | cnew.SetMultiplicity(cath, c->GetMultiplicity(cath)); |
a9e2aefa | 930 | for (i=0; i<fMul[cath]; i++) { |
0164904a | 931 | cnew.SetIndex(i, cath, c->GetIndex(i, cath)); |
002920d1 | 932 | fSeg2[cath]->SetPad(fInput->DetElemId(), fIx[i][cath], fIy[i][cath]); |
a9e2aefa | 933 | } |
934 | FillCluster(&cnew,cath); | |
935 | } | |
9e993f2a | 936 | cnew.SetClusterType(cnew.PhysicsContribution()); |
6570c14d | 937 | // cnew.SetDetElemId(fInput->DetElemId()); |
a9e2aefa | 938 | AddRawCluster(cnew); |
939 | fNPeaks++; | |
940 | } | |
941 | } | |
f8ffca81 | 942 | delete [] xm; |
943 | delete [] ym; | |
944 | delete [] ixm; | |
945 | delete [] iym; | |
a9e2aefa | 946 | } |
947 | } | |
948 | ||
e3cba86e | 949 | void AliMUONClusterFinderVS::FindLocalMaxima(AliMUONRawCluster* /*c*/) |
a9e2aefa | 950 | { |
951 | // Find all local maxima of a cluster | |
c4a97bcd | 952 | AliDebug(1,"\n Find Local maxima !"); |
f0d86bc4 | 953 | |
a9e2aefa | 954 | AliMUONDigit* digt; |
955 | ||
956 | Int_t cath, cath1; // loops over cathodes | |
957 | Int_t i; // loops over digits | |
958 | Int_t j; // loops over cathodes | |
959 | // | |
960 | // Find local maxima | |
961 | // | |
962 | // counters for number of local maxima | |
963 | fNLocal[0]=fNLocal[1]=0; | |
964 | // flags digits as local maximum | |
965 | Bool_t isLocal[100][2]; | |
966 | for (i=0; i<100;i++) { | |
967 | isLocal[i][0]=isLocal[i][1]=kFALSE; | |
968 | } | |
969 | // number of next neighbours and arrays to store them | |
970 | Int_t nn; | |
30aaba74 | 971 | Int_t x[10], y[10]; |
f7db2071 | 972 | // loop over cathodes |
a9e2aefa | 973 | for (cath=0; cath<2; cath++) { |
f7db2071 | 974 | // loop over cluster digits |
975 | for (i=0; i<fMul[cath]; i++) { | |
976 | // get neighbours for that digit and assume that it is local maximum | |
977 | Int_t isec; | |
978 | Float_t a0; | |
fed772f3 | 979 | |
002920d1 | 980 | fSeg2[cath]->Neighbours(fInput->DetElemId(), fIx[i][cath], fIy[i][cath], &nn, x, y); |
f7db2071 | 981 | |
982 | isLocal[i][cath]=kTRUE; | |
002920d1 | 983 | isec = fSeg2[cath]->Sector(fInput->DetElemId(), fIx[i][cath], fIy[i][cath]); |
984 | a0 = fSeg2[cath]->Dpx(fInput->DetElemId(), isec)*fSeg2[cath]->Dpy(fInput->DetElemId(), isec); | |
985 | ||
f7db2071 | 986 | // loop over next neighbours, if at least one neighbour has higher charger assumption |
987 | // digit is not local maximum | |
988 | for (j=0; j<nn; j++) { | |
5289cf2f | 989 | if (fDigitMap[cath]->TestHit(x[j], y[j])==kEmpty) continue; |
990 | digt=(AliMUONDigit*) fDigitMap[cath]->GetHit(x[j], y[j]); | |
f7db2071 | 991 | Float_t a1; |
002920d1 | 992 | isec=fSeg2[cath]->Sector(fInput->DetElemId(), x[j], y[j]); |
993 | a1 = fSeg2[cath]->Dpx(fInput->DetElemId(),isec)*fSeg2[cath]->Dpy(fInput->DetElemId(), isec); | |
994 | ||
f7db2071 | 995 | if (digt->Signal()/a1 > fQ[i][cath]/a0) { |
996 | isLocal[i][cath]=kFALSE; | |
997 | break; | |
998 | // | |
999 | // handle special case of neighbouring pads with equal signal | |
1000 | } else if (digt->Signal() == fQ[i][cath]) { | |
1001 | if (fNLocal[cath]>0) { | |
1002 | for (Int_t k=0; k<fNLocal[cath]; k++) { | |
1003 | if (x[j]==fIx[fIndLocal[k][cath]][cath] | |
1004 | && y[j]==fIy[fIndLocal[k][cath]][cath]) | |
1005 | { | |
a9e2aefa | 1006 | isLocal[i][cath]=kFALSE; |
f7db2071 | 1007 | } |
1008 | } // loop over local maxima | |
1009 | } // are there already local maxima | |
1010 | } // same charge ? | |
1011 | } // loop over next neighbours | |
1012 | if (isLocal[i][cath]) { | |
1013 | fIndLocal[fNLocal[cath]][cath]=i; | |
1014 | fNLocal[cath]++; | |
1015 | } | |
1016 | } // loop over all digits | |
a9e2aefa | 1017 | } // loop over cathodes |
07cfabcf | 1018 | |
c4a97bcd | 1019 | AliDebug(1,Form("\n Found %d %d %d %d local Maxima\n", |
1020 | fNLocal[0], fNLocal[1], fMul[0], fMul[1])); | |
1021 | AliDebug(1,Form("\n Cathode 1 local Maxima %d Multiplicite %d\n",fNLocal[0], fMul[0])); | |
1022 | AliDebug(1,Form(" Cathode 2 local Maxima %d Multiplicite %d\n",fNLocal[1], fMul[1])); | |
a9e2aefa | 1023 | Int_t ix, iy, isec; |
1024 | Float_t dpx, dpy; | |
1025 | ||
1026 | ||
1027 | if (fNLocal[1]==2 && (fNLocal[0]==1 || fNLocal[0]==0)) { | |
1028 | Int_t iback=fNLocal[0]; | |
1029 | ||
1030 | // Two local maxima on cathode 2 and one maximum on cathode 1 | |
1031 | // Look for local maxima considering up and down neighbours on the 1st cathode only | |
1032 | // | |
1033 | // Loop over cluster digits | |
1034 | cath=0; | |
1035 | cath1=1; | |
1036 | ||
1037 | for (i=0; i<fMul[cath]; i++) { | |
002920d1 | 1038 | isec=fSeg2[cath]->Sector(fInput->DetElemId(), fIx[i][cath],fIy[i][cath]); |
1039 | dpy=fSeg2[cath]->Dpy(fInput->DetElemId(), isec); | |
1040 | dpx=fSeg2[cath]->Dpx(fInput->DetElemId(), isec); | |
1041 | ||
a9e2aefa | 1042 | if (isLocal[i][cath]) continue; |
1043 | // Pad position should be consistent with position of local maxima on the opposite cathode | |
1044 | if ((TMath::Abs(fX[i][cath]-fX[fIndLocal[0][cath1]][cath1]) > dpx/2.) && | |
1045 | (TMath::Abs(fX[i][cath]-fX[fIndLocal[1][cath1]][cath1]) > dpx/2.)) | |
1046 | continue; | |
1047 | ||
1048 | // get neighbours for that digit and assume that it is local maximum | |
1049 | isLocal[i][cath]=kTRUE; | |
1050 | // compare signal to that on the two neighbours on the left and on the right | |
a9e2aefa | 1051 | // iNN counts the number of neighbours with signal, it should be 1 or 2 |
1052 | Int_t iNN=0; | |
fed772f3 | 1053 | |
f0d86bc4 | 1054 | |
002920d1 | 1055 | for (fSeg2[cath]->FirstPad(fInput->DetElemId(), fX[i][cath], fY[i][cath], fZPlane, 0., dpy); |
fed772f3 | 1056 | fSeg2[cath]->MorePads(fInput->DetElemId()); |
1057 | fSeg2[cath]->NextPad(fInput->DetElemId())) | |
1058 | { | |
1059 | ix = fSeg2[cath]->Ix(); | |
1060 | iy = fSeg2[cath]->Iy(); | |
1061 | // skip the current pad | |
1062 | if (iy == fIy[i][cath]) continue; | |
f0d86bc4 | 1063 | |
5289cf2f | 1064 | if (fDigitMap[cath]->TestHit(ix, iy)!=kEmpty) { |
f0d86bc4 | 1065 | iNN++; |
5289cf2f | 1066 | digt=(AliMUONDigit*) fDigitMap[cath]->GetHit(ix,iy); |
08a636a8 | 1067 | if (digt->Signal() > fQ[i][cath]) isLocal[i][cath]=kFALSE; |
fed772f3 | 1068 | } |
1069 | } // Loop over pad neighbours in y | |
002920d1 | 1070 | |
a9e2aefa | 1071 | if (isLocal[i][cath] && iNN>0) { |
1072 | fIndLocal[fNLocal[cath]][cath]=i; | |
1073 | fNLocal[cath]++; | |
1074 | } | |
1075 | } // loop over all digits | |
1076 | // if one additional maximum has been found we are happy | |
1077 | // if more maxima have been found restore the previous situation | |
c4a97bcd | 1078 | AliDebug(1,Form("\n New search gives %d local maxima for cathode 1 \n", |
1079 | fNLocal[0])); | |
1080 | AliDebug(1,Form(" %d local maxima for cathode 2 \n", | |
1081 | fNLocal[1])); | |
a9e2aefa | 1082 | if (fNLocal[cath]>2) { |
1083 | fNLocal[cath]=iback; | |
1084 | } | |
1085 | ||
1086 | } // 1,2 local maxima | |
1087 | ||
1088 | if (fNLocal[0]==2 && (fNLocal[1]==1 || fNLocal[1]==0)) { | |
1089 | Int_t iback=fNLocal[1]; | |
1090 | ||
1091 | // Two local maxima on cathode 1 and one maximum on cathode 2 | |
1092 | // Look for local maxima considering left and right neighbours on the 2nd cathode only | |
1093 | cath=1; | |
05c39730 | 1094 | Int_t cath1 = 0; |
1095 | Float_t eps = 1.e-5; | |
1096 | ||
a9e2aefa | 1097 | // |
1098 | // Loop over cluster digits | |
1099 | for (i=0; i<fMul[cath]; i++) { | |
fed772f3 | 1100 | isec=fSeg2[cath]->Sector(fInput->DetElemId(), fIx[i][cath],fIy[i][cath]); |
1101 | dpx=fSeg2[cath]->Dpx(fInput->DetElemId(), isec); | |
1102 | dpy=fSeg2[cath]->Dpy(fInput->DetElemId(), isec); | |
002920d1 | 1103 | |
fed772f3 | 1104 | |
a9e2aefa | 1105 | if (isLocal[i][cath]) continue; |
1106 | // Pad position should be consistent with position of local maxima on the opposite cathode | |
05c39730 | 1107 | if ((TMath::Abs(fY[i][cath]-fY[fIndLocal[0][cath1]][cath1]) > dpy/2.+eps) && |
1108 | (TMath::Abs(fY[i][cath]-fY[fIndLocal[1][cath1]][cath1]) > dpy/2.+eps)) | |
a9e2aefa | 1109 | continue; |
05c39730 | 1110 | |
a9e2aefa | 1111 | // |
1112 | // get neighbours for that digit and assume that it is local maximum | |
1113 | isLocal[i][cath]=kTRUE; | |
1114 | // compare signal to that on the two neighbours on the left and on the right | |
f0d86bc4 | 1115 | |
a9e2aefa | 1116 | // iNN counts the number of neighbours with signal, it should be 1 or 2 |
1117 | Int_t iNN=0; | |
002920d1 | 1118 | for (fSeg2[cath]->FirstPad(fInput->DetElemId(), fX[i][cath], fY[i][cath], fZPlane, dpx, 0.); |
fed772f3 | 1119 | fSeg2[cath]->MorePads(fInput->DetElemId()); |
1120 | fSeg2[cath]->NextPad(fInput->DetElemId())) | |
1121 | { | |
1122 | ||
1123 | ix = fSeg2[cath]->Ix(); | |
1124 | iy = fSeg2[cath]->Iy(); | |
1125 | ||
1126 | // skip the current pad | |
1127 | if (ix == fIx[i][cath]) continue; | |
1128 | ||
5289cf2f | 1129 | if (fDigitMap[cath]->TestHit(ix, iy)!=kEmpty) { |
fed772f3 | 1130 | iNN++; |
5289cf2f | 1131 | digt=(AliMUONDigit*) fDigitMap[cath]->GetHit(ix,iy); |
fed772f3 | 1132 | if (digt->Signal() > fQ[i][cath]) isLocal[i][cath]=kFALSE; |
1133 | } | |
1134 | } // Loop over pad neighbours in x | |
002920d1 | 1135 | |
a9e2aefa | 1136 | if (isLocal[i][cath] && iNN>0) { |
1137 | fIndLocal[fNLocal[cath]][cath]=i; | |
1138 | fNLocal[cath]++; | |
1139 | } | |
1140 | } // loop over all digits | |
1141 | // if one additional maximum has been found we are happy | |
1142 | // if more maxima have been found restore the previous situation | |
c4a97bcd | 1143 | AliDebug(1,Form("\n New search gives %d local maxima for cathode 1 \n",fNLocal[0])); |
1144 | AliDebug(1,Form("\n %d local maxima for cathode 2 \n",fNLocal[1])); | |
1145 | AliDebug(1,Form("\n New search gives %d %d \n",fNLocal[0],fNLocal[1])); | |
a9e2aefa | 1146 | if (fNLocal[cath]>2) { |
1147 | fNLocal[cath]=iback; | |
1148 | } | |
a9e2aefa | 1149 | } // 2,1 local maxima |
1150 | } | |
1151 | ||
1152 | ||
1153 | void AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t flag, Int_t cath) | |
1154 | { | |
b137f8b9 | 1155 | // |
1156 | // Completes cluster information starting from list of digits | |
1157 | // | |
1158 | AliMUONDigit* dig; | |
1159 | Float_t x, y, z; | |
1160 | Int_t ix, iy; | |
1161 | ||
1162 | if (cath==1) { | |
1163 | c->SetPeakSignal(cath,c->GetPeakSignal(0)); | |
1164 | } else { | |
1165 | c->SetPeakSignal(cath,0); | |
1166 | } | |
1167 | ||
1168 | ||
1169 | if (flag) { | |
1170 | c->SetX(cath,0.); | |
1171 | c->SetY(cath,0.); | |
1172 | c->SetCharge(cath,0); | |
1173 | } | |
1174 | ||
1175 | AliDebug(1,Form("\n fPeakSignal %d\n",c->GetPeakSignal(cath))); | |
1176 | for (Int_t i=0; i<c->GetMultiplicity(cath); i++) | |
a9e2aefa | 1177 | { |
b137f8b9 | 1178 | dig= fInput->Digit(cath,c->GetIndex(i,cath)); |
1179 | ix=dig->PadX()+c->GetOffset(i,cath); | |
1180 | iy=dig->PadY(); | |
1181 | Int_t q=dig->Signal(); | |
1182 | if (!flag) q=Int_t(q*c->GetContrib(i,cath)); | |
1183 | // fprintf(stderr,"q %d c->fPeakSignal[ %d ] %d\n",q,cath,c->fPeakSignal[cath]); | |
1184 | if (dig->Physics() >= dig->Signal()) { | |
1185 | c->SetPhysics(i,2); | |
1186 | } else if (dig->Physics() == 0) { | |
1187 | c->SetPhysics(i,0); | |
1188 | } else c->SetPhysics(i,1); | |
1189 | // | |
1190 | // | |
1191 | AliDebug(2,Form("q %d c->fPeakSignal[cath] %d\n",q,c->GetPeakSignal(cath))); | |
1192 | // peak signal and track list | |
1193 | if (q>c->GetPeakSignal(cath)) { | |
1194 | c->SetPeakSignal(cath, q); | |
1195 | c->SetTrack(0,dig->Hit()); | |
1196 | c->SetTrack(1,dig->Track(0)); | |
1197 | c->SetTrack(2,dig->Track(1)); | |
1198 | // fprintf(stderr," c->fTracks[0] %d c->fTracks[1] %d\n",dig->fHit,dig->fTracks[0]); | |
1199 | } | |
1200 | // | |
1201 | if (flag) { | |
002920d1 | 1202 | fSeg2[cath]->GetPadC(fInput->DetElemId(), ix, iy, x, y, z); |
a9e2aefa | 1203 | |
b137f8b9 | 1204 | c->AddX(cath, q*x); |
1205 | c->AddY(cath, q*y); | |
1206 | c->AddCharge(cath, q); | |
1207 | } | |
1208 | } // loop over digits | |
1209 | AliDebug(1," fin du cluster c\n"); | |
1210 | ||
1211 | ||
1212 | if (flag) { | |
1213 | c->SetX(cath, c->GetX(cath)/c->GetCharge(cath)); | |
1214 | // Force on anod | |
002920d1 | 1215 | c->SetX(cath, fSeg2[cath]->GetAnod(fInput->DetElemId(), c->GetX(cath))); |
b137f8b9 | 1216 | c->SetY(cath, c->GetY(cath)/c->GetCharge(cath)); |
1217 | // | |
1218 | // apply correction to the coordinate along the anode wire | |
1219 | // | |
1220 | x=c->GetX(cath); | |
1221 | y=c->GetY(cath); | |
1222 | TF1* cogCorr; | |
1223 | Int_t isec; | |
002920d1 | 1224 | fSeg2[cath]->GetPadI(fInput->DetElemId(), x, y, fZPlane, ix, iy); |
1225 | fSeg2[cath]->GetPadC(fInput->DetElemId(), ix, iy, x, y, z); | |
1226 | isec=fSeg2[cath]->Sector(fInput->DetElemId(), ix,iy); | |
1227 | cogCorr = fSeg2[cath]->CorrFunc(fInput->DetElemId(), isec-1); | |
1228 | ||
b137f8b9 | 1229 | |
1230 | if (cogCorr) { | |
1231 | Float_t yOnPad; | |
002920d1 | 1232 | yOnPad=(c->GetY(cath)-y)/fSeg2[cath]->Dpy(fInput->DetElemId(), isec); |
b137f8b9 | 1233 | |
1234 | c->SetY(cath, c->GetY(cath)-cogCorr->Eval(yOnPad, 0, 0)); | |
1235 | // slat ID from digit | |
1236 | ||
a9e2aefa | 1237 | } |
b137f8b9 | 1238 | } |
a9e2aefa | 1239 | } |
1240 | ||
1241 | void AliMUONClusterFinderVS::FillCluster(AliMUONRawCluster* c, Int_t cath) | |
1242 | { | |
b137f8b9 | 1243 | // |
1244 | // Completes cluster information starting from list of digits | |
1245 | // | |
1246 | static Float_t dr0; | |
1247 | ||
1248 | AliMUONDigit* dig; | |
1249 | ||
1250 | if (cath==0) { | |
1251 | dr0 = 10000; | |
1252 | } | |
1253 | ||
1254 | Float_t xpad, ypad, zpad; | |
1255 | Float_t dx, dy, dr; | |
1256 | ||
1257 | for (Int_t i=0; i<c->GetMultiplicity(cath); i++) | |
a9e2aefa | 1258 | { |
b137f8b9 | 1259 | dig = fInput->Digit(cath,c->GetIndex(i,cath)); |
002920d1 | 1260 | fSeg2[cath]-> |
b137f8b9 | 1261 | GetPadC(fInput->DetElemId(),dig->PadX(),dig->PadY(),xpad,ypad, zpad); |
1262 | AliDebug(1,Form("x %f y %f cx %f cy %f\n",xpad,ypad,c->GetX(0),c->GetY(0))); | |
1263 | dx = xpad - c->GetX(0); | |
1264 | dy = ypad - c->GetY(0); | |
1265 | dr = TMath::Sqrt(dx*dx+dy*dy); | |
1266 | ||
1267 | if (dr < dr0) { | |
1268 | dr0 = dr; | |
1269 | AliDebug(1,Form(" dr %f\n",dr)); | |
1270 | Int_t q=dig->Signal(); | |
1271 | if (dig->Physics() >= dig->Signal()) { | |
1272 | c->SetPhysics(i,2); | |
1273 | } else if (dig->Physics() == 0) { | |
1274 | c->SetPhysics(i,0); | |
1275 | } else c->SetPhysics(i,1); | |
1276 | c->SetPeakSignal(cath,q); | |
1277 | c->SetTrack(0,dig->Hit()); | |
1278 | c->SetTrack(1,dig->Track(0)); | |
1279 | c->SetTrack(2,dig->Track(1)); | |
1280 | ||
1281 | AliDebug(1,Form(" c->fTracks[0] %d c->fTracks[1] %d\n",dig->Hit(), | |
1282 | dig->Track(0))); | |
1283 | } | |
1284 | // | |
a9e2aefa | 1285 | } // loop over digits |
b137f8b9 | 1286 | |
1287 | // apply correction to the coordinate along the anode wire | |
1288 | // Force on anod | |
b137f8b9 | 1289 | c->SetX(cath,fSeg2[cath]->GetAnod(fInput->DetElemId(), c->GetX(cath))); |
a9e2aefa | 1290 | } |
1291 | ||
1292 | void AliMUONClusterFinderVS::FindCluster(Int_t i, Int_t j, Int_t cath, AliMUONRawCluster &c){ | |
f0d86bc4 | 1293 | |
1294 | ||
a9e2aefa | 1295 | // |
f0d86bc4 | 1296 | // Find a super cluster on both cathodes |
a9e2aefa | 1297 | // |
1298 | // | |
1299 | // Add i,j as element of the cluster | |
1300 | // | |
f0d86bc4 | 1301 | |
5289cf2f | 1302 | Int_t idx = fDigitMap[cath]->GetHitIndex(i,j); |
1303 | AliMUONDigit* dig = (AliMUONDigit*) fDigitMap[cath]->GetHit(i,j); | |
08a636a8 | 1304 | Int_t q=dig->Signal(); |
1305 | Int_t theX=dig->PadX(); | |
1306 | Int_t theY=dig->PadY(); | |
f0d86bc4 | 1307 | |
9e993f2a | 1308 | if (q > TMath::Abs(c.GetPeakSignal(0)) && q > TMath::Abs(c.GetPeakSignal(1))) { |
1309 | c.SetPeakSignal(cath,q); | |
1310 | c.SetTrack(0,dig->Hit()); | |
1311 | c.SetTrack(1,dig->Track(0)); | |
1312 | c.SetTrack(2,dig->Track(1)); | |
a9e2aefa | 1313 | } |
1314 | ||
1315 | // | |
1316 | // Make sure that list of digits is ordered | |
1317 | // | |
9e993f2a | 1318 | Int_t mu=c.GetMultiplicity(cath); |
0164904a | 1319 | c.SetIndex(mu, cath, idx); |
a9e2aefa | 1320 | |
08a636a8 | 1321 | if (dig->Physics() >= dig->Signal()) { |
0164904a | 1322 | c.SetPhysics(mu,2); |
08a636a8 | 1323 | } else if (dig->Physics() == 0) { |
0164904a | 1324 | c.SetPhysics(mu,0); |
1325 | } else c.SetPhysics(mu,1); | |
f0d86bc4 | 1326 | |
1327 | ||
a9e2aefa | 1328 | if (mu > 0) { |
f0d86bc4 | 1329 | for (Int_t ind = mu-1; ind >= 0; ind--) { |
0164904a | 1330 | Int_t ist=c.GetIndex(ind,cath); |
08a636a8 | 1331 | Int_t ql=fInput->Digit(cath, ist)->Signal(); |
1332 | Int_t ix=fInput->Digit(cath, ist)->PadX(); | |
1333 | Int_t iy=fInput->Digit(cath, ist)->PadY(); | |
f0d86bc4 | 1334 | |
a9e2aefa | 1335 | if (q>ql || (q==ql && theX > ix && theY < iy)) { |
0164904a | 1336 | c.SetIndex(ind, cath, idx); |
1337 | c.SetIndex(ind+1, cath, ist); | |
a9e2aefa | 1338 | } else { |
f0d86bc4 | 1339 | |
a9e2aefa | 1340 | break; |
1341 | } | |
1342 | } | |
1343 | } | |
f0d86bc4 | 1344 | |
9e993f2a | 1345 | c.SetMultiplicity(cath, c.GetMultiplicity(cath)+1); |
1346 | if (c.GetMultiplicity(cath) >= 50 ) { | |
c4a97bcd | 1347 | AliDebug(1,Form("FindCluster - multiplicity >50 %d \n",c.GetMultiplicity(0))); |
9e993f2a | 1348 | c.SetMultiplicity(cath, 49); |
a9e2aefa | 1349 | } |
1350 | ||
1351 | // Prepare center of gravity calculation | |
802a864d | 1352 | Float_t x, y, z; |
002920d1 | 1353 | fSeg2[cath]->GetPadC(fInput->DetElemId(), i, j, x, y, z); |
ba12c242 | 1354 | c.AddX(cath,q*x); |
1355 | c.AddY(cath,q*y); | |
1356 | c.AddCharge(cath,q); | |
f0d86bc4 | 1357 | // |
1358 | // Flag hit as "taken" | |
5289cf2f | 1359 | fDigitMap[cath]->FlagHit(i,j); |
a9e2aefa | 1360 | // |
1361 | // Now look recursively for all neighbours and pad hit on opposite cathode | |
1362 | // | |
1363 | // Loop over neighbours | |
1364 | Int_t ix,iy; | |
f0d86bc4 | 1365 | ix=iy=0; |
a9e2aefa | 1366 | Int_t nn; |
30aaba74 | 1367 | Int_t xList[10], yList[10]; |
002920d1 | 1368 | fSeg2[cath]->Neighbours(fInput->DetElemId(), i,j,&nn,xList,yList); |
a9e2aefa | 1369 | for (Int_t in=0; in<nn; in++) { |
1370 | ix=xList[in]; | |
1371 | iy=yList[in]; | |
f0d86bc4 | 1372 | |
5289cf2f | 1373 | if (fDigitMap[cath]->TestHit(ix,iy)==kUnused) { |
c4a97bcd | 1374 | AliDebug(2,Form("\n Neighbours %d %d %d", cath, ix, iy)); |
f0d86bc4 | 1375 | FindCluster(ix, iy, cath, c); |
1376 | } | |
1377 | ||
1378 | } | |
1379 | Int_t nOpp=0; | |
1380 | Int_t iXopp[50], iYopp[50]; | |
1381 | ||
a9e2aefa | 1382 | // Neighbours on opposite cathode |
1383 | // Take into account that several pads can overlap with the present pad | |
fed772f3 | 1384 | Int_t isec; |
002920d1 | 1385 | isec=fSeg2[cath]->Sector(fInput->DetElemId(), i,j); |
fed772f3 | 1386 | |
a9e2aefa | 1387 | Int_t iop; |
f0d86bc4 | 1388 | Float_t dx, dy; |
002920d1 | 1389 | |
1390 | if (cath==0) { | |
1391 | iop = 1; | |
1392 | dx = (fSeg2[cath]->Dpx(fInput->DetElemId(), isec))/2.; | |
1393 | dy = 0.; | |
fed772f3 | 1394 | } else { |
002920d1 | 1395 | iop = 0; |
1396 | dx = 0.; | |
1397 | dy = (fSeg2[cath]->Dpy(fInput->DetElemId(), isec))/2; | |
1398 | } | |
fed772f3 | 1399 | |
1400 | ||
1401 | ||
002920d1 | 1402 | // loop over pad neighbours on opposite cathode |
1403 | for (fSeg2[iop]->FirstPad(fInput->DetElemId(), x, y, fZPlane, dx, dy); | |
1404 | fSeg2[iop]->MorePads(fInput->DetElemId()); | |
1405 | fSeg2[iop]->NextPad(fInput->DetElemId())) | |
1406 | { | |
fed772f3 | 1407 | |
002920d1 | 1408 | ix = fSeg2[iop]->Ix(); iy = fSeg2[iop]->Iy(); |
1409 | AliDebug(2,Form("\n ix, iy: %f %f %f %d %d %d", x,y,z,ix, iy, fSector)); | |
5289cf2f | 1410 | if (fDigitMap[iop]->TestHit(ix,iy)==kUnused){ |
002920d1 | 1411 | iXopp[nOpp]=ix; |
1412 | iYopp[nOpp++]=iy; | |
1413 | AliDebug(2,Form("\n Opposite %d %d %d", iop, ix, iy)); | |
1414 | } | |
fed772f3 | 1415 | |
002920d1 | 1416 | } // Loop over pad neighbours |
1417 | // This had to go outside the loop since recursive calls inside the iterator are not possible | |
1418 | // | |
1419 | Int_t jopp; | |
1420 | for (jopp=0; jopp<nOpp; jopp++) { | |
5289cf2f | 1421 | if (fDigitMap[iop]->TestHit(iXopp[jopp],iYopp[jopp]) == kUnused) |
002920d1 | 1422 | FindCluster(iXopp[jopp], iYopp[jopp], iop, c); |
a9e2aefa | 1423 | } |
002920d1 | 1424 | |
a9e2aefa | 1425 | } |
1426 | ||
1427 | //_____________________________________________________________________________ | |
1428 | ||
1429 | void AliMUONClusterFinderVS::FindRawClusters() | |
1430 | { | |
1431 | // | |
1432 | // MUON cluster finder from digits -- finds neighbours on both cathodes and | |
1433 | // fills the tree with raw clusters | |
1434 | // | |
1435 | ||
4da78c65 | 1436 | ResetRawClusters(); |
f0d86bc4 | 1437 | // Return if no input datad available |
30aaba74 | 1438 | if (!fInput->NDigits(0) && !fInput->NDigits(1)) return; |
a9e2aefa | 1439 | |
5289cf2f | 1440 | AliMpPlaneType plane1, plane2; |
1441 | ||
002920d1 | 1442 | fSeg2[0] = fInput->Segmentation2(0); |
1443 | fSeg2[1] = fInput->Segmentation2(1); | |
1444 | ||
5289cf2f | 1445 | if ( fSeg2[0]->GetDirection(fInput->DetElemId()) == kDirY || |
1446 | fSeg2[0]->GetDirection(fInput->DetElemId()) == kDirUndefined ) { | |
1447 | plane1 = kBendingPlane; | |
1448 | plane2 = kNonBendingPlane; | |
1449 | } else { | |
1450 | plane2 = kBendingPlane; | |
1451 | plane1 = kNonBendingPlane; | |
1452 | } | |
1453 | ||
1454 | fDigitMap[0] = new AliMUONDigitMapA1(fInput->DetElemId(), plane1); | |
1455 | fDigitMap[1] = new AliMUONDigitMapA1(fInput->DetElemId(), plane2); | |
002920d1 | 1456 | |
a9e2aefa | 1457 | AliMUONDigit *dig; |
1458 | ||
1459 | Int_t ndig, cath; | |
1460 | Int_t nskip=0; | |
1461 | Int_t ncls=0; | |
5289cf2f | 1462 | |
1463 | fDigitMap[0]->FillHits(fInput->Digits(0)); | |
1464 | fDigitMap[1]->FillHits(fInput->Digits(1)); | |
a9e2aefa | 1465 | // |
1466 | // Outer Loop over Cathodes | |
5289cf2f | 1467 | for (cath = 0; cath < 2; cath++) { |
b137f8b9 | 1468 | |
30aaba74 | 1469 | for (ndig=0; ndig<fInput->NDigits(cath); ndig++) { |
b137f8b9 | 1470 | dig = fInput->Digit(cath, ndig); |
1471 | Int_t padx = dig->PadX(); | |
1472 | Int_t pady = dig->PadY(); | |
5289cf2f | 1473 | if (fDigitMap[cath]->TestHit(padx,pady)==kUsed ||fDigitMap[0]->TestHit(padx,pady)==kEmpty) { |
b137f8b9 | 1474 | nskip++; |
1475 | continue; | |
1476 | } | |
1477 | AliDebug(1,Form("\n CATHODE %d CLUSTER %d\n",cath,ncls)); | |
1478 | AliMUONRawCluster clus; | |
1479 | clus.SetMultiplicity(0, 0); | |
1480 | clus.SetMultiplicity(1, 0); | |
1481 | clus.SetPeakSignal(cath,dig->Signal()); | |
1482 | clus.SetTrack(0, dig->Hit()); | |
1483 | clus.SetTrack(1, dig->Track(0)); | |
1484 | clus.SetTrack(2, dig->Track(1)); | |
1485 | ||
1486 | AliDebug(1,Form("idDE %d Padx %d Pady %d", fInput->DetElemId(), padx, pady)); | |
1487 | ||
1488 | // tag the beginning of cluster list in a raw cluster | |
1489 | clus.SetNcluster(0,-1); | |
1490 | Float_t xcu, ycu; | |
002920d1 | 1491 | fSeg2[cath]->GetPadC(fInput->DetElemId(), padx, pady, xcu, ycu, fZPlane); |
1492 | fSector= fSeg2[cath]->Sector(fInput->DetElemId(), padx, pady)/100; | |
1493 | ||
b137f8b9 | 1494 | |
1495 | ||
1496 | ||
1497 | FindCluster(padx,pady,cath,clus); | |
1498 | //^^^^^^^^^^^^^^^^^^^^^^^^ | |
1499 | // center of gravity | |
1500 | if (clus.GetX(0)!=0.) clus.SetX(0, clus.GetX(0)/clus.GetCharge(0)); // clus.fX[0] /= clus.fQ[0]; | |
1501 | ||
1502 | // Force on anod | |
002920d1 | 1503 | clus.SetX(0,fSeg2[0]->GetAnod(fInput->DetElemId(), clus.GetX(0))); |
b137f8b9 | 1504 | if (clus.GetY(0)!=0.) clus.SetY(0, clus.GetY(0)/clus.GetCharge(0)); // clus.fY[0] /= clus.fQ[0]; |
1505 | ||
1506 | if(clus.GetCharge(1)!=0.) clus.SetX(1, clus.GetX(1)/clus.GetCharge(1)); // clus.fX[1] /= clus.fQ[1]; | |
1507 | ||
1508 | // Force on anod | |
002920d1 | 1509 | clus.SetX(1, fSeg2[0]->GetAnod(fInput->DetElemId(),clus.GetX(1))); |
b137f8b9 | 1510 | if(clus.GetCharge(1)!=0.) clus.SetY(1, clus.GetY(1)/clus.GetCharge(1));// clus.fY[1] /= clus.fQ[1]; |
1511 | ||
1512 | clus.SetZ(0, fZPlane); | |
1513 | clus.SetZ(1, fZPlane); | |
1514 | ||
1515 | AliDebug(1,Form("\n Cathode 1 multiplicite %d X(CG) %f Y(CG) %f\n", | |
1516 | clus.GetMultiplicity(0),clus.GetX(0),clus.GetY(0))); | |
1517 | AliDebug(1,Form(" Cathode 2 multiplicite %d X(CG) %f Y(CG) %f\n", | |
1518 | clus.GetMultiplicity(1),clus.GetX(1),clus.GetY(1))); | |
1519 | // Analyse cluster and decluster if necessary | |
1520 | // | |
1521 | ncls++; | |
1522 | clus.SetNcluster(1,fNRawClusters); | |
1523 | clus.SetClusterType(clus.PhysicsContribution()); | |
1524 | ||
1525 | fNPeaks=0; | |
1526 | // | |
1527 | // | |
1528 | Decluster(&clus); | |
1529 | // | |
1530 | // reset Cluster object | |
1531 | { // begin local scope | |
faef62a9 | 1532 | for (int k=0;k<clus.GetMultiplicity(0);k++) clus.SetIndex(k, 0, 0); |
b137f8b9 | 1533 | } // end local scope |
1534 | ||
1535 | { // begin local scope | |
faef62a9 | 1536 | for (int k=0;k<clus.GetMultiplicity(1);k++) clus.SetIndex(k, 1, 0); |
b137f8b9 | 1537 | } // end local scope |
1538 | ||
1539 | clus.SetMultiplicity(0,0); | |
1540 | clus.SetMultiplicity(1,0); | |
1541 | ||
a9e2aefa | 1542 | |
1543 | } // end loop ndig | |
1544 | } // end loop cathodes | |
5289cf2f | 1545 | delete fDigitMap[0]; |
1546 | delete fDigitMap[1]; | |
a9e2aefa | 1547 | } |
1548 | ||
1549 | Float_t AliMUONClusterFinderVS::SingleMathiesonFit(AliMUONRawCluster *c, Int_t cath) | |
1550 | { | |
f0d86bc4 | 1551 | // Performs a single Mathieson fit on one cathode |
1552 | // | |
19dd5b2f | 1553 | Double_t arglist[20]; |
1554 | Int_t ierflag=0; | |
9825400f | 1555 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
a9e2aefa | 1556 | |
9825400f | 1557 | clusterInput.Fitter()->SetFCN(fcnS1); |
1558 | clusterInput.Fitter()->mninit(2,10,7); | |
5ac16716 | 1559 | clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel()); |
19dd5b2f | 1560 | arglist[0]=-1; |
1561 | clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag); | |
a9e2aefa | 1562 | // Set starting values |
1563 | static Double_t vstart[2]; | |
ba12c242 | 1564 | vstart[0]=c->GetX(1); |
1565 | vstart[1]=c->GetY(0); | |
a9e2aefa | 1566 | |
1567 | ||
1568 | // lower and upper limits | |
1569 | static Double_t lower[2], upper[2]; | |
fed772f3 | 1570 | Int_t ix,iy, isec; |
002920d1 | 1571 | fSeg2[cath]->GetPadI(fInput->DetElemId(), c->GetX(cath), c->GetY(cath), fZPlane, ix, iy); |
1572 | isec=fSeg2[cath]->Sector(fInput->DetElemId(), ix, iy); | |
fed772f3 | 1573 | |
002920d1 | 1574 | lower[0]=vstart[0]-fSeg2[cath]->Dpx(fInput->DetElemId(), isec)/2; |
1575 | lower[1]=vstart[1]-fSeg2[cath]->Dpy(fInput->DetElemId(), isec)/2; | |
a9e2aefa | 1576 | |
002920d1 | 1577 | upper[0]=lower[0]+fSeg2[cath]->Dpx(fInput->DetElemId(), isec); |
1578 | upper[1]=lower[1]+fSeg2[cath]->Dpy(fInput->DetElemId(), isec); | |
a9e2aefa | 1579 | |
fed772f3 | 1580 | |
a9e2aefa | 1581 | // step sizes |
1582 | static Double_t step[2]={0.0005, 0.0005}; | |
1583 | ||
9825400f | 1584 | clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag); |
1585 | clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag); | |
a9e2aefa | 1586 | // ready for minimisation |
a9e2aefa | 1587 | arglist[0]= -1; |
1588 | arglist[1]= 0; | |
1589 | ||
9825400f | 1590 | clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag); |
1591 | clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag); | |
4da78c65 | 1592 | // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag); |
a9e2aefa | 1593 | Double_t fmin, fedm, errdef; |
1594 | Int_t npari, nparx, istat; | |
1595 | ||
9825400f | 1596 | clusterInput.Fitter()->mnstat(fmin, fedm, errdef, npari, nparx, istat); |
a9e2aefa | 1597 | fFitStat=istat; |
1598 | ||
1599 | // Print results | |
1600 | // Get fitted parameters | |
1601 | Double_t xrec, yrec; | |
1602 | TString chname; | |
1603 | Double_t epxz, b1, b2; | |
1604 | Int_t ierflg; | |
9825400f | 1605 | clusterInput.Fitter()->mnpout(0, chname, xrec, epxz, b1, b2, ierflg); |
1606 | clusterInput.Fitter()->mnpout(1, chname, yrec, epxz, b1, b2, ierflg); | |
a9e2aefa | 1607 | fXFit[cath]=xrec; |
1608 | fYFit[cath]=yrec; | |
1609 | return fmin; | |
1610 | } | |
1611 | ||
e3cba86e | 1612 | Float_t AliMUONClusterFinderVS::CombiSingleMathiesonFit(AliMUONRawCluster * /*c*/) |
a9e2aefa | 1613 | { |
1614 | // Perform combined Mathieson fit on both cathode planes | |
1615 | // | |
19dd5b2f | 1616 | Double_t arglist[20]; |
1617 | Int_t ierflag=0; | |
9825400f | 1618 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
1619 | clusterInput.Fitter()->SetFCN(fcnCombiS1); | |
1620 | clusterInput.Fitter()->mninit(2,10,7); | |
5ac16716 | 1621 | clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel()); |
19dd5b2f | 1622 | arglist[0]=-1; |
1623 | clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag); | |
a9e2aefa | 1624 | static Double_t vstart[2]; |
1625 | vstart[0]=fXInit[0]; | |
1626 | vstart[1]=fYInit[0]; | |
1627 | ||
1628 | ||
1629 | // lower and upper limits | |
f0d86bc4 | 1630 | static Float_t lower[2], upper[2]; |
a9e2aefa | 1631 | Int_t ix,iy,isec; |
fed772f3 | 1632 | Float_t dpy, dpx; |
1633 | ||
002920d1 | 1634 | fSeg2[0]->GetPadI(fInput->DetElemId(), fXInit[0], fYInit[0], fZPlane, ix, iy); |
1635 | isec=fSeg2[0]->Sector(fInput->DetElemId(), ix, iy); | |
1636 | dpy=fSeg2[0]->Dpy(fInput->DetElemId(), isec); | |
1637 | fSeg2[1]->GetPadI(fInput->DetElemId(), fXInit[0], fYInit[0], fZPlane, ix, iy); | |
1638 | isec=fSeg2[1]->Sector(fInput->DetElemId(), ix, iy); | |
1639 | dpx=fSeg2[1]->Dpx(fInput->DetElemId(), isec); | |
1640 | ||
f0d86bc4 | 1641 | Int_t icount; |
1642 | Float_t xdum, ydum, zdum; | |
a9e2aefa | 1643 | |
f0d86bc4 | 1644 | // Find save upper and lower limits |
a9e2aefa | 1645 | |
f0d86bc4 | 1646 | icount = 0; |
002920d1 | 1647 | for (fSeg2[1]->FirstPad(fInput->DetElemId(),fXInit[0], fYInit[0], fZPlane, dpx, 0.); |
1648 | fSeg2[1]->MorePads(fInput->DetElemId()); | |
1649 | fSeg2[1]->NextPad(fInput->DetElemId())) | |
fed772f3 | 1650 | { |
1651 | ix=fSeg2[1]->Ix(); iy=fSeg2[1]->Iy(); | |
1652 | fSeg2[1]->GetPadC(fInput->DetElemId(), ix,iy, upper[0], ydum, zdum); | |
1653 | if (icount ==0) lower[0]=upper[0]; | |
1654 | icount++; | |
1655 | } | |
002920d1 | 1656 | |
f0d86bc4 | 1657 | if (lower[0]>upper[0]) {xdum=lower[0]; lower[0]=upper[0]; upper[0]=xdum;} |
1658 | ||
1659 | icount=0; | |
c4a97bcd | 1660 | AliDebug(1,Form("\n single y %f %f", fXInit[0], fYInit[0])); |
f0d86bc4 | 1661 | |
002920d1 | 1662 | for (fSeg2[0]->FirstPad(fInput->DetElemId(), fXInit[0], fYInit[0], fZPlane, 0., dpy); |
1663 | fSeg2[0]->MorePads(fInput->DetElemId()); | |
1664 | fSeg2[0]->NextPad(fInput->DetElemId())) | |
fed772f3 | 1665 | { |
1666 | ix=fSeg2[0]->Ix(); iy=fSeg2[0]->Iy(); | |
1667 | fSeg2[0]->GetPadC(fInput->DetElemId(), ix,iy,xdum,upper[1],zdum); | |
1668 | if (icount ==0) lower[1]=upper[1]; | |
1669 | icount++; | |
1670 | AliDebug(1,Form("\n upper lower %d %f %f", icount, upper[1], lower[1])); | |
1671 | } | |
002920d1 | 1672 | |
f0d86bc4 | 1673 | if (lower[1]>upper[1]) {xdum=lower[1]; lower[1]=upper[1]; upper[1]=xdum;} |
1674 | ||
a9e2aefa | 1675 | // step sizes |
1676 | static Double_t step[2]={0.00001, 0.0001}; | |
1677 | ||
9825400f | 1678 | clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag); |
1679 | clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag); | |
a9e2aefa | 1680 | // ready for minimisation |
a9e2aefa | 1681 | arglist[0]= -1; |
1682 | arglist[1]= 0; | |
1683 | ||
9825400f | 1684 | clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag); |
1685 | clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag); | |
4da78c65 | 1686 | // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag); |
a9e2aefa | 1687 | Double_t fmin, fedm, errdef; |
1688 | Int_t npari, nparx, istat; | |
1689 | ||
9825400f | 1690 | clusterInput.Fitter()->mnstat(fmin, fedm, errdef, npari, nparx, istat); |
a9e2aefa | 1691 | fFitStat=istat; |
1692 | ||
1693 | // Print results | |
1694 | // Get fitted parameters | |
1695 | Double_t xrec, yrec; | |
1696 | TString chname; | |
1697 | Double_t epxz, b1, b2; | |
1698 | Int_t ierflg; | |
9825400f | 1699 | clusterInput.Fitter()->mnpout(0, chname, xrec, epxz, b1, b2, ierflg); |
1700 | clusterInput.Fitter()->mnpout(1, chname, yrec, epxz, b1, b2, ierflg); | |
a9e2aefa | 1701 | fXFit[0]=xrec; |
1702 | fYFit[0]=yrec; | |
1703 | return fmin; | |
1704 | } | |
1705 | ||
e3cba86e | 1706 | Bool_t AliMUONClusterFinderVS::DoubleMathiesonFit(AliMUONRawCluster * /*c*/, Int_t cath) |
a9e2aefa | 1707 | { |
f0d86bc4 | 1708 | // Performs a double Mathieson fit on one cathode |
1709 | // | |
1710 | ||
a9e2aefa | 1711 | // |
1712 | // Initialise global variables for fit | |
19dd5b2f | 1713 | Double_t arglist[20]; |
1714 | Int_t ierflag=0; | |
9825400f | 1715 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
1716 | clusterInput.Fitter()->SetFCN(fcnS2); | |
1717 | clusterInput.Fitter()->mninit(5,10,7); | |
5ac16716 | 1718 | clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel()); |
19dd5b2f | 1719 | arglist[0]=-1; |
1720 | clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag); | |
a9e2aefa | 1721 | // Set starting values |
1722 | static Double_t vstart[5]; | |
1723 | vstart[0]=fX[fIndLocal[0][cath]][cath]; | |
1724 | vstart[1]=fY[fIndLocal[0][cath]][cath]; | |
1725 | vstart[2]=fX[fIndLocal[1][cath]][cath]; | |
1726 | vstart[3]=fY[fIndLocal[1][cath]][cath]; | |
1727 | vstart[4]=Float_t(fQ[fIndLocal[0][cath]][cath])/ | |
1728 | Float_t(fQ[fIndLocal[0][cath]][cath]+fQ[fIndLocal[1][cath]][cath]); | |
1729 | // lower and upper limits | |
f0d86bc4 | 1730 | static Float_t lower[5], upper[5]; |
fed772f3 | 1731 | Int_t isec; |
1732 | ||
002920d1 | 1733 | isec=fSeg2[cath]->Sector(fInput->DetElemId(),fIx[fIndLocal[0][cath]][cath], |
1734 | fIy[fIndLocal[0][cath]][cath]); | |
1735 | lower[0]=vstart[0]-fSeg2[cath]->Dpx(fInput->DetElemId(),isec); | |
1736 | lower[1]=vstart[1]-fSeg2[cath]->Dpy(fInput->DetElemId(),isec); | |
fed772f3 | 1737 | |
002920d1 | 1738 | upper[0]=lower[0]+2.*fSeg2[cath]->Dpx(fInput->DetElemId(),isec); |
1739 | upper[1]=lower[1]+2.*fSeg2[cath]->Dpy(fInput->DetElemId(),isec); | |
fed772f3 | 1740 | |
002920d1 | 1741 | isec=fSeg2[cath]->Sector(fInput->DetElemId(),fIx[fIndLocal[1][cath]][cath], |
1742 | fIy[fIndLocal[1][cath]][cath]); | |
1743 | lower[2]=vstart[2]-fSeg2[cath]->Dpx(fInput->DetElemId(),isec)/2; | |
1744 | lower[3]=vstart[3]-fSeg2[cath]->Dpy(fInput->DetElemId(),isec)/2; | |
a9e2aefa | 1745 | |
002920d1 | 1746 | upper[2]=lower[2]+fSeg2[cath]->Dpx(fInput->DetElemId(),isec); |
1747 | upper[1]=lower[1]+2.*fSeg2[cath]->Dpy(fInput->DetElemId(),isec); | |
fed772f3 | 1748 | |
a9e2aefa | 1749 | |
fed772f3 | 1750 | |
a9e2aefa | 1751 | lower[4]=0.; |
1752 | upper[4]=1.; | |
1753 | // step sizes | |
1754 | static Double_t step[5]={0.0005, 0.0005, 0.0005, 0.0005, 0.0001}; | |
1755 | ||
9825400f | 1756 | clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag); |
1757 | clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag); | |
1758 | clusterInput.Fitter()->mnparm(2,"x2",vstart[2],step[2],lower[2],upper[2],ierflag); | |
1759 | clusterInput.Fitter()->mnparm(3,"y2",vstart[3],step[3],lower[3],upper[3],ierflag); | |
1760 | clusterInput.Fitter()->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag); | |
a9e2aefa | 1761 | // ready for minimisation |
a9e2aefa | 1762 | arglist[0]= -1; |
1763 | arglist[1]= 0; | |
1764 | ||
9825400f | 1765 | clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag); |
1766 | clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag); | |
4da78c65 | 1767 | // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag); |
a9e2aefa | 1768 | // Get fitted parameters |
1769 | Double_t xrec[2], yrec[2], qfrac; | |
1770 | TString chname; | |
1771 | Double_t epxz, b1, b2; | |
1772 | Int_t ierflg; | |
9825400f | 1773 | clusterInput.Fitter()->mnpout(0, chname, xrec[0], epxz, b1, b2, ierflg); |
1774 | clusterInput.Fitter()->mnpout(1, chname, yrec[0], epxz, b1, b2, ierflg); | |
1775 | clusterInput.Fitter()->mnpout(2, chname, xrec[1], epxz, b1, b2, ierflg); | |
1776 | clusterInput.Fitter()->mnpout(3, chname, yrec[1], epxz, b1, b2, ierflg); | |
1777 | clusterInput.Fitter()->mnpout(4, chname, qfrac, epxz, b1, b2, ierflg); | |
a9e2aefa | 1778 | |
1779 | Double_t fmin, fedm, errdef; | |
1780 | Int_t npari, nparx, istat; | |
1781 | ||
9825400f | 1782 | clusterInput.Fitter()->mnstat(fmin, fedm, errdef, npari, nparx, istat); |
a9e2aefa | 1783 | fFitStat=istat; |
a9e2aefa | 1784 | return kTRUE; |
1785 | } | |
1786 | ||
e3cba86e | 1787 | Float_t AliMUONClusterFinderVS::CombiDoubleMathiesonFit(AliMUONRawCluster * /*c*/) |
a9e2aefa | 1788 | { |
1789 | // | |
1790 | // Perform combined double Mathieson fit on both cathode planes | |
1791 | // | |
19dd5b2f | 1792 | Double_t arglist[20]; |
1793 | Int_t ierflag=0; | |
9825400f | 1794 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
1795 | clusterInput.Fitter()->SetFCN(fcnCombiS2); | |
1796 | clusterInput.Fitter()->mninit(6,10,7); | |
5ac16716 | 1797 | clusterInput.Fitter()->SetPrintLevel(-1 + AliLog::GetGlobalDebugLevel()); |
19dd5b2f | 1798 | arglist[0]=-1; |
1799 | clusterInput.Fitter()->mnexcm("SET NOW", arglist, 0, ierflag); | |
a9e2aefa | 1800 | // Set starting values |
1801 | static Double_t vstart[6]; | |
1802 | vstart[0]=fXInit[0]; | |
1803 | vstart[1]=fYInit[0]; | |
1804 | vstart[2]=fXInit[1]; | |
1805 | vstart[3]=fYInit[1]; | |
1806 | vstart[4]=fQrInit[0]; | |
1807 | vstart[5]=fQrInit[1]; | |
1808 | // lower and upper limits | |
f0d86bc4 | 1809 | static Float_t lower[6], upper[6]; |
a9e2aefa | 1810 | Int_t ix,iy,isec; |
1811 | Float_t dpx, dpy; | |
a9e2aefa | 1812 | |
fed772f3 | 1813 | fSeg2[1]->GetPadI(fInput->DetElemId(),fXInit[0], fYInit[0], fZPlane, ix, iy); |
1814 | isec=fSeg2[1]->Sector(fInput->DetElemId(),ix, iy); | |
1815 | dpx=fSeg2[1]->Dpx(fInput->DetElemId(), isec); | |
1816 | ||
1817 | fSeg2[0]->GetPadI(fInput->DetElemId(), fXInit[0], fYInit[0], fZPlane, ix, iy); | |
1818 | isec=fSeg2[0]->Sector(fInput->DetElemId(), ix, iy); | |
1819 | dpy=fSeg2[0]->Dpy(fInput->DetElemId(), isec); | |
1820 | ||
002920d1 | 1821 | |
a9e2aefa | 1822 | |
f0d86bc4 | 1823 | Int_t icount; |
1824 | Float_t xdum, ydum, zdum; | |
c4a97bcd | 1825 | AliDebug(1,Form("\n Cluster Finder: %f %f %f %f ", fXInit[0], fXInit[1],fYInit[0], fYInit[1] )); |
fed772f3 | 1826 | |
fed772f3 | 1827 | // Find save upper and lower limits |
002920d1 | 1828 | icount = 0; |
fed772f3 | 1829 | |
002920d1 | 1830 | for (fSeg2[1]->FirstPad(fInput->DetElemId(),fXInit[0], fYInit[0], fZPlane, dpx, 0.); |
1831 | fSeg2[1]->MorePads(fInput->DetElemId()); | |
1832 | fSeg2[1]->NextPad(fInput->DetElemId())) | |
1833 | { | |
1834 | ix=fSeg2[1]->Ix(); iy=fSeg2[1]->Iy(); | |
5289cf2f | 1835 | // if (fDigitMap[1]->TestHit(ix, iy) == kEmpty) continue; |
002920d1 | 1836 | fSeg2[1]->GetPadC(fInput->DetElemId(),ix,iy,upper[0],ydum,zdum); |
1837 | if (icount ==0) lower[0]=upper[0]; | |
1838 | icount++; | |
1839 | } | |
1840 | if (lower[0]>upper[0]) {xdum=lower[0]; lower[0]=upper[0]; upper[0]=xdum;} | |
1841 | // vstart[0] = 0.5*(lower[0]+upper[0]); | |
fed772f3 | 1842 | |
05c39730 | 1843 | |
002920d1 | 1844 | icount=0; |
fed772f3 | 1845 | |
002920d1 | 1846 | for (fSeg2[0]->FirstPad(fInput->DetElemId(),fXInit[0], fYInit[0], fZPlane, 0., dpy); |
1847 | fSeg2[0]->MorePads(fInput->DetElemId()); | |
1848 | fSeg2[0]->NextPad(fInput->DetElemId())) | |
1849 | { | |
1850 | ix=fSeg2[0]->Ix(); iy=fSeg2[0]->Iy(); | |
5289cf2f | 1851 | // if (fDigitMap[0]->TestHit(ix, iy) == kEmpty) continue; |
002920d1 | 1852 | fSeg2[0]->GetPadC(fInput->DetElemId(),ix,iy,xdum,upper[1],zdum); |
1853 | if (icount ==0) lower[1]=upper[1]; | |
1854 | icount++; | |
1855 | } | |
fed772f3 | 1856 | |
002920d1 | 1857 | if (lower[1]>upper[1]) {xdum=lower[1]; lower[1]=upper[1]; upper[1]=xdum;} |
1858 | // vstart[1] = 0.5*(lower[1]+upper[1]); | |
fed772f3 | 1859 | |
1860 | ||
002920d1 | 1861 | fSeg2[1]->GetPadI(fInput->DetElemId(),fXInit[1], fYInit[1], fZPlane, ix, iy); |
1862 | isec=fSeg2[1]->Sector(fInput->DetElemId(),ix, iy); | |
1863 | dpx=fSeg2[1]->Dpx(fInput->DetElemId(),isec); | |
1864 | fSeg2[0]->GetPadI(fInput->DetElemId(),fXInit[1], fYInit[1], fZPlane, ix, iy); | |
1865 | isec=fSeg2[0]->Sector(fInput->DetElemId(),ix, iy); | |
1866 | dpy=fSeg2[0]->Dpy(fInput->DetElemId(),isec); | |
fed772f3 | 1867 | |
1868 | ||
002920d1 | 1869 | // Find save upper and lower limits |
fed772f3 | 1870 | |
002920d1 | 1871 | icount=0; |
fed772f3 | 1872 | |
002920d1 | 1873 | for (fSeg2[1]->FirstPad(fInput->DetElemId(),fXInit[1], fYInit[1], fZPlane, dpx, 0); |
1874 | fSeg2[1]->MorePads(fInput->DetElemId()); | |
1875 | fSeg2[1]->NextPad(fInput->DetElemId())) | |
1876 | { | |
1877 | ix=fSeg2[1]->Ix(); iy=fSeg2[1]->Iy(); | |
5289cf2f | 1878 | // if (fDigitMap[1]->TestHit(ix, iy) == kEmpty) continue; |
002920d1 | 1879 | fSeg2[1]->GetPadC(fInput->DetElemId(),ix,iy,upper[2],ydum,zdum); |
1880 | if (icount ==0) lower[2]=upper[2]; | |
1881 | icount++; | |
1882 | } | |
1883 | if (lower[2]>upper[2]) {xdum=lower[2]; lower[2]=upper[2]; upper[2]=xdum;} | |
1884 | // vstart[2] = 0.5*(lower[2]+upper[2]); | |
fed772f3 | 1885 | |
002920d1 | 1886 | icount=0; |
fed772f3 | 1887 | |
002920d1 | 1888 | for (fSeg2[0]->FirstPad(fInput->DetElemId(),fXInit[1], fYInit[1], fZPlane, 0, dpy); |
1889 | fSeg2[0]-> MorePads(fInput->DetElemId()); | |
1890 | fSeg2[0]->NextPad(fInput->DetElemId())) | |
1891 | { | |
1892 | ix=fSeg2[0]->Ix(); iy=fSeg2[0]->Iy(); | |
5289cf2f | 1893 | // if (fDigitMap[0]->TestHit(ix, iy) != kEmpty) continue; |
fed772f3 | 1894 | |
002920d1 | 1895 | fSeg2[0]->GetPadC(fInput->DetElemId(),ix,iy,xdum,upper[3],zdum); |
1896 | if (icount ==0) lower[3]=upper[3]; | |
1897 | icount++; | |
fed772f3 | 1898 | |
002920d1 | 1899 | } |
1900 | if (lower[3]>upper[3]) {xdum=lower[3]; lower[3]=upper[3]; upper[3]=xdum;} | |
1901 | ||
a9e2aefa | 1902 | lower[4]=0.; |
1903 | upper[4]=1.; | |
1904 | lower[5]=0.; | |
1905 | upper[5]=1.; | |
1906 | ||
1907 | // step sizes | |
1908 | static Double_t step[6]={0.0005, 0.0005, 0.0005, 0.0005, 0.001, 0.001}; | |
9825400f | 1909 | clusterInput.Fitter()->mnparm(0,"x1",vstart[0],step[0],lower[0],upper[0],ierflag); |
1910 | clusterInput.Fitter()->mnparm(1,"y1",vstart[1],step[1],lower[1],upper[1],ierflag); | |
1911 | clusterInput.Fitter()->mnparm(2,"x2",vstart[2],step[2],lower[2],upper[2],ierflag); | |
1912 | clusterInput.Fitter()->mnparm(3,"y2",vstart[3],step[3],lower[3],upper[3],ierflag); | |
1913 | clusterInput.Fitter()->mnparm(4,"a0",vstart[4],step[4],lower[4],upper[4],ierflag); | |
1914 | clusterInput.Fitter()->mnparm(5,"a1",vstart[5],step[5],lower[5],upper[5],ierflag); | |
a9e2aefa | 1915 | // ready for minimisation |
a9e2aefa | 1916 | arglist[0]= -1; |
1917 | arglist[1]= 0; | |
1918 | ||
9825400f | 1919 | clusterInput.Fitter()->mnexcm("SET NOGR", arglist, 0, ierflag); |
1920 | clusterInput.Fitter()->mnexcm("MIGRAD", arglist, 0, ierflag); | |
4da78c65 | 1921 | // clusterInput.Fitter()->mnexcm("EXIT" , arglist, 0, ierflag); |
a9e2aefa | 1922 | // Get fitted parameters |
1923 | TString chname; | |
1924 | Double_t epxz, b1, b2; | |
1925 | Int_t ierflg; | |
9825400f | 1926 | clusterInput.Fitter()->mnpout(0, chname, fXFit[0], epxz, b1, b2, ierflg); |
1927 | clusterInput.Fitter()->mnpout(1, chname, fYFit[0], epxz, b1, b2, ierflg); | |
1928 | clusterInput.Fitter()->mnpout(2, chname, fXFit[1], epxz, b1, b2, ierflg); | |
1929 | clusterInput.Fitter()->mnpout(3, chname, fYFit[1], epxz, b1, b2, ierflg); | |
1930 | clusterInput.Fitter()->mnpout(4, chname, fQrFit[0], epxz, b1, b2, ierflg); | |
1931 | clusterInput.Fitter()->mnpout(5, chname, fQrFit[1], epxz, b1, b2, ierflg); | |
a9e2aefa | 1932 | |
1933 | Double_t fmin, fedm, errdef; | |
1934 | Int_t npari, nparx, istat; | |
1935 | ||
9825400f | 1936 | clusterInput.Fitter()->mnstat(fmin, fedm, errdef, npari, nparx, istat); |
a9e2aefa | 1937 | fFitStat=istat; |
1938 | ||
1939 | fChi2[0]=fmin; | |
1940 | fChi2[1]=fmin; | |
1941 | return fmin; | |
1942 | } | |
1943 | ||
1944 | void AliMUONClusterFinderVS::Split(AliMUONRawCluster* c) | |
1945 | { | |
1946 | // | |
1947 | // One cluster for each maximum | |
1948 | // | |
1949 | Int_t i, j, cath; | |
9825400f | 1950 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
a9e2aefa | 1951 | for (j=0; j<2; j++) { |
1952 | AliMUONRawCluster cnew; | |
3b5272e3 | 1953 | cnew.SetGhost(c->GetGhost()); |
a9e2aefa | 1954 | for (cath=0; cath<2; cath++) { |
3b5272e3 | 1955 | cnew.SetChi2(cath,fChi2[0]); |
07cfabcf | 1956 | // ?? why not cnew.fChi2[cath]=fChi2[cath]; |
a9e2aefa | 1957 | |
1958 | if (fNPeaks == 0) { | |
3b5272e3 | 1959 | cnew.SetNcluster(0,-1); |
1960 | cnew.SetNcluster(1,fNRawClusters); | |
a9e2aefa | 1961 | } else { |
3b5272e3 | 1962 | cnew.SetNcluster(0,fNPeaks); |
1963 | cnew.SetNcluster(1,0); | |
a9e2aefa | 1964 | } |
9e993f2a | 1965 | cnew.SetMultiplicity(cath,0); |
ba12c242 | 1966 | cnew.SetX(cath, Float_t(fXFit[j])); |
1967 | cnew.SetY(cath, Float_t(fYFit[j])); | |
1968 | cnew.SetZ(cath, fZPlane); | |
a9e2aefa | 1969 | if (j==0) { |
ba12c242 | 1970 | cnew.SetCharge(cath, Int_t(clusterInput.TotalCharge(cath)*fQrFit[cath])); |
a9e2aefa | 1971 | } else { |
ba12c242 | 1972 | cnew.SetCharge(cath, Int_t(clusterInput.TotalCharge(cath)*(1-fQrFit[cath]))); |
a9e2aefa | 1973 | } |
002920d1 | 1974 | fSeg2[cath]->SetHit(fInput->DetElemId(), fXFit[j],fYFit[j],fZPlane); |
fed772f3 | 1975 | |
a9e2aefa | 1976 | for (i=0; i<fMul[cath]; i++) { |
fed772f3 | 1977 | Float_t q1; |
0164904a | 1978 | cnew.SetIndex(cnew.GetMultiplicity(cath), cath, c->GetIndex(i,cath)); |
002920d1 | 1979 | |
1980 | fSeg2[cath]->SetPad(fInput->DetElemId(),fIx[i][cath], fIy[i][cath]); | |
1981 | q1 = fInput->Mathieson()->IntXY(fInput->DetElemId(),fSeg2[cath]); | |
1982 | ||
0164904a | 1983 | cnew.SetContrib(i, cath, q1*Float_t(cnew.GetCharge(cath))/Float_t(fQ[i][cath])); |
9e993f2a | 1984 | cnew.SetMultiplicity(cath, cnew.GetMultiplicity(cath)+1 ); |
a9e2aefa | 1985 | } |
1986 | FillCluster(&cnew,0,cath); | |
1987 | } // cathode loop | |
9e993f2a | 1988 | cnew.SetClusterType(cnew.PhysicsContribution()); |
ba12c242 | 1989 | if (cnew.GetCharge(0)>0 && cnew.GetCharge(1)>0) AddRawCluster(cnew); |
a9e2aefa | 1990 | fNPeaks++; |
1991 | } | |
1992 | } | |
b137f8b9 | 1993 | void AliMUONClusterFinderVS::AddRawCluster(AliMUONRawCluster& c) |
a713db22 | 1994 | { |
1995 | // | |
1996 | // Add a raw cluster copy to the list | |
1997 | // | |
b137f8b9 | 1998 | // AliMUON *pMUON=(AliMUON*)gAlice->GetModule("MUON"); |
1999 | // pMUON->GetMUONData()->AddRawCluster(fInput->Chamber(),c); | |
2000 | // fNRawClusters++; | |
2001 | ||
2002 | // Setting detection element in raw cluster for alignment | |
2003 | // BB 19/05/05 | |
6570c14d | 2004 | c.SetDetElemId(fInput->DetElemId()); |
a713db22 | 2005 | |
b137f8b9 | 2006 | TClonesArray &lrawcl = *fRawClusters; |
2007 | new(lrawcl[fNRawClusters++]) AliMUONRawCluster(c); | |
2008 | AliDebug(1,Form("\nfNRawClusters %d\n",fNRawClusters)); | |
a713db22 | 2009 | } |
2010 | ||
2011 | AliMUONClusterFinderVS& AliMUONClusterFinderVS | |
2012 | ::operator = (const AliMUONClusterFinderVS& rhs) | |
2013 | { | |
2014 | // Protected assignement operator | |
2015 | ||
2016 | if (this == &rhs) return *this; | |
a9e2aefa | 2017 | |
a713db22 | 2018 | AliFatal("Not implemented."); |
2019 | ||
2020 | return *this; | |
2021 | } | |
a9e2aefa | 2022 | |
a9e2aefa | 2023 | // |
2024 | // Minimisation functions | |
2025 | // Single Mathieson | |
e3cba86e | 2026 | void fcnS1(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/) |
a9e2aefa | 2027 | { |
9825400f | 2028 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
a9e2aefa | 2029 | Int_t i; |
2030 | Float_t delta; | |
2031 | Float_t chisq=0; | |
2032 | Float_t qcont=0; | |
2033 | Float_t qtot=0; | |
9825400f | 2034 | |
2035 | for (i=0; i<clusterInput.Nmul(0); i++) { | |
2036 | Float_t q0=clusterInput.Charge(i,0); | |
2037 | Float_t q1=clusterInput.DiscrChargeS1(i,par); | |
a9e2aefa | 2038 | delta=(q0-q1)/q0; |
2039 | chisq+=delta*delta; | |
2040 | qcont+=q1; | |
2041 | qtot+=q0; | |
2042 | } | |
2043 | f=chisq; | |
2044 | } | |
2045 | ||
e3cba86e | 2046 | void fcnCombiS1(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/) |
a9e2aefa | 2047 | { |
9825400f | 2048 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
a9e2aefa | 2049 | Int_t i, cath; |
2050 | Float_t delta; | |
2051 | Float_t chisq=0; | |
2052 | Float_t qcont=0; | |
2053 | Float_t qtot=0; | |
a9e2aefa | 2054 | |
2055 | for (cath=0; cath<2; cath++) { | |
9825400f | 2056 | for (i=0; i<clusterInput.Nmul(cath); i++) { |
2057 | Float_t q0=clusterInput.Charge(i,cath); | |
2058 | Float_t q1=clusterInput.DiscrChargeCombiS1(i,par,cath); | |
a9e2aefa | 2059 | delta=(q0-q1)/q0; |
2060 | chisq+=delta*delta; | |
2061 | qcont+=q1; | |
2062 | qtot+=q0; | |
2063 | } | |
a9e2aefa | 2064 | } |
a9e2aefa | 2065 | f=chisq; |
2066 | } | |
2067 | ||
2068 | // Double Mathieson | |
e3cba86e | 2069 | void fcnS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/) |
a9e2aefa | 2070 | { |
9825400f | 2071 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
a9e2aefa | 2072 | Int_t i; |
2073 | Float_t delta; | |
2074 | Float_t chisq=0; | |
2075 | Float_t qcont=0; | |
2076 | Float_t qtot=0; | |
2077 | ||
9825400f | 2078 | for (i=0; i<clusterInput.Nmul(0); i++) { |
a9e2aefa | 2079 | |
9825400f | 2080 | Float_t q0=clusterInput.Charge(i,0); |
2081 | Float_t q1=clusterInput.DiscrChargeS2(i,par); | |
a9e2aefa | 2082 | delta=(q0-q1)/q0; |
2083 | chisq+=delta*delta; | |
2084 | qcont+=q1; | |
2085 | qtot+=q0; | |
2086 | } | |
a9e2aefa | 2087 | f=chisq; |
2088 | } | |
2089 | ||
2090 | // Double Mathieson | |
e3cba86e | 2091 | void fcnCombiS2(Int_t & /*npar*/, Double_t * /*gin*/, Double_t &f, Double_t *par, Int_t /*iflag*/) |
a9e2aefa | 2092 | { |
9825400f | 2093 | AliMUONClusterInput& clusterInput = *(AliMUONClusterInput::Instance()); |
a9e2aefa | 2094 | Int_t i, cath; |
2095 | Float_t delta; | |
2096 | Float_t chisq=0; | |
2097 | Float_t qcont=0; | |
2098 | Float_t qtot=0; | |
a9e2aefa | 2099 | for (cath=0; cath<2; cath++) { |
9825400f | 2100 | for (i=0; i<clusterInput.Nmul(cath); i++) { |
2101 | Float_t q0=clusterInput.Charge(i,cath); | |
2102 | Float_t q1=clusterInput.DiscrChargeCombiS2(i,par,cath); | |
a9e2aefa | 2103 | delta=(q0-q1)/q0; |
2104 | chisq+=delta*delta; | |
2105 | qcont+=q1; | |
2106 | qtot+=q0; | |
2107 | } | |
a9e2aefa | 2108 | } |
a9e2aefa | 2109 | f=chisq; |
2110 | } |