change bits according to TObject (Theo)
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDTracklet.cxx
CommitLineData
d679dd6c 1#include "AliHLTTRDTracklet.h"
d679dd6c 2/**
3 * Default Constructor
4 */
5//============================================================================
6AliHLTTRDTracklet::AliHLTTRDTracklet():
93ce7d1b 7 fN(0),
93ce7d1b 8 fdX(-1),
9 fS2Y(-1),
e44c0591 10 fPt(-1),
d679dd6c 11 fX0(-1),
d679dd6c 12 fC(-1),
d679dd6c 13 fChi2(-1),
9630a0b8 14 fDet(-1),
15 fCount(0),
93ce7d1b 16#if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC)
9630a0b8 17 fSize(sizeof(AliHLTTRDTracklet)-sizeof(IndexAndCluster))
93ce7d1b 18#else
9630a0b8 19 fSize(sizeof(AliHLTTRDTracklet))
93ce7d1b 20#endif
d679dd6c 21{
22 InitArrays();
d679dd6c 23}
24
25/**
93ce7d1b 26 * Main Constructor
d679dd6c 27 */
28//============================================================================
93ce7d1b 29AliHLTTRDTracklet::AliHLTTRDTracklet(const AliTRDseedV1* const inTracklet):
30 fN(inTracklet->fN),
93ce7d1b 31 fdX(inTracklet->fdX),
32 fS2Y(inTracklet->fS2Y),
33 fPt(inTracklet->fPt),
93ce7d1b 34 fX0(inTracklet->fX0),
35 fC(inTracklet->fC),
36 fChi2(inTracklet->fChi2),
9630a0b8 37 fDet(inTracklet->fDet),
38 fCount(0),
93ce7d1b 39#if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC)
9630a0b8 40 fSize(sizeof(AliHLTTRDTracklet)-sizeof(IndexAndCluster))
93ce7d1b 41#else
9630a0b8 42 fSize(sizeof(AliHLTTRDTracklet))
93ce7d1b 43#endif
d679dd6c 44{
93ce7d1b 45 CopyDataMembers(inTracklet);
d679dd6c 46}
47
48/**
49 * Copy simple (non-pointer) data members from TRDTracklet to HLTTRDTracklet
50 */
51//============================================================================
93ce7d1b 52void AliHLTTRDTracklet::CopyDataMembers(const AliTRDseedV1* const inTracklet)
d679dd6c 53{
93ce7d1b 54 //fChi2Z = inTracklet->GetChi2Z();
55
d679dd6c 56 for (Int_t i=0; i < 2; i++){
93ce7d1b 57 fYref[i] = inTracklet->fYref[i];
58 fZref[i] = inTracklet->fZref[i];
59 fYfit[i] = inTracklet->fYfit[i];
60 fZfit[i] = inTracklet->fZfit[i];
d679dd6c 61 }
9630a0b8 62
63 for (Int_t i=0; i < 3; i++){
64 fPad[i] = inTracklet->fPad[i];
65 }
d679dd6c 66
93ce7d1b 67 for (Int_t i=0; i < AliPID::kSPECIES; i++){
68 fProb[i] = inTracklet->fProb[i];
d679dd6c 69 }
70
93ce7d1b 71 for (Int_t iTimeBin = 0; iTimeBin < AliTRDseedV1::kNclusters; iTimeBin++)
72 {
73 AliTRDcluster* trdCluster = inTracklet->GetClusters(iTimeBin);
74 if (trdCluster){
75 fClusters[fCount].Index = inTracklet->fIndexes[iTimeBin];
76 new (&fClusters[fCount].Cluster) AliHLTTRDCluster(trdCluster);
77 fCount++;
78 fSize += sizeof(IndexAndCluster);
79 }
80 }
d679dd6c 81
93ce7d1b 82 //if((void*)&fClusters[fCount].Index!=(void*)GetEndPointer()){printf("ERRR");return;}
d679dd6c 83}
84
85/**
86 * Copy data to the output TRDseedV1
87 */
88//============================================================================
93ce7d1b 89void AliHLTTRDTracklet::ExportTRDTracklet(AliTRDseedV1* const outTracklet) const
d679dd6c 90{
93ce7d1b 91 //outTracklet->Reset(); we always use a fresh trdtracklet as input, so this is useless
d8731936 92 outTracklet->SetBit(AliTRDseedV1::kOwner);
93ce7d1b 93
94 outTracklet->fN = fN;
95 outTracklet->fDet = fDet;
93ce7d1b 96 outTracklet->fdX = fdX;
97 outTracklet->fX0 = fX0;
98 outTracklet->fS2Y = fS2Y;
99 outTracklet->fPt = fPt;
100 outTracklet->fC = fC;
101 outTracklet->fChi2 = fChi2;
102
d679dd6c 103 for (Int_t i=0; i < 2; i++){
93ce7d1b 104 outTracklet->fYref[i] = fYref[i];
105 outTracklet->fZref[i] = fZref[i];
106 outTracklet->fYfit[i] = fYfit[i];
107 outTracklet->fZfit[i] = fZfit[i];
d679dd6c 108 }
d679dd6c 109
9630a0b8 110 for (Int_t i=0; i < 3; i++){
111 outTracklet->fPad[i] = fPad[i];
112 }
113
93ce7d1b 114 for (Int_t i=0; i < AliPID::kSPECIES; i++){
115 outTracklet->fProb[i] = fProb[i];
d679dd6c 116 }
e3cf3d02 117
93ce7d1b 118 for (UInt_t iCluster=0; iCluster < fCount; iCluster++){
119 AliTRDcluster *trdCluster = new AliTRDcluster();
120 fClusters[iCluster].Cluster.ExportTRDCluster(trdCluster);
121 outTracklet->fClusters[iCluster] = trdCluster;
122 outTracklet->fIndexes[iCluster] = fClusters[iCluster].Index;
123 iCluster++;
d679dd6c 124 }
d679dd6c 125}
126
127
128/**
129 * Init arrays
130 */
131//============================================================================
132void AliHLTTRDTracklet::InitArrays()
133{
d679dd6c 134 for (Int_t i=0; i < 2; i++){
135 fYref[i] = -1;
136 fZref[i] = -1;
d679dd6c 137 fYfit[i] = -1;
138 fZfit[i] = -1;
d679dd6c 139 }
93ce7d1b 140 for (Int_t i=0; i < AliPID::kSPECIES; i++)
141 fProb[i]=0;
d679dd6c 142}
143
144/**
145 * Prints main info about tracklet
146 */
147//============================================================================
93ce7d1b 148void AliHLTTRDTracklet::Print(Bool_t printClusters) const
d679dd6c 149{
150 //printf("--hltTracklet-- addr 0x%p(%i); fSize %i\n", this, (int)this, fSize);
93ce7d1b 151 printf(" fDet %i; fPt %f; fdX %f fN %i\n", fDet, fPt, fdX, fN);
d679dd6c 152
e3cf3d02 153 if(!printClusters) return;
93ce7d1b 154 for (UInt_t iCount=0, iCluster = 0; iCluster < fCount; iCount++){
155 printf(" [%i] ",iCount);
156 fClusters[iCluster].Cluster.Print();
157 iCluster++;
d679dd6c 158 }
d679dd6c 159}
160
161/**
162 * Read clusters to TRDtracklet from the memory
163 */
164//============================================================================
93ce7d1b 165// void AliHLTTRDTracklet::ReadClustersFromMemory(void *input)
166// {
167// AliHLTUInt8_t *iterPtr = (AliHLTUInt8_t*) input;
168// AliHLTTRDCluster* hltCluster = NULL;
d679dd6c 169
93ce7d1b 170// for (Int_t iCluster = 0; iCluster < AliTRDseedV1::kNclusters; iCluster++){
171// // if we had something in the fClusters[iCluster] before copying,
172// // then this entry in the array should not be empty. Fill it.
173// if (fClusters[iCluster]){
174// hltCluster = (AliHLTTRDCluster*) iterPtr;
175// fClusters[iCluster] = hltCluster;
176// iterPtr += hltCluster->GetSize();
177// //hltCluster->Print();
178// }
d679dd6c 179
93ce7d1b 180// }
181// }
d8731936 182