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