]>
Commit | Line | Data |
---|---|---|
31a920d3 | 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 | **************************************************************************/ | |
15 | ||
16 | #include "AliAltroData.h" | |
17 | #include "AliAltroBunch.h" | |
18 | ||
19 | ClassImp(AliAltroData) | |
20 | ||
21 | AliAltroData::AliAltroData(): fData(0), | |
22 | fBunchData(0), | |
23 | fDataSize(0), | |
24 | fWc(0), | |
25 | fHadd(0), | |
26 | fBunchCounter(0), | |
27 | fIsComplete(0) | |
28 | { | |
29 | ||
30 | ||
31 | } | |
32 | ||
33 | ||
34 | ||
35 | AliAltroData::~AliAltroData() | |
36 | { | |
37 | ||
38 | ||
39 | } | |
40 | ||
41 | ||
42 | Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch) | |
43 | { | |
44 | if(fIsComplete == kTRUE) | |
45 | { | |
46 | ||
47 | if(fBunchCounter == 0) | |
48 | { | |
49 | fBunchData = &fData[fDataSize - 1]; | |
50 | } | |
51 | ||
52 | if(fWc < fDataSize) | |
53 | { | |
54 | if(*fBunchData == 0){ fWc += 1;}; | |
55 | fWc += *fBunchData; | |
56 | altroBunch->SetData( fData - *fBunchData -1 ); | |
57 | altroBunch->SetBunchSize( *fBunchData -2 ); | |
58 | fBunchData --; | |
59 | altroBunch->SetEndTimeBin( *fBunchData ); | |
60 | fBunchData -= (altroBunch->GetBunchSize() +1); | |
61 | ||
62 | ||
63 | fBunchCounter ++; | |
64 | return kTRUE; | |
65 | } | |
66 | else | |
67 | { | |
68 | fBunchCounter = 0; | |
69 | fWc = 0; | |
70 | return kFALSE; | |
71 | } | |
72 | } | |
73 | else | |
74 | { | |
75 | printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing "); | |
76 | printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel()); | |
77 | return kFALSE; | |
78 | } | |
79 | ||
80 | } | |
81 | ||
82 | void AliAltroData::Reset() | |
83 | { | |
84 | fWc = 0; | |
85 | fBunchCounter = 0; | |
86 | } | |
87 | ||
88 | ||
89 | Int_t AliAltroData::GetChannel() const | |
90 | { | |
91 | return fHadd & 0xf; | |
92 | } | |
93 | ||
94 | Int_t AliAltroData::GetChip() const | |
95 | { | |
96 | return (fHadd & 0x70) >> 4 ; | |
97 | } | |
98 | ||
99 | Int_t AliAltroData::GetCard() const | |
100 | { | |
101 | return (fHadd & 0x780) >> 7; | |
102 | } | |
103 | ||
104 | ||
105 | Int_t AliAltroData::GetBranch() const | |
106 | { | |
107 | return (fHadd & 0x800 ) >> 11; | |
108 | } |