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