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 "Riostream.h"
35 ClassImp(AliMUONRawClusterV2)
39 //____________________________________________________
40 AliMUONRawClusterV2::AliMUONRawClusterV2()
45 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
46 fErrY2(AliMUONConstants::DefaultBendingReso2()),
52 /// Default Constructor
55 //_____________________________________________________________________________
56 AliMUONRawClusterV2::AliMUONRawClusterV2(Int_t chamberId, Int_t detElemId, Int_t clusterIndex)
57 : AliMUONVCluster(chamberId, detElemId, clusterIndex),
61 fErrX2(AliMUONConstants::DefaultNonBendingReso2()),
62 fErrY2(AliMUONConstants::DefaultBendingReso2()),
71 //____________________________________________________
72 AliMUONRawClusterV2::~AliMUONRawClusterV2()
78 //____________________________________________________
79 AliMUONRawClusterV2::AliMUONRawClusterV2(const AliMUONRawClusterV2& cluster)
80 : AliMUONVCluster(cluster),
84 fErrX2(cluster.fErrX2),
85 fErrY2(cluster.fErrY2),
88 fNDigits(cluster.fNDigits),
94 if (cluster.fDigitsId) {
95 fDigitsId = new UInt_t[fNDigits];
96 memcpy(fDigitsId,cluster.fDigitsId, fNDigits*sizeof(UInt_t));
100 //__________________________________________________________________________
101 AliMUONRawClusterV2 & AliMUONRawClusterV2::operator=(const AliMUONRawClusterV2& cluster)
103 /// Asignment operator
105 // check assignement to self
106 if (this == &cluster)
109 // base class assignement
110 AliMUONVCluster::operator=(cluster);
115 fErrX2 = cluster.fErrX2;
116 fErrY2 = cluster.fErrY2;
118 fChi2 = cluster.fChi2;
119 SetDigitsId(cluster.fNDigits,cluster.fDigitsId);
124 //____________________________________________________
125 void AliMUONRawClusterV2::Clear(Option_t*)
127 /// Reset this cluster, in particular the internal arrays are deleted.
132 fErrX2 = AliMUONConstants::DefaultNonBendingReso2();
133 fErrY2 = AliMUONConstants::DefaultBendingReso2();
141 //____________________________________________________
142 void AliMUONRawClusterV2::SetDigitsId(Int_t nDigits, const UInt_t *digitsId)
144 /// Set size of array of digits Id to n ints and set the content
145 /// if digitsId is not given the array is filled with id=0
147 if (fDigitsId && fNDigits != nDigits) {
152 if (fNDigits == 0) return;
153 if (!fDigitsId) fDigitsId = new UInt_t[fNDigits];
155 for (Int_t i=0; i<fNDigits; i++) fDigitsId[i] = 0;
157 memcpy(fDigitsId,digitsId, fNDigits*sizeof(UInt_t));
160 //____________________________________________________
161 void AliMUONRawClusterV2::AddDigitId(UInt_t id)
163 /// Reset size of array of digits Id and add the new id to its content
165 UInt_t *digitsIdNew = new UInt_t[fNDigits+1];
166 memcpy(digitsIdNew,fDigitsId, fNDigits*sizeof(UInt_t));
167 digitsIdNew[fNDigits++] = id;
169 fDigitsId = digitsIdNew;
172 //____________________________________________________
173 Int_t AliMUONRawClusterV2::Compare(const TObject *obj) const
177 const AliMUONRawClusterV2* raw = static_cast<const AliMUONRawClusterV2*>(obj);
178 if ( GetCharge() > raw->GetCharge() )
182 else if ( GetCharge() < raw->GetCharge() )