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