X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=ITS%2FAliITSclusterSSD.cxx;h=43b2616df7a71fc7dde4c707f1f58874418fef0c;hb=74999ed1b2c144c77513f2ac869b6522546298a7;hp=40daea703b154d8f828d615fb8d0efaeac306d30;hpb=e81897071a6c895e2796d84a2531f1385a0a1017;p=u%2Fmrichter%2FAliRoot.git diff --git a/ITS/AliITSclusterSSD.cxx b/ITS/AliITSclusterSSD.cxx index 40daea703b1..43b2616df7a 100644 --- a/ITS/AliITSclusterSSD.cxx +++ b/ITS/AliITSclusterSSD.cxx @@ -1,385 +1,390 @@ -#include +/************************************************************************** + * 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. * + **************************************************************************/ -#include "AliITSdigit.h" +/* $Id$ */ +//////////////////////////////////////////////////////////////////////////// +//Piotr Krzysztof Skowronski // +//Warsaw University of Technology // +//skowron@if.pw.edu.pl // +// // +// Describes set of neighbouring digits on one side of detector, // +// that are supposed to be generated by one particle. // +// includes information about clusters on other side that it crosses with // +//////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + + +#include "AliITSdigitSSD.h" #include "AliITSclusterSSD.h" ClassImp(AliITSclusterSSD) -AliITSclusterSSD::AliITSclusterSSD() -{ - // default constructor - fSide = kTRUE; - fDigits = 0; - fNDigits = 0; - fDigitsIndex = 0; - fNCrosses = 0; - fTotalSignal = -1; - fNTrack = -1; - fLeftNeighbour = kFALSE; - fRightNeighbour = kFALSE; - fCrossedClusterIndexes = new TArrayI(300); - fConsumed=kFALSE; +//______________________________________________________________________ +AliITSclusterSSD::AliITSclusterSSD(): +fSide(kTRUE), +fDigits(0), +fNDigits(0), +fDigitsIndex(0), +fNCrosses(0), +fCrossedClusterIndexes(0), +fLeftNeighbour(kFALSE), +fRightNeighbour(kFALSE), +fConsumed(kFALSE), +fTotalSignal(-1), +fNTracks(-1){ + // default constructor +} +//______________________________________________________________________ +AliITSclusterSSD::AliITSclusterSSD(Int_t ndigits, Int_t *DigitIndexes, + TObjArray *Digits, Bool_t side): +fSide(side), +fDigits(Digits), +fNDigits(ndigits), +fDigitsIndex(0), +fNCrosses(0), +fCrossedClusterIndexes(0), +fLeftNeighbour(kFALSE), +fRightNeighbour(kFALSE), +fConsumed(kFALSE), +fTotalSignal(-1), +fNTracks(-1){ + // non-default constructor + fDigitsIndex = new TArrayI(fNDigits,DigitIndexes ); + fCrossedClusterIndexes = new TArrayI(300); } -/*************************************************************************/ +//______________________________________________________________________ +AliITSclusterSSD::~AliITSclusterSSD(){ + // destructor -AliITSclusterSSD::AliITSclusterSSD - (Int_t ndigits, Int_t *DigitIndexes, - TObjArray *Digits, Bool_t side) -{ - // comment to be written - fNDigits = ndigits; - fDigits = Digits; - fSide = side; - fDigitsIndex = new TArrayI(fNDigits,DigitIndexes ); - fNCrosses = 0; - fCrossedClusterIndexes = new TArrayI(300); - fLeftNeighbour = kFALSE; - fRightNeighbour = kFALSE; - fTotalSignal =-1; - fNTrack = -1; - fConsumed=kFALSE; + delete fDigitsIndex; + delete fCrossedClusterIndexes; } -/*************************************************************************/ -AliITSclusterSSD::~AliITSclusterSSD() -{ - // destructor - delete fDigitsIndex; - delete fCrossedClusterIndexes; +//______________________________________________________________________ +AliITSclusterSSD::AliITSclusterSSD(const AliITSclusterSSD &OneSCluster) : +TObject(OneSCluster), +fSide(OneSCluster.fSide), +fDigits(OneSCluster.fDigits), +fNDigits(OneSCluster.fNDigits), +fDigitsIndex(0), +fNCrosses(OneSCluster.fNCrosses), +fCrossedClusterIndexes(0), +fLeftNeighbour(OneSCluster.fLeftNeighbour), +fRightNeighbour(OneSCluster.fRightNeighbour), +fConsumed(OneSCluster.fConsumed), +fTotalSignal(-1), +fNTracks(-1){ + // copy constructor + + fDigitsIndex = new TArrayI(fNDigits); + fTotalSignal =-1; + fNTracks = -1; + Int_t i; + for (i = 0; i< fNCrosses ; i++){ + fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i]; + } + for (i = 0; i< fNDigits ; i++){ + fDigitsIndex[i]=OneSCluster.fDigitsIndex[i]; + } + return; } - -/*************************************************************************/ -AliITSclusterSSD::AliITSclusterSSD(const AliITSclusterSSD &OneSCluster) -{ - // copy constructor - if (this == &OneSCluster) return; - fNDigits = OneSCluster.fNDigits; - fSide=OneSCluster.fSide; - fDigits=OneSCluster.fDigits; - fDigitsIndex = new TArrayI(fNDigits); - fLeftNeighbour = OneSCluster.fLeftNeighbour; - fRightNeighbour = OneSCluster.fRightNeighbour; - fTotalSignal =-1; - fNTrack = -1; - fNCrosses = OneSCluster.fNCrosses; - fConsumed = OneSCluster.fConsumed; - Int_t i; - for (i = 0; i< fNCrosses ; i++) - { - fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i]; - } - for (i = 0; i< fNDigits ; i++) - { - fDigitsIndex[i]=OneSCluster.fDigitsIndex[i]; - } - return; -} +//______________________________________________________________________ +AliITSclusterSSD& AliITSclusterSSD::operator=(const AliITSclusterSSD + &OneSCluster){ + // assignment operator -/*************************************************************************/ -AliITSclusterSSD& AliITSclusterSSD::operator=(const AliITSclusterSSD & OneSCluster) -{ - // assignment operator - if (this == &OneSCluster) return *this; - fNDigits = OneSCluster.fNDigits; - fSide=OneSCluster.fSide; - fDigits=OneSCluster.fDigits; - fDigitsIndex = new TArrayI(fNDigits); - fLeftNeighbour = OneSCluster.fLeftNeighbour; - fRightNeighbour = OneSCluster.fRightNeighbour; - fTotalSignal =-1; - fNTrack = -1; - fNCrosses = OneSCluster.fNCrosses; - fConsumed = OneSCluster.fConsumed; - Int_t i; - for (i = 0; i< fNCrosses ; i++) - { - fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i]; - } - for (i = 0; i< fNDigits ; i++) - { - fDigitsIndex[i]=OneSCluster.fDigitsIndex[i]; - } - return *this; -} + if (this == &OneSCluster) return *this; + fNDigits = OneSCluster.fNDigits; + fSide=OneSCluster.fSide; + fDigits=OneSCluster.fDigits; + fDigitsIndex = new TArrayI(fNDigits); + fLeftNeighbour = OneSCluster.fLeftNeighbour; + fRightNeighbour = OneSCluster.fRightNeighbour; + fTotalSignal =-1; + fNTracks = -1; + fNCrosses = OneSCluster.fNCrosses; + fConsumed = OneSCluster.fConsumed; + Int_t i; + for (i = 0; i< fNCrosses ; i++){ + fCrossedClusterIndexes[i] = OneSCluster.fCrossedClusterIndexes[i]; + } + for (i = 0; i< fNDigits ; i++){ + fDigitsIndex[i]=OneSCluster.fDigitsIndex[i]; + } + return *this; +} +//______________________________________________________________________ +Int_t AliITSclusterSSD::SplitCluster(Int_t where, Int_t *outdigits){ + //This methods generate data necessery to make new object of this class + //I choosen this way, because methods TClonesArray::Add* dont work + //so I have to use constraction: new (a[i]) Creator(params...); + //where 'a' is a TClonesArray + //This method generate params - see AliITSmoduleSSD::SplitCluster; + Int_t tmp = fNDigits; + Int_t ind = 0; -/*************************************************************************/ -Int_t AliITSclusterSSD::SplitCluster(Int_t where, Int_t *outdigits) -{ -//This methods generate data necessery to make new object of this class -//I choosen this way, because methods TClonesArray::Add* dont work -//so I have to use constraction: new (a[i]) Creator(params...); -//where 'a' is a TClonesArray -//This method generate params - see AliITSmoduleSSD::SplitCluster; - - - Int_t tmp = fNDigits; - Int_t ind = 0; outdigits[ind++]=(*fDigitsIndex)[where]; - //coping border strip (it is shared by this two clusters) - for (Int_t i = (where+1); i < tmp; i++) - { - outdigits[ind++]=(*fDigitsIndex)[i]; //"moving" strips from this to the new one - (*fDigitsIndex)[i]=-1; - fNDigits--; //deleting strips from this cluster - } - return ind; + //coping border strip (it is shared by this two clusters) + for (Int_t i = (where+1); i < tmp; i++) { + outdigits[ind++]=(*fDigitsIndex)[i]; + //"moving" strips from this to the new one + (*fDigitsIndex)[i]=-1; + fNDigits--; //deleting strips from this cluster + } + return ind; } - -/*******************************************************************/ -Int_t AliITSclusterSSD::GetDigitStripNo(Int_t digit) -{ - // comment to be written - if (digit<0) return -1; - return (digit>(fNDigits-1))?-1 : - ((AliITSdigitSSD*)((*fDigits)[(*fDigitsIndex)[digit]]))->GetStripNumber(); +//______________________________________________________________________ +Int_t AliITSclusterSSD::GetDigitStripNo(Int_t digit){ + // return strip no of a digit + if (digit<0) return -1; + return (digit>(fNDigits-1)) ? -1 : + ((AliITSdigitSSD*)(fDigits->At((*fDigitsIndex)[digit])))->GetStripNumber(); } -/************************************************************/ -Int_t AliITSclusterSSD::GetDigitSignal(Int_t digit) -{ - Int_t index,signal; - // returns digit signal - if (digit<0||digit>=fNDigits) return -1; - index = (*fDigitsIndex)[digit]; - signal = ((AliITSdigitSSD*)((*fDigits)[index]))->GetSignal(); - /* - if(signal>1.e5) printf("GetDigitSignal: digit %d index %d signal %d\n", - digit,index, signal); - */ - return signal; +//______________________________________________________________________ +Int_t AliITSclusterSSD::GetDigitSignal(Int_t digit){ + // returns digit signal + Int_t index,signal; + if (digit<0||digit>=fNDigits) return -1; + index = (*fDigitsIndex)[digit]; + signal = ((AliITSdigitSSD*)(fDigits->At(index)))->GetSignal(); + /* + if(signal>1.e5) printf("GetDigitSignal: digit %d index %d signal %d\n", + digit,index, signal); + */ + return signal; } - -/***********************************************************/ -void AliITSclusterSSD::AddCross(Int_t clIndex) -{ - // comment to be written - (*fCrossedClusterIndexes)[fNCrosses++] = clIndex; +//______________________________________________________________________ +void AliITSclusterSSD::AddCross(Int_t clIndex){ + // add cluster cross to list of cluster crosses + + (*fCrossedClusterIndexes)[fNCrosses++] = clIndex; } -/***********************************************************/ +//______________________________________________________________________ +Int_t AliITSclusterSSD::GetCross(Int_t crIndex) const { + // return crossing cluster -Int_t AliITSclusterSSD::GetCross(Int_t crIndex) -{ - // comment to be written - return ((crIndex>-1)&&(crIndex-1)&&(crIndexGetNTracks(); + Int_t ndig = GetNumOfDigits(); + Int_t *idig = new Int_t[ndig]; + Int_t *sdig = new Int_t[ndig]; + Int_t *itrk = new Int_t[ndig*ntrk]; + Int_t i,j,k,l,trk; + Bool_t b; -for (i =0;iGetSignal();} + TMath::Sort(ndig,sdig,idig,kTRUE); + for(i=0;iGetTrack(k))>=0) { + itrk[l] = trk; + l++; + } // end for k/if + } // end for i + for(i=0;i<10;i++) fTrack[i] = -3; + fTrack[0] = itrk[0]; // first element + k = 1; + b = kTRUE; + for(i=1;i9) break; + } // end for i + nt = k; -} -/***********************************************************/ + delete[] idig; + delete[] sdig; + delete[] itrk; -Int_t *AliITSclusterSSD::GetTracks(Int_t &nt) -{ - // comment to be written - Int_t *tidx=0; - Int_t i, bit; - nt=0; + return fTrack; +/* + Int_t *tidx=0; + Int_t i, j,n; + Int_t bit =0; + Int_t ntracks=0; + nt=0; - - - fNTrack =0; - for (i=0;i<10;i++) - { - fTrack[i] = 0; - } + for (i=0;i<10;i++) fTrack[i] = -3; - tidx=GetDigit(0)->GetTracks(); - - for (i = 0; i<3;i++) - { - fTrack[i]=tidx[i]; - if (fTrack[i] != 0) fNTrack++; - } - for (i = 1; iGetTracks(); - for (Int_t j = 0; j<3;j++) - { - bit = 1; - if (tidx[j]==0) break; - for (Int_t k = 0; k < fNTrack;k++) - { - if (tidx[j]==fTrack[k]) bit =0; - } - if (bit) fTrack[fNTrack++]=tidx[j]; - } - } - - - if (fNTrack > 10) - { - cout<<"\n\n Error AliITSclusterSSD::GetTracks OUT "<