Add classes for TOF Calibration (C.Zampolli)
[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
16/*$Log$
17author: Chiara Zampolli, zampolli@bo.infn.it
18 */
19
20///////////////////////////////////////////////////////////////////////////////
21// //
22// class for TOF calibration //
23// //
24///////////////////////////////////////////////////////////////////////////////
25
26#include "AliTOFcalibESD.h"
27#include <Riostream.h>
28#include <stdlib.h>
29
30
31ClassImp(AliTOFcalibESD)
32
33//________________________________________________________________
34AliTOFcalibESD::AliTOFcalibESD():
35 fToT(0),
36 fIntLen(0),
37 fTOFtime(0),
38 fP(0),
39 fSector(-1),
40 fPlate(-1),
41 fStrip(-1),
42 fPadz(-1),
43 fPadx(-1),
44 fTOFsignalND(0)
45{
46 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = 0;
47}
48//________________________________________________________________
49
50AliTOFcalibESD::AliTOFcalibESD(const AliTOFcalibESD& UnCalib):
51 AliESDtrack(UnCalib),
52 fToT(UnCalib.fToT),
53 fIntLen(UnCalib.fIntLen),
54 fTOFtime(UnCalib.fTOFtime),
55 fP(UnCalib.fP),
56 fCombID(UnCalib.fCombID),
57 fSector(UnCalib.fSector),
58 fPlate(UnCalib.fPlate),
59 fStrip(UnCalib.fStrip),
60 fPadz(UnCalib.fPadz),
61 fPadx(UnCalib.fPadx),
62 fTOFsignalND(UnCalib.fTOFsignalND)
63{
64 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = UnCalib.fTrackTime[i];
65 for (Int_t i = 0;i<15;i++) fExtCov[i] = UnCalib.fExtCov[i];
66}
67//________________________________________________________________
68
69AliTOFcalibESD::~AliTOFcalibESD()
70{
71}
72//________________________________________________________________
73
74void AliTOFcalibESD::SetIntegratedTime(const Double_t *tracktime){
75 for (Int_t i=0;i<AliPID::kSPECIES;i++) fTrackTime[i] = tracktime[i];
76}
77//________________________________________________________________
78
79void AliTOFcalibESD::CopyFromAliESD(const AliESDtrack* track)
80{
81 fP = track->GetP();
82 fTOFtime = track->GetTOFsignal();
83 fIntLen = track->GetIntegratedLength();
84 Double_t exptime[10];
85 track->GetIntegratedTimes(exptime);
86 for (Int_t i=0;i<AliPID::kSPECIES;i++) {
87 fTrackTime[i] = exptime[i];
88 }
89 Double_t c[15];
90 track->GetExternalCovariance(c);
91 for (Int_t i = 0;i<15;i++){
92 fExtCov[i] = c[i];
93 }
94}
95//______________________________________________________________________
96
97void AliTOFcalibESD::GetExternalCovariance(Double_t cov[15]) const {
98 for (Int_t i=0; i<15; i++) cov[i]=fExtCov[i];
99}
100//______________________________________________________________________
101
102void AliTOFcalibESD::GetIntegratedTimes(Double_t exp[AliPID::kSPECIES]) const {
103 for (Int_t i=0; i<AliPID::kSPECIES; i++) exp[i]=fTrackTime[i];
104}
105//______________________________________________________________________
106
107Int_t AliTOFcalibESD::Compare(const TObject* uncobj) const{
108 Double_t c1[15];
109 this->GetExternalCovariance(c1);
110 Double_t c2[15];
111 ((AliTOFcalibESD*)uncobj)->GetExternalCovariance(c2);
112 if (c1[0]*c1[2] <c2[0]*c2[2]) return -1;
113 if (c1[0]*c1[2]>c2[0]*c2[2]) return 1;
114 return 0;
115}
116
117