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