Line data Source code
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 :
24 : #include "AliHLTTRDCluster.h"
25 : #include <cstring>
26 :
27 : /**
28 : * Default Constructor
29 : */
30 : //============================================================================
31 : AliHLTTRDCluster::AliHLTTRDCluster():
32 0 : fSignals(0),
33 0 : fPadCol(0),
34 0 : fPadRow(0),
35 0 : fPadTime(0),
36 0 : fBits(0)
37 0 : {
38 0 : }
39 :
40 : /**
41 : * Main Constructor
42 : */
43 : //============================================================================
44 : AliHLTTRDCluster::AliHLTTRDCluster(const AliTRDcluster* const inCluster):
45 0 : fSignals(0),
46 0 : fPadCol(inCluster->fPadCol),
47 0 : fPadRow(inCluster->fPadRow),
48 0 : fPadTime(inCluster->fPadTime),
49 0 : fBits(0)
50 0 : {
51 :
52 0 : fSignals = inCluster->fSignals[2];
53 0 : fSignals|= inCluster->fSignals[3]<<10;
54 0 : fSignals|= inCluster->fSignals[4]<<21;
55 :
56 0 : fBits = UInt_t(inCluster->TestBits(-1)) >> 14;
57 0 : }
58 :
59 : /**
60 : * Copy data to the output TRDcluster
61 : */
62 : //============================================================================
63 : void AliHLTTRDCluster::ExportTRDCluster(AliTRDcluster* const outCluster) const
64 : {
65 0 : outCluster->fPadCol=fPadCol;
66 0 : outCluster->fPadRow=fPadRow;
67 0 : outCluster->fPadTime=fPadTime;
68 :
69 0 : outCluster->fSignals[2] = 0x3ff & fSignals;
70 0 : outCluster->fSignals[3] = 0x7ff & fSignals>>10;
71 0 : outCluster->fSignals[4] = 0x3ff & fSignals>>21;
72 :
73 0 : for(int i=2; i<5; i++){
74 0 : outCluster->fQ+=outCluster->fSignals[i];
75 : }
76 :
77 0 : outCluster->SetBit(UInt_t(fBits)<<14);
78 0 : }
79 :
80 :
81 : /**
82 : * Default Constructor
83 : */
84 : //============================================================================
85 : AliHLTTRDExtCluster::AliHLTTRDExtCluster():
86 0 : AliHLTTRDCluster(),
87 0 : fX(0),
88 0 : fY(0),
89 0 : fZ(0)
90 0 : {
91 0 : }
92 :
93 : /**
94 : * Main Constructor
95 : */
96 : //============================================================================
97 : AliHLTTRDExtCluster::AliHLTTRDExtCluster(const AliTRDcluster* const inCluster):
98 0 : AliHLTTRDCluster(inCluster),
99 0 : fX(inCluster->GetX()),
100 0 : fY(inCluster->GetY()),
101 0 : fZ(inCluster->GetZ())
102 0 : {
103 0 : }
104 :
105 :
106 : /**
107 : * Copy data to the output TRDcluster
108 : */
109 : //============================================================================
110 : void AliHLTTRDExtCluster::ExportTRDCluster(AliTRDcluster* const outCluster) const
111 : {
112 0 : AliHLTTRDCluster::ExportTRDCluster(outCluster);
113 0 : outCluster->SetX(fX);
114 0 : outCluster->SetY(fY);
115 0 : outCluster->SetZ(fZ);
116 0 : }
117 :
118 : /**
119 : * Prints main info about cluster
120 : */
121 : //============================================================================
122 : void AliHLTTRDExtCluster::Print() const
123 : {
124 0 : printf(" --hltCluster-- addr %p; sizeof(*this) %i\n", (void*)this, (int)sizeof(*this));
125 0 : printf(" fX %f; fY %f; fZ %f\n",fX,fY,fZ);
126 0 : }
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 0 : memcpy(block,inClust,sizeof(AliTRDcluster));
137 : size+=sizeof(AliTRDcluster);
138 :
139 0 : 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 0 : memcpy(((AliHLTUInt8_t*)outClust)+sizeof(void*),block+sizeof(void*),sizeof(AliTRDcluster)-sizeof(void*));
151 : size+=sizeof(AliTRDcluster);
152 :
153 0 : return size;
154 : }
|