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() :
37 // default constructor
39 SetPosition((Float_t*)NULL);
40 SetPID((Float_t*)NULL);
43 //______________________________________________________________________________
44 AliAODCluster::AliAODCluster(Int_t id,
57 fFilterMap(selectInfo),
64 SetLabel(label, nLabel);
67 //______________________________________________________________________________
68 AliAODCluster::AliAODCluster(Int_t id,
81 fFilterMap(selectInfo),
88 SetLabel(label, nLabel);
92 //______________________________________________________________________________
93 AliAODCluster::~AliAODCluster()
101 //______________________________________________________________________________
102 AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
104 fEnergy(clus.fEnergy),
109 fFilterMap(clus.fFilterMap),
114 clus.GetPosition(fPosition);
116 SetLabel(clus.fLabel, clus.fNLabel);
119 //______________________________________________________________________________
120 AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
122 // Assignment operator
125 clus.GetPosition(fPosition);
128 fEnergy = clus.fEnergy;
132 SetLabel(clus.fLabel, clus.fNLabel);
133 fFilterMap = clus.fFilterMap;
141 //______________________________________________________________________________
142 template <class T> void AliAODCluster::SetPosition(const T *x)
152 fPosition[0] = -999.;
153 fPosition[1] = -999.;
154 fPosition[2] = -999.;
158 //______________________________________________________________________________
159 AliAODCluster::AODCluPID_t AliAODCluster::GetMostProbablePID() const
161 // Returns the most probable PID array element.
165 AODCluPID_t loc = kUnknown;
167 Bool_t allTheSame = kTRUE;
169 for (Int_t iPID = 0; iPID < nPID; iPID++) {
170 if (fPID[iPID] >= max) {
171 if (fPID[iPID] > max) {
174 loc = (AODCluPID_t)iPID;
181 return allTheSame ? kUnknown : loc;
187 //______________________________________________________________________________
188 void AliAODCluster::SetLabel(Int_t *label, UInt_t size)
190 if (label && size>0) {
191 if (size != (UInt_t)fNLabel) {
194 fLabel = new Int_t[fNLabel];
197 for (Int_t i = 0; i < fNLabel; i++) {
198 fLabel[i] = label[i];
207 //______________________________________________________________________________
208 Int_t AliAODCluster::GetLabel(UInt_t i) const
210 if (fLabel && i < (UInt_t)fNLabel) {
217 //______________________________________________________________________________
218 void AliAODCluster::RemoveLabel()
227 //______________________________________________________________________________
228 void AliAODCluster::Print(Option_t* /* option */) const
230 // prints information about AliAODCluster
232 printf("Cluster type: %d\n", GetType());
233 printf(" energy = %f\n", E());
234 printf(" chi2 = %f\n", Chi2());
235 printf(" PID object: %p\n", PID());