1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 // Class AliMUONAlignmentClusterRecord
20 // Class AliMUONAlignmentTrackRecord
21 //-----------------------------------------------------------------------------
23 #include "AliMUONAlignmentRecord.h"
28 // class implementation in root context
29 ClassImp( AliMUONAlignmentClusterRecord )
31 // class implementation in root context
32 ClassImp( AliMUONAlignmentTrackRecord )
34 //__________________________________________________________________________
35 AliMUONAlignmentClusterRecord::AliMUONAlignmentClusterRecord( void ):
42 // initialize derivatives
43 for( Int_t index = 0; index < 4; ++index )
45 fLocalDerivatives[index] = 0;
46 fGlobalDerivatives[index] = 0;
51 //__________________________________________________________________________
52 void AliMUONAlignmentClusterRecord::Print( Option_t* ) const
55 // detector id and measurement
57 << " AliMUONAlignmentClusterRecord::Print - fDetElemId: " << fDetElemId
58 << " fMeas: " << fMeas
59 << " fSigma: " << fSigma;
62 std::cout << " fLocalDerivatives: ";
63 for( Int_t index = 0; index < 4; ++index )
64 { std::cout << fLocalDerivatives[index] << " "; }
67 std::cout << " fGlobalDerivatives: ";
68 for( Int_t index = 0; index < 4; ++index )
69 { std::cout << fGlobalDerivatives[index] << " "; }
71 std::cout << std::endl;
75 //__________________________________________________________________________
76 AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( void ):
77 fClusterRecords (new TClonesArray( "AliMUONAlignmentClusterRecord", fSize ) ),
81 //__________________________________________________________________________
82 AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( const AliMUONAlignmentTrackRecord& other ):
84 fClusterRecords (new TClonesArray( "AliMUONAlignmentClusterRecord", fSize ) ),
85 fClusterCount( other.fClusterCount )
88 // deep copy of records
89 for( Int_t index = 0; index < other.GetNRecords(); ++index )
90 { new ((*fClusterRecords)[index]) AliMUONAlignmentClusterRecord( *static_cast<const AliMUONAlignmentClusterRecord*>( other.fClusterRecords->UncheckedAt( index ) ) ); }
94 //__________________________________________________________________________
95 AliMUONAlignmentTrackRecord& AliMUONAlignmentTrackRecord::operator = ( const AliMUONAlignmentTrackRecord& other )
98 if( this == &other ) return *this;
101 TObject::operator =( other );
103 // copy number of cluster
104 fClusterCount = other.fClusterCount;
106 // deep copy of records
107 for( Int_t index = 0; index < other.GetNRecords(); ++index )
108 { new ((*fClusterRecords)[index]) AliMUONAlignmentClusterRecord( *static_cast<const AliMUONAlignmentClusterRecord*>( other.fClusterRecords->UncheckedAt( index ) ) ); }
115 //__________________________________________________________________________
116 void AliMUONAlignmentTrackRecord::Print( Option_t* ) const
119 std::cout << "AliMUONAlignmentTrackRecord::Print - fClusterCount: " << fClusterCount << std::endl;
120 if( fClusterRecords )
122 for( Int_t index = 0; index < fClusterCount; ++index )
123 { static_cast<AliMUONAlignmentClusterRecord*>( fClusterRecords->UncheckedAt( index ) )->Print(); }
128 //__________________________________________________________________________
129 AliMUONAlignmentTrackRecord::~AliMUONAlignmentTrackRecord( void )
132 // note: it is safe to delete a NULL pointer, so no need to check.
133 delete fClusterRecords;
137 //__________________________________________________________________________
138 void AliMUONAlignmentTrackRecord::AddClusterRecord( const AliMUONAlignmentClusterRecord& record )
141 // append copy to array
142 new ((*fClusterRecords)[fClusterCount]) AliMUONAlignmentClusterRecord( record );
147 //__________________________________________________________________________
148 void AliMUONAlignmentTrackRecord::RemoveClusterRecord( AliMUONAlignmentClusterRecord* record )
151 AliMUONAlignmentClusterRecord* local( static_cast<AliMUONAlignmentClusterRecord*>( fClusterRecords->Remove( record ) ) );
157 fClusterRecords->Compress();
160 } else AliWarning("object to remove does not exist in array fClusterRecords");
164 //__________________________________________________________________________
165 void AliMUONAlignmentTrackRecord::Clear( Option_t* options )
168 TObject::Clear( options );
170 // only Clear, not delete, since fClusterRecords does not allocate memory
171 fClusterRecords->Clear();