+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+$Log$
+Revision 1.6 2002/10/22 14:45:42 alibrary
+Introducing Riostream.h
+
+Revision 1.5 2001/11/19 16:17:03 nilsen
+Applyed fixes to bugs found by Rene Brun. With many thanks. Some additonal
+bugs found by Rene require more work to fix. Will be fixed soon.
+
+Revision 1.4 2000/07/12 05:32:20 fca
+Correcting several syntax problem with static members
+
+*/
+
+#include <Riostream.h>
+#include <TClonesArray.h>
#include "AliITSpackageSSD.h"
+
//************************************************
//Piotr Krzysztof Skowronski
//Warsaw University of Technology
//skowron@if.pw.edu.pl
//
-const Int_t debug=0;
+const Bool_t AliITSpackageSSD::fgkSIDEP=kTRUE;
+const Bool_t AliITSpackageSSD::fgkSIDEN=kFALSE;
+
+static const Int_t debug=0;
ClassImp(AliITSpackageSSD)
AliITSpackageSSD::AliITSpackageSSD()
{
fNclustersN=0;
- fClusterNIndexes = new TArrayI(300);
+ fClusterNIndexes = 0;
fNclustersP=0;
- fClusterPIndexes = new TArrayI(300);
+ fClusterPIndexes = 0;
if (debug) cout<<"Default Ctor was used\n>>>>>>>>>>>>>><<<<<<<<<<<<<";
}
fNclustersN= package.fNclustersN;
fNclustersP= package.fNclustersP;
- for(i =0; i<fNclustersN;i++)
+ for ( i =0; i<fNclustersN;i++)
{
fClusterNIndexes[i]= package.fClusterNIndexes[i];
}
- for(i =0; i<fNclustersP;i++)
+ for ( i =0; i<fNclustersP;i++)
{
fClusterPIndexes[i]= package.fClusterPIndexes[i];
}
fNclustersN= package.fNclustersN;
fNclustersP= package.fNclustersP;
-for(i =0; i<fNclustersN;i++)
+for ( i =0; i<fNclustersN;i++)
{
fClusterNIndexes[i]= package.fClusterNIndexes[i];
}
-for(i =0; i<fNclustersP;i++)
+for ( i =0; i<fNclustersP;i++)
{
fClusterPIndexes[i]= package.fClusterPIndexes[i];
}
{
//index=ind;
index =fNclustersP-1;
- side=SIDEP;
+ side=fgkSIDEP;
return kTRUE;
}
{
//index=ind;
index = fNclustersN-1;
- side=SIDEN;
+ side=fgkSIDEN;
return kTRUE;
}
{
//index=ind;
index = 0;
- side=SIDEP;
+ side=fgkSIDEP;
return kTRUE;
}
{
// index=ind;
index = 0;
- side=SIDEN;
+ side=fgkSIDEN;
return kTRUE;
}
void AliITSpackageSSD::DelCluster(Int_t index, Bool_t side)
{
- if(side==SIDEP) DelPCluster(index); else DelNCluster(index);
+ if(side==fgkSIDEP) DelPCluster(index); else DelNCluster(index);
}
/*******************************************************/
void AliITSpackageSSD::DelPCluster(Int_t index)
AliITSclusterSSD *clToDel = GetPSideCluster(index); //cluster to be deleted
Int_t ncr = clToDel->GetCrossNo();
- for(i =0;i<ncr;i++)
+ for (i =0;i<ncr;i++)
{
idx = clToDel->GetCross(i);
((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx);
}
- for(i=index;i<fNclustersP-1;i++)
+ for (i=index;i<fNclustersP-1;i++)
{
(*fClusterPIndexes)[i]=(*fClusterPIndexes)[i+1];
}
if (debug) cout<<"Cluster P ("<<index<<") deleted\n";
- for(i=0;i<fNclustersN;i++)
+ for (i=0;i<fNclustersN;i++)
{
if ( (GetNSideCluster(i)->GetCrossNo())==0) DelNCluster(i);
}
AliITSclusterSSD *clToDel = GetNSideCluster(index); //cluster to be deleted
Int_t ncr = clToDel->GetCrossNo();
- for(i =0;i<ncr;i++)
+ for (i =0;i<ncr;i++)
{
idx = clToDel->GetCross(i);
((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx);
}
- for(i=index;i<fNclustersN-1;i++)
+ for (i=index;i<fNclustersN-1;i++)
{
(*fClusterNIndexes)[i]=(*fClusterNIndexes)[i+1];
}
fNclustersN--;
if (debug) cout<<"Cluster N ("<<index<<") deleted\n";
- for(i=0;i<fNclustersP;i++)
+ for (i=0;i<fNclustersP;i++)
{
if ( (GetPSideCluster(i)->GetCrossNo())==0) DelPCluster(i);
}
}
else
{
- for(i=1;i<fNclustersP-1;i++)
+ for (i=1;i<fNclustersP-1;i++)
{
if( ((*fClusterPIndexes)[i])==index)
{
}
else
{
- for(i=1;i<fNclustersN-1;i++)
+ for (i=1;i<fNclustersN-1;i++)
{
if( ((*fClusterNIndexes)[i])==index)
{
void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side)
{
- if (side == SIDEP)
+ if (side == fgkSIDEP)
{
DelPClusterOI(index);
}
if (debug) PrintClusters();
- Int_t i;
- for(i=0;i<fNclustersP;i++)
+ for (Int_t i=0;i<fNclustersP;i++)
{
takenNcl[i]=-1;
}
//this cluster
AliITSclusterSSD *cl=GetPSideCluster(np);
- //printf("np %d cl %p\n",np,cl);
-
-
Int_t NC = cl->GetCrossNo(); //number of crosses for this cluster
Int_t indcro; //index of given cluster on side N that
// this cluster crosses with
- // printf("NC %d \n",NC);
-
-
if (np == fNclustersP-1) {
- //printf("if \n");
- for(i=0;i<NC;i++) {
+ for (i=0;i<NC;i++) {
indcro=cl->GetCross(i);
- //printf("if: i indcro %d %d\n",i, indcro);
if(IsFree(indcro,np,occup)) {
occup[np]=indcro;
- //printf("if- isFree: i np occup[np] %d %d %d\n",i,np,occup[np]);
for(j=0;j<fNclustersP;j++)
{
- //printf("if- for: j nu occup[j] %d %d %d\n",j, nu, occup[j]);
if (nu<sizet) arr[nu][j]=occup[j];
else {
- //printf("MakeComb - exceeding array size! i j %d %d\n",i,j);
continue;}
- //printf("if- for: j nu arr[nu][j] %d %d %d\n",j, nu, arr[nu][j]);
-
}
occup[np]=-1;
if (nu<sizet-1) nu++;
- //printf("i j nu %d %d %d \n",i,j,nu);
}
}
} else {
- // printf("else \n");
-
- for(i=0;i<NC;i++) {
+ for (i=0;i<NC;i++) {
indcro=cl->GetCross(i);
- //printf("else: i indcro %d %d\n",i, indcro);
if(IsFree(indcro,np,occup)) {
occup[np]=indcro;
- //printf("else:recursive call - i np occup %d %d %d\n",i,np,occup[np]);
if (nu<sizet) MakeCombin(arr,nu,(np+1),occup,sizet);
//else printf("MakeComb - exceeding array size!\n");
}
Bool_t AliITSpackageSSD::IsFree(Int_t idx, Int_t nn, Int_t *lis)
{
- Int_t i;
- for(i=0;i<nn;i++)
+ for (Int_t i=0;i<nn;i++)
{
if (lis[i]==idx) return kFALSE;
}
Int_t i,j;
cout<<"SIDE P\n";
-for(i=0;i<fNclustersP;i++)
+for (i=0;i<fNclustersP;i++)
{
cout<<i<<". IO="<<GetPSideClusterIdx(i)<<" NC="<<GetPSideCluster(i)->GetCrossNo()<<" C. IDXs : ";
- for(j=0;j<GetPSideCluster(i)->GetCrossNo();j++)
+ for (j=0;j<GetPSideCluster(i)->GetCrossNo();j++)
{
cout<<GetPSideCluster(i)->GetCross(j)<<" ";
}
}
cout <<"SIDE N\n";
-for(i=0;i<fNclustersN;i++)
+for (i=0;i<fNclustersN;i++)
{
cout<<i<<". IO="<<GetNSideClusterIdx(i)<<" NC="<<GetNSideCluster(i)->GetCrossNo()<<" C. IDXs : ";
- for(j=0;j<GetNSideCluster(i)->GetCrossNo();j++)
+ for (j=0;j<GetNSideCluster(i)->GetCrossNo();j++)
{
cout<<GetNSideCluster(i)->GetCross(j)<<" ";
}
{
//Returns index of next P cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
- Int_t i;
- for(i =0; i<fNclustersP-1;i++)
+ for (Int_t i =0; i<fNclustersP-1;i++)
{
if(GetPSideClusterIdx(i) == OI)
return GetPSideClusterIdx(i+1);
//Returns index of previous P cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
- Int_t i;
- for(i =1; i<fNclustersP;i++)
+ for (Int_t i =1; i<fNclustersP;i++)
{
if(GetPSideClusterIdx(i) == OI)
return GetPSideClusterIdx(i-1);
{
//Returns index of next N cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
- Int_t i;
- for(i =0; i<fNclustersN-1;i++)
+ for (Int_t i =0; i<fNclustersN-1;i++)
{
if(GetNSideClusterIdx(i) == OI)
return GetNSideClusterIdx(i+1);
//Returns index of previous N cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
- Int_t i;
- for(i =1; i<fNclustersN;i++)
+ for (Int_t i =1; i<fNclustersN;i++)
{
if(GetNSideClusterIdx(i) == OI)
return GetNSideClusterIdx(i-1);
// split package of clusters
Int_t p=-1, n=-1;
Int_t i;
- for(i=0;i<fNclustersN;i++)
+ for (i=0;i<fNclustersN;i++)
{
if((*fClusterNIndexes)[i]==ni)
{
}
}
- for(i=0;i<fNclustersP;i++)
+ for (i=0;i<fNclustersP;i++)
{
if((*fClusterPIndexes)[i]==pi)
{
break;
}
}
- if (debug) cout<<" p = "<<p<<" n = "<<n;
+ if (debug) {
+ cout<<" p = "<<p<<" n = "<<n;
+ }
if ((p==-1)||(n==-1)) return;
- for(i=p;i<fNclustersP;i++)
+ for (i=p;i<fNclustersP;i++)
{
pkg->AddPSideCluster(GetPSideClusterIdx(i));
}
fNclustersP = p;
- for(i=n;i<fNclustersN;i++)
+ for (i=n;i<fNclustersN;i++)
{
pkg->AddNSideCluster(GetNSideClusterIdx(i));
}