]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliESDMuonCluster.cxx
Gsatt replaces
[u/mrichter/AliRoot.git] / STEER / AliESDMuonCluster.cxx
CommitLineData
d5efea33 1/**************************************************************************
2* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3* *
4* Author: The ALICE Off-line Project. *
5* Contributors are mentioned in the code where appropriate. *
6* *
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**************************************************************************/
15
16// $Id$
17
18//-----------------------------------------------------------------------------
19/// \class AliESDMuonCluster
20///
21/// Class to describe the MUON clusters in the Event Summary Data
22///
23/// \author Philippe Pillot, Subatech
24//-----------------------------------------------------------------------------
25
26#include "AliESDMuonCluster.h"
c34d2b8c 27#include "AliESDMuonPad.h"
d5efea33 28
29#include "AliLog.h"
30
c34d2b8c 31#include <TClonesArray.h>
d5efea33 32#include <Riostream.h>
33
34/// \cond CLASSIMP
35ClassImp(AliESDMuonCluster)
36/// \endcond
37
38//_____________________________________________________________________________
39AliESDMuonCluster::AliESDMuonCluster()
c34d2b8c 40: TObject(),
41 fCharge(0.),
42 fChi2(0.),
2e2d0c44 43 fPads(0x0),
44 fLabel(-1)
d5efea33 45{
46 /// default constructor
47 fXYZ[0] = fXYZ[1] = fXYZ[2] = 0.;
48 fErrXY[0] = fErrXY[1] = 0.;
49}
50
51//_____________________________________________________________________________
52AliESDMuonCluster::AliESDMuonCluster (const AliESDMuonCluster& cluster)
c34d2b8c 53: TObject(cluster),
54 fCharge(cluster.fCharge),
55 fChi2(cluster.fChi2),
2e2d0c44 56 fPads(0x0),
57 fLabel(cluster.fLabel)
d5efea33 58{
59 /// Copy constructor
60 fXYZ[0] = cluster.fXYZ[0];
61 fXYZ[1] = cluster.fXYZ[1];
62 fXYZ[2] = cluster.fXYZ[2];
63 fErrXY[0] = cluster.fErrXY[0];
64 fErrXY[1] = cluster.fErrXY[1];
c34d2b8c 65
66 if (cluster.fPads) {
67 fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
68 AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
69 while (pad) {
70 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
71 pad = (AliESDMuonPad*) cluster.fPads->After(pad);
72 }
73 }
d5efea33 74}
75
76//_____________________________________________________________________________
77AliESDMuonCluster& AliESDMuonCluster::operator=(const AliESDMuonCluster& cluster)
78{
79 /// Equal operator
80 if (this == &cluster) return *this;
81
82 TObject::operator=(cluster); // don't forget to invoke the base class' assignment operator
83
84 fXYZ[0] = cluster.fXYZ[0];
85 fXYZ[1] = cluster.fXYZ[1];
86 fXYZ[2] = cluster.fXYZ[2];
87 fErrXY[0] = cluster.fErrXY[0];
88 fErrXY[1] = cluster.fErrXY[1];
89
c34d2b8c 90 fCharge = cluster.fCharge;
91 fChi2 = cluster.fChi2;
2e2d0c44 92 fLabel = cluster.fLabel;
c34d2b8c 93
94 delete fPads;
95 if (cluster.fPads) {
96 fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
97 AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
98 while (pad) {
99 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
100 pad = (AliESDMuonPad*) cluster.fPads->After(pad);
101 }
102 } else fPads = 0x0;
103
d5efea33 104 return *this;
105}
106
c34d2b8c 107//__________________________________________________________________________
108AliESDMuonCluster::~AliESDMuonCluster()
109{
110 /// Destructor
111 delete fPads;
112}
113
114//__________________________________________________________________________
9e5a26b4 115void AliESDMuonCluster::Clear(Option_t* /*opt*/)
c34d2b8c 116{
117 /// Clear arrays
9e5a26b4 118 delete fPads;
119 fPads = 0x0;
c34d2b8c 120}
121
122//_____________________________________________________________________________
123Int_t AliESDMuonCluster::GetNPads() const
124{
125 // return the number of pads associated to the cluster
126 if (!fPads) return 0;
127
128 return fPads->GetEntriesFast();
129}
130
131//_____________________________________________________________________________
132TClonesArray& AliESDMuonCluster::GetPads() const
133{
134 // return the array of pads associated to the cluster
135 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
136
137 return *fPads;
138}
139
140//_____________________________________________________________________________
141void AliESDMuonCluster::AddPad(const AliESDMuonPad &pad)
142{
143 // add a pad to the TClonesArray of pads associated to the cluster
144 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
145
146 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(pad);
147}
148
149//_____________________________________________________________________________
150Bool_t AliESDMuonCluster::PadsStored() const
151{
152 // return kTRUE if the pads associated to the cluster are registered
153 if (GetNPads() == 0) return kFALSE;
154
155 return kTRUE;
156}
157
d5efea33 158//_____________________________________________________________________________
159void AliESDMuonCluster::Print(Option_t */*option*/) const
160{
161 /// print cluster content
162 UInt_t cId = GetUniqueID();
163
164 cout<<Form("clusterID=%u (ch=%d, det=%d, index=%d)",
165 cId,GetChamberId(),GetDetElemId(),GetClusterIndex())<<endl;
166
c34d2b8c 167 cout<<Form(" position=(%5.2f, %5.2f, %5.2f), sigma=(%5.2f, %5.2f, 0.0)",
d5efea33 168 GetX(),GetY(),GetZ(),GetErrX(),GetErrY())<<endl;
c34d2b8c 169
2e2d0c44 170 cout<<Form(" charge=%5.2f, chi2=%5.2f, MClabel=%d", GetCharge(), GetChi2(), GetLabel())<<endl;
c34d2b8c 171
172 if (PadsStored()) {
173 cout<<" pad infos:"<<endl;
174 for (Int_t iPad=0; iPad<GetNPads(); iPad++) {
175 cout<<" ";
176 ( (AliESDMuonPad*) fPads->UncheckedAt(iPad) )->Print();
177 }
178 }
d5efea33 179}
180