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 // if( (fBufferLeft <= 7 ) || ( fBufferLeft - tmpsize) <= 7)
125 if( fBufferLeft - tmpsize <= 7)
127 // printf("%s:%d, ERROR, attempt too access buffer outside allowed range\n", __FILE__ , __LINE__ );
134 int tmpret = altroBunch->CheckConsistency();
142 if( altroBunch->CheckConsistency() == kFALSE)
149 // altroBunch->SetStartTimeBin(*fBunchData - fBunchSize);
150 fBunchData -= (altroBunch->GetBunchSize() +1);
152 // PATCH from Per Thomas Hille 250408 mke sure tha
153 // Data is consistent by cheking the start timebin, should never be negative
154 if( (int)altroBunch->GetStartTimeBin( ) < 0)
156 // printf("ERROR altroBunch->GetStartTimeBin( ) is %d", (int)altroBunch->GetStartTimeBin( ) );
172 // printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
173 // printf("\nfor branch %d, card %d, chip %d, channel %d\n", GetBranch(), GetCard(), GetChip(), GetChannel());
181 void AliAltroData::Reset()
188 Int_t AliAltroData::GetChannel() const
193 Int_t AliAltroData::GetChip() const
195 return (fHadd & 0x70) >> 4 ;
198 Int_t AliAltroData::GetCard() const
200 return (fHadd & 0x780) >> 7;
204 Int_t AliAltroData::GetBranch() const
206 return (fHadd & 0x800 ) >> 11;