]>
Commit | Line | Data |
---|---|---|
b669392e | 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 | /* | |
17 | $Log$ | |
18 | */ | |
19 | ||
e8189707 | 20 | #include <iostream.h> |
21 | #include <TClonesArray.h> | |
b0f5e3fc | 22 | #include "AliITSpackageSSD.h" |
e8189707 | 23 | |
b0f5e3fc | 24 | //************************************************ |
25 | //Piotr Krzysztof Skowronski | |
26 | //Warsaw University of Technology | |
27 | //skowron@if.pw.edu.pl | |
28 | // | |
29 | ||
b669392e | 30 | const Bool_t AliITSpackageSSD::fgkSIDEP=kTRUE; |
31 | const Bool_t AliITSpackageSSD::fgkSIDEN=kFALSE; | |
32 | ||
33 | static const Int_t debug=0; | |
b0f5e3fc | 34 | |
35 | ClassImp(AliITSpackageSSD) | |
36 | ||
37 | AliITSpackageSSD::AliITSpackageSSD() | |
38 | { | |
39 | fNclustersN=0; | |
40 | fClusterNIndexes = new TArrayI(300); | |
41 | ||
42 | fNclustersP=0; | |
43 | fClusterPIndexes = new TArrayI(300); | |
44 | if (debug) cout<<"Default Ctor was used\n>>>>>>>>>>>>>><<<<<<<<<<<<<"; | |
45 | } | |
46 | ||
47 | ||
48 | /*******************************************************/ | |
49 | ||
50 | AliITSpackageSSD::AliITSpackageSSD | |
51 | (TClonesArray *clustersP, TClonesArray *clustersN) | |
52 | { | |
53 | fClustersP=clustersP; | |
54 | fClustersN=clustersN; | |
55 | ||
56 | fNclustersN=0; | |
57 | fClusterNIndexes = new TArrayI(300); | |
58 | ||
59 | fNclustersP=0; | |
60 | fClusterPIndexes = new TArrayI(300); | |
61 | } | |
62 | ||
63 | /*******************************************************/ | |
64 | ||
65 | ||
66 | AliITSpackageSSD::AliITSpackageSSD | |
67 | ( Int_t len, TClonesArray *clustersP, TClonesArray *clustersN) | |
68 | ||
69 | { | |
70 | fClustersP=clustersP; | |
71 | fClustersN=clustersN; | |
72 | ||
73 | fNclustersN=0; | |
74 | fClusterNIndexes = new TArrayI(len); | |
75 | ||
76 | fNclustersP=0; | |
77 | fClusterPIndexes = new TArrayI(len); | |
78 | } | |
79 | ||
80 | ||
81 | /*******************************************************/ | |
82 | ||
83 | AliITSpackageSSD::~AliITSpackageSSD() | |
84 | { | |
85 | // destructor | |
86 | delete fClusterNIndexes; | |
87 | delete fClusterPIndexes; | |
88 | } | |
89 | /*******************************************************/ | |
90 | ||
91 | AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package) | |
92 | { | |
93 | // copy constractor | |
94 | Int_t i; //iterator | |
95 | ||
96 | if (this == &package) return; | |
97 | fClustersN = package.fClustersN; | |
98 | fClustersP = package.fClustersP; | |
99 | ||
100 | fNclustersN= package.fNclustersN; | |
101 | fNclustersP= package.fNclustersP; | |
102 | ||
e8189707 | 103 | for ( i =0; i<fNclustersN;i++) |
b0f5e3fc | 104 | { |
105 | fClusterNIndexes[i]= package.fClusterNIndexes[i]; | |
106 | } | |
107 | ||
e8189707 | 108 | for ( i =0; i<fNclustersP;i++) |
b0f5e3fc | 109 | { |
110 | fClusterPIndexes[i]= package.fClusterPIndexes[i]; | |
111 | } | |
112 | ||
113 | if (debug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"; | |
114 | ||
115 | return; | |
116 | ||
117 | } | |
118 | /*******************************************************/ | |
119 | ||
120 | AliITSpackageSSD& | |
121 | AliITSpackageSSD::operator=( const AliITSpackageSSD & package) | |
122 | { | |
123 | ||
124 | Int_t i; //iterator | |
125 | ||
126 | if (this == &package) return *this; | |
127 | fClustersN = package.fClustersN; | |
128 | fClustersP = package.fClustersP; | |
129 | ||
130 | fNclustersN= package.fNclustersN; | |
131 | fNclustersP= package.fNclustersP; | |
132 | ||
e8189707 | 133 | for ( i =0; i<fNclustersN;i++) |
b0f5e3fc | 134 | { |
135 | fClusterNIndexes[i]= package.fClusterNIndexes[i]; | |
136 | } | |
137 | ||
e8189707 | 138 | for ( i =0; i<fNclustersP;i++) |
b0f5e3fc | 139 | { |
140 | fClusterPIndexes[i]= package.fClusterPIndexes[i]; | |
141 | } | |
142 | ||
143 | if (debug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>"; | |
144 | ||
145 | return *this; | |
146 | ||
147 | } | |
148 | ||
149 | ||
150 | /*******************************************************/ | |
151 | ||
152 | Int_t | |
153 | AliITSpackageSSD::GetNSideClusterIdx(Int_t index) | |
154 | ||
155 | { | |
156 | if ((index>-1)&&(index<fNclustersN)) | |
157 | return (*fClusterNIndexes)[index]; | |
158 | else | |
159 | { | |
160 | cout << "AliITSpackageSSD::GetNSideClusterIdx : Out of Range\n"; | |
161 | return -1; | |
162 | } | |
163 | } | |
164 | /*******************************************************/ | |
165 | ||
166 | ||
167 | Int_t AliITSpackageSSD::GetPSideClusterIdx(Int_t index) | |
168 | { | |
169 | if ((index>-1)&&(index<fNclustersP)) | |
170 | return (*fClusterPIndexes)[index]; | |
171 | else | |
172 | { | |
173 | cout << "AliITSpackageSSD::GetPSideClusterIdx : Out of Range\n"; | |
174 | return -1; | |
175 | } | |
176 | } | |
177 | /*******************************************************/ | |
178 | AliITSclusterSSD* | |
179 | AliITSpackageSSD::GetPSideCluster(Int_t index) | |
180 | { | |
181 | ||
182 | return (AliITSclusterSSD*)((*fClustersP)[GetPSideClusterIdx(index)]); | |
183 | } | |
184 | ||
185 | /*******************************************************/ | |
186 | ||
187 | AliITSclusterSSD* | |
188 | AliITSpackageSSD::GetNSideCluster(Int_t index) | |
189 | { | |
190 | return (AliITSclusterSSD*)((*fClustersN)[GetNSideClusterIdx(index)]); | |
191 | } | |
192 | ||
193 | ||
194 | /*******************************************************/ | |
195 | ||
196 | ||
197 | ||
198 | Bool_t | |
199 | AliITSpackageSSD::GetClusterWithOneCross | |
200 | (Int_t & index, Bool_t& side) | |
201 | { | |
202 | ||
203 | ||
204 | if((fNclustersP==0)||(fNclustersN==0) ) | |
205 | { | |
206 | printf("Empty package ((fNclustersP==0)||(fNclustersN==0))\n"); | |
207 | index = -2; | |
208 | return kFALSE; | |
209 | } | |
210 | Int_t ind; | |
211 | ||
212 | ind =(*fClusterPIndexes)[fNclustersP-1]; | |
213 | if ( ( ((AliITSclusterSSD*)(*fClustersP)[ind] )->GetCrossNo() ) ==1 ) | |
214 | { | |
215 | //index=ind; | |
216 | index =fNclustersP-1; | |
e8189707 | 217 | side=fgkSIDEP; |
b0f5e3fc | 218 | return kTRUE; |
219 | } | |
220 | ||
221 | ind =(*fClusterNIndexes)[fNclustersN-1]; | |
222 | if ( ( ((AliITSclusterSSD*)(*fClustersN)[ind] )->GetCrossNo() ) ==1 ) | |
223 | { | |
224 | //index=ind; | |
225 | index = fNclustersN-1; | |
e8189707 | 226 | side=fgkSIDEN; |
b0f5e3fc | 227 | return kTRUE; |
228 | } | |
229 | ||
230 | ||
231 | ind =(*fClusterPIndexes)[0]; | |
232 | if ( ( ((AliITSclusterSSD*)(*fClustersP)[ind] )->GetCrossNo() ) ==1 ) | |
233 | { | |
234 | //index=ind; | |
235 | index = 0; | |
e8189707 | 236 | side=fgkSIDEP; |
b0f5e3fc | 237 | return kTRUE; |
238 | } | |
239 | ||
240 | ||
241 | ind =(*fClusterNIndexes)[0]; | |
242 | if ( ( ((AliITSclusterSSD*)(*fClustersN)[ind] )->GetCrossNo() ) ==1 ) | |
243 | { | |
244 | // index=ind; | |
245 | index = 0; | |
e8189707 | 246 | side=fgkSIDEN; |
b0f5e3fc | 247 | return kTRUE; |
248 | } | |
249 | ||
250 | ||
251 | //Add for to be shure | |
252 | index = -1; | |
253 | return kFALSE; | |
254 | ||
255 | } | |
256 | /*******************************************************/ | |
257 | ||
258 | void AliITSpackageSSD::DelCluster(Int_t index, Bool_t side) | |
259 | { | |
e8189707 | 260 | if(side==fgkSIDEP) DelPCluster(index); else DelNCluster(index); |
b0f5e3fc | 261 | } |
262 | /*******************************************************/ | |
263 | void AliITSpackageSSD::DelPCluster(Int_t index) | |
264 | { | |
265 | ||
266 | //it not deletes delete given cluster physically, | |
267 | //but only complytely erase it from package | |
268 | //all clusters are deleted automatically when TClonesArray is deleted | |
269 | ||
270 | Int_t i; | |
271 | Int_t idx; | |
272 | Int_t clToDelIdx = GetPSideClusterIdx(index); //Index of cluster in TClonesArray | |
273 | AliITSclusterSSD *clToDel = GetPSideCluster(index); //cluster to be deleted | |
274 | Int_t ncr = clToDel->GetCrossNo(); | |
275 | ||
e8189707 | 276 | for (i =0;i<ncr;i++) |
b0f5e3fc | 277 | { |
278 | idx = clToDel->GetCross(i); | |
279 | ((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx); | |
280 | } | |
281 | ||
282 | ||
e8189707 | 283 | for (i=index;i<fNclustersP-1;i++) |
b0f5e3fc | 284 | { |
285 | (*fClusterPIndexes)[i]=(*fClusterPIndexes)[i+1]; | |
286 | } | |
287 | fNclustersP--; | |
288 | if (debug) cout<<"Cluster P ("<<index<<") deleted\n"; | |
289 | ||
290 | ||
e8189707 | 291 | for (i=0;i<fNclustersN;i++) |
b0f5e3fc | 292 | { |
293 | if ( (GetNSideCluster(i)->GetCrossNo())==0) DelNCluster(i); | |
294 | } | |
295 | } | |
296 | ||
297 | ||
298 | ||
299 | /*******************************************************/ | |
300 | void AliITSpackageSSD::DelNCluster(Int_t index) | |
301 | { | |
302 | ||
303 | //it not deletes delete given cluster physically, | |
304 | //but only complytely erase it from package | |
305 | //all clusters are deleted automatically when TClonesArray is deleted | |
306 | ||
307 | Int_t i; | |
308 | Int_t idx; | |
309 | Int_t clToDelIdx = GetNSideClusterIdx(index); //Index of cluster in TClonesArray | |
310 | AliITSclusterSSD *clToDel = GetNSideCluster(index); //cluster to be deleted | |
311 | Int_t ncr = clToDel->GetCrossNo(); | |
312 | ||
e8189707 | 313 | for (i =0;i<ncr;i++) |
b0f5e3fc | 314 | { |
315 | idx = clToDel->GetCross(i); | |
316 | ((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx); | |
317 | } | |
318 | ||
319 | ||
e8189707 | 320 | for (i=index;i<fNclustersN-1;i++) |
b0f5e3fc | 321 | { |
322 | (*fClusterNIndexes)[i]=(*fClusterNIndexes)[i+1]; | |
323 | } | |
324 | fNclustersN--; | |
325 | if (debug) cout<<"Cluster N ("<<index<<") deleted\n"; | |
326 | ||
e8189707 | 327 | for (i=0;i<fNclustersP;i++) |
b0f5e3fc | 328 | { |
329 | if ( (GetPSideCluster(i)->GetCrossNo())==0) DelPCluster(i); | |
330 | } | |
331 | ||
332 | } | |
333 | ||
334 | ||
335 | /*******************************************************/ | |
336 | ||
337 | void AliITSpackageSSD::DelPClusterOI(Int_t index) | |
338 | { | |
339 | //This function looks like this, | |
340 | //because probably cut cluster is | |
341 | //on the beginning or on the end of package | |
342 | Int_t i; | |
343 | if( ((*fClusterPIndexes)[0]) == index) | |
344 | { | |
345 | DelPCluster(0); | |
346 | return; | |
347 | } | |
348 | else | |
349 | { | |
350 | if( ((*fClusterPIndexes)[fNclustersP-1]) ==index) | |
351 | { | |
352 | DelPCluster(fNclustersP-1); | |
353 | return; | |
354 | } | |
355 | else | |
356 | { | |
e8189707 | 357 | for (i=1;i<fNclustersP-1;i++) |
b0f5e3fc | 358 | { |
359 | if( ((*fClusterPIndexes)[i])==index) | |
360 | { | |
361 | DelPCluster(i); | |
362 | return; | |
363 | } | |
364 | } | |
365 | } | |
366 | } | |
367 | ||
368 | cout<<"AliITSpackageSSD - DelPClusterOI: index "<<index<<" not found\n"; | |
369 | ||
370 | } | |
371 | ||
372 | ||
373 | /*******************************************************/ | |
374 | ||
375 | void AliITSpackageSSD::DelNClusterOI(Int_t index) | |
376 | { | |
377 | //This function looks like this, | |
378 | //because probably cluster to cut is | |
379 | //on the beginning or on the end of package | |
380 | ||
381 | Int_t i; | |
382 | if( ((*fClusterNIndexes)[0])==index) | |
383 | { | |
384 | DelNCluster(0); | |
385 | return; | |
386 | } | |
387 | else | |
388 | { | |
389 | if( ((*fClusterNIndexes)[fNclustersN-1])==index) | |
390 | { | |
391 | DelNCluster(fNclustersN-1); | |
392 | return; | |
393 | } | |
394 | else | |
395 | { | |
e8189707 | 396 | for (i=1;i<fNclustersN-1;i++) |
b0f5e3fc | 397 | { |
398 | if( ((*fClusterNIndexes)[i])==index) | |
399 | { | |
400 | DelNCluster(i); | |
401 | return; | |
402 | } | |
403 | } | |
404 | } | |
405 | } | |
406 | cout<<"AliITSpackageSSD - DelNClusterOI: index "<<index<<" not found\n"; | |
407 | } | |
408 | ||
409 | ||
410 | /*******************************************************/ | |
411 | ||
412 | ||
413 | void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side) | |
414 | { | |
e8189707 | 415 | if (side == fgkSIDEP) |
b0f5e3fc | 416 | { |
417 | DelPClusterOI(index); | |
418 | } | |
419 | else | |
420 | { | |
421 | DelNClusterOI(index); | |
422 | } | |
423 | ||
424 | } | |
425 | ||
426 | ||
427 | /**********************************************/ | |
428 | ||
429 | ||
430 | void AliITSpackageSSD::GetAllCombinations(Int_t**array,Int_t &num,Int_t sizet) | |
431 | { | |
432 | ||
433 | Int_t *takenNcl = new Int_t[fNclustersN]; | |
434 | ||
435 | num=0; | |
436 | ||
437 | if (debug) PrintClusters(); | |
438 | ||
e8189707 | 439 | for (Int_t i=0;i<fNclustersP;i++) |
b0f5e3fc | 440 | { |
441 | takenNcl[i]=-1; | |
442 | } | |
443 | //see comment on the beginning of MakeCombin | |
444 | if (debug) cout<<"GetAllCombinations entered"; | |
445 | MakeCombin (array,num,0,takenNcl,sizet); | |
446 | ||
447 | delete []takenNcl; | |
448 | } | |
449 | /**********************************************/ | |
450 | ||
451 | ||
452 | void AliITSpackageSSD::MakeCombin | |
453 | (Int_t**arr,Int_t& nu, Int_t np, Int_t *occup, Int_t sizet) | |
454 | ||
455 | { | |
456 | ||
457 | //ATTENTION: anybody watching this function | |
458 | //AliITSclusterSSD::GetCrossNo() returns index of cluster in main array belonging to AliITSmodulesSSD | |
459 | //however, we have pointer to that array (TClonesArray) | |
460 | //we can not use | |
461 | //Get?SideCluster because it takes index from local look_up_table | |
462 | ||
463 | Int_t i,j; | |
464 | ||
465 | //this cluster | |
466 | AliITSclusterSSD *cl=GetPSideCluster(np); | |
467 | ||
b0f5e3fc | 468 | Int_t NC = cl->GetCrossNo(); //number of crosses for this cluster |
469 | Int_t indcro; //index of given cluster on side N that | |
470 | // this cluster crosses with | |
471 | ||
b0f5e3fc | 472 | if (np == fNclustersP-1) { |
e8189707 | 473 | for (i=0;i<NC;i++) { |
b0f5e3fc | 474 | indcro=cl->GetCross(i); |
b0f5e3fc | 475 | if(IsFree(indcro,np,occup)) { |
476 | occup[np]=indcro; | |
b0f5e3fc | 477 | for(j=0;j<fNclustersP;j++) |
478 | { | |
b0f5e3fc | 479 | if (nu<sizet) arr[nu][j]=occup[j]; |
480 | else { | |
b0f5e3fc | 481 | continue;} |
b0f5e3fc | 482 | } |
483 | ||
484 | occup[np]=-1; | |
485 | if (nu<sizet-1) nu++; | |
b0f5e3fc | 486 | } |
487 | } | |
488 | } else { | |
e8189707 | 489 | for (i=0;i<NC;i++) { |
b0f5e3fc | 490 | indcro=cl->GetCross(i); |
b0f5e3fc | 491 | if(IsFree(indcro,np,occup)) { |
492 | occup[np]=indcro; | |
b0f5e3fc | 493 | if (nu<sizet) MakeCombin(arr,nu,(np+1),occup,sizet); |
494 | //else printf("MakeComb - exceeding array size!\n"); | |
495 | } | |
496 | } | |
497 | occup[np]=-1; | |
498 | } | |
499 | ||
500 | } | |
501 | ||
502 | /**********************************************/ | |
503 | Bool_t AliITSpackageSSD::IsFree(Int_t idx, Int_t nn, Int_t *lis) | |
504 | { | |
505 | ||
e8189707 | 506 | for (Int_t i=0;i<nn;i++) |
b0f5e3fc | 507 | { |
508 | if (lis[i]==idx) return kFALSE; | |
509 | } | |
510 | return kTRUE; | |
511 | } | |
512 | ||
513 | /**********************************************/ | |
514 | void AliITSpackageSSD::PrintClusters() | |
515 | { | |
516 | ||
517 | Int_t i,j; | |
518 | cout<<"SIDE P\n"; | |
e8189707 | 519 | for (i=0;i<fNclustersP;i++) |
b0f5e3fc | 520 | { |
521 | cout<<i<<". IO="<<GetPSideClusterIdx(i)<<" NC="<<GetPSideCluster(i)->GetCrossNo()<<" C. IDXs : "; | |
e8189707 | 522 | for (j=0;j<GetPSideCluster(i)->GetCrossNo();j++) |
b0f5e3fc | 523 | { |
524 | cout<<GetPSideCluster(i)->GetCross(j)<<" "; | |
525 | } | |
526 | // if (GetPSideCluster(i)->GetSide()) cout<<" P\n"; | |
527 | // else cout<<"BAD SIDE ==N\n"; | |
528 | cout<<"\n"; | |
529 | ||
530 | } | |
531 | ||
532 | cout <<"SIDE N\n"; | |
e8189707 | 533 | for (i=0;i<fNclustersN;i++) |
b0f5e3fc | 534 | { |
535 | cout<<i<<". IO="<<GetNSideClusterIdx(i)<<" NC="<<GetNSideCluster(i)->GetCrossNo()<<" C. IDXs : "; | |
e8189707 | 536 | for (j=0;j<GetNSideCluster(i)->GetCrossNo();j++) |
b0f5e3fc | 537 | { |
538 | cout<<GetNSideCluster(i)->GetCross(j)<<" "; | |
539 | } | |
540 | // if (GetNSideCluster(i)->GetSide()) cout<<" N\n"; | |
541 | // else cout<<"BAD SIDE ==P\n"; | |
542 | cout<<"\n"; | |
543 | } | |
544 | ||
545 | ||
546 | ||
547 | } | |
548 | /**********************************************/ | |
549 | void AliITSpackageSSD::ConsumeClusters() | |
550 | { | |
551 | register Int_t i; | |
552 | ||
553 | for(i=0;i<fNclustersP;i++) | |
554 | { | |
555 | GetPSideCluster(i)->Consume(); | |
556 | } | |
557 | ||
558 | for(i=0;i<fNclustersN;i++) | |
559 | { | |
560 | GetNSideCluster(i)->Consume(); | |
561 | } | |
562 | ||
563 | } | |
564 | ||
565 | /**********************************************/ | |
566 | ||
567 | Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI) | |
568 | { | |
569 | //Returns index of next P cluster OI in package; OI == Original Inedx (in TClonesArray) | |
570 | //if not egsist return -1; | |
e8189707 | 571 | for (Int_t i =0; i<fNclustersP-1;i++) |
b0f5e3fc | 572 | { |
573 | if(GetPSideClusterIdx(i) == OI) | |
574 | return GetPSideClusterIdx(i+1); | |
575 | } | |
576 | return -1; | |
577 | } | |
578 | /**********************************************/ | |
579 | Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI) | |
580 | { | |
581 | //Returns index of previous P cluster OI in package; OI == Original Inedx (in TClonesArray) | |
582 | //if not egsist return -1; | |
583 | ||
e8189707 | 584 | for (Int_t i =1; i<fNclustersP;i++) |
b0f5e3fc | 585 | { |
586 | if(GetPSideClusterIdx(i) == OI) | |
587 | return GetPSideClusterIdx(i-1); | |
588 | } | |
589 | return -1; | |
590 | } | |
591 | /**********************************************/ | |
592 | Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI) | |
593 | { | |
594 | //Returns index of next N cluster OI in package; OI == Original Inedx (in TClonesArray) | |
595 | //if not egsist return -1; | |
e8189707 | 596 | for (Int_t i =0; i<fNclustersN-1;i++) |
b0f5e3fc | 597 | { |
598 | if(GetNSideClusterIdx(i) == OI) | |
599 | return GetNSideClusterIdx(i+1); | |
600 | } | |
601 | return -1; | |
602 | ||
603 | } | |
604 | /**********************************************/ | |
605 | Int_t AliITSpackageSSD::GetPrvNIdx(Int_t OI) | |
606 | { | |
607 | //Returns index of previous N cluster OI in package; OI == Original Inedx (in TClonesArray) | |
608 | //if not egsist return -1; | |
609 | ||
e8189707 | 610 | for (Int_t i =1; i<fNclustersN;i++) |
b0f5e3fc | 611 | { |
612 | if(GetNSideClusterIdx(i) == OI) | |
613 | return GetNSideClusterIdx(i-1); | |
614 | } | |
615 | return -1; | |
616 | ||
617 | } | |
618 | ||
619 | void AliITSpackageSSD::SplitPackage(Int_t pi, Int_t ni, AliITSpackageSSD* pkg) | |
620 | { | |
621 | // split package of clusters | |
622 | Int_t p=-1, n=-1; | |
623 | Int_t i; | |
e8189707 | 624 | for (i=0;i<fNclustersN;i++) |
b0f5e3fc | 625 | { |
626 | if((*fClusterNIndexes)[i]==ni) | |
627 | { | |
628 | n = i; | |
629 | break; | |
630 | } | |
631 | } | |
632 | ||
e8189707 | 633 | for (i=0;i<fNclustersP;i++) |
b0f5e3fc | 634 | { |
635 | if((*fClusterPIndexes)[i]==pi) | |
636 | { | |
637 | p = i; | |
638 | break; | |
639 | } | |
640 | } | |
641 | if (debug) cout<<" p = "<<p<<" n = "<<n; | |
642 | if ((p==-1)||(n==-1)) return; | |
643 | ||
e8189707 | 644 | for (i=p;i<fNclustersP;i++) |
b0f5e3fc | 645 | { |
646 | pkg->AddPSideCluster(GetPSideClusterIdx(i)); | |
647 | } | |
648 | fNclustersP = p; | |
649 | ||
e8189707 | 650 | for (i=n;i<fNclustersN;i++) |
b0f5e3fc | 651 | { |
652 | pkg->AddNSideCluster(GetNSideClusterIdx(i)); | |
653 | } | |
654 | fNclustersN = n; | |
655 | ||
656 | cout<<" After split: fNclustersP = "<< fNclustersP<< "fNclustersN = "<< fNclustersN<<"\n"; | |
657 | } |