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