]>
Commit | Line | Data |
---|---|---|
56673b84 | 1 | /************************************************************************** |
2 | * This file is property of and copyright by the ALICE HLT Project * | |
3 | * All rights reserved. * | |
4 | * * | |
5 | * Primary Author: Per Thomas Hille <perthi@fys.uio.no> * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
7a18a20c | 15 | |
cd9b0124 | 16 | |
56673b84 | 17 | #include "AliHLTAltroData.h" |
7a18a20c | 18 | |
cd9b0124 | 19 | |
9c9d15d6 | 20 | AliHLTAltroData::AliHLTAltroData(): fData(0), |
21 | fBunchData(0), | |
22 | fDataSize(0), | |
23 | fWc(0), | |
24 | fHadd(0), | |
25 | fBunchCounter(0), | |
26 | fIsComplete(0) | |
7a18a20c | 27 | { |
28 | ||
29 | ||
30 | } | |
31 | ||
32 | ||
56673b84 | 33 | |
7a18a20c | 34 | AliHLTAltroData::~AliHLTAltroData() |
35 | { | |
36 | ||
37 | ||
38 | } | |
39 | ||
40 | ||
41 | bool | |
0d7c9b63 | 42 | AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch) |
7a18a20c | 43 | { |
44 | if(fIsComplete == true) | |
45 | { | |
46 | ||
7a18a20c | 47 | if(fBunchCounter == 0) |
48 | { | |
49 | fBunchData = &fData[fDataSize - 1]; | |
50 | } | |
7a18a20c | 51 | |
52 | if(fWc < fDataSize) | |
53 | { | |
cd9b0124 | 54 | |
55 | // if(*fBunchData == 0) | |
56 | // { | |
57 | // fWc += 1; | |
58 | // } | |
59 | ||
7a18a20c | 60 | fWc += *fBunchData; |
0d7c9b63 | 61 | altroBunch->fData = fData - *fBunchData -1; ; |
62 | altroBunch->fBunchSize = *fBunchData -2; | |
7a18a20c | 63 | fBunchData --; |
0d7c9b63 | 64 | altroBunch->fEndTimeBin = *fBunchData; |
cd9b0124 | 65 | cout << "*fBuncchData = " << *fBunchData << endl; |
0d7c9b63 | 66 | fBunchData = fBunchData - (altroBunch->fBunchSize +1); |
67 | ||
68 | ||
7a18a20c | 69 | fBunchCounter ++; |
7a18a20c | 70 | return true; |
71 | } | |
72 | else | |
73 | { | |
74 | fBunchCounter = 0; | |
7a18a20c | 75 | fWc = 0; |
76 | return false; | |
77 | } | |
78 | } | |
79 | else | |
80 | { | |
81 | printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing "); | |
82 | printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel()); | |
83 | return false; | |
84 | } | |
85 | ||
86 | } | |
87 | ||
88 | void | |
89 | AliHLTAltroData::Reset() | |
90 | { | |
91 | fWc = 0; | |
92 | fBunchCounter = 0; | |
93 | } | |
94 | ||
95 | ||
96 | int | |
97 | AliHLTAltroData::GetChannel() | |
98 | { | |
99 | return fHadd & 0xf; | |
100 | } | |
101 | ||
102 | int | |
103 | AliHLTAltroData::GetChip() | |
104 | { | |
105 | return (fHadd & 0x70) >> 4 ; | |
106 | } | |
107 | ||
108 | int | |
109 | AliHLTAltroData::GetCard() | |
110 | { | |
111 | return (fHadd & 0x780) >> 7; | |
112 | } | |
113 | ||
114 | ||
115 | int | |
116 | AliHLTAltroData::GetBranch() | |
117 | { | |
118 | return (fHadd & 0x800 ) >> 11; | |
119 | } |