Bug fix. Removed delete statement
[u/mrichter/AliRoot.git] / STEER / 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"
1c28d174 26
27ClassImp(AliAODPid)
28
d7bdc804 29
1c28d174 30//______________________________________________________________________________
d7bdc804 31AliAODPid::AliAODPid():
32 fITSsignal(0),
33 fTPCsignal(0),
34 fTRDnSlices(0),
35 fTRDslices(0x0),
36 fTOFesdsignal(0),
37 fHMPIDsignal(0)
1c28d174 38{
39 // default constructor
d7bdc804 40 for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=0;
a401ba0b 41 for(Int_t i=0; i<3; i++) fEMCALPosition[i] = 0.;
373fc041 42
1c28d174 43}
44
45//______________________________________________________________________________
46AliAODPid::~AliAODPid()
47{
341952b8 48 delete [] fTRDslices;
49 fTRDslices = 0;
1c28d174 50 // destructor
51}
52
53
54//______________________________________________________________________________
55AliAODPid::AliAODPid(const AliAODPid& pid) :
d7bdc804 56 TObject(pid),
57 fITSsignal(pid.fITSsignal),
58 fTPCsignal(pid.fTPCsignal),
59 fTRDnSlices(pid.fTRDnSlices),
60 fTRDslices(0x0),
61 fTOFesdsignal(pid.fTOFesdsignal),
62 fHMPIDsignal(pid.fHMPIDsignal)
1c28d174 63{
64 // Copy constructor
d7bdc804 65 fTRDslices = new Double32_t[fTRDnSlices];
66 for(Int_t i=0; i< fTRDnSlices; i++) fTRDslices[i]=pid.fTRDslices[i];
67 for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=pid.fIntTime[i];
a401ba0b 68 for(Int_t i=0; i<3; i++) fEMCALPosition[i]=pid.fEMCALPosition[i];
1c28d174 69}
70
71//______________________________________________________________________________
72AliAODPid& AliAODPid::operator=(const AliAODPid& pid)
73{
74 // Assignment operator
75 if(this!=&pid) {
76 // copy stuff
341952b8 77 fITSsignal=pid.fITSsignal;
78 fTPCsignal=pid.fTPCsignal;
79
80 if(pid.fTRDnSlices<=0||(fTRDnSlices!=pid.fTRDnSlices)){
81 // only delete if number changed or is 0
82 delete [] fTRDslices;
83 fTRDslices = 0;
84 if(pid.fTRDnSlices>0) fTRDslices = new Double32_t[fTRDnSlices];
85 }
86 fTRDnSlices=pid.fTRDnSlices;
87
88 for(Int_t i=0; i< fTRDnSlices; i++) fTRDslices[i]=pid.fTRDslices[i];
89 fTOFesdsignal=pid.fTOFesdsignal;
90 fHMPIDsignal=pid.fHMPIDsignal;
91 for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=pid.fIntTime[i];
a401ba0b 92 for(Int_t i=0; i<3; i++) fEMCALPosition[i]=pid.fEMCALPosition[i];
1c28d174 93 }
94
95 return *this;
96}
d7bdc804 97//_______________________________________________________________________________
373fc041 98void AliAODPid::GetIntegratedTimes(Double_t timeint[kSPECIES])
d7bdc804 99{
373fc041 100 // Returns the array with integrated times for each particle hypothesis
101for(Int_t i=0; i<kSPECIES; i++) timeint[i]=fIntTime[i];
d7bdc804 102}
373fc041 103//_______________________________________________________________________________
104void AliAODPid::SetIntegratedTimes(Double_t timeint[kSPECIES])
d7bdc804 105{
106 // Returns the array with integrated times for each particle hypothesis
373fc041 107for(Int_t i=0; i<kSPECIES; i++) fIntTime[i]=timeint[i];
d7bdc804 108}
a401ba0b 109//_______________________________________________________________________________
110void AliAODPid::GetEMCALPosition(Double_t emcalpos[3])
111{
112 // Returns the array with extrapolated track position at the EMCAL surface
113 for(Int_t i=0; i<3; i++) emcalpos[i]=fEMCALPosition[i];
114}
115//_______________________________________________________________________________
116void AliAODPid::SetEMCALPosition(Double_t emcpos[3])
117{
118 // Sets the array with extrapolated track position at the EMCAL surface
119 for(Int_t i=0; i<3; i++) fEMCALPosition[i]=emcpos[i];
120}
121//_______________________________________________________________________________
122void AliAODPid::GetEMCALMomentum(Double_t emcalmom[3])
123{
124 // Returns the array with extrapolated track momentum at the EMCAL surface
125 for(Int_t i=0; i<3; i++) emcalmom[i]=fEMCALMomentum[i];
126}
127//_______________________________________________________________________________
128void AliAODPid::SetEMCALMomentum(Double_t emcmom[3])
129{
130 // Sets the array with extrapolated track momentum at the EMCAL surface
131 for(Int_t i=0; i<3; i++) fEMCALMomentum[i]=emcmom[i];
132}