From 936875a40225e7b2bd9a99c1f0cfeea07f151740 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 9 Sep 2008 12:22:01 +0000 Subject: [PATCH] Improving the time performance of alimdc: 1. disabling support for pointer tracking in all the branches (i.e. this will work only if your objects do not refers to the same objects twice via a pointer). 2. tuning the size of the internal map tracking the class name of the objects. 3. Caching the size of the raw-data header (fHeaderSize). (Philippe Canal) --- RAW/AliMDC.cxx | 3 +++ RAW/AliRawDB.cxx | 33 ++++++++++++++++++++++++++------- RAW/AliRawEventHeaderBase.cxx | 7 ++++++- RAW/AliRawEventHeaderBase.h | 3 ++- RAW/AliTagDB.cxx | 16 +++++++++++++++- 5 files changed, 52 insertions(+), 10 deletions(-) diff --git a/RAW/AliMDC.cxx b/RAW/AliMDC.cxx index 618bfffd937..e2bf176a000 100644 --- a/RAW/AliMDC.cxx +++ b/RAW/AliMDC.cxx @@ -50,6 +50,7 @@ #include #include #include +#include #include #ifdef USE_EB @@ -125,6 +126,8 @@ AliMDC::AliMDC(Int_t compress, Bool_t deleteFiles, EFilterMode filterMode, // Set the maximum tree size to 19GB // in order to allow big raw data files TTree::SetMaxTreeSize(20000000000LL); + + TBufferFile::SetGlobalReadParam(5); // This line is needed in case of a stand-alone application w/o // $ROOTSYS/etc/system.rootrc file diff --git a/RAW/AliRawDB.cxx b/RAW/AliRawDB.cxx index 825a4454d6d..719d97c823f 100644 --- a/RAW/AliRawDB.cxx +++ b/RAW/AliRawDB.cxx @@ -36,6 +36,8 @@ #include +#include + #include "AliESDEvent.h" #include "AliRawEvent.h" #include "AliRawDataArray.h" @@ -263,6 +265,18 @@ again: return kTRUE; } +static void BranchResetBit(TBranch *b) +{ + // Reset MapObject on this branch and all the sub-branches + + b->ResetBit( kBranchObject | kBranchAny ); // Or in newer ROOT: b->ResetBit( kMapObject ) + TIter next( b->GetListOfBranches() ); + TBranch *sub = 0; + while ( (sub = (TBranch*)next() ) ) { + BranchResetBit( sub ); + } +} + //______________________________________________________________________________ void AliRawDB::MakeTree() { @@ -276,18 +290,23 @@ void AliRawDB::MakeTree() // splitting 29.6 MB/s, no splitting 35.3 MB/s on P4 2GHz 15k SCSI //Int_t split = 1; Int_t split = 0; - fTree->Branch("rawevent", "AliRawEvent", &fEvent, fBasketSize, split); + TBranch *b = fTree->Branch("rawevent", "AliRawEvent", &fEvent, fBasketSize, split); + BranchResetBit(b); // Make brach for each sub-detector for (Int_t iDet = 0; iDet < AliDAQ::kNDetectors; iDet++) { - for (Int_t iBranch = 0; iBranch < fgkDetBranches[iDet]; iBranch++) - fTree->Branch(Form("%s%d",AliDAQ::DetectorName(iDet),iBranch),"AliRawDataArray", - &fDetRawData[iDet][iBranch],fBasketSize,split); + for (Int_t iBranch = 0; iBranch < fgkDetBranches[iDet]; iBranch++) { + b = fTree->Branch(Form("%s%d",AliDAQ::DetectorName(iDet),iBranch),"AliRawDataArray", + &fDetRawData[iDet][iBranch],fBasketSize,split); + BranchResetBit(b); + } } // Make special branch for unrecognized raw-data payloads - for (Int_t iBranch = 0; iBranch < fgkDetBranches[AliDAQ::kNDetectors]; iBranch++) - fTree->Branch(Form("Common%d",iBranch),"AliRawDataArray", - &fDetRawData[AliDAQ::kNDetectors][iBranch],fBasketSize,split); + for (Int_t iBranch = 0; iBranch < fgkDetBranches[AliDAQ::kNDetectors]; iBranch++) { + b = fTree->Branch(Form("Common%d",iBranch),"AliRawDataArray", + &fDetRawData[AliDAQ::kNDetectors][iBranch],fBasketSize,split); + BranchResetBit(b); + } // Create tree which will contain the HLT ESD information diff --git a/RAW/AliRawEventHeaderBase.cxx b/RAW/AliRawEventHeaderBase.cxx index b70c775c6ec..dccd36a8099 100644 --- a/RAW/AliRawEventHeaderBase.cxx +++ b/RAW/AliRawEventHeaderBase.cxx @@ -49,7 +49,8 @@ fVersion(0), fExtendedDataSize(0), fExtendedAllocSize(0), fExtendedData(NULL), -fIsSwapped(kFALSE) +fIsSwapped(kFALSE), +fHeaderSize(0) { // Default constructor } @@ -76,6 +77,8 @@ Int_t AliRawEventHeaderBase::HeaderSize() const // Returns the size of the data members list // beyond the base class data members + if (fHeaderSize) return fHeaderSize; + Int_t size = 0; TList *datalist = IsA()->GetListOfDataMembers(); @@ -91,6 +94,8 @@ Int_t AliRawEventHeaderBase::HeaderSize() const for(UInt_t i=0;iGetMaxIndex(i)*unitsize; } + const_cast(this)->fHeaderSize = size; + return size; } diff --git a/RAW/AliRawEventHeaderBase.h b/RAW/AliRawEventHeaderBase.h index 97d6536e7c4..966a5da7892 100644 --- a/RAW/AliRawEventHeaderBase.h +++ b/RAW/AliRawEventHeaderBase.h @@ -86,11 +86,12 @@ private: char *fExtendedData; //[fExtendedDataSize] pointer to header extension data Bool_t fIsSwapped; // is data swapped + Int_t fHeaderSize; //! cache for the header size estimate static const UInt_t fgkEventMagicNumber = 0xDA1E5AFE; // magic word static const UInt_t fgkEventMagicNumberSwapped = 0xFE5A1EDA; // swapped magic word - ClassDef(AliRawEventHeaderBase,2) // Alice raw event header base class + ClassDef(AliRawEventHeaderBase,3) // Alice raw event header base class }; #define EVENT_HEADER_VERSION(AA,BB) AliRawEventHeaderV##AA##_##BB diff --git a/RAW/AliTagDB.cxx b/RAW/AliTagDB.cxx index a2f64f8ed9b..797c13b5d25 100644 --- a/RAW/AliTagDB.cxx +++ b/RAW/AliTagDB.cxx @@ -26,6 +26,7 @@ #include #include +#include #include "AliESD.h" @@ -55,6 +56,18 @@ AliTagDB::AliTagDB(AliRawEventTag *eventTag, const char* fileName) : } } +static void BranchResetBit(TBranch *b) +{ + // Reset MapObject on this branch and all the sub-branches + + b->ResetBit( kBranchObject | kBranchAny ); // Or in newer ROOT: b->ResetBit( kMapObject ) + TIter next( b->GetListOfBranches() ); + TBranch *sub = 0; + while ( (sub = (TBranch*)next() ) ) { + BranchResetBit( sub ); + } +} + //______________________________________________________________________________ Bool_t AliTagDB::Create(const char* fileName) { @@ -83,7 +96,8 @@ Bool_t AliTagDB::Create(const char* fileName) Int_t bufsize = 32000; Int_t split = 1; const char *tagname = fEventTag->GetName(); - fTree->Branch("TAG", tagname, &fEventTag, bufsize, split); + TBranch * b = fTree->Branch("TAG", tagname, &fEventTag, bufsize, split); + BranchResetBit(b); return kTRUE; } -- 2.39.3