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