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()
45 /// default constructor
46 fXYZ[0] = fXYZ[1] = fXYZ[2] = 0.;
47 fErrXY[0] = fErrXY[1] = 0.;
50 //_____________________________________________________________________________
51 AliESDMuonCluster::AliESDMuonCluster (const AliESDMuonCluster& cluster)
53 fCharge(cluster.fCharge),
58 fXYZ[0] = cluster.fXYZ[0];
59 fXYZ[1] = cluster.fXYZ[1];
60 fXYZ[2] = cluster.fXYZ[2];
61 fErrXY[0] = cluster.fErrXY[0];
62 fErrXY[1] = cluster.fErrXY[1];
65 fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
66 AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
68 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
69 pad = (AliESDMuonPad*) cluster.fPads->After(pad);
74 //_____________________________________________________________________________
75 AliESDMuonCluster& AliESDMuonCluster::operator=(const AliESDMuonCluster& cluster)
78 if (this == &cluster) return *this;
80 TObject::operator=(cluster); // don't forget to invoke the base class' assignment operator
82 fXYZ[0] = cluster.fXYZ[0];
83 fXYZ[1] = cluster.fXYZ[1];
84 fXYZ[2] = cluster.fXYZ[2];
85 fErrXY[0] = cluster.fErrXY[0];
86 fErrXY[1] = cluster.fErrXY[1];
88 fCharge = cluster.fCharge;
89 fChi2 = cluster.fChi2;
93 fPads = new TClonesArray("AliESDMuonPad",cluster.fPads->GetEntriesFast());
94 AliESDMuonPad *pad = (AliESDMuonPad*) cluster.fPads->First();
96 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(*pad);
97 pad = (AliESDMuonPad*) cluster.fPads->After(pad);
104 //__________________________________________________________________________
105 AliESDMuonCluster::~AliESDMuonCluster()
111 //__________________________________________________________________________
112 void AliESDMuonCluster::Clear(Option_t* opt)
115 if (fPads) fPads->Clear(opt);
118 //_____________________________________________________________________________
119 Int_t AliESDMuonCluster::GetNPads() const
121 // return the number of pads associated to the cluster
122 if (!fPads) return 0;
124 return fPads->GetEntriesFast();
127 //_____________________________________________________________________________
128 TClonesArray& AliESDMuonCluster::GetPads() const
130 // return the array of pads associated to the cluster
131 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
136 //_____________________________________________________________________________
137 void AliESDMuonCluster::AddPad(const AliESDMuonPad &pad)
139 // add a pad to the TClonesArray of pads associated to the cluster
140 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
142 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(pad);
145 //_____________________________________________________________________________
146 Bool_t AliESDMuonCluster::PadsStored() const
148 // return kTRUE if the pads associated to the cluster are registered
149 if (GetNPads() == 0) return kFALSE;
154 //_____________________________________________________________________________
155 void AliESDMuonCluster::Print(Option_t */*option*/) const
157 /// print cluster content
158 UInt_t cId = GetUniqueID();
160 cout<<Form("clusterID=%u (ch=%d, det=%d, index=%d)",
161 cId,GetChamberId(),GetDetElemId(),GetClusterIndex())<<endl;
163 cout<<Form(" position=(%5.2f, %5.2f, %5.2f), sigma=(%5.2f, %5.2f, 0.0)",
164 GetX(),GetY(),GetZ(),GetErrX(),GetErrY())<<endl;
166 cout<<Form(" charge=%5.2f, chi2=%5.2f", GetCharge(), GetChi2())<<endl;
169 cout<<" pad infos:"<<endl;
170 for (Int_t iPad=0; iPad<GetNPads(); iPad++) {
172 ( (AliESDMuonPad*) fPads->UncheckedAt(iPad) )->Print();