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 AliESDMuonCluster
21 /// Class to describe the MUON clusters in the Event Summary Data
23 /// \author Philippe Pillot, Subatech
24 //-----------------------------------------------------------------------------
26 #include "AliESDMuonCluster.h"
27 #include "AliESDMuonPad.h"
31 #include <TClonesArray.h>
32 #include <Riostream.h>
35 ClassImp(AliESDMuonCluster)
38 //_____________________________________________________________________________
39 AliESDMuonCluster::AliESDMuonCluster()
46 /// default constructor
47 fXYZ[0] = fXYZ[1] = fXYZ[2] = 0.;
48 fErrXY[0] = fErrXY[1] = 0.;
51 //_____________________________________________________________________________
52 AliESDMuonCluster::AliESDMuonCluster (const AliESDMuonCluster& cluster)
54 fCharge(cluster.fCharge),
57 fLabel(cluster.fLabel)
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];
67 fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
68 AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
70 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
71 pad = (AliESDMuonPad*) cluster.fPads->After(pad);
76 //_____________________________________________________________________________
77 AliESDMuonCluster& AliESDMuonCluster::operator=(const AliESDMuonCluster& cluster)
80 if (this == &cluster) return *this;
82 TObject::operator=(cluster); // don't forget to invoke the base class' assignment operator
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];
90 fCharge = cluster.fCharge;
91 fChi2 = cluster.fChi2;
92 fLabel = cluster.fLabel;
96 fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
97 AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
99 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
100 pad = (AliESDMuonPad*) cluster.fPads->After(pad);
107 //__________________________________________________________________________
108 AliESDMuonCluster::~AliESDMuonCluster()
114 //__________________________________________________________________________
115 void AliESDMuonCluster::Clear(Option_t* opt)
118 if (fPads) fPads->Clear(opt);
121 //_____________________________________________________________________________
122 Int_t AliESDMuonCluster::GetNPads() const
124 // return the number of pads associated to the cluster
125 if (!fPads) return 0;
127 return fPads->GetEntriesFast();
130 //_____________________________________________________________________________
131 TClonesArray& AliESDMuonCluster::GetPads() const
133 // return the array of pads associated to the cluster
134 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
139 //_____________________________________________________________________________
140 void AliESDMuonCluster::AddPad(const AliESDMuonPad &pad)
142 // add a pad to the TClonesArray of pads associated to the cluster
143 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
145 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(pad);
148 //_____________________________________________________________________________
149 Bool_t AliESDMuonCluster::PadsStored() const
151 // return kTRUE if the pads associated to the cluster are registered
152 if (GetNPads() == 0) return kFALSE;
157 //_____________________________________________________________________________
158 void AliESDMuonCluster::Print(Option_t */*option*/) const
160 /// print cluster content
161 UInt_t cId = GetUniqueID();
163 cout<<Form("clusterID=%u (ch=%d, det=%d, index=%d)",
164 cId,GetChamberId(),GetDetElemId(),GetClusterIndex())<<endl;
166 cout<<Form(" position=(%5.2f, %5.2f, %5.2f), sigma=(%5.2f, %5.2f, 0.0)",
167 GetX(),GetY(),GetZ(),GetErrX(),GetErrY())<<endl;
169 cout<<Form(" charge=%5.2f, chi2=%5.2f, MClabel=%d", GetCharge(), GetChi2(), GetLabel())<<endl;
172 cout<<" pad infos:"<<endl;
173 for (Int_t iPad=0; iPad<GetNPads(); iPad++) {
175 ( (AliESDMuonPad*) fPads->UncheckedAt(iPad) )->Print();