38 #if !defined(__CINT__) || defined(__MAKECINT__)
40 #include "AliCodeTimer.h"
51 #include "AliRawReader.h"
52 #include "AliRawReaderMemory.h"
53 #include "AliRawDataHeader.h"
55 #include "TStopwatch.h"
57 #include "Riostream.h"
91 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
93 if (rawReader == NULL)
95 cerr <<
"ERROR: Could not create AliRawReader." << endl;
103 while (rawReader->NextEvent())
105 if (iEvent++ >= maxEvent)
break;
107 rawReader->Select(
"MUONTRG", 0, 1);
108 while (rawReader->ReadHeader())
113 cerr <<
"ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
118 info->
fEquipId = rawReader->GetEquipmentId();
119 info->
fBufferSize = rawReader->GetDataSize() +
sizeof(AliRawDataHeader);
123 cerr <<
"ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
130 memcpy(info->
fBuffer, rawReader->GetDataHeader(),
sizeof(AliRawDataHeader));
133 if (! rawReader->ReadNext(
134 info->
fBuffer +
sizeof(AliRawDataHeader),
139 cerr <<
"ERROR: Failed to read from AliRawReader." << endl;
156 while (current != NULL)
159 current = current->
fNext;
170 while (current != NULL)
173 current = current->
fNext;
184 AliRawReaderMemory rawReader;
186 rawReader.NextEvent();
193 while (current != NULL)
196 rawReader.SetEquipmentID(current->
fEquipId);
207 fXPattern, fYPattern)
210 if (i < maxBufferSize-1) i++;
213 current = current->
fNext;
216 return timer.RealTime();
224 AliRawReaderMemory rawReader;
226 rawReader.NextEvent();
233 while (current != NULL)
236 rawReader.SetEquipmentID(current->
fEquipId);
242 while ( (local = rawStream.
Next()) != NULL )
244 if (i < maxBufferSize)
259 current = current->
fNext;
262 return timer.RealTime();
271 AliRawReaderMemory rawReader;
273 rawReader.NextEvent();
280 while (current != NULL)
283 rawReader.SetEquipmentID(current->
fEquipId);
294 fXPattern, fYPattern)
297 if (i < maxBufferSize-1) i++;
300 current = current->
fNext;
303 return timer.RealTime();
307 void Loop(
const char* filename, Bool_t newDecoder)
309 AliCodeTimerAutoGeneral(Form(
"Loop %s",(newDecoder ?
"NEW":
"OLD")),);
311 AliRawReader* reader = AliRawReader::Create(filename);
336 while ( reader->NextEvent() )
340 while ( stream->
Next(
id, dec, trigY, yPos, sXDev, xDev, xPos,
341 triggerY, triggerX, xPattern, yPattern) )
354 AliCodeTimer::Instance()->Reset();
357 AliRawReader* reader = AliRawReader::Create(fileName.Data());
360 cerr <<
"Cannot create reader from " << fileName.Data() << endl;
367 Loop(fileName,kFALSE);
369 Loop(fileName,kTRUE);
371 AliCodeTimer::Instance()->Print();
380 UInt_t bufferCount =
LoadFiles(list, fileName, maxEvent);
381 if (bufferCount == 0)
383 cerr <<
"ERROR: No DDL files found or read in." << endl;
392 cerr <<
"ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
395 Double_t oldTimes[100];
396 for (Int_t i = 0; i < 100; i++)
398 cout <<
"Timing old decoder: timing iteration " << i+1 <<
" of 100" << endl;
401 Double_t newTimes[100];
402 for (Int_t i = 0; i < 100; i++)
404 cout <<
"Timing new decoder: timing iteration " << i+1 <<
" of 100" << endl;
407 Double_t newTimes2[100];
408 for (Int_t i = 0; i < 100; i++)
410 cout <<
"Timing new decoder with old interface: timing iteration " << i+1 <<
" of 100" << endl;
417 Double_t oldTime = TMath::Mean(100, oldTimes) / Double_t(bufferCount);
418 Double_t oldTimeErr = TMath::RMS(100, oldTimes) / Double_t(bufferCount);
419 Double_t newTime = TMath::Mean(100, newTimes) / Double_t(bufferCount);
420 Double_t newTimeErr = TMath::RMS(100, newTimes) / Double_t(bufferCount);
421 Double_t newTime2 = TMath::Mean(100, newTimes2) / Double_t(bufferCount);
422 Double_t newTime2Err = TMath::RMS(100, newTimes2) / Double_t(bufferCount);
424 cout <<
"Average processing time per DDL for:" << endl;
425 cout <<
" Old decoder = " << oldTime*1e6 <<
" +/- " << oldTimeErr*1e6/TMath::Sqrt(100) <<
" micro seconds" << endl;
426 cout <<
" New decoder = " << newTime*1e6 <<
" +/- " << newTimeErr*1e6/TMath::Sqrt(100) <<
" micro seconds" << endl;
427 cout <<
"New decoder with old interface = " << newTime2*1e6 <<
" +/- " << newTime2Err*1e6/TMath::Sqrt(100) <<
" micro seconds" << endl;
virtual Bool_t Next(UChar_t &id, UChar_t &dec, Bool_t &trigY, UChar_t &yPos, UChar_t &sXDev, UChar_t &xDev, UChar_t &xPos, Bool_t &triggerY, Bool_t &triggerX, TArrayS &xPattern, TArrayS &yPattern)
Advance one step in the iteration. Returns false if finished.
UChar_t GetYPos() const
Return Upos.
Light weight interface class to the local trigger card data.
void Loop(const char *filename, Bool_t newDecoder)
UInt_t CountMaxStructs(AliBufferInfo *list)
UChar_t GetId() const
Return Id.
Higher performance decoder stream class for reading MUON raw trigger data.
virtual void First()
Initialize iterator.
void ReleaseBuffers(AliBufferInfo *list)
virtual Bool_t Next(UChar_t &id, UChar_t &dec, Bool_t &trigY, UChar_t &yPos, UChar_t &sXDev, UChar_t &xDev, UChar_t &xPos, Bool_t &triggerY, Bool_t &triggerX, TArrayS &xPattern, TArrayS &yPattern)
Advance one step in the iteration. Returns false if finished.
UInt_t LoadFiles(AliBufferInfo *&list, TString fileName="./", Int_t maxEvent=1000)
void MUONTimeRawStreamTriggerDumb(TString fileName)
Double_t TimeUsingNewDecoder(AliBufferInfo *list, AliLocalStructInfo *buffer, UInt_t maxBufferSize)
Class for reading MUON raw digits.
Base class for reading MUON raw trigger data.
UChar_t GetXDev() const
Get X deviation.
void MUONTimeRawStreamTrigger(TString fileName="./", Int_t maxEvent=1000)
Bool_t GetSXDev() const
Get Sign of X deviation.
Double_t TimeUsingOldDecoder(AliBufferInfo *list, AliLocalStructInfo *buffer, UInt_t maxBufferSize)
UChar_t GetXPos() const
Return Xpos.
Bool_t GetTriggerY() const
Return TriggerY.
void First()
Initialize iterator.
Bool_t GetTrigY() const
Return TrigY.
UChar_t GetDec() const
Return Dec.
Bool_t GetTriggerX() const
Return TriggerX.
virtual void First()
Initialize iterator.
virtual Bool_t Next(UChar_t &id, UChar_t &dec, Bool_t &trigY, UChar_t &yPos, UChar_t &sXDev, UChar_t &xDev, UChar_t &xPos, Bool_t &triggerY, Bool_t &triggerX, TArrayS &xPattern, TArrayS &yPattern)=0
Advance one step in the iteration. Returns false if finished.
Double_t TimeUsingNewDecoderOldInterface(AliBufferInfo *list, AliLocalStructInfo *buffer, UInt_t maxBufferSize)