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 <TClonesArray.h>
32 #include <Riostream.h>
35 ClassImp(AliMUONRawClusterV2)
39 //____________________________________________________
40 AliMUONRawClusterV2::AliMUONRawClusterV2()
53 /// Default Constructor
56 //_____________________________________________________________________________
57 AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
58 : AliMUONVCluster(chamberId, detElemId, clusterIndex),
73 //____________________________________________________
74 AliMUONRawClusterV2::~AliMUONRawClusterV2()
80 //____________________________________________________
81 AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
82 : AliMUONVCluster(cluster),
86 fErrX2(cluster.fErrX2),
87 fErrY2(cluster.fErrY2),
90 fNDigits(cluster.fNDigits),
92 fMCLabel(cluster.fMCLabel)
97 if (cluster.fDigitsId) {
98 fDigitsId = new UInt_t[fNDigits];
99 memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
103 //__________________________________________________________________________
104 AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
106 /// Asignment operator
108 // check assignement to self
109 if (this == &cluster)
112 // base class assignement
113 AliMUONVCluster::operator=(cluster);
118 fErrX2 = cluster.fErrX2;
119 fErrY2 = cluster.fErrY2;
121 fChi2 = cluster.fChi2;
122 SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
123 fMCLabel = cluster.fMCLabel;
128 //____________________________________________________
129 void AliMUONRawClusterV2::Clear(Option_t*)
137 //____________________________________________________
138 void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
140 /// Set size of array of digits Id to n ints and set the content
141 /// if digitsId is not given the array is filled with id=0
143 if (fDigitsId && fNDigits != nDigits) {
148 if (fNDigits == 0) return;
149 if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
151 for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
153 memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
156 //____________________________________________________
157 void AliMUONRawClusterV2::AddDigitId(UInt_t id)
159 /// Reset size of array of digits Id and add the new id to its content
161 UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
162 memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
163 digitsIdNew[fNDigits++] = id;
165 fDigitsId = digitsIdNew;
168 //____________________________________________________
169 Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
173 const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
174 if ( GetCharge() > raw->GetCharge() )
178 else if ( GetCharge() < raw->GetCharge() )