]>
Commit | Line | Data |
---|---|---|
2060b217 | 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 AliMUONRawClusterV2 | |
20 | /// | |
21 | /// Class for the MUON RecPoint | |
22 | /// | |
23 | /// \author Philippe Pillot, Subatech | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | ||
27 | #include "AliMUONRawClusterV2.h" | |
a04a1860 | 28 | #include "AliMUONConstants.h" |
2060b217 | 29 | |
30 | #include "AliLog.h" | |
31 | ||
3448ba98 | 32 | #include <TClonesArray.h> |
33 | #include <Riostream.h> | |
2060b217 | 34 | |
35 | /// \cond CLASSIMP | |
36 | ClassImp(AliMUONRawClusterV2) | |
37 | /// \endcond | |
38 | ||
39 | ||
40 | //____________________________________________________ | |
41 | AliMUONRawClusterV2::AliMUONRawClusterV2() | |
42 | : AliMUONVCluster(), | |
43 | fX(FLT_MAX), | |
44 | fY(FLT_MAX), | |
45 | fZ(FLT_MAX), | |
a04a1860 | 46 | fErrX2(AliMUONConstants::DefaultNonBendingReso2()), |
47 | fErrY2(AliMUONConstants::DefaultBendingReso2()), | |
2060b217 | 48 | fQ(0.), |
49 | fChi2(0.), | |
50 | fNDigits(0), | |
51 | fDigitsId(0x0) | |
52 | { | |
53 | /// Default Constructor | |
54 | } | |
55 | ||
56 | //_____________________________________________________________________________ | |
57 | AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex) | |
58 | : AliMUONVCluster(chamberId, detElemId, clusterIndex), | |
59 | fX(FLT_MAX), | |
60 | fY(FLT_MAX), | |
61 | fZ(FLT_MAX), | |
a04a1860 | 62 | fErrX2(AliMUONConstants::DefaultNonBendingReso2()), |
63 | fErrY2(AliMUONConstants::DefaultBendingReso2()), | |
2060b217 | 64 | fQ(0.), |
65 | fChi2(0.), | |
66 | fNDigits(0), | |
67 | fDigitsId(0x0) | |
68 | { | |
69 | /// Constructor | |
70 | } | |
71 | ||
72 | //____________________________________________________ | |
73 | AliMUONRawClusterV2::~AliMUONRawClusterV2() | |
74 | { | |
75 | /// Destructor | |
76 | delete [] fDigitsId; | |
77 | } | |
78 | ||
79 | //____________________________________________________ | |
80 | AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster) | |
81 | : AliMUONVCluster(cluster), | |
82 | fX(cluster.fX), | |
83 | fY(cluster.fY), | |
84 | fZ(cluster.fZ), | |
85 | fErrX2(cluster.fErrX2), | |
86 | fErrY2(cluster.fErrY2), | |
87 | fQ(cluster.fQ), | |
88 | fChi2(cluster.fChi2), | |
89 | fNDigits(cluster.fNDigits), | |
90 | fDigitsId(0x0) | |
91 | ||
92 | { | |
93 | /// Copy constructor | |
94 | ||
95 | if (cluster.fDigitsId) { | |
96 | fDigitsId = new UInt_t[fNDigits]; | |
97 | memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t)); | |
98 | } | |
99 | } | |
100 | ||
101 | //__________________________________________________________________________ | |
102 | AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster) | |
103 | { | |
104 | /// Asignment operator | |
105 | ||
106 | // check assignement to self | |
107 | if (this == &cluster) | |
108 | return *this; | |
109 | ||
110 | // base class assignement | |
111 | AliMUONVCluster::operator=(cluster); | |
112 | ||
113 | fX = cluster.fX; | |
114 | fY = cluster.fY; | |
115 | fZ = cluster.fZ; | |
116 | fErrX2 = cluster.fErrX2; | |
117 | fErrY2 = cluster.fErrY2; | |
118 | fQ = cluster.fQ; | |
119 | fChi2 = cluster.fChi2; | |
120 | SetDigitsId(cluster.fNDigits,cluster.fDigitsId); | |
121 | ||
122 | return *this; | |
123 | } | |
124 | ||
125 | //____________________________________________________ | |
126 | void AliMUONRawClusterV2::Clear(Option_t*) | |
127 | { | |
103e6575 | 128 | /// clear memory |
2060b217 | 129 | delete [] fDigitsId; |
130 | fDigitsId = 0x0; | |
103e6575 | 131 | fNDigits = 0; |
2060b217 | 132 | } |
133 | ||
134 | //____________________________________________________ | |
135 | void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId) | |
136 | { | |
137 | /// Set size of array of digits Id to n ints and set the content | |
138 | /// if digitsId is not given the array is filled with id=0 | |
139 | ||
140 | if (fDigitsId && fNDigits != nDigits) { | |
141 | delete [] fDigitsId; | |
142 | fDigitsId = 0; | |
143 | } | |
144 | fNDigits = nDigits; | |
145 | if (fNDigits == 0) return; | |
146 | if (!fDigitsId) fDigitsId = new UInt_t[fNDigits]; | |
147 | if (digitsId == 0) | |
148 | for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0; | |
149 | else | |
150 | memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t)); | |
151 | } | |
152 | ||
153 | //____________________________________________________ | |
154 | void AliMUONRawClusterV2::AddDigitId(UInt_t id) | |
155 | { | |
156 | /// Reset size of array of digits Id and add the new id to its content | |
157 | ||
158 | UInt_t *digitsIdNew = new UInt_t[fNDigits+1]; | |
159 | memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t)); | |
160 | digitsIdNew[fNDigits++] = id; | |
9bf6860b | 161 | delete[] fDigitsId; |
2060b217 | 162 | fDigitsId = digitsIdNew; |
163 | } | |
164 | ||
165 | //____________________________________________________ | |
166 | Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const | |
167 | { | |
168 | /// Compare | |
169 | ||
170 | const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj); | |
171 | if ( GetCharge() > raw->GetCharge() ) | |
172 | { | |
173 | return 1; | |
174 | } | |
175 | else if ( GetCharge() < raw->GetCharge() ) | |
176 | { | |
177 | return -1; | |
178 | } | |
179 | return 0; | |
180 | } |