]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODCluster.cxx
Introduced the checking of QA results from previous step before entering the event...
[u/mrichter/AliRoot.git] / STEER / AliAODCluster.cxx
CommitLineData
df9db588 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18//-------------------------------------------------------------------------
a9255000 19// AOD cluster base class
df9db588 20// Author: Markus Oldenburg, CERN
21//-------------------------------------------------------------------------
22
a9255000 23#include "AliAODCluster.h"
df9db588 24
a9255000 25ClassImp(AliAODCluster)
df9db588 26
27//______________________________________________________________________________
a9255000 28AliAODCluster::AliAODCluster() :
ff7c57dd 29 AliVParticle(),
df9db588 30 fEnergy(0),
31 fChi2(-999.),
32 fID(-999),
33 fLabel(-999),
9333290e 34 fType(kUndef),
df9db588 35 fCovMatrix(NULL),
36 fProdVertex(0x0),
9333290e 37 fPrimTrack(NULL)
df9db588 38{
39 // default constructor
40
41 SetPosition((Float_t*)NULL);
42 SetPID((Float_t*)NULL);
43}
44
45//______________________________________________________________________________
a9255000 46AliAODCluster::AliAODCluster(Int_t id,
df9db588 47 Int_t label,
48 Double_t energy,
49 Double_t x[3],
01afc3fc 50 Double_t covMatrix[10],
14d55e62 51 Double_t pid[9],
df9db588 52 AliAODVertex *prodVertex,
53 AliAODTrack *primTrack,
54 Char_t ttype) :
ff7c57dd 55 AliVParticle(),
df9db588 56 fEnergy(energy),
57 fChi2(-999.),
58 fID(id),
59 fLabel(label),
9333290e 60 fType(ttype),
df9db588 61 fCovMatrix(NULL),
62 fProdVertex(prodVertex),
9333290e 63 fPrimTrack(primTrack)
df9db588 64{
65 // constructor
66
01afc3fc 67 SetPosition(x);
df9db588 68 if(covMatrix) SetCovMatrix(covMatrix);
69 SetPID(pid);
70
71}
72
73//______________________________________________________________________________
a9255000 74AliAODCluster::AliAODCluster(Int_t id,
df9db588 75 Int_t label,
76 Float_t energy,
77 Float_t x[3],
01afc3fc 78 Float_t covMatrix[10],
14d55e62 79 Float_t pid[9],
df9db588 80 AliAODVertex *prodVertex,
81 AliAODTrack *primTrack,
82 Char_t ttype) :
ff7c57dd 83 AliVParticle(),
df9db588 84 fEnergy(energy),
85 fChi2(-999.),
86 fID(id),
87 fLabel(label),
9333290e 88 fType(ttype),
df9db588 89 fCovMatrix(NULL),
90 fProdVertex(prodVertex),
9333290e 91 fPrimTrack(primTrack)
df9db588 92{
93 // constructor
94
01afc3fc 95 SetPosition(x);
df9db588 96 if(covMatrix) SetCovMatrix(covMatrix);
97 SetPID(pid);
98
99}
100
101
102//______________________________________________________________________________
a9255000 103AliAODCluster::~AliAODCluster()
df9db588 104{
105 // destructor
106 delete fCovMatrix;
107}
108
109
110//______________________________________________________________________________
14d55e62 111AliAODCluster::AliAODCluster(const AliAODCluster& clus) :
ff7c57dd 112 AliVParticle(clus),
14d55e62 113 fEnergy(clus.fEnergy),
114 fChi2(clus.fChi2),
115 fID(clus.fID),
116 fLabel(clus.fLabel),
9333290e 117 fType(clus.fType),
df9db588 118 fCovMatrix(NULL),
14d55e62 119 fProdVertex(clus.fProdVertex),
9333290e 120 fPrimTrack(clus.fPrimTrack)
df9db588 121{
122 // Copy constructor
123
14d55e62 124 clus.GetPosition(fPosition);
125 if(clus.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*clus.fCovMatrix);
126 SetPID(clus.fPID);
df9db588 127
128}
129
130//______________________________________________________________________________
14d55e62 131AliAODCluster& AliAODCluster::operator=(const AliAODCluster& clus)
df9db588 132{
133 // Assignment operator
14d55e62 134 if(this!=&clus) {
df9db588 135
ff7c57dd 136 AliVParticle::operator=(clus);
df9db588 137
14d55e62 138 clus.GetPosition(fPosition);
139 clus.GetPID(fPID);
df9db588 140
14d55e62 141 fEnergy = clus.fEnergy;
142 fChi2 = clus.fChi2;
df9db588 143
14d55e62 144 fID = clus.fID;
145 fLabel = clus.fLabel;
9333290e 146
147 fType = clus.fType;
df9db588 148
149 delete fCovMatrix;
14d55e62 150 if(clus.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*clus.fCovMatrix);
df9db588 151 else fCovMatrix=NULL;
9333290e 152
14d55e62 153 fProdVertex = clus.fProdVertex;
154 fPrimTrack = clus.fPrimTrack;
df9db588 155 }
156
157 return *this;
158}
159
160//______________________________________________________________________________
a9255000 161template <class T> void AliAODCluster::SetPosition(const T *x)
df9db588 162{
163 // set the position
164
165 if (x) {
df9db588 166 fPosition[0] = x[0];
167 fPosition[1] = x[1];
168 fPosition[2] = x[2];
df9db588 169 } else {
df9db588 170
171 fPosition[0] = -999.;
172 fPosition[1] = -999.;
173 fPosition[2] = -999.;
174 }
175}
176
14d55e62 177//______________________________________________________________________________
178AliAODCluster::AODCluPID_t AliAODCluster::GetMostProbablePID() const
179{
180 // Returns the most probable PID array element.
181
182 Int_t nPID = 9;
183 if (fPID) {
184 AODCluPID_t loc = kUnknown;
185 Double_t max = 0.;
186 Bool_t allTheSame = kTRUE;
187
188 for (Int_t iPID = 0; iPID < nPID; iPID++) {
189 if (fPID[iPID] >= max) {
190 if (fPID[iPID] > max) {
191 allTheSame = kFALSE;
192 max = fPID[iPID];
193 loc = (AODCluPID_t)iPID;
194 } else {
195 allTheSame = kTRUE;
196 }
197 }
198 }
199
200 return allTheSame ? kUnknown : loc;
201 } else {
202 return kUnknown;
203 }
204}
205
df9db588 206//______________________________________________________________________________
a9255000 207void AliAODCluster::Print(Option_t* /* option */) const
df9db588 208{
a9255000 209 // prints information about AliAODCluster
df9db588 210
a9255000 211 printf("Object name: %s Cluster type: %s\n", GetName(), GetTitle());
df9db588 212 printf(" energy = %f\n", E());
213 printf(" chi2 = %f\n", Chi2());
214 printf(" PID object: %p\n", PID());
215}
216