#include "AliHLTTPCDigitReaderUnpacked.h"
#include "AliHLTTPCDigitReaderPacked.h"
#include "AliHLTTPCDigitReaderRaw.h"
+#include "AliHLTTPCDigitReaderDecoder.h"
#include "AliHLTTPCDefinitions.h"
#define DefaultRawreaderMode 0
:
AliHLTFileWriter(),
fRawreaderMode(DefaultRawreaderMode),
- fDigitReaderType(kDigitReaderRaw),
+ fDigitReaderType(kDigitReaderDecoder),
fRcuTrailerSize(2),
fUnsorted(false)
{
fDigitReaderType=kDigitReaderPacked;
} else if (param.CompareTo("raw", TString::kIgnoreCase)==0) {
fDigitReaderType=kDigitReaderRaw;
+ } else if (param.CompareTo("decoder", TString::kIgnoreCase)==0) {
+ fDigitReaderType=kDigitReaderDecoder;
} else {
HLTError("unknown digit reader type %s", param.Data());
iResult=-EINVAL;
HLTInfo("create DigitReaderRaw");
pReader=new AliHLTTPCDigitReaderRaw(fRawreaderMode);
break;
+ case kDigitReaderDecoder:
+ HLTInfo("create DigitReaderDecoder");
+ pReader=new AliHLTTPCDigitReaderDecoder();
+ break;
}
if (!pReader) {
HLTError("can not create digit reader of type %d", fDigitReaderType);
int iPrintedPad=-1;
int iLastTime=-1;
while (pReader->Next()) {
- if ((iPrintedSlice!=-1 && iLastTime!=pReader->GetTime()+1 && iLastTime!=pReader->GetTime()-1) ||
- (iPrintedPad!=-1 && iPrintedPad!=pReader->GetPad()) ||
- (iPrintedRow!=-1 && iPrintedRow!=pReader->GetRow())) {
+ if ((iPrintedSlice!=-1 && iLastTime!=-1 && iLastTime!=pReader->GetTime()+1 && iLastTime!=pReader->GetTime()-1)) {
+ dump << " -> Time: " << iLastTime << endl;
+ } else if ((iPrintedPad!=-1 && iPrintedPad!=pReader->GetPad()) ||
+ (iPrintedRow!=-1 && iPrintedRow!=pReader->GetRow())) {
dump << endl;
}
+
if (iPrintedSlice!=slice || iPrintedPart!=part) {
iPrintedSlice=slice;
iPrintedPart=part;
*
* Optional arguments: <br>
* <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
- * \li -rawreadermode <i> mode </i> <br>
- * data mode of the <b>AliHLTTPCDigitReaderRaw</b>
* \li -digitreader <i> reader </i> <br>
- * type of the digit reader: <i>unpacked, packed, raw</i>
+ * type of the digit reader: <i>unpacked, packed, raw, decoder</i>
+ * default 'decoder'
* \li -rcutrailersize <i> size </i> <br>
- * size of the RCU trailer in 32bit words (default 2)
+ * size of the RCU trailer in 32bit words (default 2), if digitreader
+ * 'decoder' is used, the trailer size is determined automatically
+ * \li -rawreadermode <i> mode </i> <br>
+ * data mode of the <b>AliHLTTPCDigitReaderRaw</b>
* \li -unsorted <br>
* unsorted mode of digit readers (default sorted)
* \li -sorted <br>
kDigitReaderInvalid,
kDigitReaderUnpacked,
kDigitReaderPacked,
- kDigitReaderRaw
+ kDigitReaderRaw,
+ kDigitReaderDecoder
};
/** the mode for the DigitReaderRaw */
using namespace std;
#endif
+#include <cassert>
#include "AliHLTTPCDigitReaderDecoder.h"
#include "AliHLTTPCMapping.h"
#include "AliAltroDecoder.h"
fAltroData(),
fAltroBunch(NULL),
fMapping(NULL),
- fNextCounter(0),
+ // initialization due to the logic in NextSignals
+ fNextCounter(-1),
fNextSignalMethodUsed(kFALSE)
{
// see header file for class documentation
int AliHLTTPCDigitReaderDecoder::InitBlock(void* ptr,unsigned long size, Int_t patch, Int_t slice)
{
// see header file for class documentation
- fMapping = new AliHLTTPCMapping(patch);
- fAltroDecoder = new AliAltroDecoder();
- fAltroBunch = new AliAltroBunch();
+ // HLTDebug("Initializing block in decoder");
+ if(!fMapping){
+ fMapping = new AliHLTTPCMapping(patch);
+ }
+ if(!fAltroDecoder){
+ fAltroDecoder = new AliAltroDecoder();
+ }
+ if(!fAltroBunch){
+ fAltroBunch = new AliAltroBunch();
+ }
fAltroDecoder->SetMemory((UChar_t*)ptr, size);
fAltroDecoder->Decode();
return 0;
bool AliHLTTPCDigitReaderDecoder::NextSignal()
{
// see header file for class documentation
- /* nextSignalMethodUsed=kTRUE;
- if(!fAltroBunch){ // this is true when NextChannel and Next bunch has not been called yet
- if(NextChannel()){ // checks if ther is any pads with data
- if(!NextBunch()){ // checks if there is any bunch
- return false;
- }
+ fNextSignalMethodUsed=kTRUE;
+ do {
+ if (fNextCounter>0) {
+ // there is data available in the current bunch
+ fNextCounter--;
+ return true;
}
- else{
- return false;
+
+ // there is no data left in the current bunch, search for the next one
+ while (NextBunch()) if (GetBunchSize()>0) {
+ fNextCounter=GetBunchSize()-1;
+ return true;
}
- }
+
+ fNextCounter=-1;
+ // there is no bunch left, go to the next channel
+ } while (NextChannel());
- UInt_t bunchSize=fAltroBunchSize;
- if(nextCounter==bunchSize){
- nextCounter=0;
- return false;
- }*/
- return true;
+ return false;
}
const UInt_t* AliHLTTPCDigitReaderDecoder::GetSignals()
{
// see header file for class documentation
return fMapping->GetPad(fAltroData.GetHadd());
- // return 0;
}
int AliHLTTPCDigitReaderDecoder::GetSignal()
{
// see header file for class documentation
+ if (fNextSignalMethodUsed) {
+ const UInt_t* pData=GetSignals();
+ if (pData && fNextCounter>=0) {
+ assert(fNextCounter<GetBunchSize());
+ return pData[fNextCounter];
+ }
+ }
return 0;
}
return fAltroBunch->GetStartTimeBin();
}
else{
+ assert(fNextCounter>=0);
return fAltroBunch->GetStartTimeBin()+fNextCounter;
}
}
int AliHLTTPCDigitReaderDecoder::GetBunchSize()
{
+ // see header file for class documentation
return fAltroBunch->GetBunchSize();
}
+
+AliHLTUInt32_t AliHLTTPCDigitReaderDecoder::GetAltroBlockHWaddr() const
+{
+ // see header file for class documentation
+ return (AliHLTUInt32_t)fAltroData.GetHadd();
+}
const UInt_t* GetSignals();
int GetTime();
int GetBunchSize();
+ AliHLTUInt32_t GetAltroBlockHWaddr() const;
+
protected:
bool NextSignal();
AliAltroBunch *fAltroBunch; //! transient
AliHLTTPCMapping *fMapping; //! transient
- UInt_t fNextCounter; //! transient
- Bool_t fNextSignalMethodUsed; //! transient
-
-
+ int fNextCounter; //! transient
+ bool fNextSignalMethodUsed; //! transient
- ClassDef(AliHLTTPCDigitReaderDecoder, 1)
+ ClassDef(AliHLTTPCDigitReaderDecoder, 2)
};
#endif