]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/PHOS/AliHLTAltroData.cxx
New component for writing calibration data to fxs (Oystein)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTAltroData.cxx
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
17 #include "AliHLTAltroData.h"
18
19
20 AliHLTAltroData::AliHLTAltroData(): fData(0),
21                                     fBunchData(0),
22                                     fDataSize(0),
23                                     fWc(0),
24                                     fHadd(0),
25                                     fBunchCounter(0),
26                                     fIsComplete(0)
27 {
28   //comment
29
30 }
31
32
33
34 AliHLTAltroData::~AliHLTAltroData()
35 {
36   //comment
37
38 }
39
40
41
42 bool
43 AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch)
44 {
45   //comment
46   if(fIsComplete == true)
47     {
48
49       if(fBunchCounter == 0)
50         {
51           fBunchData = &fData[fDataSize - 1];
52           altroBunch->fData = &fData[fDataSize - 1];
53         }
54
55       if(fWc < fDataSize)
56         {
57           fWc += *fBunchData;
58           altroBunch->fBunchSize = *fBunchData;
59           altroBunch->fBunchDataSize = altroBunch->fBunchSize  -2;
60
61           fBunchData --;
62           altroBunch->fEndTimeBin = *fBunchData;
63           fBunchData ++;
64
65           fBunchData = fBunchData  -  (altroBunch->fBunchSize);
66           altroBunch->fData = altroBunch->fData -  (altroBunch->fBunchSize);
67           //      altroBunch->fData = fBunchData -  (altroBunch->fBunchSize);
68           
69           //      fBunchData ++;
70           //      altroBunch->fData ++; 
71           
72
73
74           fBunchCounter ++;
75           return true;
76
77         }
78       else
79         {
80           fBunchCounter = 0;
81           fWc = 0;
82           return false;
83         }
84     }
85   else
86     {
87       printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
88       printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
89       return false;
90     }
91
92 }
93
94
95
96 /*
97 bool
98 AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch)
99 {
100   if(fIsComplete == true)
101     {
102
103       if(fBunchCounter == 0)
104         {
105           fBunchData = &fData[fDataSize - 1];
106         }
107
108       if(fWc < fDataSize)
109         {
110           
111           //      if(*fBunchData == 0)
112           //        {
113           //          fWc += 1;
114           //        }
115           
116           fWc += *fBunchData;
117           altroBunch->fData = fData - *fBunchData -1; ;
118           altroBunch->fBunchDataSize = *fBunchData -2;
119           fBunchData --;
120           altroBunch->fEndTimeBin = *fBunchData;
121           cout <<  "*fBuncchData = " << *fBunchData << endl;
122           fBunchData = fBunchData  -  (altroBunch->fBunchDataSize +1);
123
124
125           fBunchCounter ++;
126           return true;
127         }
128       else
129         {
130           fBunchCounter = 0;
131           fWc = 0;
132           return false;
133         }
134     }
135   else
136     {
137       printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
138       printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
139       return false;
140     }
141
142 }
143 */
144
145
146 void
147 AliHLTAltroData::Reset()
148 {
149   //comment
150    fWc = 0;
151    fBunchCounter = 0;
152 }
153
154
155 int
156 AliHLTAltroData::GetChannel()
157 {
158   //comment
159  return  fHadd & 0xf;
160 }
161
162 int
163 AliHLTAltroData::GetChip()
164 {
165   //comment
166  return  (fHadd & 0x70) >> 4 ;
167 }
168
169 int
170 AliHLTAltroData::GetCard()
171 {
172   //comment
173  return   (fHadd & 0x780) >>  7;
174 }
175
176
177 int
178 AliHLTAltroData::GetBranch()
179 {
180   //comment
181  return   (fHadd & 0x800 ) >> 11;
182 }