]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliAODCluster.cxx
First prototype of the new AliCluster base class
[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() :
df9db588 29 AliVirtualParticle(),
30 fEnergy(0),
31 fChi2(-999.),
32 fID(-999),
33 fLabel(-999),
34 fCovMatrix(NULL),
35 fProdVertex(0x0),
36 fPrimTrack(NULL),
37 fType(kUndef)
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],
df9db588 51 Double_t pid[10],
52 AliAODVertex *prodVertex,
53 AliAODTrack *primTrack,
54 Char_t ttype) :
55 AliVirtualParticle(),
56 fEnergy(energy),
57 fChi2(-999.),
58 fID(id),
59 fLabel(label),
60 fCovMatrix(NULL),
61 fProdVertex(prodVertex),
62 fPrimTrack(primTrack),
63 fType(ttype)
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],
df9db588 79 Float_t pid[10],
80 AliAODVertex *prodVertex,
81 AliAODTrack *primTrack,
82 Char_t ttype) :
83 AliVirtualParticle(),
84 fEnergy(energy),
85 fChi2(-999.),
86 fID(id),
87 fLabel(label),
88 fCovMatrix(NULL),
89 fProdVertex(prodVertex),
90 fPrimTrack(primTrack),
91 fType(ttype)
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//______________________________________________________________________________
a9255000 111AliAODCluster::AliAODCluster(const AliAODCluster& trk) :
df9db588 112 AliVirtualParticle(trk),
113 fEnergy(trk.fEnergy),
114 fChi2(trk.fChi2),
115 fID(trk.fID),
116 fLabel(trk.fLabel),
117 fCovMatrix(NULL),
118 fProdVertex(trk.fProdVertex),
119 fPrimTrack(trk.fPrimTrack),
120 fType(trk.fType)
121{
122 // Copy constructor
123
124 trk.GetPosition(fPosition);
5d62ce04 125 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*trk.fCovMatrix);
df9db588 126 SetPID(trk.fPID);
127
128}
129
130//______________________________________________________________________________
a9255000 131AliAODCluster& AliAODCluster::operator=(const AliAODCluster& trk)
df9db588 132{
133 // Assignment operator
134 if(this!=&trk) {
135
136 AliVirtualParticle::operator=(trk);
137
138 trk.GetPosition(fPosition);
139 trk.GetPID(fPID);
140
141 fChi2 = trk.fEnergy;
142 fChi2 = trk.fChi2;
143
144 fID = trk.fID;
145 fLabel = trk.fLabel;
146
147 delete fCovMatrix;
5d62ce04 148 if(trk.fCovMatrix) fCovMatrix=new AliAODRedCov<4>(*trk.fCovMatrix);
df9db588 149 else fCovMatrix=NULL;
150 fProdVertex = trk.fProdVertex;
151 fPrimTrack = trk.fPrimTrack;
152
153 fType = trk.fType;
154 }
155
156 return *this;
157}
158
159//______________________________________________________________________________
a9255000 160template <class T> void AliAODCluster::SetPosition(const T *x)
df9db588 161{
162 // set the position
163
164 if (x) {
df9db588 165 fPosition[0] = x[0];
166 fPosition[1] = x[1];
167 fPosition[2] = x[2];
df9db588 168 } else {
df9db588 169
170 fPosition[0] = -999.;
171 fPosition[1] = -999.;
172 fPosition[2] = -999.;
173 }
174}
175
df9db588 176//______________________________________________________________________________
a9255000 177void AliAODCluster::Print(Option_t* /* option */) const
df9db588 178{
a9255000 179 // prints information about AliAODCluster
df9db588 180
a9255000 181 printf("Object name: %s Cluster type: %s\n", GetName(), GetTitle());
df9db588 182 printf(" energy = %f\n", E());
183 printf(" chi2 = %f\n", Chi2());
184 printf(" PID object: %p\n", PID());
185}
186