added getter for number of ITS clusters in AliESDTrack, fixed bug in SetFromESD funct...
[u/mrichter/AliRoot.git] / HLT / global / AliFlatESDTrack.cxx
CommitLineData
251a2c81 1/* $Id$ */
2
3/**************************************************************************
4 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * *
6 * Author: The ALICE Off-line Project. *
7 * Contributors are mentioned in the code where appropriate. *
8 * *
9 * Permission to use, copy, modify and distribute this software and its *
10 * documentation strictly for non-commercial purposes is hereby granted *
11 * without fee, provided that the above copyright notice appears in all *
12 * copies and that both the copyright notice and this permission notice *
13 * appear in the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It is *
15 * provided "as is" without express or implied warranty. *
16 **************************************************************************/
17
18/**
19 * >> Flat structure representing an ESDTrack <<
20 *
21 * To be used in the online and offline calibration schema.
22 *
23 * Class provides interface methods for
24 * - Filling from AliESDtrack and AliExternalTrackParam, as well
25 * as clusters from ESD friends (if requested)
26 * - HLT Filling to be added
27 *
28 *
29 * Primary Authors : Sergey Gorbunov, Jochen Thaeder, Chiara Zampolli
30 *
31 **************************************************************************/
32
888585e5 33#include "Rtypes.h"
34#include "AliFlatESDTrack.h"
35#include "AliFlatExternalTrackParam.h"
251a2c81 36#include "AliESDtrack.h"
251a2c81 37#include "AliExternalTrackParam.h"
251a2c81 38#include "Riostream.h"
39
251a2c81 40
48ec9ee6 41
c2ea967e 42
251a2c81 43// _______________________________________________________________________________________________________
251a2c81 44
251a2c81 45
46// _______________________________________________________________________________________________________
0d577a2c 47Int_t AliFlatESDTrack::SetFromESDTrack(const AliESDtrack* track)
888585e5 48{
49 // Fill external track parameters
251a2c81 50 fTrackParamMask = 0;
51 fNTPCClusters = 0;
52 fNITSClusters = 0;
888585e5 53 fContentSize = 0;
251a2c81 54
55 if( !track ) return 0;
56
888585e5 57 Int_t iResult = SetExternalTrackParam( track,
58 track->GetInnerParam(),
59 track->GetTPCInnerParam(),
60 track->GetOuterParam(),
61 track->GetConstrainedParam(), NULL );
cee25adb 62 fNTPCClusters = track->GetTPCNcls();
63 fNITSClusters = track->GetITSNcls();
251a2c81 64
65 return iResult;
66}
67
68// _______________________________________________________________________________________________________
888585e5 69Int_t AliFlatESDTrack::SetExternalTrackParam(
70 const AliExternalTrackParam* refittedParam,
71 const AliExternalTrackParam* innerParam,
72 const AliExternalTrackParam* innerTPC,
73 const AliExternalTrackParam* outerParam,
74 const AliExternalTrackParam* constrainedParam,
75 const AliExternalTrackParam* outerITS
76 ){
251a2c81 77 // Fill external track parameters
78
79 fTrackParamMask = 0;
80 fNTPCClusters = 0;
888585e5 81 fContentSize = 0;
251a2c81 82
83 Int_t iResult = 0;
84
85 Byte_t flag = 0x1;
86 iResult = FillExternalTrackParam(refittedParam, flag);
87
88 flag = 0x2;
89 iResult = FillExternalTrackParam(innerParam, flag);
90
91 flag = 0x4;
92 iResult = FillExternalTrackParam(innerTPC, flag);
93
94 flag = 0x8;
95 iResult = FillExternalTrackParam(outerParam, flag);
96
97 flag = 0x10;
98 iResult = FillExternalTrackParam(constrainedParam, flag);
99
100 flag = 0x20;
101 iResult = FillExternalTrackParam(outerITS, flag);
102
103 return iResult;
104}
105
106// _______________________________________________________________________________________________________
107Int_t AliFlatESDTrack::FillExternalTrackParam(const AliExternalTrackParam* param, UShort_t flag) {
108 // Fill external track parameters
109
48ec9ee6 110 if (!param) return -1;
251a2c81 111
ee82d961 112 //Printf(" DEBUG: CONTENT %d >> %p + 0x%07llx = %p", flag, fContent, fContentSize, fContent + fContentSize);
251a2c81 113
888585e5 114 AliFlatExternalTrackParam * current = reinterpret_cast<AliFlatExternalTrackParam*> (fContent + fContentSize);
48ec9ee6 115 current->SetExternalTrackParam( param );
251a2c81 116 fTrackParamMask |= flag;
888585e5 117 fContentSize += sizeof(AliFlatExternalTrackParam);
251a2c81 118
119 return 0;
120}
121
0d577a2c 122
251a2c81 123// _______________________________________________________________________________________________________
ea12701f 124Bool_t AliFlatESDTrack::GetXYZ(Double_t *p) const {
125 const AliFlatExternalTrackParam *f = GetFlatTrackParam();
126 if (!f) { return kFALSE; }
127 p[0]=f->GetX();
128 p[1]=f->GetY();
129 p[2]=f->GetZ();
130 return kTRUE;
131}