]>
Commit | Line | Data |
---|---|---|
64b82e53 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // TRD cluster finder for the slow simulator. | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
24 | #include <TF1.h> | |
25 | #include <TTree.h> | |
26 | #include <TH1.h> | |
27 | #include <TFile.h> | |
28 | ||
29 | #include "AliRun.h" | |
30 | #include "AliRunLoader.h" | |
31 | #include "AliLoader.h" | |
32 | ||
64b82e53 | 33 | #include "AliTRDclusterizerMI.h" |
34 | #include "AliTRDmatrix.h" | |
35 | #include "AliTRDgeometry.h" | |
64b82e53 | 36 | #include "AliTRDdataArrayF.h" |
37 | #include "AliTRDdataArrayI.h" | |
38 | #include "AliTRDdigitsManager.h" | |
39 | #include "AliTRDparameter.h" | |
40 | #include "AliTRDclusterMI.h" | |
a5cadd36 | 41 | #include "AliTRDpadPlane.h" |
64b82e53 | 42 | |
43 | ClassImp(AliTRDclusterizerMI) | |
44 | ||
45 | //_____________________________________________________________________________ | |
46 | AliTRDclusterizerMI::AliTRDclusterizerMI():AliTRDclusterizerV1() | |
47 | { | |
48 | // | |
49 | // AliTRDclusterizerMI default constructor | |
50 | // | |
51 | } | |
52 | ||
53 | //_____________________________________________________________________________ | |
54 | AliTRDclusterizerMI::AliTRDclusterizerMI(const Text_t* name, const Text_t* title) | |
55 | :AliTRDclusterizerV1(name,title) | |
56 | { | |
57 | // | |
58 | // AliTRDclusterizerMI default constructor | |
59 | // | |
60 | } | |
61 | ||
62 | //_____________________________________________________________________________ | |
63 | AliTRDclusterizerMI::~AliTRDclusterizerMI() | |
64 | { | |
65 | // | |
66 | // AliTRDclusterizerMI destructor | |
67 | // | |
68 | } | |
69 | ||
a5cadd36 | 70 | //_____________________________________________________________________________ |
64b82e53 | 71 | AliTRDclusterMI * AliTRDclusterizerMI::AddCluster() |
72 | { | |
a5cadd36 | 73 | // |
74 | // Adds cluster | |
75 | // | |
76 | ||
64b82e53 | 77 | AliTRDclusterMI *c = new AliTRDclusterMI(); |
78 | fClusterContainer->Add(c); | |
79 | return c; | |
a5cadd36 | 80 | |
64b82e53 | 81 | } |
82 | ||
a5cadd36 | 83 | //_____________________________________________________________________________ |
84 | void AliTRDclusterizerMI::SetCluster(AliTRDclusterMI * cl,Double_t *pos | |
85 | , Int_t det, Double_t amp | |
86 | , Int_t *tracks, Double_t *sig, Int_t iType | |
87 | , Double_t sigmay, Double_t relpad) | |
64b82e53 | 88 | { |
89 | // | |
a5cadd36 | 90 | // Sets cluster |
64b82e53 | 91 | // |
a5cadd36 | 92 | |
64b82e53 | 93 | cl->SetDetector(det); |
94 | cl->AddTrackIndex(tracks); | |
95 | cl->SetQ(amp); | |
96 | cl->SetY(pos[0]); | |
97 | cl->SetZ(pos[1]); | |
98 | cl->SetSigmaY2(sig[0]); | |
99 | cl->SetSigmaZ2(sig[1]); | |
100 | cl->SetLocalTimeBin(((Int_t) pos[2])); | |
101 | cl->SetNPads(iType); | |
102 | cl->SetRelPos(relpad); | |
103 | cl->fRmsY = sigmay; | |
104 | } | |
105 | ||
a5cadd36 | 106 | //_____________________________________________________________________________ |
107 | void AliTRDclusterizerMI::MakeCluster(Double_t * padSignal, Double_t * pos | |
108 | , Double_t &sigma, Double_t & relpad) | |
64b82e53 | 109 | { |
110 | // | |
a5cadd36 | 111 | // Does something with the cluster |
112 | // | |
113 | ||
114 | Double_t sum = 0; | |
115 | Double_t sumx = 0; | |
116 | Double_t sumx2 = 0; | |
117 | Double_t signal[3]={padSignal[0],padSignal[1],padSignal[2]}; | |
64b82e53 | 118 | if ( signal[0]<2){ |
119 | signal[0] = 0.015*(signal[1]*signal[1])/(signal[2]+0.5); | |
120 | if (signal[0]>2) signal[0]=2; | |
121 | } | |
122 | if ( signal[2]<2){ | |
123 | signal[2] = 0.015*(signal[1]*signal[1])/(signal[0]+0.5); | |
124 | if (signal[2]>2) signal[2]=2; | |
125 | } | |
126 | ||
127 | for (Int_t i=-1;i<=1;i++){ | |
128 | sum +=signal[i+1]; | |
129 | sumx +=signal[i+1]*float(i); | |
130 | sumx2 +=signal[i+1]*float(i)*float(i); | |
131 | } | |
132 | ||
133 | pos[0] = sumx/sum; | |
134 | sigma = sumx2/sum-pos[0]*pos[0]; | |
135 | relpad = pos[0]; | |
136 | } | |
137 | ||
138 | //_____________________________________________________________________________ | |
139 | Bool_t AliTRDclusterizerMI::MakeClusters() | |
140 | { | |
141 | // | |
142 | // Generates the cluster. | |
143 | // | |
144 | ||
145 | ////////////////////// | |
146 | //STUPIDITY to be fixed later | |
bdbb05bb | 147 | fClusterContainer = RecPoints(); |
64b82e53 | 148 | |
149 | Int_t row, col, time; | |
150 | ||
bdbb05bb | 151 | /* |
64b82e53 | 152 | if (fTRD->IsVersion() != 1) { |
153 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
154 | printf("TRD must be version 1 (slow simulator).\n"); | |
155 | return kFALSE; | |
156 | } | |
bdbb05bb | 157 | */ |
64b82e53 | 158 | |
159 | // Get the geometry | |
bdbb05bb | 160 | AliTRDgeometry *geo = AliTRDgeometry::GetGeometry(fRunLoader); |
64b82e53 | 161 | |
162 | // Create a default parameter class if none is defined | |
163 | if (!fPar) { | |
164 | fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter"); | |
165 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
166 | printf("Create the default parameter object.\n"); | |
167 | } | |
168 | ||
a5cadd36 | 169 | Double_t timeBinSize = fPar->GetDriftVelocity() |
170 | / fPar->GetSamplingFrequency(); | |
64b82e53 | 171 | // Half of ampl.region |
172 | const Float_t kAmWidth = AliTRDgeometry::AmThick()/2.; | |
173 | ||
174 | Float_t omegaTau = fPar->GetOmegaTau(); | |
175 | if (fVerbose > 0) { | |
176 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
177 | printf("OmegaTau = %f \n",omegaTau); | |
178 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
179 | printf("Start creating clusters.\n"); | |
180 | } | |
181 | ||
182 | AliTRDdataArrayI *digits; | |
183 | AliTRDdataArrayI *track0; | |
184 | AliTRDdataArrayI *track1; | |
185 | AliTRDdataArrayI *track2; | |
186 | ||
187 | // Threshold value for the maximum | |
188 | Int_t maxThresh = fPar->GetClusMaxThresh(); | |
189 | // Threshold value for the digit signal | |
190 | Int_t sigThresh = fPar->GetClusSigThresh(); | |
191 | ||
192 | // Iteration limit for unfolding procedure | |
a5cadd36 | 193 | const Double_t kEpsilon = 0.01; |
64b82e53 | 194 | |
a5cadd36 | 195 | const Int_t kNclus = 3; |
196 | const Int_t kNsig = 5; | |
197 | const Int_t kNtrack = 3 * kNclus; | |
64b82e53 | 198 | |
a5cadd36 | 199 | Int_t iType = 0; |
200 | Int_t iUnfold = 0; | |
64b82e53 | 201 | |
a5cadd36 | 202 | Double_t ratioLeft = 1.0; |
203 | Double_t ratioRight = 1.0; | |
64b82e53 | 204 | |
a5cadd36 | 205 | Double_t padSignal[kNsig]; |
206 | Double_t clusterSignal[kNclus]; | |
207 | Double_t clusterPads[kNclus]; | |
208 | Int_t clusterDigit[kNclus]; | |
209 | Int_t clusterTracks[kNtrack]; | |
64b82e53 | 210 | |
211 | Int_t chamBeg = 0; | |
212 | Int_t chamEnd = AliTRDgeometry::Ncham(); | |
64b82e53 | 213 | Int_t planBeg = 0; |
214 | Int_t planEnd = AliTRDgeometry::Nplan(); | |
64b82e53 | 215 | Int_t sectBeg = 0; |
216 | Int_t sectEnd = AliTRDgeometry::Nsect(); | |
217 | ||
218 | // Start clustering in every chamber | |
219 | for (Int_t icham = chamBeg; icham < chamEnd; icham++) { | |
220 | for (Int_t iplan = planBeg; iplan < planEnd; iplan++) { | |
221 | for (Int_t isect = sectBeg; isect < sectEnd; isect++) { | |
222 | ||
64b82e53 | 223 | Int_t idet = geo->GetDetector(iplan,icham,isect); |
224 | ||
225 | Int_t nClusters = 0; | |
226 | Int_t nClusters2pad = 0; | |
227 | Int_t nClusters3pad = 0; | |
228 | Int_t nClusters4pad = 0; | |
229 | Int_t nClusters5pad = 0; | |
230 | Int_t nClustersLarge = 0; | |
231 | ||
232 | if (fVerbose > 0) { | |
233 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
234 | printf("Analyzing chamber %d, plane %d, sector %d.\n" | |
235 | ,icham,iplan,isect); | |
236 | } | |
237 | ||
238 | Int_t nRowMax = fPar->GetRowMax(iplan,icham,isect); | |
239 | Int_t nColMax = fPar->GetColMax(iplan); | |
240 | Int_t nTimeBefore = fPar->GetTimeBefore(); | |
241 | Int_t nTimeTotal = fPar->GetTimeTotal(); | |
242 | ||
a5cadd36 | 243 | AliTRDpadPlane *padPlane = fPar->GetPadPlane(iplan,icham); |
64b82e53 | 244 | |
245 | // Get the digits | |
246 | digits = fDigitsManager->GetDigits(idet); | |
247 | digits->Expand(); | |
248 | track0 = fDigitsManager->GetDictionary(idet,0); | |
249 | track0->Expand(); | |
250 | track1 = fDigitsManager->GetDictionary(idet,1); | |
251 | track1->Expand(); | |
252 | track2 = fDigitsManager->GetDictionary(idet,2); | |
253 | track2->Expand(); | |
254 | ||
255 | // Loop through the chamber and find the maxima | |
256 | for ( row = 0; row < nRowMax; row++) { | |
257 | for ( col = 2; col < nColMax; col++) { | |
258 | for (time = 0; time < nTimeTotal; time++) { | |
259 | ||
260 | Int_t signalL = TMath::Abs(digits->GetDataUnchecked(row,col ,time)); | |
261 | Int_t signalM = TMath::Abs(digits->GetDataUnchecked(row,col-1,time)); | |
262 | Int_t signalR = TMath::Abs(digits->GetDataUnchecked(row,col-2,time)); | |
263 | ||
264 | // Look for the maximum | |
265 | if (signalM >= maxThresh) { | |
266 | if (((signalL >= sigThresh) && | |
267 | (signalL < signalM)) || | |
268 | ((signalR >= sigThresh) && | |
269 | (signalR < signalM))) { | |
270 | // Maximum found, mark the position by a negative signal | |
271 | digits->SetDataUnchecked(row,col-1,time,-signalM); | |
272 | } | |
273 | } | |
274 | ||
275 | } | |
276 | } | |
277 | } | |
278 | ||
279 | // Now check the maxima and calculate the cluster position | |
280 | for ( row = 0; row < nRowMax ; row++) { | |
281 | for (time = 0; time < nTimeTotal; time++) { | |
282 | for ( col = 1; col < nColMax-1; col++) { | |
283 | ||
284 | // Maximum found ? | |
285 | if (digits->GetDataUnchecked(row,col,time) < 0) { | |
286 | ||
287 | Int_t iPad; | |
288 | for (iPad = 0; iPad < kNclus; iPad++) { | |
289 | Int_t iPadCol = col - 1 + iPad; | |
290 | clusterSignal[iPad] = TMath::Abs(digits->GetDataUnchecked(row | |
291 | ,iPadCol | |
292 | ,time)); | |
293 | clusterDigit[iPad] = digits->GetIndexUnchecked(row,iPadCol,time); | |
294 | clusterTracks[3*iPad ] = track0->GetDataUnchecked(row,iPadCol,time) - 1; | |
295 | clusterTracks[3*iPad+1] = track1->GetDataUnchecked(row,iPadCol,time) - 1; | |
296 | clusterTracks[3*iPad+2] = track2->GetDataUnchecked(row,iPadCol,time) - 1; | |
297 | } | |
298 | ||
299 | // Count the number of pads in the cluster | |
300 | Int_t nPadCount = 0; | |
301 | Int_t ii = 0; | |
302 | while (TMath::Abs(digits->GetDataUnchecked(row,col-ii ,time)) | |
303 | >= sigThresh) { | |
304 | nPadCount++; | |
305 | ii++; | |
306 | if (col-ii < 0) break; | |
307 | } | |
308 | ii = 0; | |
309 | while (TMath::Abs(digits->GetDataUnchecked(row,col+ii+1,time)) | |
310 | >= sigThresh) { | |
311 | nPadCount++; | |
312 | ii++; | |
313 | if (col+ii+1 >= nColMax) break; | |
314 | } | |
315 | ||
316 | nClusters++; | |
317 | switch (nPadCount) { | |
318 | case 2: | |
319 | iType = 0; | |
320 | nClusters2pad++; | |
321 | break; | |
322 | case 3: | |
323 | iType = 1; | |
324 | nClusters3pad++; | |
325 | break; | |
326 | case 4: | |
327 | iType = 2; | |
328 | nClusters4pad++; | |
329 | break; | |
330 | case 5: | |
331 | iType = 3; | |
332 | nClusters5pad++; | |
333 | break; | |
334 | default: | |
335 | iType = 4; | |
336 | nClustersLarge++; | |
337 | break; | |
338 | }; | |
339 | ||
340 | // Don't analyze large clusters | |
341 | //if (iType == 4) continue; | |
342 | ||
343 | // Look for 5 pad cluster with minimum in the middle | |
344 | Bool_t fivePadCluster = kFALSE; | |
345 | if (col < nColMax-3) { | |
346 | if (digits->GetDataUnchecked(row,col+2,time) < 0) { | |
347 | fivePadCluster = kTRUE; | |
348 | } | |
349 | if ((fivePadCluster) && (col < nColMax-5)) { | |
350 | if (digits->GetDataUnchecked(row,col+4,time) >= sigThresh) { | |
351 | fivePadCluster = kFALSE; | |
352 | } | |
353 | } | |
354 | if ((fivePadCluster) && (col > 1)) { | |
355 | if (digits->GetDataUnchecked(row,col-2,time) >= sigThresh) { | |
356 | fivePadCluster = kFALSE; | |
357 | } | |
358 | } | |
359 | } | |
360 | ||
361 | // 5 pad cluster | |
362 | // Modify the signal of the overlapping pad for the left part | |
363 | // of the cluster which remains from a previous unfolding | |
364 | if (iUnfold) { | |
365 | clusterSignal[0] *= ratioLeft; | |
366 | iType = 3; | |
367 | iUnfold = 0; | |
368 | } | |
369 | ||
370 | // Unfold the 5 pad cluster | |
371 | if (fivePadCluster) { | |
372 | for (iPad = 0; iPad < kNsig; iPad++) { | |
373 | padSignal[iPad] = TMath::Abs(digits->GetDataUnchecked(row | |
374 | ,col-1+iPad | |
375 | ,time)); | |
376 | } | |
377 | // Unfold the two maxima and set the signal on | |
378 | // the overlapping pad to the ratio | |
379 | ratioRight = Unfold(kEpsilon,iplan,padSignal); | |
380 | ratioLeft = 1.0 - ratioRight; | |
381 | clusterSignal[2] *= ratioRight; | |
382 | iType = 3; | |
383 | iUnfold = 1; | |
384 | } | |
385 | ||
a5cadd36 | 386 | Double_t clusterCharge = clusterSignal[0] |
387 | + clusterSignal[1] | |
388 | + clusterSignal[2]; | |
64b82e53 | 389 | |
390 | // The position of the cluster | |
391 | clusterPads[0] = row + 0.5; | |
392 | // Take the shift of the additional time bins into account | |
393 | clusterPads[2] = time - nTimeBefore + 0.5; | |
394 | ||
395 | if (fPar->LUTOn()) { | |
396 | ||
397 | // Calculate the position of the cluster by using the | |
398 | // lookup table method | |
a5cadd36 | 399 | // clusterPads[1] = col + 0.5 |
400 | // + fPar->LUTposition(iplan,clusterSignal[0] | |
401 | // ,clusterSignal[1] | |
402 | // ,clusterSignal[2]); | |
403 | clusterPads[1] = 0.5 | |
64b82e53 | 404 | + fPar->LUTposition(iplan,clusterSignal[0] |
405 | ,clusterSignal[1] | |
406 | ,clusterSignal[2]); | |
407 | ||
408 | } | |
409 | else { | |
410 | ||
411 | // Calculate the position of the cluster by using the | |
412 | // center of gravity method | |
a5cadd36 | 413 | // clusterPads[1] = col + 0.5 |
414 | // + (clusterSignal[2] - clusterSignal[0]) | |
415 | // / clusterCharge; | |
416 | clusterPads[1] = 0.5 | |
64b82e53 | 417 | + (clusterSignal[2] - clusterSignal[0]) |
418 | / clusterCharge; | |
419 | ||
420 | } | |
421 | ||
a5cadd36 | 422 | Double_t q0 = clusterSignal[0]; |
423 | Double_t q1 = clusterSignal[1]; | |
424 | Double_t q2 = clusterSignal[2]; | |
425 | Double_t clusterSigmaY2 = (q1*(q0+q2)+4*q0*q2) / | |
64b82e53 | 426 | (clusterCharge*clusterCharge); |
427 | ||
64b82e53 | 428 | // Calculate the position and the error |
a5cadd36 | 429 | Double_t clusterPos[3]; |
430 | // clusterPos[0] = clusterPads[1] * colSize + col0; | |
431 | // clusterPos[1] = clusterPads[0] * rowSize + row0; | |
432 | clusterPos[0] = padPlane->GetColPos(col) - clusterPads[1]; | |
433 | clusterPos[1] = padPlane->GetRowPos(row) - clusterPads[0]; | |
64b82e53 | 434 | clusterPos[2] = clusterPads[2]; |
a5cadd36 | 435 | Double_t clusterSig[2]; |
436 | Double_t colSize = padPlane->GetColSize(col); | |
437 | Double_t rowSize = padPlane->GetRowSize(row); | |
64b82e53 | 438 | clusterSig[0] = (clusterSigmaY2 + 1./12.) * colSize*colSize; |
439 | clusterSig[1] = rowSize * rowSize / 12.; | |
a5cadd36 | 440 | |
441 | // Correct for ExB displacement | |
442 | if (fPar->ExBOn()) { | |
443 | Int_t local_time_bin = (Int_t) clusterPads[2]; | |
444 | Double_t driftLength = local_time_bin * timeBinSize + kAmWidth; | |
445 | Double_t deltaY = omegaTau * driftLength; | |
446 | clusterPos[1] = clusterPos[1] - deltaY; | |
447 | } | |
448 | ||
64b82e53 | 449 | // |
450 | // | |
451 | AliTRDclusterMI * cluster = AddCluster(); | |
a5cadd36 | 452 | Double_t sigma, relpos; |
64b82e53 | 453 | MakeCluster(clusterSignal, clusterPos, sigma,relpos); |
454 | ||
a5cadd36 | 455 | // clusterPos[0] = clusterPads[1] * colSize + col0; |
456 | // clusterPos[1] = clusterPads[0] * rowSize + row0; | |
64b82e53 | 457 | clusterPos[2] = clusterPads[2]; |
a5cadd36 | 458 | clusterPos[0] = padPlane->GetColPos(col) - clusterPads[1]; |
459 | clusterPos[1] = padPlane->GetRowPos(row) - clusterPads[0]; | |
64b82e53 | 460 | SetCluster(cluster, clusterPos,idet,clusterCharge,clusterTracks,clusterSig,iType,sigma,relpos); |
461 | // Add the cluster to the output array | |
462 | // fTRD->AddCluster(clusterPos | |
463 | // ,idet | |
464 | // ,clusterCharge | |
465 | // ,clusterTracks | |
466 | // ,clusterSig | |
467 | // ,iType); | |
468 | ||
469 | } | |
470 | } | |
471 | } | |
472 | } | |
473 | ||
474 | // Compress the arrays | |
475 | digits->Compress(1,0); | |
476 | track0->Compress(1,0); | |
477 | track1->Compress(1,0); | |
478 | track2->Compress(1,0); | |
479 | ||
480 | // Write the cluster and reset the array | |
481 | WriteClusters(idet); | |
bdbb05bb | 482 | ResetRecPoints(); |
64b82e53 | 483 | |
484 | if (fVerbose > 0) { | |
485 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
486 | printf("Found %d clusters in total.\n" | |
487 | ,nClusters); | |
488 | printf(" 2pad: %d\n",nClusters2pad); | |
489 | printf(" 3pad: %d\n",nClusters3pad); | |
490 | printf(" 4pad: %d\n",nClusters4pad); | |
491 | printf(" 5pad: %d\n",nClusters5pad); | |
492 | printf(" Large: %d\n",nClustersLarge); | |
493 | } | |
494 | ||
495 | } | |
496 | } | |
497 | } | |
498 | ||
499 | if (fVerbose > 0) { | |
500 | printf("<AliTRDclusterizerMI::MakeCluster> "); | |
501 | printf("Done.\n"); | |
502 | } | |
503 | ||
504 | return kTRUE; | |
505 | ||
506 | } | |
507 | ||
508 | //_____________________________________________________________________________ | |
a5cadd36 | 509 | Double_t AliTRDclusterizerMI::Unfold(Double_t eps, Int_t plane, Double_t* padSignal) |
64b82e53 | 510 | { |
511 | // | |
512 | // Method to unfold neighbouring maxima. | |
513 | // The charge ratio on the overlapping pad is calculated | |
514 | // until there is no more change within the range given by eps. | |
515 | // The resulting ratio is then returned to the calling method. | |
516 | // | |
517 | ||
a5cadd36 | 518 | Int_t irc = 0; |
519 | Int_t itStep = 0; // Count iteration steps | |
64b82e53 | 520 | |
a5cadd36 | 521 | Double_t ratio = 0.5; // Start value for ratio |
522 | Double_t prevRatio = 0; // Store previous ratio | |
64b82e53 | 523 | |
a5cadd36 | 524 | Double_t newLeftSignal[3] = {0}; // Array to store left cluster signal |
525 | Double_t newRightSignal[3] = {0}; // Array to store right cluster signal | |
526 | Double_t newSignal[3] = {0}; | |
64b82e53 | 527 | |
528 | // Start the iteration | |
529 | while ((TMath::Abs(prevRatio - ratio) > eps) && (itStep < 10)) { | |
530 | ||
531 | itStep++; | |
532 | prevRatio = ratio; | |
533 | ||
534 | // Cluster position according to charge ratio | |
a5cadd36 | 535 | Double_t maxLeft = (ratio*padSignal[2] - padSignal[0]) |
536 | / (padSignal[0] + padSignal[1] + ratio*padSignal[2]); | |
537 | Double_t maxRight = (padSignal[4] - (1-ratio)*padSignal[2]) | |
538 | / ((1-ratio)*padSignal[2] + padSignal[3] + padSignal[4]); | |
64b82e53 | 539 | |
540 | // Set cluster charge ratio | |
541 | irc = fPar->PadResponse(1.0,maxLeft ,plane,newSignal); | |
a5cadd36 | 542 | Double_t ampLeft = padSignal[1] / newSignal[1]; |
64b82e53 | 543 | irc = fPar->PadResponse(1.0,maxRight,plane,newSignal); |
a5cadd36 | 544 | Double_t ampRight = padSignal[3] / newSignal[1]; |
64b82e53 | 545 | |
546 | // Apply pad response to parameters | |
547 | irc = fPar->PadResponse(ampLeft ,maxLeft ,plane,newLeftSignal ); | |
548 | irc = fPar->PadResponse(ampRight,maxRight,plane,newRightSignal); | |
549 | ||
550 | // Calculate new overlapping ratio | |
a5cadd36 | 551 | ratio = TMath::Min((Double_t)1.0,newLeftSignal[2] / |
64b82e53 | 552 | (newLeftSignal[2] + newRightSignal[0])); |
553 | ||
554 | } | |
555 | ||
556 | return ratio; | |
557 | ||
558 | } | |
559 | ||
560 | ||
561 |