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