]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONAlignmentRecord.cxx
Fixing anti-aliasing problem on MacOSX
[u/mrichter/AliRoot.git] / MUON / AliMUONAlignmentRecord.cxx
CommitLineData
56218672 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//-----------------------------------------------------------------------------
19// Class AliMUONAlignmentClusterRecord
20// Class AliMUONAlignmentTrackRecord
21//-----------------------------------------------------------------------------
22
23#include "AliMUONAlignmentRecord.h"
24#include "AliLog.h"
25
26#include <iostream>
27
28// class implementation in root context
29ClassImp( AliMUONAlignmentClusterRecord )
30
31// class implementation in root context
32ClassImp( AliMUONAlignmentTrackRecord )
33
34//__________________________________________________________________________
35AliMUONAlignmentClusterRecord::AliMUONAlignmentClusterRecord( void ):
36 fDetElemId(0),
37 fDetElemNumber(0),
38 fMeas(0),
39 fSigma(0)
40{
41
42 // initialize derivatives
43 for( Int_t index = 0; index < 4; ++index )
44 {
45 fLocalDerivatives[index] = 0;
46 fGlobalDerivatives[index] = 0;
47 }
48
49}
50
51//__________________________________________________________________________
52void AliMUONAlignmentClusterRecord::Print( Option_t* ) const
53{
54
55 // detector id and measurement
56 std::cout
57 << " AliMUONAlignmentClusterRecord::Print - fDetElemId: " << fDetElemId
58 << " fMeas: " << fMeas
59 << " fSigma: " << fSigma;
60
61 // local derivatives
62 std::cout << " fLocalDerivatives: ";
63 for( Int_t index = 0; index < 4; ++index )
64 { std::cout << fLocalDerivatives[index] << " "; }
65
66 // global derivatives
67 std::cout << " fGlobalDerivatives: ";
68 for( Int_t index = 0; index < 4; ++index )
69 { std::cout << fGlobalDerivatives[index] << " "; }
70
71 std::cout << std::endl;
72
73}
74
75//__________________________________________________________________________
d9426e3f 76AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( TRootIOCtor* /*dummy*/ ):
77 fClusterRecords (0x0),
56218672 78 fClusterCount( 0 )
79 {}
80
d9426e3f 81//__________________________________________________________________________
82AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( void ):
83fClusterRecords (new TClonesArray( "AliMUONAlignmentClusterRecord", fSize ) ),
84fClusterCount( 0 )
85{}
86
87
56218672 88//__________________________________________________________________________
89AliMUONAlignmentTrackRecord::AliMUONAlignmentTrackRecord( const AliMUONAlignmentTrackRecord& other ):
90 TObject(other),
91 fClusterRecords (new TClonesArray( "AliMUONAlignmentClusterRecord", fSize ) ),
92 fClusterCount( other.fClusterCount )
93{
94
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 ) ) ); }
98
99}
100
101//__________________________________________________________________________
102AliMUONAlignmentTrackRecord& AliMUONAlignmentTrackRecord::operator = ( const AliMUONAlignmentTrackRecord& other )
103{
104
105 if( this == &other ) return *this;
106 Clear();
107
108 TObject::operator =( other );
109
110 // copy number of cluster
111 fClusterCount = other.fClusterCount;
112
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 ) ) ); }
116
117 return *this;
118
119}
120
121
122//__________________________________________________________________________
123void AliMUONAlignmentTrackRecord::Print( Option_t* ) const
124{
125
126 std::cout << "AliMUONAlignmentTrackRecord::Print - fClusterCount: " << fClusterCount << std::endl;
127 if( fClusterRecords )
128 {
129 for( Int_t index = 0; index < fClusterCount; ++index )
130 { static_cast<AliMUONAlignmentClusterRecord*>( fClusterRecords->UncheckedAt( index ) )->Print(); }
131 }
132
133}
134
135//__________________________________________________________________________
136AliMUONAlignmentTrackRecord::~AliMUONAlignmentTrackRecord( void )
137{
138
139 // note: it is safe to delete a NULL pointer, so no need to check.
140 delete fClusterRecords;
141
142}
143
144//__________________________________________________________________________
145void AliMUONAlignmentTrackRecord::AddClusterRecord( const AliMUONAlignmentClusterRecord& record )
146{
147
148 // append copy to array
149 new ((*fClusterRecords)[fClusterCount]) AliMUONAlignmentClusterRecord( record );
150 fClusterCount++;
151
152}
153
154//__________________________________________________________________________
155void AliMUONAlignmentTrackRecord::RemoveClusterRecord( AliMUONAlignmentClusterRecord* record )
156{
157
158 AliMUONAlignmentClusterRecord* local( static_cast<AliMUONAlignmentClusterRecord*>( fClusterRecords->Remove( record ) ) );
159
160 if( local )
161 {
162
163 delete local;
164 fClusterRecords->Compress();
165 fClusterCount--;
166
167 } else AliWarning("object to remove does not exist in array fClusterRecords");
168
169}
170
171//__________________________________________________________________________
172void AliMUONAlignmentTrackRecord::Clear( Option_t* options )
173{
174
175 TObject::Clear( options );
176
177 // only Clear, not delete, since fClusterRecords does not allocate memory
178 fClusterRecords->Clear();
179
180 // reset count
181 fClusterCount = 0;
182
183}