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"
31 #include "Riostream.h"
34 ClassImp(AliMUONRawClusterV2)
38 //____________________________________________________
39 AliMUONRawClusterV2::AliMUONRawClusterV2()
44 fErrX2(fgkDefaultNonBendingReso * fgkDefaultNonBendingReso),
45 fErrY2(fgkDefaultBendingReso * fgkDefaultBendingReso),
51 /// Default Constructor
54 //_____________________________________________________________________________
55 AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
56 : AliMUONVCluster(chamberId, detElemId, clusterIndex),
60 fErrX2(fgkDefaultNonBendingReso * fgkDefaultNonBendingReso),
61 fErrY2(fgkDefaultBendingReso * fgkDefaultBendingReso),
70 //____________________________________________________
71 AliMUONRawClusterV2::~AliMUONRawClusterV2()
77 //____________________________________________________
78 AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
79 : AliMUONVCluster(cluster),
83 fErrX2(cluster.fErrX2),
84 fErrY2(cluster.fErrY2),
87 fNDigits(cluster.fNDigits),
93 if (cluster.fDigitsId) {
94 fDigitsId = new UInt_t[fNDigits];
95 memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
99 //__________________________________________________________________________
100 AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
102 /// Asignment operator
104 // check assignement to self
105 if (this == &cluster)
108 // base class assignement
109 AliMUONVCluster::operator=(cluster);
114 fErrX2 = cluster.fErrX2;
115 fErrY2 = cluster.fErrY2;
117 fChi2 = cluster.fChi2;
118 SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
123 //____________________________________________________
124 void AliMUONRawClusterV2::Clear(Option_t*)
126 /// Reset this cluster, in particular the internal arrays are deleted.
131 fErrX2 = fgkDefaultNonBendingReso * fgkDefaultNonBendingReso;
132 fErrY2 = fgkDefaultBendingReso * fgkDefaultBendingReso;
140 //____________________________________________________
141 void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
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
146 if (fDigitsId && fNDigits != nDigits) {
151 if (fNDigits == 0) return;
152 if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
154 for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
156 memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
159 //____________________________________________________
160 void AliMUONRawClusterV2::AddDigitId(UInt_t id)
162 /// Reset size of array of digits Id and add the new id to its content
164 UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
165 memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
166 digitsIdNew[fNDigits++] = id;
168 fDigitsId = digitsIdNew;
171 //____________________________________________________
172 Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
176 const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
177 if ( GetCharge() > raw->GetCharge() )
181 else if ( GetCharge() < raw->GetCharge() )