]>
Commit | Line | Data |
---|---|---|
196a8c4f | 1 | // $Id$ |
2 | ||
3 | /************************************************************************** | |
4 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * * | |
6 | * Authors: * | |
7 | * for The ALICE HLT Project. * | |
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 | // @file AliHLTTRDCluster.cxx | |
19 | // @author Theodor Rascanu | |
20 | // @date | |
21 | // @brief A datacontainer for clusters fitting component for the HLT. | |
22 | // | |
23 | ||
d679dd6c | 24 | #include "AliHLTTRDCluster.h" |
196a8c4f | 25 | #include <cstring> |
d679dd6c | 26 | |
d679dd6c | 27 | /** |
28 | * Default Constructor | |
29 | */ | |
30 | //============================================================================ | |
31 | AliHLTTRDCluster::AliHLTTRDCluster(): | |
196a8c4f | 32 | fSignals(0), |
d679dd6c | 33 | fPadCol(0), |
34 | fPadRow(0), | |
93ce7d1b | 35 | fPadTime(0), |
0fae33c8 | 36 | fBits(0) |
d679dd6c | 37 | { |
38 | } | |
39 | ||
40 | /** | |
41 | * Main Constructor | |
42 | */ | |
43 | //============================================================================ | |
93ce7d1b | 44 | AliHLTTRDCluster::AliHLTTRDCluster(const AliTRDcluster* const inCluster): |
196a8c4f | 45 | fSignals(0), |
46 | fPadCol(inCluster->fPadCol), | |
47 | fPadRow(inCluster->fPadRow), | |
48 | fPadTime(inCluster->fPadTime), | |
0fae33c8 | 49 | fBits(0) |
d679dd6c | 50 | { |
0fae33c8 | 51 | |
196a8c4f | 52 | fSignals = inCluster->fSignals[2]; |
53 | fSignals|= inCluster->fSignals[3]<<10; | |
54 | fSignals|= inCluster->fSignals[4]<<20; | |
0fae33c8 | 55 | |
56 | fBits = UInt_t(inCluster->TestBits(-1)) >> 14; | |
d679dd6c | 57 | } |
58 | ||
d679dd6c | 59 | /** |
60 | * Copy data to the output TRDcluster | |
61 | */ | |
62 | //============================================================================ | |
93ce7d1b | 63 | void AliHLTTRDCluster::ExportTRDCluster(AliTRDcluster* const outCluster) const |
d679dd6c | 64 | { |
93ce7d1b | 65 | outCluster->fPadCol=fPadCol; |
66 | outCluster->fPadRow=fPadRow; | |
67 | outCluster->fPadTime=fPadTime; | |
196a8c4f | 68 | |
69 | outCluster->fSignals[2] = 0x3ff & fSignals; | |
70 | outCluster->fSignals[3] = 0x3ff & fSignals>>10; | |
71 | outCluster->fSignals[4] = 0x3ff & fSignals>>20; | |
d679dd6c | 72 | |
0fae33c8 | 73 | for(int i=0; i<3; i++){ |
196a8c4f | 74 | outCluster->fQ+=outCluster->fSignals[i]; |
0fae33c8 | 75 | } |
76 | ||
77 | outCluster->SetBit(UInt_t(fBits)<<14); | |
d679dd6c | 78 | } |
79 | ||
196a8c4f | 80 | |
81 | /** | |
82 | * Default Constructor | |
83 | */ | |
84 | //============================================================================ | |
85 | AliHLTTRDExtCluster::AliHLTTRDExtCluster(): | |
86 | AliHLTTRDCluster(), | |
87 | fX(0), | |
88 | fY(0), | |
89 | fZ(0) | |
90 | { | |
91 | } | |
92 | ||
93 | /** | |
94 | * Main Constructor | |
95 | */ | |
96 | //============================================================================ | |
97 | AliHLTTRDExtCluster::AliHLTTRDExtCluster(const AliTRDcluster* const inCluster): | |
98 | AliHLTTRDCluster(inCluster), | |
99 | fX(inCluster->GetX()), | |
100 | fY(inCluster->GetY()), | |
101 | fZ(inCluster->GetZ()) | |
102 | { | |
103 | } | |
104 | ||
105 | ||
106 | /** | |
107 | * Copy data to the output TRDcluster | |
108 | */ | |
109 | //============================================================================ | |
110 | void AliHLTTRDExtCluster::ExportTRDCluster(AliTRDcluster* const outCluster) const | |
111 | { | |
112 | AliHLTTRDCluster::ExportTRDCluster(outCluster); | |
113 | outCluster->SetX(fX); | |
114 | outCluster->SetY(fY); | |
115 | outCluster->SetZ(fZ); | |
116 | } | |
117 | ||
d679dd6c | 118 | /** |
119 | * Prints main info about cluster | |
120 | */ | |
121 | //============================================================================ | |
196a8c4f | 122 | void AliHLTTRDExtCluster::Print() const |
d679dd6c | 123 | { |
e03c1166 | 124 | printf(" --hltCluster-- addr %p; sizeof(*this) %i\n", (void*)this, (int)sizeof(*this)); |
93ce7d1b | 125 | printf(" fX %f; fY %f; fZ %f\n",fX,fY,fZ); |
d679dd6c | 126 | } |
196a8c4f | 127 | |
128 | /** | |
129 | * Save cluster at block position | |
130 | */ | |
131 | //============================================================================ | |
132 | AliHLTUInt32_t AliHLTTRDCluster::SaveAt(AliHLTUInt8_t *const block, const AliTRDcluster* const inClust) | |
133 | { | |
134 | AliHLTUInt32_t size=0; | |
135 | ||
136 | memcpy(block,inClust,sizeof(AliTRDcluster)); | |
137 | size+=sizeof(AliTRDcluster); | |
138 | ||
139 | return size; | |
140 | } | |
141 | ||
142 | /** | |
143 | * Read cluster from block | |
144 | */ | |
145 | //============================================================================ | |
146 | AliHLTUInt32_t AliHLTTRDCluster::LoadFrom(AliTRDcluster *const outClust, const AliHLTUInt8_t *const block) | |
147 | { | |
148 | AliHLTUInt32_t size=0; | |
149 | ||
150 | memcpy(((AliHLTUInt8_t*)outClust)+sizeof(void*),block+sizeof(void*),sizeof(AliTRDcluster)-sizeof(void*)); | |
151 | size+=sizeof(AliTRDcluster); | |
152 | ||
153 | return size; | |
154 | } |