]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliAltroData.cxx
Commit of new FMD3 geometry and other geometry related issues.
[u/mrichter/AliRoot.git] / RAW / AliAltroData.cxx
CommitLineData
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
19ClassImp(AliAltroData)
20
21AliAltroData::AliAltroData(): fData(0),
22 fBunchData(0),
23 fDataSize(0),
24 fWc(0),
53d3458c 25 fHadd(-1),
26 fPrevHadd(-1),
31a920d3 27 fBunchCounter(0),
28 fIsComplete(0)
29{
30
31
32}
33
34
35
36AliAltroData::~AliAltroData()
37{
38
39
40}
41
42
ac672c4c 43/*
44bool
45//AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch)
46AliAltroData::NextBunch(AliAltroBunch *altroBunch)
47{
48 //comment
49 if(fIsComplete == true)
50 {
51
52 if(fBunchCounter == 0)
53 {
54 fBunchData = &fData[fDataSize - 1];
55 altroBunch->fData = &fData[fDataSize - 1];
56
57 }
58
59 if(fWc < fDataSize)
60 {
61 fWc += *fBunchData;
62 altroBunch->fBunchSize = *fBunchData;
63 altroBunch->fBunchDataSize = altroBunch->fBunchSize -2;
64
65 fBunchData --;
66 altroBunch->fEndTimeBin = *fBunchData;
67 fBunchData ++;
68
69 fBunchData = fBunchData - (altroBunch->fBunchSize);
70 altroBunch->fData = altroBunch->fData - (altroBunch->fBunchSize);
71 fBunchCounter ++;
72 return true;
73
74 }
75 else
76 {
77 fBunchCounter = 0;
78 fWc = 0;
79 return false;
80 }
81 }
82 else
83 {
84 printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
85 printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel());
86 return false;
87 }
88}
89
90*/
91
92
93
94
31a920d3 95Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
96{
ac672c4c 97
31a920d3 98 if(fIsComplete == kTRUE)
99 {
100
101 if(fBunchCounter == 0)
102 {
103 fBunchData = &fData[fDataSize - 1];
104 }
105
106 if(fWc < fDataSize)
107 {
108 if(*fBunchData == 0){ fWc += 1;};
109 fWc += *fBunchData;
1f8ca0bc 110 altroBunch->SetData(fData + fDataSize - fWc);
111 altroBunch->SetBunchSize(*fBunchData -2);
31a920d3 112 fBunchData --;
113 altroBunch->SetEndTimeBin( *fBunchData );
1f8ca0bc 114 // altroBunch->SetStartTimeBin(*fBunchData - fBunchSize);
31a920d3 115 fBunchData -= (altroBunch->GetBunchSize() +1);
84111923 116
117 // PATCH from Per Thomas Hille 250408 mke sure tha
118 // Data is consistent by cheking the start timebin, should never be negative
119 if( (int)altroBunch->GetStartTimeBin( ) < 0)
120 {
121 // printf("ERROR altroBunch->GetStartTimeBin( ) is %d", (int)altroBunch->GetStartTimeBin( ) );
122 return kFALSE;
123 }
124
125
31a920d3 126 fBunchCounter ++;
127 return kTRUE;
128 }
129 else
130 {
131 fBunchCounter = 0;
132 fWc = 0;
133 return kFALSE;
134 }
135 }
136 else
137 {
84111923 138 // printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
139 // printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel());
31a920d3 140 return kFALSE;
141 }
142
143}
144
ac672c4c 145
146
31a920d3 147void AliAltroData::Reset()
148{
149 fWc = 0;
150 fBunchCounter = 0;
151}
152
153
154Int_t AliAltroData::GetChannel() const
155{
156 return fHadd & 0xf;
157}
158
159Int_t AliAltroData::GetChip() const
160{
161 return (fHadd & 0x70) >> 4 ;
162}
163
164Int_t AliAltroData::GetCard() const
165{
166 return (fHadd & 0x780) >> 7;
167}
168
169
170Int_t AliAltroData::GetBranch() const
171{
172 return (fHadd & 0x800 ) >> 11;
173}