]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RAW/AliAltroData.cxx
Record changes.
[u/mrichter/AliRoot.git] / RAW / AliAltroData.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 #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(-1),
26                                     fPrevHadd(-1),
27                                     fBunchCounter(0),
28                                     fIsComplete(0)
29 {
30
31
32 }
33
34
35
36 AliAltroData::~AliAltroData()
37 {
38
39
40 }
41
42
43 Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
44 {
45   if(fIsComplete == kTRUE)
46     {
47
48       if(fBunchCounter == 0)
49         {
50           fBunchData = &fData[fDataSize - 1];
51         }
52
53       if(fWc < fDataSize)
54         {
55           if(*fBunchData == 0){ fWc += 1;};
56           fWc += *fBunchData;
57           altroBunch->SetData(fData + fDataSize - fWc);
58           altroBunch->SetBunchSize(*fBunchData -2);
59           fBunchData --;
60           altroBunch->SetEndTimeBin( *fBunchData );
61           //      altroBunch->SetStartTimeBin(*fBunchData - fBunchSize);
62           fBunchData -= (altroBunch->GetBunchSize() +1);
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 }