X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliRecPoint.cxx;h=7ab6b8a999f779d9f7e5426417466fea2a52d94b;hb=a362759049bb26ddc3a16954d3e598d4fe3dddf1;hp=40fc7a58350d349ed23c3828e39789021165b179;hpb=2685bf0058cf8c070a7216d849987da45460a11b;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliRecPoint.cxx b/STEER/AliRecPoint.cxx index 40fc7a58350..7ab6b8a999f 100644 --- a/STEER/AliRecPoint.cxx +++ b/STEER/AliRecPoint.cxx @@ -13,32 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.7 2000/11/30 07:12:49 alibrary -Introducing new Rndm and QA classes - -Revision 1.6 2000/10/02 21:28:14 fca -Removal of useless dependecies via forward declarations - -Revision 1.5 2000/07/11 18:24:59 fca -Coding convention corrections + few minor bug fixes - -Revision 1.4 2000/05/16 08:30:02 fca -Using automatic streamer for c arrays - -Revision 1.3 2000/03/20 14:22:25 fca -New version to support new PHOS code - -Revision 1.2 2000/02/15 09:43:54 fca -Corrections -- a bug in the streamer (wrong size of the arrays) -- replace Read/WriteArray by Read/WriteFastArray (suggestion R.Brun) - -Revision 1.1 1999/12/17 09:01:14 fca -Y.Schutz new classes for reconstruction - -*/ +/* $Id$ */ //-*-C++-*- //_________________________________________________________________________ @@ -63,26 +38,58 @@ Y.Schutz new classes for reconstruction ClassImp(AliRecPoint) -//____________________________________________________________________________ -AliRecPoint::AliRecPoint() +//_______________________________________________________________________ +AliRecPoint::AliRecPoint(): + fAmp(0), + fGeom(0), + fIndexInList(-1), // to be set when the point is already stored + fLocPos(0,0,0), + fLocPosM(0), + fMaxDigit(100), + fMulDigit(0), + fMaxTrack(5), + fMulTrack(0), + fDigitsList(0), + fTracksList(0) { - // ctor - fGeom = 0; - fAmp = 0.0 ; - - fLocPos.SetXYZ(0., 0., 0.) ; - fLocPosM = new TMatrix(3,3) ; - fMaxDigit = 100 ; - fMulDigit = 0 ; - fDigitsList = new int[fMaxDigit]; ; - fMaxTrack = 5 ; - fMulTrack = 0 ; - fTracksList = new int[fMaxTrack]; ; - fIndexInList = -1 ; // to be set when the point is already stored + // + // default ctor + // } -//____________________________________________________________________________ -AliRecPoint::AliRecPoint(const AliRecPoint& recp) +//_______________________________________________________________________ +AliRecPoint::AliRecPoint(const char * ): + fAmp(0), + fGeom(0), + fIndexInList(-1), // to be set when the point is already stored + fLocPos(0,0,0), + fLocPosM(new TMatrixF(3,3)), + fMaxDigit(100), + fMulDigit(0), + fMaxTrack(5), + fMulTrack(0), + fDigitsList(new int[fMaxDigit]), + fTracksList(new int[fMaxTrack]) +{ + // + // Standard ctor + // +} + +//_______________________________________________________________________ +AliRecPoint::AliRecPoint(const AliRecPoint& recp): + TObject(recp), + fAmp(0), + fGeom(0), + fIndexInList(-1), // to be set when the point is already stored + fLocPos(0,0,0), + fLocPosM(0), + fMaxDigit(100), + fMulDigit(0), + fMaxTrack(5), + fMulTrack(0), + fDigitsList(0), + fTracksList(0) { // // Copy constructor @@ -90,20 +97,18 @@ AliRecPoint::AliRecPoint(const AliRecPoint& recp) recp.Copy(*this); } -//____________________________________________________________________________ +//_______________________________________________________________________ AliRecPoint::~AliRecPoint() { // dtor delete fLocPosM ; - if ( fDigitsList ) - delete fDigitsList ; - if ( fTracksList ) - delete fTracksList ; + delete [] fDigitsList ; + delete [] fTracksList ; } -//____________________________________________________________________________ +//_______________________________________________________________________ void AliRecPoint::AddDigit(AliDigitNew & digit) { // adds a digit to the digits list @@ -111,14 +116,14 @@ void AliRecPoint::AddDigit(AliDigitNew & digit) if ( fMulDigit >= fMaxDigit ) { // increase the size of the list - int * tempo = new ( int[fMaxDigit*=2] ) ; + int * tempo = new int[fMaxDigit*2]; Int_t index ; for ( index = 0 ; index < fMulDigit ; index++ ) tempo[index] = fDigitsList[index] ; - delete fDigitsList ; + delete [] fDigitsList ; fDigitsList = tempo ; } @@ -127,7 +132,7 @@ void AliRecPoint::AddDigit(AliDigitNew & digit) fAmp += digit.GetAmp() ; } -//____________________________________________________________________________ +//_______________________________________________________________________ // void AliRecPoint::AddTrack(AliTrack & track) // { // // adds a digit to the digits list @@ -146,35 +151,35 @@ void AliRecPoint::AddDigit(AliDigitNew & digit) // fTracksList[fMulTrack++]= (int) &Track ; // } -//____________________________________________________________________________ -void AliRecPoint::Copy(AliRecPoint& recp) const +//_______________________________________________________________________ +void AliRecPoint::Copy(TObject& recp) const { // // Copy *this onto pts // // Copy all first - if(this != &recp) { - ((TObject*) this)->Copy((TObject&)recp); - recp.fAmp = fAmp; - recp.fGeom = fGeom; - recp.fIndexInList = fIndexInList; - recp.fLocPos = fLocPos; - recp.fLocPosM = new TMatrix(*fLocPosM); - recp.fMaxDigit = fMaxDigit; - recp.fMulDigit = fMulDigit; - recp.fMaxTrack = fMaxTrack; - recp.fMulTrack = fMulTrack; + if((TObject*)this != &recp) { + ((TObject*) this)->Copy(recp); + (dynamic_cast(recp)).fAmp = fAmp; + (dynamic_cast(recp)).fGeom = fGeom; + (dynamic_cast(recp)).fIndexInList = fIndexInList; + (dynamic_cast(recp)).fLocPos = fLocPos; + (dynamic_cast(recp)).fLocPosM = new TMatrixF(*fLocPosM); + (dynamic_cast(recp)).fMaxDigit = fMaxDigit; + (dynamic_cast(recp)).fMulDigit = fMulDigit; + (dynamic_cast(recp)).fMaxTrack = fMaxTrack; + (dynamic_cast(recp)).fMulTrack = fMulTrack; // Duplicate pointed objects - recp.fDigitsList = new Int_t[fMulDigit]; - memcpy(recp.fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t)); - recp.fTracksList = new Int_t[fMulTrack]; - memcpy(recp.fTracksList,fTracksList,fMulTrack*sizeof(Int_t)); + (dynamic_cast(recp)).fDigitsList = new Int_t[fMulDigit]; + memcpy((dynamic_cast(recp)).fDigitsList,fDigitsList,fMulDigit*sizeof(Int_t)); + (dynamic_cast(recp)).fTracksList = new Int_t[fMulTrack]; + memcpy((dynamic_cast(recp)).fTracksList,fTracksList,fMulTrack*sizeof(Int_t)); } } -//____________________________________________________________________________ -void AliRecPoint::GetCovarianceMatrix(TMatrix & mat) +//_______________________________________________________________________ +void AliRecPoint::GetCovarianceMatrix(TMatrixF & mat) const { // returns the covariant matrix for the local position @@ -193,15 +198,7 @@ void AliRecPoint::GetLocalPosition(TVector3 & pos) const } //____________________________________________________________________________ -AliRecPoint & AliRecPoint::operator= (const AliRecPoint &recp) -{ - recp.Copy(*this); - return (*this); -} - - -//____________________________________________________________________________ -void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrix & gmat) const +void AliRecPoint::GetGlobalPosition(TVector3 & gpos, TMatrixF & gmat) const { // returns the position of the cluster in the global reference system of ALICE // and the uncertainty on this position