X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ITS%2FAliITSpackageSSD.cxx;h=284bd20e90fc9847a82c9ab8abaa20c42bdb259b;hb=ecdd2482017f01ae8339e38caf493da8c8993f29;hp=785be49bfe43fdbbab66999d131dfecb98030459;hpb=cd77595ef8dc1f3b33b2eb180b715a44681d6407;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSpackageSSD.cxx b/ITS/AliITSpackageSSD.cxx index 785be49bfe4..284bd20e90f 100644 --- a/ITS/AliITSpackageSSD.cxx +++ b/ITS/AliITSpackageSSD.cxx @@ -12,47 +12,46 @@ * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ +/* $Id$ */ -/* -$Log$ -Revision 1.4 2000/07/12 05:32:20 fca -Correcting several syntax problem with static members - -*/ - -#include +#include #include #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; @@ -66,10 +65,14 @@ AliITSpackageSSD::AliITSpackageSSD /*******************************************************/ -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; @@ -89,20 +92,20 @@ AliITSpackageSSD::~AliITSpackageSSD() 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>>>>>>>>>>>>>>>"; - - return; } /*******************************************************/ @@ -123,66 +123,69 @@ AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package) 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>>>>>>>>>>>>>>>"; - -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>>>>>>>>>>>>>>>"; + + 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-1)&&(indexGetCrossNo() ) ==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; + } + + + 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; + //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 @@ -277,24 +280,24 @@ void AliITSpackageSSD::DelPCluster(Int_t index) Int_t ncr = clToDel->GetCrossNo(); for (i =0;iGetCross(i); - ((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx); - } - - - for (i=index;iGetCrossNo())==0) DelNCluster(i); - } + { + idx = clToDel->GetCross(i); + ((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx); + } + + + for (i=index;iGetCrossNo())==0) DelNCluster(i); + } } @@ -302,11 +305,10 @@ void AliITSpackageSSD::DelPCluster(Int_t index) /*******************************************************/ 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 @@ -314,24 +316,24 @@ void AliITSpackageSSD::DelNCluster(Int_t index) Int_t ncr = clToDel->GetCrossNo(); for (i =0;iGetCross(i); - ((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx); - } - - - for (i=index;iGetCrossNo())==0) DelPCluster(i); - } - + { + idx = clToDel->GetCross(i); + ((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx); + } + + + for (i=index;iGetCrossNo())==0) DelPCluster(i); + } + } @@ -339,7 +341,7 @@ void AliITSpackageSSD::DelNCluster(Int_t index) 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; @@ -415,6 +417,7 @@ void AliITSpackageSSD::DelNClusterOI(Int_t index) void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side) { + // delete cluster if (side == fgkSIDEP) { DelPClusterOI(index); @@ -432,19 +435,19 @@ void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side) 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;iGetCrossNo(); //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;iGetCross(i); if(IsFree(indcro,np,occup)) { occup[np]=indcro; @@ -489,7 +491,7 @@ void AliITSpackageSSD::MakeCombin } } } else { - for (i=0;iGetCross(i); if(IsFree(indcro,np,occup)) { occup[np]=indcro; @@ -503,9 +505,9 @@ void AliITSpackageSSD::MakeCombin } /**********************************************/ -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;iConsume(); - } - -for(i=0;iConsume(); - } - + // consume cluster + register Int_t i; + + for(i=0;iConsume(); + } + + for(i=0;iConsume(); + } + } /**********************************************/ -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; @@ -578,8 +580,9 @@ Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI) } 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; @@ -592,7 +595,7 @@ Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI) 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; @@ -605,7 +608,7 @@ Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI) } /**********************************************/ -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; @@ -641,7 +644,9 @@ void AliITSpackageSSD::SplitPackage(Int_t pi, Int_t ni, AliITSpackageSSD* pkg) break; } } - if (debug) cout<<" p = "<