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