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