37 #if !defined(__CINT__) || defined(__MAKECINT__)
39 #include "AliCodeTimer.h"
49 #include "AliRawReader.h"
50 #include "AliRawReaderMemory.h"
51 #include "AliRawDataHeader.h"
53 #include "TStopwatch.h"
55 #include "Riostream.h"
83 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
85 if (rawReader == NULL)
87 cerr <<
"ERROR: Could not create AliRawReader." << endl;
95 while (rawReader->NextEvent())
97 if (iEvent++ >= maxEvent)
break;
99 rawReader->Select(
"MUONTRK", 0, 19);
100 while (rawReader->ReadHeader())
105 cerr <<
"ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
110 info->
fEquipId = rawReader->GetEquipmentId();
111 info->
fBufferSize = rawReader->GetDataSize() +
sizeof(AliRawDataHeader);
115 cerr <<
"ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
122 memcpy(info->
fBuffer, rawReader->GetDataHeader(),
sizeof(AliRawDataHeader));
125 if (! rawReader->ReadNext(
126 info->
fBuffer +
sizeof(AliRawDataHeader),
131 cerr <<
"ERROR: Failed to read from AliRawReader." << endl;
148 while (current != NULL)
151 current = current->
fNext;
162 while (current != NULL)
165 current = current->
fNext;
176 AliRawReaderMemory rawReader;
178 rawReader.NextEvent();
185 while (current != NULL)
188 rawReader.SetEquipmentID(current->
fEquipId);
191 UShort_t manuId, adc;
197 while ((buspatch = rawStream.
Next()) != NULL)
201 buspatch->
GetData(j, manuId, manuChannel, adc);
202 if (i < maxBufferSize)
205 buffer[i].
fAdc = adc;
212 current = current->
fNext;
215 return timer.RealTime();
223 AliRawReaderMemory rawReader;
225 rawReader.NextEvent();
232 while (current != NULL)
235 rawReader.SetEquipmentID(current->
fEquipId);
239 UShort_t manuId, adc;
244 while ( rawStream.
Next(busPatch,manuId,manuChannel,adc,skipParityErrors) )
246 if (i < maxBufferSize)
249 buffer[i].
fAdc = adc;
255 current = current->
fNext;
258 return timer.RealTime();
263 AliCodeTimer::Instance()->Reset();
266 AliRawReader* reader = AliRawReader::Create(fileName.Data());
269 cerr <<
"Cannot create reader from " << fileName.Data() << endl;
276 UShort_t manuId, adc;
279 while ( reader->NextEvent() )
283 while ( stream.
Next(busPatch,manuId,manuChannel,adc) )
289 AliCodeTimer::Instance()->Print();
298 UInt_t bufferCount =
LoadFiles(list, fileName, maxEvent);
299 if (bufferCount == 0)
301 cerr <<
"ERROR: No DDL files found or read in." << endl;
310 cerr <<
"ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
313 Double_t bpTimes[100];
314 for (Int_t i = 0; i < 100; i++)
316 cout <<
"Timing decoder: bus patch iteration " << i+1 <<
" of 100" << endl;
319 Double_t channelTimes[100];
320 for (Int_t i = 0; i < 100; i++)
322 cout <<
"Timing decoder: channel iteration w/ parity check" << i+1 <<
" of 100" << endl;
325 Double_t channelTimes2[100];
326 for (Int_t i = 0; i < 100; i++)
328 cout <<
"Timing decoder: channel iteration w/o parity check" << i+1 <<
" of 100" << endl;
335 Double_t bpTime = TMath::Mean(100, bpTimes) / Double_t(bufferCount);
336 Double_t bpTimeErr = TMath::RMS(100, bpTimes) / Double_t(bufferCount);
337 Double_t channelTime = TMath::Mean(100, channelTimes) / Double_t(bufferCount);
338 Double_t channelTimeErr = TMath::RMS(100, channelTimes) / Double_t(bufferCount);
339 Double_t channelTime2 = TMath::Mean(100, channelTimes2) / Double_t(bufferCount);
340 Double_t channelTime2Err = TMath::RMS(100, channelTimes2) / Double_t(bufferCount);
342 cout <<
"Average processing time per DDL for:" << endl;
343 cout <<
" bus patch iteration = " << bpTime*1e6 <<
" +/- " << bpTimeErr*1e6/TMath::Sqrt(100) <<
" micro seconds" << endl;
344 cout <<
" channel iteration with parity check = " << channelTime*1e6 <<
" +/- " << channelTimeErr*1e6/TMath::Sqrt(100) <<
" micro seconds" << endl;
345 cout <<
" channel iteration without parity check = " << channelTime2*1e6 <<
" +/- " << channelTime2Err*1e6/TMath::Sqrt(100) <<
" micro seconds" << endl;
A high performance stream decoder for muon tracking DDL streams.
Double_t TimeDecoderChannelIteration(AliBufferInfo *list, AliDigitInfo *buffer, UInt_t maxBufferSize, Bool_t skipParityErrors)
void ReleaseBuffers(AliBufferInfo *list)
UInt_t GetDataCount() const
Returns the number of raw data words within this bus patch.
UInt_t CountMaxDigits(AliBufferInfo *list)
void MUONTimeRawStreamTrackerDumb(TString fileName)
const UInt_t * GetData() const
Return raw digit data.
Double_t TimeDecoderBusPatchIteration(AliBufferInfo *list, AliDigitInfo *buffer, UInt_t maxBufferSize)
UInt_t LoadFiles(AliBufferInfo *&list, TString fileName="./", Int_t maxEvent=1000)
virtual void First()
Initialize iterator.
Light weight interface class to the bus patch data.
void MUONTimeRawStreamTracker(TString fileName="./", Int_t maxEvent=1000)
Declaration of the high performance decoder for muon trigger chamber raw streams. ...
virtual Bool_t Next(Int_t &busPatchId, UShort_t &manuId, UChar_t &manuChannel, UShort_t &adc)
Advance one step in the iteration. Returns false if finished.