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*/)
122 //_____________________________________________________________________________
123 Int_t AliESDMuonCluster::GetNPads() const
125 // return the number of pads associated to the cluster
126 if (!fPads) return 0;
128 return fPads->GetEntriesFast();
131 //_____________________________________________________________________________
132 TClonesArray& AliESDMuonCluster::GetPads() const
134 // return the array of pads associated to the cluster
135 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
140 //_____________________________________________________________________________
141 void AliESDMuonCluster::AddPad(const AliESDMuonPad &pad)
143 // add a pad to the TClonesArray of pads associated to the cluster
144 if (!fPads) fPads = new TClonesArray("AliESDMuonPad",10);
146 new ((*fPads)[fPads->GetEntriesFast()]) AliESDMuonPad(pad);
149 //_____________________________________________________________________________
150 Bool_t AliESDMuonCluster::PadsStored() const
152 // return kTRUE if the pads associated to the cluster are registered
153 if (GetNPads() == 0) return kFALSE;
158 //_____________________________________________________________________________
159 void AliESDMuonCluster::Print(Option_t */*option*/) const
161 /// print cluster content
162 UInt_t cId = GetUniqueID();
164 cout<<Form("clusterID=%u (ch=%d, det=%d, index=%d)",
165 cId,GetChamberId(),GetDetElemId(),GetClusterIndex())<<endl;
167 cout<<Form(" position=(%5.2f, %5.2f, %5.2f), sigma=(%5.2f, %5.2f, 0.0)",
168 GetX(),GetY(),GetZ(),GetErrX(),GetErrY())<<endl;
170 cout<<Form(" charge=%5.2f, chi2=%5.2f, MClabel=%d", GetCharge(), GetChi2(), GetLabel())<<endl;
173 cout<<" pad infos:"<<endl;
174 for (Int_t iPad=0; iPad<GetNPads(); iPad++) {
176 ( (AliESDMuonPad*) fPads->UncheckedAt(iPad) )->Print();