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() :
39 // default constructor
45 //______________________________________________________________________________
46 AliAODCluster::AliAODCluster(Int_t id,
60 fFilterMap(selectInfo),
65 for (Int_t i = 0; i < 3; i++) fPosition[i] = 0.;
66 for (Int_t i = 0; i < 13; i++) fPID[i] = 0;
68 if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);}
69 if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);}
70 SetLabel(label, nLabel);
73 //______________________________________________________________________________
74 AliAODCluster::AliAODCluster(Int_t id,
88 fFilterMap(selectInfo),
93 for (Int_t i = 0; i < 3; i++) fPosition[i] = 0.;
94 for (Int_t i = 0; i < 13; i++) fPID[i] = 0;
96 if(x) {for (Int_t i = 0; i < 3 ; i++) SetPositionAt(x[i] ,i);}
97 if(pid) {for (Int_t i = 0; i < 13 ; i++) SetPIDAt (pid[i],i);}
98 SetLabel(label, nLabel);
102 //______________________________________________________________________________
103 AliAODCluster::~AliAODCluster()
110 //______________________________________________________________________________
111 void AliAODCluster::Clear(const Option_t*)
119 //______________________________________________________________________________
120 AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
122 fEnergy(clus.fEnergy),
127 fFilterMap(clus.fFilterMap),
129 fMCEnergyFraction(clus.fMCEnergyFraction)
133 for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];
134 for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];
136 SetLabel(clus.fLabel, clus.fNLabel);
139 //______________________________________________________________________________
140 AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
142 // Assignment operator
145 for(Int_t i = 0; i < 3 ; i++) fPosition[i] = clus.fPosition[i];
146 for(Int_t i = 0; i < 13 ; i++) fPID[i] = clus.fPID[i];
148 fEnergy = clus.fEnergy;
152 SetLabel(clus.fLabel, clus.fNLabel);
153 fFilterMap = clus.fFilterMap;
157 fMCEnergyFraction = clus.fMCEnergyFraction;
163 //______________________________________________________________________________
164 void AliAODCluster::SetPosition(Float_t *x)
173 fPosition[0] = -999.;
174 fPosition[1] = -999.;
175 fPosition[2] = -999.;
179 //______________________________________________________________________________
180 UShort_t AliAODCluster::GetMostProbablePID() const
182 // Returns the most probable PID array element.
185 UShort_t unknown = AliVCluster::kUnknown;
187 UShort_t loc = unknown;
189 Bool_t allTheSame = kTRUE;
191 for (Int_t iPID = 0; iPID < nPID; iPID++) {
192 if (fPID[iPID] >= max) {
193 if (fPID[iPID] > max) {
196 loc = (UShort_t)iPID;
202 return allTheSame ? unknown : loc;
205 //______________________________________________________________________________
206 void AliAODCluster::SetLabel(Int_t *label, UInt_t size)
208 if (label && size>0) {
209 if (size != (UInt_t)fNLabel) {
212 fLabel = new Int_t[fNLabel];
215 for (Int_t i = 0; i < fNLabel; i++) {
216 fLabel[i] = label[i];
225 //______________________________________________________________________________
226 Int_t AliAODCluster::GetLabelAt(UInt_t i) const
228 if (fLabel && i < (UInt_t)fNLabel) {
235 //______________________________________________________________________________
236 void AliAODCluster::RemoveLabel()
245 //______________________________________________________________________________
246 void AliAODCluster::Print(Option_t* /* option */) const
248 // prints information about AliAODCluster
250 printf("Cluster type: %d\n", GetType());
251 printf(" energy = %f\n", E());
252 printf(" chi2 = %f\n", Chi2());
253 const Double_t *pid = GetPID();
254 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",
255 pid[AliVCluster::kPhoton], pid[AliVCluster::kPi0],
256 pid[AliVCluster::kElectron], pid[AliVCluster::kEleCon],
257 pid[AliVCluster::kPion], pid[AliVCluster::kKaon], pid[AliVCluster::kProton],
258 pid[AliVCluster::kNeutron], pid[AliVCluster::kKaon0]);