]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AOD/AliAODPid.cxx
Fixing leak
[u/mrichter/AliRoot.git] / STEER / AOD / AliAODPid.cxx
CommitLineData
1c28d174 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//-------------------------------------------------------------------------
19// AOD Pid class to store additional pid information
d7bdc804 20// Author: Annalisa Mastroserio
1c28d174 21//-------------------------------------------------------------------------
22
23#include "AliAODPid.h"
d7bdc804 24#include "AliESDtrack.h"
25#include "AliLog.h"
7330f0e5 26#include "AliPID.h"
1c28d174 27
28ClassImp(AliAODPid)
29
d7bdc804 30
1c28d174 31//______________________________________________________________________________
d7bdc804 32AliAODPid::AliAODPid():
33 fITSsignal(0),
34 fTPCsignal(0),
a7307087 35 fTPCsignalN(0),
d999f2e6 36 fTPCmomentum(0),
d7bdc804 37 fTRDnSlices(0),
59a8e853 38 fTRDntls(0),
d7bdc804 39 fTRDslices(0x0),
40 fTOFesdsignal(0),
41 fHMPIDsignal(0)
1c28d174 42{
43 // default constructor
7ba6f91a 44 for(Int_t i=0; i<kSPECIES; i++) fIntTime[i] = 0;
028c7a2c 45 for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = 0.;
7ba6f91a 46 for(Int_t i=0; i<3; i++) fEMCALPosition[i] = 0.;
b13bcc35 47 for(Int_t i=0; i<5; i++) fTOFpidResolution[i] = 0.;
59a8e853 48 for(Int_t i=0; i<6; i++) {
49 fTRDmomentum[i] = 0.;
50 fTRDncls[i] = 0;
51 }
7ba6f91a 52 for(Int_t i=0; i<3; i++) fEMCALMomentum[i] = 0.;
6d354ed1 53 for(Int_t i=0; i<4; i++) fITSdEdxSamples[i] = 0.;
1c28d174 54}
55
56//______________________________________________________________________________
57AliAODPid::~AliAODPid()
58{
341952b8 59 delete [] fTRDslices;
60 fTRDslices = 0;
1c28d174 61 // destructor
62}
63
64
65//______________________________________________________________________________
66AliAODPid::AliAODPid(const AliAODPid& pid) :
d7bdc804 67 TObject(pid),
68 fITSsignal(pid.fITSsignal),
69 fTPCsignal(pid.fTPCsignal),
a7307087 70 fTPCsignalN(pid.fTPCsignalN),
d999f2e6 71 fTPCmomentum(pid.fTPCmomentum),
d7bdc804 72 fTRDnSlices(pid.fTRDnSlices),
59a8e853 73 fTRDntls(pid.fTRDntls),
d7bdc804 74 fTRDslices(0x0),
75 fTOFesdsignal(pid.fTOFesdsignal),
76 fHMPIDsignal(pid.fHMPIDsignal)
1c28d174 77{
78 // Copy constructor
59a8e853 79 SetTRDsignal(fTRDnSlices, pid.fTRDslices);
d7bdc804 80 for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=pid.fIntTime[i];
028c7a2c 81 for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = pid.fHMPIDprobs[i];
64c79a6a 82 for(Int_t i=0; i<3; i++) {
83 fEMCALPosition[i]=pid.fEMCALPosition[i];
84 fEMCALMomentum[i]=pid.fEMCALMomentum[i];
85 }
59a8e853 86 for(Int_t i=0; i<6; i++){
87 fTRDmomentum[i]=pid.fTRDmomentum[i];
88 fTRDncls[i] = 0;
89 }
b13bcc35 90
91 for(Int_t i=0; i<5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];
6d354ed1 92
93 for(Int_t i=0; i<4; i++) fITSdEdxSamples[i]=pid.fITSdEdxSamples[i];
1c28d174 94}
95
96//______________________________________________________________________________
97AliAODPid& AliAODPid::operator=(const AliAODPid& pid)
98{
99 // Assignment operator
100 if(this!=&pid) {
101 // copy stuff
341952b8 102 fITSsignal=pid.fITSsignal;
103 fTPCsignal=pid.fTPCsignal;
104
105 if(pid.fTRDnSlices<=0||(fTRDnSlices!=pid.fTRDnSlices)){
106 // only delete if number changed or is 0
107 delete [] fTRDslices;
108 fTRDslices = 0;
109 if(pid.fTRDnSlices>0) fTRDslices = new Double32_t[fTRDnSlices];
110 }
111 fTRDnSlices=pid.fTRDnSlices;
112
113 for(Int_t i=0; i< fTRDnSlices; i++) fTRDslices[i]=pid.fTRDslices[i];
114 fTOFesdsignal=pid.fTOFesdsignal;
115 fHMPIDsignal=pid.fHMPIDsignal;
116 for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=pid.fIntTime[i];
028c7a2c 117 for(Int_t i=0; i<5; i++) fHMPIDprobs[i] = pid.fHMPIDprobs[i];
59a8e853 118 for(Int_t i=0; i<6; i++){
119 fTRDmomentum[i]=pid.fTRDmomentum[i];
120 fTRDncls[i] = pid.fTRDncls[i];
121 }
64c79a6a 122 for(Int_t i=0; i<3; i++) {
123 fEMCALPosition[i]=pid.fEMCALPosition[i];
124 fEMCALMomentum[i]=pid.fEMCALMomentum[i];
125 }
b13bcc35 126 for (Int_t i=0; i<5; i++) fTOFpidResolution[i]=pid.fTOFpidResolution[i];
6d354ed1 127 for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=pid.fITSdEdxSamples[i];
1c28d174 128 }
129
130 return *this;
131}
d7bdc804 132//_______________________________________________________________________________
febefa51 133void AliAODPid::GetIntegratedTimes(Double_t timeint[kSPECIES]) const
d7bdc804 134{
373fc041 135 // Returns the array with integrated times for each particle hypothesis
136for(Int_t i=0; i<kSPECIES; i++) timeint[i]=fIntTime[i];
d7bdc804 137}
373fc041 138//_______________________________________________________________________________
139void AliAODPid::SetIntegratedTimes(Double_t timeint[kSPECIES])
d7bdc804 140{
141 // Returns the array with integrated times for each particle hypothesis
373fc041 142for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=timeint[i];
d7bdc804 143}
a401ba0b 144//_______________________________________________________________________________
febefa51 145void AliAODPid::GetEMCALPosition(Double_t emcalpos[3]) const
a401ba0b 146{
147 // Returns the array with extrapolated track position at the EMCAL surface
148 for(Int_t i=0; i<3; i++) emcalpos[i]=fEMCALPosition[i];
149}
150//_______________________________________________________________________________
151void AliAODPid::SetEMCALPosition(Double_t emcpos[3])
152{
153 // Sets the array with extrapolated track position at the EMCAL surface
154 for(Int_t i=0; i<3; i++) fEMCALPosition[i]=emcpos[i];
155}
156//_______________________________________________________________________________
febefa51 157void AliAODPid::GetEMCALMomentum(Double_t emcalmom[3]) const
a401ba0b 158{
159 // Returns the array with extrapolated track momentum at the EMCAL surface
160 for(Int_t i=0; i<3; i++) emcalmom[i]=fEMCALMomentum[i];
161}
162//_______________________________________________________________________________
163void AliAODPid::SetEMCALMomentum(Double_t emcmom[3])
164{
165 // Sets the array with extrapolated track momentum at the EMCAL surface
166 for(Int_t i=0; i<3; i++) fEMCALMomentum[i]=emcmom[i];
167}
b13bcc35 168//______________________________________________________________________________
169void AliAODPid::SetTOFpidResolution(Double_t tofPIDres[5])
170{
171 for (Int_t i=0; i<5; i++) fTOFpidResolution[i]=tofPIDres[i];
172
173}
174//______________________________________________________________________________
175void AliAODPid::GetTOFpidResolution(Double_t tofRes[5]) const
176{
177 for (Int_t i=0; i<5; i++) tofRes[i]=fTOFpidResolution[i];
178}
179
028c7a2c 180//______________________________________________________________________________
181void AliAODPid::SetHMPIDprobs(Double_t hmpPid[5])
182{
183 //
184 // Set the HMPID PID probablities that are read from ESD
185 //
186 for(Int_t i = 0; i < 5; i++ ) fHMPIDprobs[i] = hmpPid[i];
187}
188//______________________________________________________________________________
ea235c90 189void AliAODPid::GetHMPIDprobs(Double_t *p) const
028c7a2c 190{
191 //
192 // Set the HMPID PID probablities that are read from ESD
193 //
194 for(Int_t i = 0; i < AliPID::kSPECIES; i++ ) p[i] = fHMPIDprobs[i];
195}
6d354ed1 196//______________________________________________________________________________
197void AliAODPid::SetITSdEdxSamples(const Double_t s[4])
198{
199 //
200 // Set the 4 values of dE/dx from individual ITS layers that are read from ESD
201 //
202 for (Int_t i=0; i<4; i++) fITSdEdxSamples[i]=s[i];
203}
204//______________________________________________________________________________
205void AliAODPid::GetITSdEdxSamples(Double_t s[4]) const
206{
207 //
208 // Get the 4 values of dE/dx from individual ITS layers that are read from ESD
209 //
210 for (Int_t i=0; i<4; i++) s[i]=fITSdEdxSamples[i];
211}