]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/global/AliFlatESDTrack.cxx
f8653ca079c1861f0c54b428de79a879c917795c
[u/mrichter/AliRoot.git] / HLT / global / AliFlatESDTrack.cxx
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
33 #include "Rtypes.h"
34 #include "AliFlatESDTrack.h"
35 #include "AliFlatExternalTrackParam.h"
36 #include "AliESDtrack.h"
37 #include "AliExternalTrackParam.h"
38 #include "Riostream.h"
39
40 // _______________________________________________________________________________________________________
41 AliFlatESDTrack::AliFlatESDTrack() :
42   // Default constructor
43   fTrackParamMask(0),
44   fNTPCClusters(0),
45   fNITSClusters(0),
46   fContentSize(0)
47 {
48 }
49
50 // _______________________________________________________________________________________________________
51
52
53 // _______________________________________________________________________________________________________
54 Int_t AliFlatESDTrack::Set(const AliESDtrack* track)
55 {
56   // Fill external track parameters 
57   fTrackParamMask = 0;
58   fNTPCClusters = 0;
59   fNITSClusters = 0;
60   fContentSize = 0;
61   
62   if( !track ) return 0;
63
64   Int_t iResult = SetExternalTrackParam( track,
65                                          track->GetInnerParam(),
66                                          track->GetTPCInnerParam(),
67                                          track->GetOuterParam(),
68                                          track->GetConstrainedParam(), NULL );
69   fNITSClusters = track->GetTPCNcls();
70
71   return iResult;
72 }
73
74 // _______________________________________________________________________________________________________
75 Int_t AliFlatESDTrack::SetExternalTrackParam( 
76                                              const AliExternalTrackParam* refittedParam,
77                                              const AliExternalTrackParam* innerParam,
78                                              const AliExternalTrackParam* innerTPC,
79                                              const AliExternalTrackParam* outerParam,
80                                              const AliExternalTrackParam* constrainedParam,
81                                              const AliExternalTrackParam* outerITS
82                                               ){
83   // Fill external track parameters 
84
85   fTrackParamMask = 0;
86   fNTPCClusters = 0;
87   fContentSize = 0;
88
89   Int_t iResult = 0;
90
91   Byte_t flag = 0x1;
92   iResult = FillExternalTrackParam(refittedParam, flag);
93
94   flag = 0x2;
95   iResult = FillExternalTrackParam(innerParam, flag);
96   
97   flag = 0x4;
98   iResult = FillExternalTrackParam(innerTPC, flag);
99   
100   flag = 0x8;
101   iResult = FillExternalTrackParam(outerParam, flag);
102
103   flag = 0x10;
104   iResult = FillExternalTrackParam(constrainedParam, flag);
105
106   flag = 0x20;
107   iResult = FillExternalTrackParam(outerITS, flag);
108
109   return iResult;
110 }
111
112 // _______________________________________________________________________________________________________
113 Int_t AliFlatESDTrack::FillExternalTrackParam(const AliExternalTrackParam* param, UShort_t flag) {
114   // Fill external track parameters
115
116   if (!param) 
117     return -1;
118
119   Printf("  DEBUG: CONTENT %d >> %p + 0x%07llx = %p", flag, fContent, fContentSize, fContent + fContentSize);
120
121   AliFlatExternalTrackParam * current = reinterpret_cast<AliFlatExternalTrackParam*> (fContent + fContentSize);
122   current->SetAlpha(param->GetAlpha());
123   current->SetX(param->GetX());
124   current->SetY(param->GetY());
125   current->SetZ(param->GetZ());
126   current->SetSnp(param->GetSnp());
127   current->SetTgl(param->GetTgl());
128   current->SetSigned1Pt(param->GetSigned1Pt());
129   
130   const Double_t *cov = param->GetCovariance();
131   for (Int_t idx = 0; idx <15; ++idx)
132     current->fC[idx] = cov[idx];
133     
134   fTrackParamMask |= flag;
135   fContentSize += sizeof(AliFlatExternalTrackParam);
136
137   return 0;
138 }
139
140 // _______________________________________________________________________________________________________