]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONRawClusterV2.cxx
Bug fix for list of cc addresses
[u/mrichter/AliRoot.git] / MUON / AliMUONRawClusterV2.cxx
CommitLineData
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
3448ba98 30#include "AliESDMuonCluster.h"
31#include "AliESDMuonPad.h"
2060b217 32#include "AliLog.h"
33
3448ba98 34#include <TClonesArray.h>
35#include <Riostream.h>
2060b217 36
37/// \cond CLASSIMP
38ClassImp(AliMUONRawClusterV2)
39/// \endcond
40
41
42//____________________________________________________
43AliMUONRawClusterV2::AliMUONRawClusterV2()
44 : AliMUONVCluster(),
45 fX(FLT_MAX),
46 fY(FLT_MAX),
47 fZ(FLT_MAX),
a04a1860 48 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
49 fErrY2(AliMUONConstants::DefaultBendingReso2()),
2060b217 50 fQ(0.),
51 fChi2(0.),
52 fNDigits(0),
53 fDigitsId(0x0)
54{
55 /// Default Constructor
56}
57
58//_____________________________________________________________________________
59AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
60 : AliMUONVCluster(chamberId, detElemId, clusterIndex),
61 fX(FLT_MAX),
62 fY(FLT_MAX),
63 fZ(FLT_MAX),
a04a1860 64 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
65 fErrY2(AliMUONConstants::DefaultBendingReso2()),
2060b217 66 fQ(0.),
67 fChi2(0.),
68 fNDigits(0),
69 fDigitsId(0x0)
70{
71 /// Constructor
72}
73
3448ba98 74//____________________________________________________
75AliMUONRawClusterV2::AliMUONRawClusterV2(const AliESDMuonCluster& cluster)
76: AliMUONVCluster(cluster),
77 fX(cluster.GetX()),
78 fY(cluster.GetY()),
79 fZ(cluster.GetZ()),
80 fErrX2(cluster.GetErrX2()),
81 fErrY2(cluster.GetErrY2()),
82 fQ(cluster.GetCharge()),
83 fChi2(cluster.GetChi2()),
84 fNDigits(cluster.GetNPads()),
85 fDigitsId(0x0)
86
87{
88 /// Copy constructor
89
90 if (cluster.PadsStored()) {
91 fDigitsId = new UInt_t[fNDigits];
92 for (Int_t i=0; i<fNDigits; i++)
93 fDigitsId[i] = ((AliESDMuonPad*)cluster.GetPads().UncheckedAt(i))->GetUniqueID();
94 }
95}
96
2060b217 97//____________________________________________________
98AliMUONRawClusterV2::~AliMUONRawClusterV2()
99{
100 /// Destructor
101 delete [] fDigitsId;
102}
103
104//____________________________________________________
105AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
106 : AliMUONVCluster(cluster),
107 fX(cluster.fX),
108 fY(cluster.fY),
109 fZ(cluster.fZ),
110 fErrX2(cluster.fErrX2),
111 fErrY2(cluster.fErrY2),
112 fQ(cluster.fQ),
113 fChi2(cluster.fChi2),
114 fNDigits(cluster.fNDigits),
115 fDigitsId(0x0)
116
117{
118 /// Copy constructor
119
120 if (cluster.fDigitsId) {
121 fDigitsId = new UInt_t[fNDigits];
122 memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
123 }
124}
125
126 //__________________________________________________________________________
127AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
128{
129 /// Asignment operator
130
131 // check assignement to self
132 if (this == &cluster)
133 return *this;
134
135 // base class assignement
136 AliMUONVCluster::operator=(cluster);
137
138 fX = cluster.fX;
139 fY = cluster.fY;
140 fZ = cluster.fZ;
141 fErrX2 = cluster.fErrX2;
142 fErrY2 = cluster.fErrY2;
143 fQ = cluster.fQ;
144 fChi2 = cluster.fChi2;
145 SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
146
147 return *this;
148}
149
150//____________________________________________________
151void AliMUONRawClusterV2::Clear(Option_t*)
152{
153 /// Reset this cluster, in particular the internal arrays are deleted.
154
155 fX = FLT_MAX;
156 fY = FLT_MAX;
157 fZ = FLT_MAX;
a04a1860 158 fErrX2 = AliMUONConstants::DefaultNonBendingReso2();
159 fErrY2 = AliMUONConstants::DefaultBendingReso2();
2060b217 160 fQ = 0.;
161 fChi2 = 0.;
162 fNDigits = 0;
163 delete [] fDigitsId;
164 fDigitsId = 0x0;
165}
166
167//____________________________________________________
168void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
169{
170 /// Set size of array of digits Id to n ints and set the content
171 /// if digitsId is not given the array is filled with id=0
172
173 if (fDigitsId && fNDigits != nDigits) {
174 delete [] fDigitsId;
175 fDigitsId = 0;
176 }
177 fNDigits = nDigits;
178 if (fNDigits == 0) return;
179 if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
180 if (digitsId == 0)
181 for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
182 else
183 memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
184}
185
186//____________________________________________________
187void AliMUONRawClusterV2::AddDigitId(UInt_t id)
188{
189 /// Reset size of array of digits Id and add the new id to its content
190
191 UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
192 memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
193 digitsIdNew[fNDigits++] = id;
194 delete fDigitsId;
195 fDigitsId = digitsIdNew;
196}
197
198//____________________________________________________
199Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
200{
201/// Compare
202
203 const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
204 if ( GetCharge() > raw->GetCharge() )
205 {
206 return 1;
207 }
208 else if ( GetCharge() < raw->GetCharge() )
209 {
210 return -1;
211 }
212 return 0;
213}