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),
63 for (Int_t i = 0; i < 3; i++) fPosition[i] = 0.;
64 for (Int_t i = 0; i < 13; i++) fPID[i] = 0;
66 if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);}
67 if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);}
68 SetLabel(label, nLabel);
71 //______________________________________________________________________________
72 AliAODCluster::AliAODCluster(Int_t id,
86 fFilterMap(selectInfo),
90 for (Int_t i = 0; i < 3; i++) fPosition[i] = 0.;
91 for (Int_t i = 0; i < 13; i++) fPID[i] = 0;
93 if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);}
94 if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);}
95 SetLabel(label, nLabel);
99 //______________________________________________________________________________
100 AliAODCluster::~AliAODCluster()
107 //______________________________________________________________________________
108 void AliAODCluster::Clear(const Option_t*)
116 //______________________________________________________________________________
117 AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
119 fEnergy(clus.fEnergy),
124 fFilterMap(clus.fFilterMap),
129 for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];
130 for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];
132 SetLabel(clus.fLabel, clus.fNLabel);
135 //______________________________________________________________________________
136 AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
138 // Assignment operator
141 for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];
142 for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];
144 fEnergy = clus.fEnergy;
148 SetLabel(clus.fLabel, clus.fNLabel);
149 fFilterMap = clus.fFilterMap;
157 //______________________________________________________________________________
158 void AliAODCluster::SetPosition(Float_t *x)
167 fPosition[0] = -999.;
168 fPosition[1] = -999.;
169 fPosition[2] = -999.;
173 //______________________________________________________________________________
174 UShort_t AliAODCluster::GetMostProbablePID() const
176 // Returns the most probable PID array element.
179 UShort_t unknown = AliVCluster::kUnknown;
181 UShort_t loc = unknown;
183 Bool_t allTheSame = kTRUE;
185 for (Int_t iPID = 0; iPID < nPID; iPID++) {
186 if (fPID[iPID] >= max) {
187 if (fPID[iPID] > max) {
190 loc = (UShort_t)iPID;
196 return allTheSame ? unknown : loc;
199 //______________________________________________________________________________
200 void AliAODCluster::SetLabel(Int_t *label, UInt_t size)
202 if (label && size>0) {
203 if (size != (UInt_t)fNLabel) {
206 fLabel = new Int_t[fNLabel];
209 for (Int_t i = 0; i < fNLabel; i++) {
210 fLabel[i] = label[i];
219 //______________________________________________________________________________
220 Int_t AliAODCluster::GetLabelAt(UInt_t i) const
222 if (fLabel && i < (UInt_t)fNLabel) {
229 //______________________________________________________________________________
230 void AliAODCluster::RemoveLabel()
239 //______________________________________________________________________________
240 void AliAODCluster::Print(Option_t* /* option */) const
242 // prints information about AliAODCluster
244 printf("Cluster type: %d\n", GetType());
245 printf(" energy = %f\n", E());
246 printf(" chi2 = %f\n", Chi2());
247 const Double_t *pid = GetPID();
248 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",
249 pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0],
250 pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
251 pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton],
252 pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]);