Improved memory leaks in AliTOFtracker* classes: additional solution for bug #66136
[u/mrichter/AliRoot.git] / TOF / AliTOFcalibESD.cxx
CommitLineData
6dc9348d 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
762446e0 16/*
17$Log$
655e379f 18Revision 1.5 2006/04/20 22:30:50 hristov
19Coding conventions (Annalisa)
20
0e46b9ae 21Revision 1.4 2006/04/05 08:35:38 hristov
22Coding conventions (S.Arcelli, C.Zampolli)
23
340693af 24Revision 1.3 2006/03/28 14:57:13 arcelli
25updates to handle new V5 geometry & some re-arrangements
26
d4ad0d6b 27Revision 1.2 2006/02/13 17:22:26 arcelli
28just Fixing Log info
29
762446e0 30Revision 1.1 2006/02/13 16:10:48 arcelli
31Add classes for TOF Calibration (C.Zampolli)
32
6dc9348d 33author: Chiara Zampolli, zampolli@bo.infn.it
762446e0 34*/
6dc9348d 35
36///////////////////////////////////////////////////////////////////////////////
37// //
38// class for TOF calibration //
39// //
40///////////////////////////////////////////////////////////////////////////////
41
42#include "AliTOFcalibESD.h"
6dc9348d 43
0e46b9ae 44class AliPID;
6dc9348d 45
46ClassImp(AliTOFcalibESD)
47
48//________________________________________________________________
49AliTOFcalibESD::AliTOFcalibESD():
655e379f 50 fCombID(-1),
340693af 51 fTOFCalCh(-1),
6dc9348d 52 fToT(0),
53 fIntLen(0),
54 fTOFtime(0),
340693af 55 fMo(0),
6dc9348d 56 fTOFsignalND(0)
57{
340693af 58 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrTime[i] = 0;
6dc9348d 59}
60//________________________________________________________________
61
62AliTOFcalibESD::AliTOFcalibESD(const AliTOFcalibESD& UnCalib):
63 AliESDtrack(UnCalib),
d4ad0d6b 64 fCombID(UnCalib.fCombID),
340693af 65 fTOFCalCh(UnCalib.fTOFCalCh),
6dc9348d 66 fToT(UnCalib.fToT),
67 fIntLen(UnCalib.fIntLen),
68 fTOFtime(UnCalib.fTOFtime),
340693af 69 fMo(UnCalib.fMo),
6dc9348d 70 fTOFsignalND(UnCalib.fTOFsignalND)
71{
340693af 72 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrTime[i] = UnCalib.fTrTime[i];
6dc9348d 73 for (Int_t i = 0;i<15;i++) fExtCov[i] = UnCalib.fExtCov[i];
74}
75//________________________________________________________________
76
77AliTOFcalibESD::~AliTOFcalibESD()
78{
79}
80//________________________________________________________________
81
82void AliTOFcalibESD::SetIntegratedTime(const Double_t *tracktime){
340693af 83 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrTime[i] = tracktime[i];
6dc9348d 84}
85//________________________________________________________________
86
340693af 87void AliTOFcalibESD::CopyFromAliESD(const AliESDtrack* track){
88 //copy ESD track info
89 fMo = track->GetP();
6dc9348d 90 fTOFtime = track->GetTOFsignal();
d4ad0d6b 91 fToT = track->GetTOFsignalToT();
340693af 92 fTOFCalCh = track->GetTOFCalChannel();
6dc9348d 93 fIntLen = track->GetIntegratedLength();
94 Double_t exptime[10];
95 track->GetIntegratedTimes(exptime);
96 for (Int_t i=0;i<AliPID::kSPECIES;i++) {
340693af 97 fTrTime[i] = exptime[i];
6dc9348d 98 }
99 Double_t c[15];
100 track->GetExternalCovariance(c);
101 for (Int_t i = 0;i<15;i++){
102 fExtCov[i] = c[i];
103 }
104}
105//______________________________________________________________________
106
107void AliTOFcalibESD::GetExternalCovariance(Double_t cov[15]) const {
108 for (Int_t i=0; i<15; i++) cov[i]=fExtCov[i];
109}
110//______________________________________________________________________
111
112void AliTOFcalibESD::GetIntegratedTimes(Double_t exp[AliPID::kSPECIES]) const {
340693af 113 for (Int_t i=0; i<AliPID::kSPECIES; i++) exp[i]=fTrTime[i];
6dc9348d 114}
115//______________________________________________________________________
116
117Int_t AliTOFcalibESD::Compare(const TObject* uncobj) const{
340693af 118 //To order in momentum
6dc9348d 119 Double_t c1[15];
120 this->GetExternalCovariance(c1);
121 Double_t c2[15];
122 ((AliTOFcalibESD*)uncobj)->GetExternalCovariance(c2);
123 if (c1[0]*c1[2] <c2[0]*c2[2]) return -1;
124 if (c1[0]*c1[2]>c2[0]*c2[2]) return 1;
125 return 0;
126}
127
128