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 AliMUONRawClusterV2
21 /// Class for the MUON RecPoint
23 /// \author Philippe Pillot, Subatech
24 //-----------------------------------------------------------------------------
27 #include "AliMUONRawClusterV2.h"
28 #include "AliMUONConstants.h"
30 #include "AliESDMuonCluster.h"
31 #include "AliESDMuonPad.h"
34 #include <TClonesArray.h>
35 #include <Riostream.h>
38 ClassImp(AliMUONRawClusterV2)
42 //____________________________________________________
43 AliMUONRawClusterV2::AliMUONRawClusterV2()
48 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
49 fErrY2(AliMUONConstants::DefaultBendingReso2()),
55 /// Default Constructor
58 //_____________________________________________________________________________
59 AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
60 : AliMUONVCluster(chamberId, detElemId, clusterIndex),
64 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
65 fErrY2(AliMUONConstants::DefaultBendingReso2()),
74 //____________________________________________________
75 AliMUONRawClusterV2::AliMUONRawClusterV2(const AliESDMuonCluster& cluster)
76 : AliMUONVCluster(cluster),
80 fErrX2(cluster.GetErrX2()),
81 fErrY2(cluster.GetErrY2()),
82 fQ(cluster.GetCharge()),
83 fChi2(cluster.GetChi2()),
84 fNDigits(cluster.GetNPads()),
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();
97 //____________________________________________________
98 AliMUONRawClusterV2::~AliMUONRawClusterV2()
104 //____________________________________________________
105 AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
106 : AliMUONVCluster(cluster),
110 fErrX2(cluster.fErrX2),
111 fErrY2(cluster.fErrY2),
113 fChi2(cluster.fChi2),
114 fNDigits(cluster.fNDigits),
120 if (cluster.fDigitsId) {
121 fDigitsId = new UInt_t[fNDigits];
122 memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
126 //__________________________________________________________________________
127 AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
129 /// Asignment operator
131 // check assignement to self
132 if (this == &cluster)
135 // base class assignement
136 AliMUONVCluster::operator=(cluster);
141 fErrX2 = cluster.fErrX2;
142 fErrY2 = cluster.fErrY2;
144 fChi2 = cluster.fChi2;
145 SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
150 //____________________________________________________
151 void AliMUONRawClusterV2::Clear(Option_t*)
153 /// Reset this cluster, in particular the internal arrays are deleted.
158 fErrX2 = AliMUONConstants::DefaultNonBendingReso2();
159 fErrY2 = AliMUONConstants::DefaultBendingReso2();
167 //____________________________________________________
168 void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
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
173 if (fDigitsId && fNDigits != nDigits) {
178 if (fNDigits == 0) return;
179 if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
181 for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
183 memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
186 //____________________________________________________
187 void AliMUONRawClusterV2::AddDigitId(UInt_t id)
189 /// Reset size of array of digits Id and add the new id to its content
191 UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
192 memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
193 digitsIdNew[fNDigits++] = id;
195 fDigitsId = digitsIdNew;
198 //____________________________________________________
199 Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
203 const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
204 if ( GetCharge() > raw->GetCharge() )
208 else if ( GetCharge() < raw->GetCharge() )