* 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
-
-*/
+/* $Id$ */
#include <Riostream.h>
#include <TClonesArray.h>
#include "AliITSpackageSSD.h"
-
-//************************************************
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-//
+#include "AliITSclusterSSD.h"
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 = 0;
-
- fNclustersP=0;
- fClusterPIndexes = 0;
- if (debug) cout<<"Default Ctor was used\n>>>>>>>>>>>>>><<<<<<<<<<<<<";
+////////////////////////////////////////////////////////////////////////////
+//Class describing set of AliITSoneSideClusterSSDs, which contact each other.
+//Piotr Krzysztof Skowronski
+//Warsaw University of Technology
+//skowron@if.pw.edu.pl
+//
+//--------------------------------------------------------------------------
+AliITSpackageSSD::AliITSpackageSSD():
+fClustersN(0),
+fClustersP(0),
+fNclustersN(0),
+fNclustersP(0),
+fClusterNIndexes(0),
+fClusterPIndexes(0){
+ // constructor
}
/*******************************************************/
AliITSpackageSSD::AliITSpackageSSD
- (TClonesArray *clustersP, TClonesArray *clustersN)
-{
+(TClonesArray *clustersP, TClonesArray *clustersN):
+fClustersN(clustersN),
+fClustersP(clustersP),
+fNclustersN(0),
+fNclustersP(0),
+fClusterNIndexes(0),
+fClusterPIndexes(0){
+ // constructor
fClustersP=clustersP;
fClustersN=clustersN;
/*******************************************************/
-AliITSpackageSSD::AliITSpackageSSD
- ( Int_t len, TClonesArray *clustersP, TClonesArray *clustersN)
-
-{
+AliITSpackageSSD::AliITSpackageSSD(Int_t len, TClonesArray *clustersP, TClonesArray *clustersN):
+fClustersN(clustersN),
+fClustersP(clustersP),
+fNclustersN(0),
+fNclustersP(0),
+fClusterNIndexes(0),
+fClusterPIndexes(0){
+ // constructor
fClustersP=clustersP;
fClustersN=clustersN;
delete fClusterNIndexes;
delete fClusterPIndexes;
}
+
/*******************************************************/
-AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package)
-{
+AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package) :
+ TObject(package),
+fClustersN(package.fClustersN),
+fClustersP(package.fClustersP),
+fNclustersN(package.fNclustersN),
+fNclustersP(package.fNclustersP),
+fClusterNIndexes(0),
+fClusterPIndexes(0){
// copy constractor
Int_t i; //iterator
- if (this == &package) return;
- fClustersN = package.fClustersN;
- fClustersP = package.fClustersP;
-
- fNclustersN= package.fNclustersN;
- fNclustersP= package.fNclustersP;
-
for ( i =0; i<fNclustersN;i++)
{
fClusterNIndexes[i]= package.fClusterNIndexes[i];
fClusterPIndexes[i]= package.fClusterPIndexes[i];
}
- if (debug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
-
- return;
}
/*******************************************************/
AliITSpackageSSD&
AliITSpackageSSD::operator=( const AliITSpackageSSD & package)
{
-
-Int_t i; //iterator
-
-if (this == &package) return *this;
-fClustersN = package.fClustersN;
-fClustersP = package.fClustersP;
-
-fNclustersN= package.fNclustersN;
-fNclustersP= package.fNclustersP;
-
-for ( i =0; i<fNclustersN;i++)
- {
- fClusterNIndexes[i]= package.fClusterNIndexes[i];
- }
-
-for ( i =0; i<fNclustersP;i++)
- {
- fClusterPIndexes[i]= package.fClusterPIndexes[i];
- }
-
-if (debug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
-
-return *this;
+ // assignment operator
+ //
+ Int_t i; //iterator
+
+ if (this == &package) return *this;
+ fClustersN = package.fClustersN;
+ fClustersP = package.fClustersP;
+
+ fNclustersN= package.fNclustersN;
+ fNclustersP= package.fNclustersP;
+
+ for ( i =0; i<fNclustersN;i++)
+ {
+ fClusterNIndexes[i]= package.fClusterNIndexes[i];
+ }
+
+ for ( i =0; i<fNclustersP;i++)
+ {
+ fClusterPIndexes[i]= package.fClusterPIndexes[i];
+ }
+
+ if (fgkDebug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
+
+ return *this;
}
-
/*******************************************************/
-Int_t
-AliITSpackageSSD::GetNSideClusterIdx(Int_t index)
-
+Int_t AliITSpackageSSD::GetNSideClusterIdx(Int_t index) const
{
+ // get N-side cluster
+ //
if ((index>-1)&&(index<fNclustersN))
return (*fClusterNIndexes)[index];
else
- {
- cout << "AliITSpackageSSD::GetNSideClusterIdx : Out of Range\n";
- return -1;
- }
+ {
+ cout << "AliITSpackageSSD::GetNSideClusterIdx : Out of Range\n";
+ return -1;
+ }
}
/*******************************************************/
-Int_t AliITSpackageSSD::GetPSideClusterIdx(Int_t index)
+Int_t AliITSpackageSSD::GetPSideClusterIdx(Int_t index) const
{
+ // get P-side cluster
+ //
if ((index>-1)&&(index<fNclustersP))
return (*fClusterPIndexes)[index];
else
- {
- cout << "AliITSpackageSSD::GetPSideClusterIdx : Out of Range\n";
- return -1;
- }
+ {
+ cout << "AliITSpackageSSD::GetPSideClusterIdx : Out of Range\n";
+ return -1;
+ }
}
/*******************************************************/
AliITSclusterSSD*
AliITSpackageSSD::GetPSideCluster(Int_t index)
{
-
-return (AliITSclusterSSD*)((*fClustersP)[GetPSideClusterIdx(index)]);
+ // get Pside cluster from the TClonesArray of SSD clusters
+ //
+ return (AliITSclusterSSD*)((*fClustersP)[GetPSideClusterIdx(index)]);
}
/*******************************************************/
AliITSclusterSSD*
AliITSpackageSSD::GetNSideCluster(Int_t index)
{
-return (AliITSclusterSSD*)((*fClustersN)[GetNSideClusterIdx(index)]);
+ // get Nside cluster from the TClonesArray of SSD clusters
+ //
+ return (AliITSclusterSSD*)((*fClustersN)[GetNSideClusterIdx(index)]);
}
/*******************************************************/
-
-
-Bool_t
-AliITSpackageSSD::GetClusterWithOneCross
- (Int_t & index, Bool_t& side)
+Bool_t AliITSpackageSSD::GetClusterWithOneCross
+(Int_t & index, Bool_t& side)
{
+ // select clusters with on cross
+ //
+ if((fNclustersP==0)||(fNclustersN==0) )
+ {
+ printf("Empty package ((fNclustersP==0)||(fNclustersN==0))\n");
+ index = -2;
+ return kFALSE;
+ }
+ Int_t ind;
-
- if((fNclustersP==0)||(fNclustersN==0) )
- {
- printf("Empty package ((fNclustersP==0)||(fNclustersN==0))\n");
- index = -2;
- return kFALSE;
- }
- Int_t ind;
-
- ind =(*fClusterPIndexes)[fNclustersP-1];
- if ( ( ((AliITSclusterSSD*)(*fClustersP)[ind] )->GetCrossNo() ) ==1 )
- {
- //index=ind;
- index =fNclustersP-1;
- side=fgkSIDEP;
- return kTRUE;
- }
-
- ind =(*fClusterNIndexes)[fNclustersN-1];
- if ( ( ((AliITSclusterSSD*)(*fClustersN)[ind] )->GetCrossNo() ) ==1 )
- {
- //index=ind;
- index = fNclustersN-1;
- side=fgkSIDEN;
- return kTRUE;
- }
+ ind =(*fClusterPIndexes)[fNclustersP-1];
+ if ( ( ((AliITSclusterSSD*)(*fClustersP)[ind] )->GetCrossNo() ) ==1 )
+ {
+ //index=ind;
+ index =fNclustersP-1;
+ side=fgkSIDEP;
+ return kTRUE;
+ }
-
- ind =(*fClusterPIndexes)[0];
- if ( ( ((AliITSclusterSSD*)(*fClustersP)[ind] )->GetCrossNo() ) ==1 )
- {
- //index=ind;
- index = 0;
- side=fgkSIDEP;
- return kTRUE;
- }
+ ind =(*fClusterNIndexes)[fNclustersN-1];
+ if ( ( ((AliITSclusterSSD*)(*fClustersN)[ind] )->GetCrossNo() ) ==1 )
+ {
+ //index=ind;
+ index = fNclustersN-1;
+ side=fgkSIDEN;
+ return kTRUE;
+ }
-
- ind =(*fClusterNIndexes)[0];
- if ( ( ((AliITSclusterSSD*)(*fClustersN)[ind] )->GetCrossNo() ) ==1 )
- {
-// index=ind;
- index = 0;
- side=fgkSIDEN;
- return kTRUE;
- }
+
+ ind =(*fClusterPIndexes)[0];
+ if ( ( ((AliITSclusterSSD*)(*fClustersP)[ind] )->GetCrossNo() ) ==1 )
+ {
+ //index=ind;
+ index = 0;
+ side=fgkSIDEP;
+ return kTRUE;
+ }
- //Add for to be shure
- index = -1;
- return kFALSE;
+ ind =(*fClusterNIndexes)[0];
+ if ( ( ((AliITSclusterSSD*)(*fClustersN)[ind] )->GetCrossNo() ) ==1 )
+ {
+ // index=ind;
+ index = 0;
+ side=fgkSIDEN;
+ return kTRUE;
+ }
+
+
+ //Add for to be shure
+ index = -1;
+ return kFALSE;
}
/*******************************************************/
void AliITSpackageSSD::DelCluster(Int_t index, Bool_t side)
{
+ // call DelPCluster or DelNCluster depending on side
+ //
if(side==fgkSIDEP) DelPCluster(index); else DelNCluster(index);
}
/*******************************************************/
void AliITSpackageSSD::DelPCluster(Int_t index)
{
-
-//it not deletes delete given cluster physically,
-//but only complytely erase it from package
-//all clusters are deleted automatically when TClonesArray is deleted
-
+ //it not deletes delete given cluster physically,
+ //but only complytely erase it from package
+ //all clusters are deleted automatically when TClonesArray is deleted
+
Int_t i;
Int_t idx;
Int_t clToDelIdx = GetPSideClusterIdx(index); //Index of cluster in TClonesArray
Int_t ncr = clToDel->GetCrossNo();
for (i =0;i<ncr;i++)
- {
- idx = clToDel->GetCross(i);
- ((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx);
- }
-
-
- for (i=index;i<fNclustersP-1;i++)
- {
- (*fClusterPIndexes)[i]=(*fClusterPIndexes)[i+1];
- }
- fNclustersP--;
- if (debug) cout<<"Cluster P ("<<index<<") deleted\n";
-
-
- for (i=0;i<fNclustersN;i++)
- {
- if ( (GetNSideCluster(i)->GetCrossNo())==0) DelNCluster(i);
- }
+ {
+ idx = clToDel->GetCross(i);
+ ((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx);
+ }
+
+
+ for (i=index;i<fNclustersP-1;i++)
+ {
+ (*fClusterPIndexes)[i]=(*fClusterPIndexes)[i+1];
+ }
+ fNclustersP--;
+ if (fgkDebug) cout<<"Cluster P ("<<index<<") deleted\n";
+
+
+ for (i=0;i<fNclustersN;i++)
+ {
+ if ( (GetNSideCluster(i)->GetCrossNo())==0) DelNCluster(i);
+ }
}
/*******************************************************/
void AliITSpackageSSD::DelNCluster(Int_t index)
{
-
-//it not deletes delete given cluster physically,
-//but only complytely erase it from package
-//all clusters are deleted automatically when TClonesArray is deleted
-
+ //it not deletes delete given cluster physically,
+ //but only complytely erase it from package
+ //all clusters are deleted automatically when TClonesArray is deleted
+
Int_t i;
Int_t idx;
Int_t clToDelIdx = GetNSideClusterIdx(index); //Index of cluster in TClonesArray
Int_t ncr = clToDel->GetCrossNo();
for (i =0;i<ncr;i++)
- {
- idx = clToDel->GetCross(i);
- ((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx);
- }
-
-
- 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++)
- {
- if ( (GetPSideCluster(i)->GetCrossNo())==0) DelPCluster(i);
- }
-
+ {
+ idx = clToDel->GetCross(i);
+ ((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx);
+ }
+
+
+ for (i=index;i<fNclustersN-1;i++)
+ {
+ (*fClusterNIndexes)[i]=(*fClusterNIndexes)[i+1];
+ }
+ fNclustersN--;
+ if (fgkDebug) cout<<"Cluster N ("<<index<<") deleted\n";
+
+ for (i=0;i<fNclustersP;i++)
+ {
+ if ( (GetPSideCluster(i)->GetCrossNo())==0) DelPCluster(i);
+ }
+
}
void AliITSpackageSSD::DelPClusterOI(Int_t index)
{
-//This function looks like this,
+ //This function looks like this,
//because probably cut cluster is
//on the beginning or on the end of package
Int_t i;
void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side)
{
+ // delete cluster
if (side == fgkSIDEP)
{
DelPClusterOI(index);
void AliITSpackageSSD::GetAllCombinations(Int_t**array,Int_t &num,Int_t sizet)
{
-
+ // get all combinations
Int_t *takenNcl = new Int_t[fNclustersN];
num=0;
- if (debug) PrintClusters();
+ if (fgkDebug) PrintClusters();
for (Int_t i=0;i<fNclustersP;i++)
{
takenNcl[i]=-1;
}
//see comment on the beginning of MakeCombin
- if (debug) cout<<"GetAllCombinations entered";
+ if (fgkDebug) cout<<"GetAllCombinations entered";
MakeCombin (array,num,0,takenNcl,sizet);
delete []takenNcl;
(Int_t**arr,Int_t& nu, Int_t np, Int_t *occup, Int_t sizet)
{
-
//ATTENTION: anybody watching this function
//AliITSclusterSSD::GetCrossNo() returns index of cluster in main array belonging to AliITSmodulesSSD
//however, we have pointer to that array (TClonesArray)
//this cluster
AliITSclusterSSD *cl=GetPSideCluster(np);
- Int_t NC = cl->GetCrossNo(); //number of crosses for this cluster
+ 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
if (np == fNclustersP-1) {
- for (i=0;i<NC;i++) {
+ for (i=0;i<nc;i++) {
indcro=cl->GetCross(i);
if(IsFree(indcro,np,occup)) {
occup[np]=indcro;
}
}
} else {
- for (i=0;i<NC;i++) {
+ for (i=0;i<nc;i++) {
indcro=cl->GetCross(i);
if(IsFree(indcro,np,occup)) {
occup[np]=indcro;
}
/**********************************************/
-Bool_t AliITSpackageSSD::IsFree(Int_t idx, Int_t nn, Int_t *lis)
+Bool_t AliITSpackageSSD::IsFree(Int_t idx, Int_t nn, const Int_t *lis) const
{
-
+ //
for (Int_t i=0;i<nn;i++)
{
if (lis[i]==idx) return kFALSE;
/**********************************************/
void AliITSpackageSSD::PrintClusters()
{
-
+ // print cluster info
Int_t i,j;
cout<<"SIDE P\n";
for (i=0;i<fNclustersP;i++)
cout<<"\n";
}
-
-
}
+
/**********************************************/
void AliITSpackageSSD::ConsumeClusters()
{
-register Int_t i;
-
-for(i=0;i<fNclustersP;i++)
- {
- GetPSideCluster(i)->Consume();
- }
-
-for(i=0;i<fNclustersN;i++)
- {
- GetNSideCluster(i)->Consume();
- }
-
+ // consume cluster
+ register Int_t i;
+
+ for(i=0;i<fNclustersP;i++)
+ {
+ GetPSideCluster(i)->Consume();
+ }
+
+ for(i=0;i<fNclustersN;i++)
+ {
+ GetNSideCluster(i)->Consume();
+ }
+
}
/**********************************************/
-Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI) const
{
//Returns index of next P cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
}
return -1;
}
+
/**********************************************/
-Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI) const
{
//Returns index of previous P cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
return -1;
}
/**********************************************/
-Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI) const
{
//Returns index of next N cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
}
/**********************************************/
-Int_t AliITSpackageSSD::GetPrvNIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetPrvNIdx(Int_t OI) const
{
//Returns index of previous N cluster OI in package; OI == Original Inedx (in TClonesArray)
//if not egsist return -1;
break;
}
}
- if (debug) {
+ if (fgkDebug) {
cout<<" p = "<<p<<" n = "<<n;
}
if ((p==-1)||(n==-1)) return;