- Int_t iResult = 0;
-
- // -- Initialize block list
- if ( fBlockList != NULL )
- delete fBlockList;
- fBlockList = NULL;
-
- fBlockList = new TList();
- fBlockList->SetOwner( kTRUE );
-
- void* iter = GetFirstBlk();
-
- // -- Fill block list
- while ( iter != NULL ){
-
- // -- Create new block
- AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc( GetBlk(), GetBlkSize(), GetBlkOrigin(),
- GetBlkType(), GetBlkSpecification() );
-
- // -- Check sources list if block is requested
- if ( CheckIfRequested( block ) )
- fBlockList->Add( block );
- else {
- //The Following 2 line commented out and the previous is added.
- // delete block;
- // block = NULL;
- fBlockList->Add( block );
- }
- iter = GetNextBlk();
-
- } // while ( iter != NULL ){
-
- return iResult;
-}
-
-/*
- * ---------------------------------------------------------------------------------
- * BlockHandling
- * ---------------------------------------------------------------------------------
- */
-
-//##################################################################################
-void* AliEveHOMERManager::GetBlk( Int_t ndx ) {
- // Get pointer to current block in current event
- // * param ndx Block index
- // * return returns pointer to blk, NULL if no block present
-
- void* data = NULL;
-
- if ( !fReader || ! IsConnected() ) {
- AliError( Form("Not connected yet.") );
- }
- else {
- if ( ( ndx ) < (Int_t) fNBlks )
- data = (void*) fReader->GetBlockData( ndx );
- }
-
- return data;
-}
-
-//##################################################################################
-ULong_t AliEveHOMERManager::GetBlkSize( Int_t ndx ) {
- // Get size of block ndx
- // * param ndx Block index
- // * return returns pointer to blk, 0 if no block present
-
- ULong_t length = 0;
-
- if ( !fReader || ! IsConnected() ) {
- AliError( Form("Not connected yet.") );
- }
- else {
- if ( ( ndx ) < (Int_t) fNBlks )
- length = (ULong_t) fReader->GetBlockDataLength( ndx );
- }
-
- return length;
-}
-
-//##################################################################################
-TString AliEveHOMERManager::GetBlkOrigin( Int_t ndx ) {
- // Get origin of block ndx
- // * param ndx Block index
- // * return origin of block
-
- TString origin = "";
-
- // -- Check for Connection
- if ( !fReader || ! IsConnected() ) {
- AliError( Form("Not connected yet.") );
- return origin;
- }
-
- // -- Check block index
- if ( ( ndx ) >= (Int_t) fNBlks ) {
- AliError( Form("Block index %d out of range.", ndx ) );
- return origin;
- }
-
- // -- Get origin
- union{
- UInt_t data;
- Char_t array[4];
- } reverseOrigin;
-
- reverseOrigin.data = (UInt_t) fReader->GetBlockDataOrigin( ndx );
-
- // -- Reverse the order
- for (Int_t ii = 3; ii >= 0; ii-- )
- if ( reverseOrigin.array[ii] != ' ')
- origin.Append( reverseOrigin.array[ii] );
-
- return origin;
-}
-
-//##################################################################################
-TString AliEveHOMERManager::GetBlkType( Int_t ndx ) {
- // Get type of block ndx
- // * param ndx Block index
- // * return type of block
-
- TString type = "";
-
- // -- Check for Connection
- if ( !fReader || ! IsConnected() ) {
- AliError( Form("Not connected yet.") );
- return type;
- }
-
- // -- Check blockk index
- if ( ( ndx ) >= (Int_t) fNBlks ) {
- AliError( Form("Block index %d out of range.", ndx ) );
- return type;
- }
-
- // -- Get type
- union{
- ULong64_t data;
- Char_t array[8];
- } reverseType;
-
- reverseType.data = (ULong64_t) fReader->GetBlockDataType( ndx );
-
- // -- Reverse the order
- for (Int_t ii = 7; ii >= 0; ii-- )
- if ( reverseType.array[ii] != ' ')
- type.Append( reverseType.array[ii] );
-
- return type;
-}
-
-//##################################################################################
-ULong_t AliEveHOMERManager::GetBlkSpecification( Int_t ndx ) {
- // Get specification of block ndx
- // * param ndx Block index
- // * return specification of block
-
- ULong_t spec = 0;
-
- // -- Check for Connection
- if ( !fReader || ! IsConnected() ) {
- AliError( Form("Not connected yet.") );
- return spec;
- }
-
- // -- Check blockk index
- if ( ( ndx ) >= (Int_t) fNBlks ) {
- AliError( Form("Block index %d out of range.", ndx ) );
- return spec;
- }
-
- spec = (ULong_t) fReader->GetBlockDataSpec( ndx );
-
- return spec;
-}
-
-//##################################################################################
-Bool_t AliEveHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
- // Checks if current Block should was requested
- // * return returns kTRUE, if block should was requested
-
- Bool_t requested = kFALSE;
-
- AliHLTHOMERSourceDesc * source= NULL;
-
- // -- Read all sources and check if they should be read out
- TIter next( fSourceList );
- while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
-
- if ( ! source->IsSelected() )
- continue;
-
- if ( !( block->GetDetector().CompareTo( "*** " ) && block->GetDetector().CompareTo( "***" ) ) ) {
- // if not any detector
- if ( source->GetDetector().CompareTo( block->GetDetector() ) )
- continue;
- }
-
- if ( ! ( block->GetDataType().CompareTo( "******* " ) && block->GetDataType().CompareTo( "******* " ) ) ) {
- if ( source->GetDataType().CompareTo( block->GetDataType() ) )
- continue;
- }
-
- if ( ! block->HasSubDetectorRange() ) {
- if ( source->GetSubDetector().Atoi() != block->GetSubDetector().Atoi() )
- continue;
-
- if ( ! block->HasSubSubDetectorRange() ) {
-
- if ( source->GetSubSubDetector().Atoi() != block->GetSubSubDetector().Atoi() )
- continue;
-
- } // if ( ! block->HasSubSubDetectorRange ) {
- } // if ( ! block->HasSubDetectorRange ) {
-
- requested = kTRUE;
- break;
-
- } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {