]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TRD/AliHLTTRDCluster.cxx
added new function to extract DDL id from HLT origin and specification, code cleanup
[u/mrichter/AliRoot.git] / HLT / TRD / AliHLTTRDCluster.cxx
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   fSignals(0),
33   fPadCol(0),
34   fPadRow(0),
35   fPadTime(0),
36   fBits(0)
37 {
38 }
39
40 /**
41  * Main Constructor
42  */
43 //============================================================================
44 AliHLTTRDCluster::AliHLTTRDCluster(const AliTRDcluster* const inCluster):
45   fSignals(0),
46   fPadCol(inCluster->fPadCol),
47   fPadRow(inCluster->fPadRow),
48   fPadTime(inCluster->fPadTime),
49   fBits(0)
50 {
51
52   fSignals = inCluster->fSignals[2];
53   fSignals|= inCluster->fSignals[3]<<10;
54   fSignals|= inCluster->fSignals[4]<<21;
55
56   fBits = UInt_t(inCluster->TestBits(-1)) >> 14; 
57 }
58
59 /**
60  * Copy data to the output TRDcluster
61  */
62 //============================================================================
63 void AliHLTTRDCluster::ExportTRDCluster(AliTRDcluster* const outCluster) const
64 {
65   outCluster->fPadCol=fPadCol;
66   outCluster->fPadRow=fPadRow;
67   outCluster->fPadTime=fPadTime;
68   
69   outCluster->fSignals[2] = 0x3ff & fSignals;
70   outCluster->fSignals[3] = 0x7ff & fSignals>>10;
71   outCluster->fSignals[4] = 0x3ff & fSignals>>21;
72
73   for(int i=2; i<5; i++){
74     outCluster->fQ+=outCluster->fSignals[i];
75   }
76
77   outCluster->SetBit(UInt_t(fBits)<<14);
78 }
79
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
118 /**
119  * Prints main info about cluster
120  */
121 //============================================================================
122 void AliHLTTRDExtCluster::Print() const
123 {
124   printf("   --hltCluster-- addr %p; sizeof(*this) %i\n", (void*)this, (int)sizeof(*this));
125   printf("     fX %f; fY %f; fZ %f\n",fX,fY,fZ);
126 }
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 }