/************************************************************************** * 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. * **************************************************************************/ /* $Id$ */ #include #include #include "AliITSpackageSSD.h" #include "AliITSclusterSSD.h" const Bool_t AliITSpackageSSD::fgkSIDEP=kTRUE; const Bool_t AliITSpackageSSD::fgkSIDEN=kFALSE; ClassImp(AliITSpackageSSD) //////////////////////////////////////////////////////////////////////////// //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): fClustersN(clustersN), fClustersP(clustersP), fNclustersN(0), fNclustersP(0), fClusterNIndexes(0), fClusterPIndexes(0){ // constructor fClustersP=clustersP; fClustersN=clustersN; fNclustersN=0; fClusterNIndexes = new TArrayI(300); fNclustersP=0; fClusterPIndexes = new TArrayI(300); } /*******************************************************/ 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; fNclustersN=0; fClusterNIndexes = new TArrayI(len); fNclustersP=0; fClusterPIndexes = new TArrayI(len); } /*******************************************************/ AliITSpackageSSD::~AliITSpackageSSD() { // destructor delete fClusterNIndexes; delete fClusterPIndexes; } /*******************************************************/ 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 for ( i =0; i>>>>>>>>>>>>>>>"; return *this; } /*******************************************************/ 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)[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; } /*******************************************************/ 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 Int_t i; Int_t idx; Int_t clToDelIdx = GetPSideClusterIdx(index); //Index of cluster in TClonesArray AliITSclusterSSD *clToDel = GetPSideCluster(index); //cluster to be deleted Int_t ncr = clToDel->GetCrossNo(); for (i =0;iGetCross(i); ((AliITSclusterSSD *)((*fClustersN)[idx]) )->DelCross(clToDelIdx); } for (i=index;iGetCrossNo())==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 Int_t i; Int_t idx; Int_t clToDelIdx = GetNSideClusterIdx(index); //Index of cluster in TClonesArray AliITSclusterSSD *clToDel = GetNSideCluster(index); //cluster to be deleted Int_t ncr = clToDel->GetCrossNo(); for (i =0;iGetCross(i); ((AliITSclusterSSD *)((*fClustersP)[idx]) )->DelCross(clToDelIdx); } for (i=index;iGetCrossNo())==0) DelPCluster(i); } } /*******************************************************/ void AliITSpackageSSD::DelPClusterOI(Int_t index) { //This function looks like this, //because probably cut cluster is //on the beginning or on the end of package Int_t i; if( ((*fClusterPIndexes)[0]) == index) { DelPCluster(0); return; } else { if( ((*fClusterPIndexes)[fNclustersP-1]) ==index) { DelPCluster(fNclustersP-1); return; } else { for (i=1;iGetCrossNo(); //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; for(j=0;jGetCross(i); if(IsFree(indcro,np,occup)) { occup[np]=indcro; if (nuGetCrossNo();j++) { cout<GetCross(j)<<" "; } // if (GetPSideCluster(i)->GetSide()) cout<<" P\n"; // else cout<<"BAD SIDE ==N\n"; cout<<"\n"; } cout <<"SIDE N\n"; for (i=0;iGetCrossNo();j++) { cout<GetCross(j)<<" "; } // if (GetNSideCluster(i)->GetSide()) cout<<" N\n"; // else cout<<"BAD SIDE ==P\n"; cout<<"\n"; } } /**********************************************/ void AliITSpackageSSD::ConsumeClusters() { // consume cluster register Int_t i; for(i=0;iConsume(); } for(i=0;iConsume(); } } /**********************************************/ 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; for (Int_t i =0; i