/// - and one, using an iterator, where we're directly accessing the pad informations
/// (charge).
///
-/// The different stucture of the payload are readout and stored in TClonesArray
-/// with AliMUONRawStreamTracker class.
-/// The macro just simply reads again the TClonesArray contents.
-/// The parameters of each structure could be seen in the container classes
-/// AliMUONBlockHeader, AliMUONBlockHeader, AliMUONBusStruct.
-/// The class AliMUONDDLTracker manages the structure containers.
-/// The number of structures in the rawdata file could be set.
#if !defined(__CINT__) || defined(__MAKECINT__)
#include "AliRawReader.h"
// MUON includes
-#include "AliMUONRawStreamTracker.h"
#include "AliMUONRawStreamTrackerHP.h"
-#include "AliMUONDspHeader.h"
-#include "AliMUONBlockHeader.h"
-#include "AliMUONBusStruct.h"
-#include "AliMUONDDLTracker.h"
-
#include "TStopwatch.h"
#endif
void MUONRawStreamTrackerExpert(TString fileName = "./", Int_t maxEvent = 1000,
Int_t minDDL = 0, Int_t maxDDL = 19)
{
- /// Reads the data from fileName, using an "expert" mode where all substructures
- /// are looped upon.
-
- TStopwatch timer;
- timer.Start(kTRUE);
-
- AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
-
- // raw stream
- AliMUONRawStreamTracker* rawStream = new AliMUONRawStreamTracker(rawReader);
-
- // set the number of DDL block Dsp & buspatch structures that are PRESENT in the rawdata file
- // it's NOT the number to be read.
- // default wise set to 20, 2, 5 ans 5 respectively.
- // rawStream->SetMaxDDL(xx);
- // rawStream->SetMaxBlock(xx);
- // rawStream->SetMaxDsp(xx);
- // rawStream->SetMaxBus(xx);
-
- // containers
- AliMUONDDLTracker* ddlTracker = 0x0;
- AliMUONBlockHeader* blkHeader = 0x0;
- AliMUONDspHeader* dspHeader = 0x0;
- AliMUONBusStruct* busStruct = 0x0;
-
- // Loop over events
- Int_t iEvent = 0;
- Int_t dataSize;
-
- while (rawReader->NextEvent()) {
-
- if (iEvent == maxEvent)
- break;
-
- printf("Event %d\n",iEvent++);
-
- // read DDL while < 20 DDL
- while(rawStream->NextDDL()) {
-
- if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
- continue;
-
- printf("\niDDL %d\n", rawStream->GetDDL());
-
- ddlTracker = rawStream->GetDDLTracker();
-
- // loop over block structure
- Int_t nBlock = ddlTracker->GetBlkHeaderEntries();
- for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
-
- blkHeader = ddlTracker->GetBlkHeaderEntry(iBlock);
- printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
-
- // loop over DSP structure
- Int_t nDsp = blkHeader->GetDspHeaderEntries();
- for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){ //DSP loop
-
- dspHeader = blkHeader->GetDspHeaderEntry(iDsp);
- printf("Dsp %d length %d error word %d\n",iDsp,dspHeader->GetTotalLength(), dspHeader->GetErrorWord());
-
- // loop over BusPatch structure
- Int_t nBusPatch = dspHeader->GetBusPatchEntries();
- for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {
-
- busStruct = dspHeader->GetBusPatchEntry(iBusPatch);
-
- // printf("busPatchId %d", busStruct->GetBusPatchId());
- // printf(" BlockId %d", busStruct->GetBlockId());
- // printf(" DspId %d\n", busStruct->GetDspId());
-
- // loop over data
- dataSize = busStruct->GetLength();
- for (Int_t iData = 0; iData < dataSize; iData++) {
-
- Int_t manuId = busStruct->GetManuId(iData);
- Int_t channelId = busStruct->GetChannelId(iData);
- Int_t charge = busStruct->GetCharge(iData);
- printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
- busStruct->GetBusPatchId(),
- manuId,
- channelId, charge);
- } // iData
- } // iBusPatch
- } // iDsp
- } // iBlock
- } // NextDDL
- }// NextEvent
-
- delete rawReader;
- delete rawStream;
- timer.Print();
-}
-
-
-void MUONRawStreamTrackerHPExpert(TString fileName = "./", Int_t maxEvent = 1000,
- Int_t minDDL = 0, Int_t maxDDL = 19)
-{
- /// This routine shows how to use the high performance decoder's expert interface.
+ /// This routine shows how to use the decoder's expert interface.
TStopwatch timer;
timer.Start(kTRUE);
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
// light weight interfaces to headers
const AliMUONRawStreamTrackerHP::AliBlockHeader* blkHeader = 0x0;
printf("Event %d\n",iEvent++);
// read DDL while < 20 DDL
- while(rawStream->NextDDL()) {
+ while(rawStream.NextDDL()) {
- if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
+ if (rawStream.GetDDL() < minDDL || rawStream.GetDDL() > maxDDL)
continue;
- printf("\niDDL %d\n", rawStream->GetDDL());
+ printf("\niDDL %d\n", rawStream.GetDDL());
// loop over block structure
- Int_t nBlock = rawStream->GetBlockCount();
+ Int_t nBlock = rawStream.GetBlockCount();
for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
- blkHeader = rawStream->GetBlockHeader(iBlock);
+ blkHeader = rawStream.GetBlockHeader(iBlock);
printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
// loop over DSP structure
- Int_t nDsp = rawStream->GetDspCount(iBlock);
+ Int_t nDsp = rawStream.GetDspCount(iBlock);
for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){ //DSP loop
dspHeader = blkHeader->GetDspHeader(iDsp);
printf("Dsp %d length %d error word %d\n",iDsp,dspHeader->GetTotalLength(), dspHeader->GetErrorWord());
// loop over BusPatch structure
- Int_t nBusPatch = rawStream->GetBusPatchCount(iBlock, iDsp);
+ Int_t nBusPatch = rawStream.GetBusPatchCount(iBlock, iDsp);
for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {
busStruct = dspHeader->GetBusPatch(iBusPatch);
}// NextEvent
delete rawReader;
- delete rawStream;
timer.Print();
}
-void MUONRawStreamTrackerHPExpert2(TString fileName = "./", Int_t maxEvent = 1000,
+void MUONRawStreamTrackerExpert2(TString fileName = "./", Int_t maxEvent = 1000,
Int_t minDDL = 0, Int_t maxDDL = 19)
{
/// This routine shows an alternate way to iterate over the DDL structures
- /// compared to MUONRawStreamTrackerHPExpert().
+ /// compared to MUONRawStreamTrackerExpert().
TStopwatch timer;
timer.Start(kTRUE);
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
// light weight interfaces to headers
const AliMUONRawStreamTrackerHP::AliBlockHeader* blkHeader = 0x0;
printf("Event %d\n",iEvent++);
// read DDL while < 20 DDL
- while(rawStream->NextDDL()) {
+ while(rawStream.NextDDL()) {
- if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
+ if (rawStream.GetDDL() < minDDL || rawStream.GetDDL() > maxDDL)
continue;
- printf("\niDDL %d\n", rawStream->GetDDL());
+ printf("\niDDL %d\n", rawStream.GetDDL());
// loop over block structure
- Int_t nBlock = rawStream->GetBlockCount();
+ Int_t nBlock = rawStream.GetBlockCount();
for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
- blkHeader = rawStream->GetBlockHeader(iBlock);
+ blkHeader = rawStream.GetBlockHeader(iBlock);
printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
// loop over DSP structure
- Int_t nDsp = rawStream->GetDspCount(iBlock);
+ Int_t nDsp = rawStream.GetDspCount(iBlock);
for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){ //DSP loop
- dspHeader = rawStream->GetDspHeader(iBlock, iDsp);
+ dspHeader = rawStream.GetDspHeader(iBlock, iDsp);
printf("Dsp %d length %d error word %d\n",iDsp,dspHeader->GetTotalLength(), dspHeader->GetErrorWord());
// loop over BusPatch structure
- Int_t nBusPatch = rawStream->GetBusPatchCount(iBlock, iDsp);
+ Int_t nBusPatch = rawStream.GetBusPatchCount(iBlock, iDsp);
for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {
- busStruct = rawStream->GetBusPatch(iBlock, iDsp, iBusPatch);
+ busStruct = rawStream.GetBusPatch(iBlock, iDsp, iBusPatch);
// loop over data
dataSize = busStruct->GetLength();
}// NextEvent
delete rawReader;
- delete rawStream;
timer.Print();
}
-void MUONRawStreamTrackerHPExpert3(TString fileName = "./", Int_t maxEvent = 1000,
+void MUONRawStreamTrackerExpert3(TString fileName = "./", Int_t maxEvent = 1000,
Int_t minDDL = 0, Int_t maxDDL = 19)
{
/// This routine shows yet another alternate way to iterate over the DDL
- /// structures compared to MUONRawStreamTrackerHPExpert().
+ /// structures compared to MUONRawStreamTrackerExpert().
TStopwatch timer;
timer.Start(kTRUE);
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
// light weight interfaces to headers
const AliMUONRawStreamTrackerHP::AliBlockHeader* blkHeader = 0x0;
printf("Event %d\n",iEvent++);
// read DDL while < 20 DDL
- while(rawStream->NextDDL()) {
+ while(rawStream.NextDDL()) {
- if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
+ if (rawStream.GetDDL() < minDDL || rawStream.GetDDL() > maxDDL)
continue;
- printf("\niDDL %d\n", rawStream->GetDDL());
+ printf("\niDDL %d\n", rawStream.GetDDL());
// loop over block structure
Int_t iBlock = 0;
- blkHeader = rawStream->GetFirstBlockHeader();
+ blkHeader = rawStream.GetFirstBlockHeader();
while (blkHeader != NULL)
{
printf("Block %d Total length %d\n",iBlock,blkHeader->GetTotalLength());
}// NextEvent
delete rawReader;
- delete rawStream;
timer.Print();
}
void MUONRawStreamTrackerSimple(TString fileName = "./", Int_t maxEvent = 1000)
-{
- /// Reads the raw data in fileName, using a simplified interface (iterator
- /// over pads).
- TStopwatch timer;
- timer.Start(kTRUE);
-
- AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
-
- // raw stream
- AliMUONRawStreamTracker* rawStream = new AliMUONRawStreamTracker(rawReader);
-
- // Loop over events
- Int_t iEvent = 0;
-
- while (rawReader->NextEvent()) {
-
- if (iEvent == maxEvent)
- break;
-
- printf("Event %d\n",iEvent++);
-
- Int_t busPatch;
- UShort_t manuId, adc;
- UChar_t manuChannel;
-
- rawStream->First();
-
- while ( rawStream->Next(busPatch,manuId,manuChannel,adc) )
- {
- printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
- busPatch,manuId,manuChannel, adc);
- }
- }
-
- delete rawReader;
- delete rawStream;
- timer.Print();
-}
-
-
-void MUONRawStreamTrackerHPSimple(TString fileName = "./", Int_t maxEvent = 1000)
{
/// This routine shows how to use the high performance decoder's simple interface.
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
// Loop over events
Int_t iEvent = 0;
UShort_t manuId, adc;
UChar_t manuChannel;
- rawStream->First();
+ rawStream.First();
- while ( rawStream->Next(busPatch,manuId,manuChannel,adc) )
+ while ( rawStream.Next(busPatch,manuId,manuChannel,adc) )
{
printf("buspatch %5d manuI %4d channel %3d charge %4d\n",
busPatch,manuId,manuChannel, adc);
}
delete rawReader;
- delete rawStream;
timer.Print();
}
-void MUONRawStreamTrackerHPSimple2(TString fileName = "./", Int_t maxEvent = 1000)
+void MUONRawStreamTrackerSimple2(TString fileName = "./", Int_t maxEvent = 1000)
{
- /// This routine is an alternative to MUONRawStreamTrackerHPSimple() which is even faster.
+ /// This routine is an alternative to MUONRawStreamTrackerSimple() which is even faster.
TStopwatch timer;
timer.Start(kTRUE);
AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
// raw stream
- AliMUONRawStreamTrackerHP* rawStream = new AliMUONRawStreamTrackerHP(rawReader);
+ AliMUONRawStreamTrackerHP rawStream(rawReader);
// Loop over events
Int_t iEvent = 0;
UShort_t manuId, adc;
UChar_t manuChannel;
- rawStream->First();
+ rawStream.First();
const AliMUONRawStreamTrackerHP::AliBusPatch* buspatch = NULL;
- while ((buspatch = rawStream->Next()) != NULL)
+ while ((buspatch = rawStream.Next()) != NULL)
{
for (UInt_t i = 0; i < buspatch->GetDataCount(); i++)
{
}
delete rawReader;
- delete rawStream;
timer.Print();
}
/// \ingroup macros
/// \file MUONTimeRawStreamTracker.C
-/// \brief Macro for checking the timing (speed) performace of the two different tracker decoders.
+/// \brief Macro for checking the timing (speed) performance of the tracker decoder.
///
/// \author Artur Szostak <artursz@iafrica.com>
///
-/// This macro is used to check the timing (speed) performance of the existing
-/// offline decoder for the tracker DDLs and also for the new high performance
-/// decoder. It can be invoked as follows:
+/// This macro is used to check the timing (speed) performance of the
+/// decoder for the tracker DDLs. It can be invoked as follows:
///
/// $ aliroot
/// .L $ALICE_ROOT/MUON/MUONTimeRawStreamTracker.C+
#include "AliCodeTimer.h"
// MUON includes
-#include "AliMUONRawStreamTracker.h"
#include "AliMUONRawStreamTrackerHP.h"
#include "AliMUONDspHeader.h"
#include "AliMUONBlockHeader.h"
}
-Double_t TimeUsingOldDecoder(AliBufferInfo* list, AliDigitInfo* buffer, UInt_t maxBufferSize)
+Double_t TimeDecoderBusPatchIteration(AliBufferInfo* list, AliDigitInfo* buffer, UInt_t maxBufferSize)
{
- /// Perform a timing using the old decoder.
-
- AliRawReaderMemory rawReader;
- AliMUONRawStreamTracker rawStream(&rawReader);
- rawReader.NextEvent();
-
- TStopwatch timer;
- timer.Start(kTRUE);
-
- UInt_t i = 0;
- AliBufferInfo* current = list;
- while (current != NULL)
- {
- rawReader.SetMemory(current->fBuffer, current->fBufferSize);
- rawReader.SetEquipmentID(current->fEquipId);
- rawReader.Reset();
-
- Int_t busPatch;
- UShort_t manuId, adc;
- UChar_t manuChannel;
-
- rawStream.First();
-
- while ( rawStream.Next(busPatch,manuId,manuChannel,adc) )
- {
- if (i < maxBufferSize)
- {
- buffer[i].fManuId = manuId;
- buffer[i].fAdc = adc;
- buffer[i].fChannelId = manuChannel;
- i++;
- }
- }
-
- current = current->fNext;
- }
-
- return timer.RealTime();
-}
-
-
-Double_t TimeUsingNewDecoder(AliBufferInfo* list, AliDigitInfo* buffer, UInt_t maxBufferSize)
-{
- /// Perform a timing using the new decoder.
+ /// Perform a timing using the new decoder using the "next bus patch" iteration
AliRawReaderMemory rawReader;
AliMUONRawStreamTrackerHP rawStream(&rawReader);
}
-Double_t TimeUsingNewDecoderOldInterface(AliBufferInfo* list, AliDigitInfo* buffer, UInt_t maxBufferSize)
+Double_t TimeDecoderChannelIteration(AliBufferInfo* list, AliDigitInfo* buffer, UInt_t maxBufferSize, Bool_t skipParityErrors)
{
- /// Perform a timing using the new decoder but the old Next() method
- /// as the interface.
-
+ /// Perform a timing using the "next channel" iteration
+
AliRawReaderMemory rawReader;
AliMUONRawStreamTrackerHP rawStream(&rawReader);
rawReader.NextEvent();
rawStream.First();
- while ( rawStream.Next(busPatch,manuId,manuChannel,adc) )
+ while ( rawStream.Next(busPatch,manuId,manuChannel,adc,skipParityErrors) )
{
if (i < maxBufferSize)
{
return timer.RealTime();
}
-
-void Loop(const char* filename, Bool_t newDecoder)
+void MUONTimeRawStreamTrackerDumb(TString fileName)
{
- AliCodeTimerAutoGeneral(Form("Loop %s",(newDecoder ? "NEW":"OLD")));
-
- AliRawReader* reader = AliRawReader::Create(filename);
-
- AliMUONVRawStreamTracker* stream;
+ AliCodeTimer::Instance()->Reset();
- if ( newDecoder )
- {
- stream = new AliMUONRawStreamTrackerHP(reader);
- }
- else
+ // first check we can open the stream
+ AliRawReader* reader = AliRawReader::Create(fileName.Data());
+ if (!reader)
{
- stream = new AliMUONRawStreamTracker(reader);
+ cerr << "Cannot create reader from " << fileName.Data() << endl;
+ return;
}
-
+
+ AliMUONRawStreamTrackerHP stream(reader);
+
Int_t busPatch;
UShort_t manuId, adc;
UChar_t manuChannel;
while ( reader->NextEvent() )
{
- stream->First();
+ stream.First();
- while ( stream->Next(busPatch,manuId,manuChannel,adc) )
+ while ( stream.Next(busPatch,manuId,manuChannel,adc) )
{
adc *= 2;
}
}
- delete stream;
- delete reader;
-}
-
-
-void MUONTimeRawStreamTrackerDumb(TString fileName)
-{
- AliCodeTimer::Instance()->Reset();
-
- // first check we can open the stream
- AliRawReader* reader = AliRawReader::Create(fileName.Data());
- if (!reader)
- {
- cerr << "Cannot create reader from " << fileName.Data() << endl;
- return;
- }
- delete reader;
-
- // now start the timing per se
-
- Loop(fileName,kFALSE);
-
- Loop(fileName,kTRUE);
-
AliCodeTimer::Instance()->Print();
}
void MUONTimeRawStreamTracker(TString fileName = "./", Int_t maxEvent = 1000)
{
- /// Performs a timing of old and new decoders and reports this.
+ /// Performs a timing of decoder
AliBufferInfo* list = NULL;
UInt_t bufferCount = LoadFiles(list, fileName, maxEvent);
cerr << "ERROR: Out of memory, sorry. You should limit the number of events read in." << endl;
return;
}
- Double_t oldTimes[100];
+ Double_t bpTimes[100];
for (Int_t i = 0; i < 100; i++)
{
- cout << "Timing old decoder: timing iteration " << i+1 << " of 100" << endl;
- oldTimes[i] = TimeUsingOldDecoder(list, buffer, maxBufferSize);
+ cout << "Timing decoder: bus patch iteration " << i+1 << " of 100" << endl;
+ bpTimes[i] = TimeDecoderBusPatchIteration(list, buffer, maxBufferSize);
}
- Double_t newTimes[100];
+ Double_t channelTimes[100];
for (Int_t i = 0; i < 100; i++)
{
- cout << "Timing new decoder: timing iteration " << i+1 << " of 100" << endl;
- newTimes[i] = TimeUsingNewDecoder(list, buffer, maxBufferSize);
+ cout << "Timing decoder: channel iteration w/ parity check" << i+1 << " of 100" << endl;
+ channelTimes[i] = TimeDecoderChannelIteration(list, buffer, maxBufferSize,kTRUE);
}
- Double_t newTimes2[100];
+ Double_t channelTimes2[100];
for (Int_t i = 0; i < 100; i++)
{
- cout << "Timing new decoder with old interface: timing iteration " << i+1 << " of 100" << endl;
- newTimes2[i] = TimeUsingNewDecoderOldInterface(list, buffer, maxBufferSize);
+ cout << "Timing decoder: channel iteration w/o parity check" << i+1 << " of 100" << endl;
+ channelTimes2[i] = TimeDecoderChannelIteration(list, buffer, maxBufferSize,kFALSE);
}
-
+
ReleaseBuffers(list);
delete buffer;
- Double_t oldTime = TMath::Mean(100, oldTimes) / Double_t(bufferCount);
- Double_t oldTimeErr = TMath::RMS(100, oldTimes) / Double_t(bufferCount);
- Double_t newTime = TMath::Mean(100, newTimes) / Double_t(bufferCount);
- Double_t newTimeErr = TMath::RMS(100, newTimes) / Double_t(bufferCount);
- Double_t newTime2 = TMath::Mean(100, newTimes2) / Double_t(bufferCount);
- Double_t newTime2Err = TMath::RMS(100, newTimes2) / Double_t(bufferCount);
+ Double_t bpTime = TMath::Mean(100, bpTimes) / Double_t(bufferCount);
+ Double_t bpTimeErr = TMath::RMS(100, bpTimes) / Double_t(bufferCount);
+ Double_t channelTime = TMath::Mean(100, channelTimes) / Double_t(bufferCount);
+ Double_t channelTimeErr = TMath::RMS(100, channelTimes) / Double_t(bufferCount);
+ Double_t channelTime2 = TMath::Mean(100, channelTimes2) / Double_t(bufferCount);
+ Double_t channelTime2Err = TMath::RMS(100, channelTimes2) / Double_t(bufferCount);
cout << "Average processing time per DDL for:" << endl;
- cout << " Old decoder = " << oldTime*1e6 << " +/- " << oldTimeErr*1e6/TMath::Sqrt(100) << " micro seconds" << endl;
- cout << " New decoder = " << newTime*1e6 << " +/- " << newTimeErr*1e6/TMath::Sqrt(100) << " micro seconds" << endl;
- cout << "New decoder with old interface = " << newTime2*1e6 << " +/- " << newTime2Err*1e6/TMath::Sqrt(100) << " micro seconds" << endl;
+ cout << " bus patch iteration = " << bpTime*1e6 << " +/- " << bpTimeErr*1e6/TMath::Sqrt(100) << " micro seconds" << endl;
+ cout << " channel iteration with parity check = " << channelTime*1e6 << " +/- " << channelTimeErr*1e6/TMath::Sqrt(100) << " micro seconds" << endl;
+ cout << " channel iteration without parity check = " << channelTime2*1e6 << " +/- " << channelTime2Err*1e6/TMath::Sqrt(100) << " micro seconds" << endl;
}