1 /**************************************************************************
2 * Copyright(c) 1998-2007, 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 // AOD cluster base class
20 // Author: Markus Oldenburg, CERN
21 //-------------------------------------------------------------------------
23 #include "AliAODCluster.h"
25 ClassImp(AliAODCluster)
27 //______________________________________________________________________________
28 AliAODCluster::AliAODCluster() :
38 // default constructor
44 //______________________________________________________________________________
45 AliAODCluster::AliAODCluster(Int_t id,
59 fFilterMap(selectInfo),
64 if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);}
65 if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);}
66 SetLabel(label, nLabel);
69 //______________________________________________________________________________
70 AliAODCluster::AliAODCluster(Int_t id,
84 fFilterMap(selectInfo),
88 if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);}
89 if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);}
90 SetLabel(label, nLabel);
94 //______________________________________________________________________________
95 AliAODCluster::~AliAODCluster()
103 //______________________________________________________________________________
104 AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
106 fEnergy(clus.fEnergy),
111 fFilterMap(clus.fFilterMap),
116 if(fPosition) {for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];}
117 if(fPID) {for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];}
119 SetLabel(clus.fLabel, clus.fNLabel);
122 //______________________________________________________________________________
123 AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
125 // Assignment operator
128 if(fPosition) {for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];}
129 if(fPID) {for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];}
131 fEnergy = clus.fEnergy;
135 SetLabel(clus.fLabel, clus.fNLabel);
136 fFilterMap = clus.fFilterMap;
144 //______________________________________________________________________________
145 void AliAODCluster::SetPosition(Float_t *x)
154 fPosition[0] = -999.;
155 fPosition[1] = -999.;
156 fPosition[2] = -999.;
160 //______________________________________________________________________________
161 UShort_t AliAODCluster::GetMostProbablePID() const
163 // Returns the most probable PID array element.
166 UShort_t unknown = AliVCluster::kUnknown;
169 UShort_t loc = unknown;
171 Bool_t allTheSame = kTRUE;
173 for (Int_t iPID = 0; iPID < nPID; iPID++) {
174 if (fPID[iPID] >= max) {
175 if (fPID[iPID] > max) {
178 loc = (UShort_t)iPID;
185 return allTheSame ? unknown : loc;
191 //______________________________________________________________________________
192 void AliAODCluster::SetLabel(Int_t *label, UInt_t size)
194 if (label && size>0) {
195 if (size != (UInt_t)fNLabel) {
198 fLabel = new Int_t[fNLabel];
201 for (Int_t i = 0; i < fNLabel; i++) {
202 fLabel[i] = label[i];
211 //______________________________________________________________________________
212 Int_t AliAODCluster::GetLabelAt(UInt_t i) const
214 if (fLabel && i < (UInt_t)fNLabel) {
221 //______________________________________________________________________________
222 void AliAODCluster::RemoveLabel()
231 //______________________________________________________________________________
232 void AliAODCluster::Print(Option_t* /* option */) const
234 // prints information about AliAODCluster
236 printf("Cluster type: %d\n", GetType());
237 printf(" energy = %f\n", E());
238 printf(" chi2 = %f\n", Chi2());
239 const Double_t *pid = GetPID();
240 printf("PID weights: photon %0.2f, pi0 %0.2f, electron %0.2f, conversion electron %0.2f\n, hadrons: pion %0.2f, kaon %0.2f, proton %0.2f , neutron %0.2f, kaon %0.2f \n",
241 pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0],
242 pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
243 pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton],
244 pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]);