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"
32 #include <TClonesArray.h>
33 #include <Riostream.h>
36 ClassImp(AliMUONRawClusterV2)
40 //____________________________________________________
41 AliMUONRawClusterV2::AliMUONRawClusterV2()
46 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
47 fErrY2(AliMUONConstants::DefaultBendingReso2()),
53 /// Default Constructor
56 //_____________________________________________________________________________
57 AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
58 : AliMUONVCluster(chamberId, detElemId, clusterIndex),
62 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
63 fErrY2(AliMUONConstants::DefaultBendingReso2()),
72 //____________________________________________________
73 AliMUONRawClusterV2::~AliMUONRawClusterV2()
79 //____________________________________________________
80 AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
81 : AliMUONVCluster(cluster),
85 fErrX2(cluster.fErrX2),
86 fErrY2(cluster.fErrY2),
89 fNDigits(cluster.fNDigits),
95 if (cluster.fDigitsId) {
96 fDigitsId = new UInt_t[fNDigits];
97 memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
101 //__________________________________________________________________________
102 AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
104 /// Asignment operator
106 // check assignement to self
107 if (this == &cluster)
110 // base class assignement
111 AliMUONVCluster::operator=(cluster);
116 fErrX2 = cluster.fErrX2;
117 fErrY2 = cluster.fErrY2;
119 fChi2 = cluster.fChi2;
120 SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
125 //____________________________________________________
126 void AliMUONRawClusterV2::Clear(Option_t*)
134 //____________________________________________________
135 void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
137 /// Set size of array of digits Id to n ints and set the content
138 /// if digitsId is not given the array is filled with id=0
140 if (fDigitsId && fNDigits != nDigits) {
145 if (fNDigits == 0) return;
146 if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
148 for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
150 memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
153 //____________________________________________________
154 void AliMUONRawClusterV2::AddDigitId(UInt_t id)
156 /// Reset size of array of digits Id and add the new id to its content
158 UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
159 memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
160 digitsIdNew[fNDigits++] = id;
162 fDigitsId = digitsIdNew;
165 //____________________________________________________
166 Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
170 const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
171 if ( GetCharge() > raw->GetCharge() )
175 else if ( GetCharge() < raw->GetCharge() )