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( TRootIOCtor* /*dummy*/ ):
77 fClusterRecords (0x0),
81 //__________________________________________________________________________
82 AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( void ):
83 fClusterRecords (new TClonesArray( "AliMUONAlignmentClusterRecord", fSize ) ),
88 //__________________________________________________________________________
89 AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( const AliMUONAlignmentTrackRecord& other ):
91 fClusterRecords (new TClonesArray( "AliMUONAlignmentClusterRecord", fSize ) ),
92 fClusterCount( other.fClusterCount )
95 // deep copy of records
96 for( Int_t index = 0; index < other.GetNRecords(); ++index )
97 { new ((*fClusterRecords)[index]) AliMUONAlignmentClusterRecord( *static_cast<const AliMUONAlignmentClusterRecord*>( other.fClusterRecords->UncheckedAt( index ) ) ); }
101 //__________________________________________________________________________
102 AliMUONAlignmentTrackRecord& AliMUONAlignmentTrackRecord::operator = ( const AliMUONAlignmentTrackRecord& other )
105 if( this == &other ) return *this;
108 TObject::operator =( other );
110 // copy number of cluster
111 fClusterCount = other.fClusterCount;
113 // deep copy of records
114 for( Int_t index = 0; index < other.GetNRecords(); ++index )
115 { new ((*fClusterRecords)[index]) AliMUONAlignmentClusterRecord( *static_cast<const AliMUONAlignmentClusterRecord*>( other.fClusterRecords->UncheckedAt( index ) ) ); }
122 //__________________________________________________________________________
123 void AliMUONAlignmentTrackRecord::Print( Option_t* ) const
126 std::cout << "AliMUONAlignmentTrackRecord::Print - fClusterCount: " << fClusterCount << std::endl;
127 if( fClusterRecords )
129 for( Int_t index = 0; index < fClusterCount; ++index )
130 { static_cast<AliMUONAlignmentClusterRecord*>( fClusterRecords->UncheckedAt( index ) )->Print(); }
135 //__________________________________________________________________________
136 AliMUONAlignmentTrackRecord::~AliMUONAlignmentTrackRecord( void )
139 // note: it is safe to delete a NULL pointer, so no need to check.
140 delete fClusterRecords;
144 //__________________________________________________________________________
145 void AliMUONAlignmentTrackRecord::AddClusterRecord( const AliMUONAlignmentClusterRecord& record )
148 // append copy to array
149 new ((*fClusterRecords)[fClusterCount]) AliMUONAlignmentClusterRecord( record );
154 //__________________________________________________________________________
155 void AliMUONAlignmentTrackRecord::RemoveClusterRecord( AliMUONAlignmentClusterRecord* record )
158 AliMUONAlignmentClusterRecord* local( static_cast<AliMUONAlignmentClusterRecord*>( fClusterRecords->Remove( record ) ) );
164 fClusterRecords->Compress();
167 } else AliWarning("object to remove does not exist in array fClusterRecords");
171 //__________________________________________________________________________
172 void AliMUONAlignmentTrackRecord::Clear( Option_t* options )
175 TObject::Clear( options );
177 // only Clear, not delete, since fClusterRecords does not allocate memory
178 fClusterRecords->Clear();