1 /**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
5 * Primary Author: Per Thomas Hille <perthi@fys.uio.no> *
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 **************************************************************************/
16 #include "AliAltroData.h"
17 #include "AliAltroBunch.h"
19 ClassImp(AliAltroData)
21 AliAltroData::AliAltroData(): fData(0),
37 AliAltroData::~AliAltroData()
46 //AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch)
47 AliAltroData::NextBunch(AliAltroBunch *altroBunch)
50 if(fIsComplete == true)
53 if(fBunchCounter == 0)
55 fBunchData = &fData[fDataSize - 1];
56 altroBunch->fData = &fData[fDataSize - 1];
63 altroBunch->fBunchSize = *fBunchData;
64 altroBunch->fBunchDataSize = altroBunch->fBunchSize -2;
67 altroBunch->fEndTimeBin = *fBunchData;
70 fBunchData = fBunchData - (altroBunch->fBunchSize);
71 altroBunch->fData = altroBunch->fData - (altroBunch->fBunchSize);
85 printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
86 printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel());
96 //Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
97 int AliAltroData::NextBunch(AliAltroBunch *altroBunch)
100 if(fIsComplete == kTRUE)
102 if(fBunchCounter == 0)
104 fBunchData = &fData[fDataSize - 1];
109 if(*fBunchData == 0){ fWc += 1;};
111 altroBunch->SetData(fData + fDataSize - fWc);
113 int tmpsize = *fBunchData -2;
115 // altroBunch->SetBunchSize( *fBunchData -2 );
116 altroBunch->SetBunchSize( tmpsize );
119 fBufferLeft -= *fBunchData;
120 // printf("%s:%d, bufferleft = %d \n", __FILE__, __LINE__ , fBufferLeft);
122 altroBunch->SetEndTimeBin( *fBunchData );
124 // Matthias Oct 10 2008: those checks are certainly a bug, first the
125 // bunch size is subtracted from fBufferLeft ... and than once again
126 // I can understand that it should not be negative but the check as
127 // committed in revision 29090 is wrong.
128 // Effectively, this is always skipping the last bunch of the last
130 // if( (fBufferLeft <= 7 ) || ( fBufferLeft - tmpsize) <= 7)
131 //if( fBufferLeft - tmpsize <= 7)
134 // printf("%s:%d, ERROR, attempt too access buffer outside allowed range\n", __FILE__ , __LINE__ );
141 int tmpret = altroBunch->CheckConsistency();
149 if( altroBunch->CheckConsistency() == kFALSE)
156 // altroBunch->SetStartTimeBin(*fBunchData - fBunchSize);
157 fBunchData -= (altroBunch->GetBunchSize() +1);
159 // PATCH from Per Thomas Hille 250408 mke sure tha
160 // Data is consistent by cheking the start timebin, should never be negative
161 if( (int)altroBunch->GetStartTimeBin( ) < 0)
163 // printf("ERROR altroBunch->GetStartTimeBin( ) is %d", (int)altroBunch->GetStartTimeBin( ) );
179 // printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
180 // printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel());
188 void AliAltroData::Reset()
195 Int_t AliAltroData::GetChannel() const
200 Int_t AliAltroData::GetChip() const
202 return (fHadd & 0x70) >> 4 ;
205 Int_t AliAltroData::GetCard() const
207 return (fHadd & 0x780) >> 7;
211 Int_t AliAltroData::GetBranch() const
213 return (fHadd & 0x800 ) >> 11;