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