3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
8 //* for The ALICE HLT Project. *
10 //* Permission to use, copy, modify and distribute this software and its *
11 //* documentation strictly for non-commercial purposes is hereby granted *
12 //* without fee, provided that the above copyright notice appears in all *
13 //* copies and that both the copyright notice and this permission notice *
14 //* appear in the supporting documentation. The authors make no claims *
15 //* about the suitability of this software for any purpose. It is *
16 //* provided "as is" without express or implied warranty. *
17 //**************************************************************************
19 /** @file AliHLTHOMERManager.cxx
20 @author Jochen Thaeder
22 @brief Manger for HOMER in aliroot
25 // see header file for class documentation
27 // refer to README to build package
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
37 #include "AliHLTHOMERManager.h"
38 // -- -- -- -- -- -- --
39 #include "AliHLTHOMERLibManager.h"
40 #include "AliHLTHOMERSourceDesc.h"
41 #include "AliHLTHOMERBlockDesc.h"
42 // -- -- -- -- -- -- --
43 #include "AliHLTGlobalTriggerDecision.h"
44 #include "AliHLTTriggerDecision.h"
45 //---------------------------
47 ClassImp(AliHLTHOMERManager)
50 * ---------------------------------------------------------------------------------
51 * Constructor / Destructor
52 * ---------------------------------------------------------------------------------
55 //##################################################################################
56 AliHLTHOMERManager::AliHLTHOMERManager() :
57 fLibManager(new AliHLTHOMERLibManager),
58 fStateHasChanged(kTRUE),
67 fAsyncBlockList(NULL),
72 fCurrentBufferIdx(-1),
73 fNavigateBufferIdx(-1),
76 fTriggerString("ALL"),
77 fNEventsNotTriggered(0),
78 fRetryNextEvent(kFALSE),
81 // see header file for class documentation
83 // refer to README to build package
85 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
89 //##################################################################################
90 AliHLTHOMERManager::~AliHLTHOMERManager() {
91 // see header file for class documentation
96 TIter next(fReaderList);
97 TObject * object = NULL;
98 while ( ( object = next()) )
99 fLibManager->DeleteReader(static_cast<AliHLTHOMERReader*>(object) );
101 fReaderList->Clear();
110 if ( fProxyHandler != NULL )
111 delete fProxyHandler;
112 fProxyHandler = NULL;
114 if ( fSourceList != NULL )
118 if ( fEventBuffer ) {
119 fEventBuffer->Clear();
130 if ( fAsyncBlockList ) {
131 fAsyncBlockList->Clear();
132 delete fAsyncBlockList;
134 fAsyncBlockList = NULL;
137 //##################################################################################
138 Int_t AliHLTHOMERManager::Initialize() {
139 // see header file for class documentation
141 HLTInfo("Initializing");
145 // -- Initialize ProxyHandler
146 if ( !fProxyHandler )
147 fProxyHandler = new AliHLTHOMERProxyHandler();
149 if ( fProxyHandler ) {
150 iResult = fProxyHandler->Initialize();
152 HLTError(Form("Initialize of ProxyHandler failed."));
156 HLTError(Form("Creating of ProxyHandler failed."));
159 // -- Initialize ReaderList
160 // List ist not owner, as reader have to be created/deleted by the LibManager
162 fReaderList = new TList();
164 // -- Initialize asynchronous BlockList
165 if( !fAsyncBlockList ) {
166 fAsyncBlockList = new TList();
167 fAsyncBlockList->SetOwner(kTRUE);
170 //initialize normal block list
172 fBlockList = new TList();
173 fBlockList->SetOwner(kFALSE);
176 // -- Initialize Event Buffer and EventID array
177 if ( !fEventBuffer ) {
178 fEventBuffer = new TClonesArray( "TList", BUFFERSIZE );
181 for ( Int_t idx = 0; idx < BUFFERSIZE; ++idx ) {
182 new ((*fEventBuffer)[idx]) TList( );
183 (reinterpret_cast<TList*>((*fEventBuffer)[idx]))->SetOwner(kTRUE);
192 * ---------------------------------------------------------------------------------
194 * ---------------------------------------------------------------------------------
197 //##################################################################################
198 Int_t AliHLTHOMERManager::CreateSourcesList() {
199 // see header file for class documentation
203 if ( fSourceList != NULL )
207 fSourceList = new TList();
208 fSourceList->SetOwner( kTRUE );
210 iResult = fProxyHandler->FillSourceList( fSourceList );
212 HLTWarning(Form("There have been errors, while creating the sources list."));
214 else if ( iResult > 0 ) {
215 HLTWarning(Form("No active services found."));
217 else if ( fSourceList->IsEmpty() ) {
218 HLTWarning(Form("No active services in the list."));
222 HLTInfo(Form("New sources list created."));
224 // -- New SourceList has been created
225 // --> All Sources are new --> State has changed
226 fStateHasChanged = kTRUE;
232 //##################################################################################
233 void AliHLTHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t state ) {
234 // see header file for class documentation
236 if ( source->IsSelected() != state ) {
237 source->SetState( state );
238 fStateHasChanged = kTRUE;
245 * ---------------------------------------------------------------------------------
246 * Connection Handling - public
247 * ---------------------------------------------------------------------------------
250 //##################################################################################
251 Int_t AliHLTHOMERManager::ConnectHOMER( TString detector ){
252 // see header file for class documentation
260 // -- Check if LibManager is present
261 if ( ! fLibManager ) {
262 HLTError(Form("No LibManager present."));
266 // -- Check if already connected and state has not changed
267 if ( fStateHasChanged == kFALSE && IsConnected() ) {
268 HLTInfo(Form("No need for reconnection."));
272 // -- If already connected, disconnect before connect
273 // or if ReaderList already filled
274 if ( IsConnected() || fReaderList->GetSize() != 0 ) {
275 HLTInfo(Form("IsConnected: %d fReaderList.Size: %d", IsConnected(), fReaderList->GetSize()));
278 // -- Create the Readoutlist
279 UShort_t* sourcePorts = new UShort_t [fSourceList->GetEntries()];
280 const Char_t ** sourceHostnames = new const Char_t* [fSourceList->GetEntries()];
281 UInt_t sourceCount = 0;
283 CreateReadoutList( sourceHostnames, sourcePorts, sourceCount, detector );
284 if ( sourceCount == 0 ) {
285 HLTError(Form("No sources selected, aborting."));
290 // *** Connect to data sources
293 for (UInt_t idx = 0; idx < sourceCount; idx++) {
295 if (sourcePorts[idx] > 60000)
298 HLTInfo(Form("Adding source %d as %s : %d", idx, sourceHostnames[idx], sourcePorts[idx]));
300 fReaderList->Add(dynamic_cast<TObject*>(fLibManager->OpenReader(sourceHostnames[idx], sourcePorts[idx])));
301 AliHLTHOMERReader *reader = static_cast<AliHLTHOMERReader*>(fReaderList->Last());
303 HLTError(Form("Adding reader failed, aborting"));
307 if ( (iResult = reader->GetConnectionStatus()) ) {
309 // -- Connection to source failed
311 HLTError(Form("Error establishing connection to TCP source %s:%hu: %s (%d)",
312 sourceHostnames[idx], sourcePorts[idx], strerror(iResult), iResult));
314 if( !(TString(sourceHostnames[idx]).CompareTo("localhost")) ) {
315 HLTInfo("The failed connection is on localhost. is SSH tunnel up????? ");
316 HLTInfo(Form("Do: 'ssh -L %d:alihlt-vobox0.cern.ch:%d cernUser@lxplus.cern.ch -fN'",
317 sourcePorts[idx], sourcePorts[idx]));
321 fReaderList->RemoveLast();
324 fLibManager->DeleteReader( reader );
327 HLTInfo(Form("Removed source %d, %s : %d from sourceList", idx, sourceHostnames[idx], sourcePorts[idx]));
331 // -- Connection succeded
334 HLTInfo(Form("Connection established to source %s on port %d", sourceHostnames[idx], sourcePorts[idx]));
337 } // for (Int_t idx = 0; idx < sourceCount; idx++) {
339 delete[] sourceHostnames;
340 delete[] sourcePorts;
346 //##################################################################################
347 void AliHLTHOMERManager::DisconnectHOMER(){
348 // see header file for class documentation
350 HLTInfo("Disconnecting");
352 if ( fReaderList && fLibManager ) {
353 HLTInfo("Deleting readerlist and libmanager");
354 TIter next(fReaderList);
355 TObject * object = NULL;
356 while ( ( object = next()) )
357 fLibManager->DeleteReader(static_cast<AliHLTHOMERReader*>(object) );
360 HLTInfo(Form("fReaderList size %d", fReaderList->GetSize()));
361 fReaderList->Clear();
362 HLTInfo(Form("fReaderList size %d", fReaderList->GetSize()));
364 fReaderList = new TList ();
365 HLTInfo(Form("fReaderList size %d", fReaderList->GetSize()));
368 fStateHasChanged = kTRUE;
371 HLTInfo(Form("Connection closed."));
376 //##################################################################################
377 Int_t AliHLTHOMERManager::ReconnectHOMER( TString detector="" ){
378 // see header file for class documentation
385 iResult = ConnectHOMER(detector);
387 HLTError(Form("Error reconnecting."));
394 * ---------------------------------------------------------------------------------
395 * Event Handling - public
396 * ---------------------------------------------------------------------------------
399 //##################################################################################
400 Int_t AliHLTHOMERManager::NextEvent(){
402 // see header file for class documentation
405 Int_t iRetryCount = 0;
407 if ( !IsConnected() || fStateHasChanged ) {
408 HLTInfo("Not connected or state has changed, returning to AliEveHOMERManager, which will deal with this situation");
409 // cout << "connectecd " << IsConnected() << "haschanged "<<fStateHasChanged << endl;
410 return 55;//ConnectHOMER();
412 if ( !IsConnected() ) {
413 HLTWarning(Form( "Not connected yet." ));
417 // -- Reset asyncronous BlockList
418 fAsyncBlockList->Clear();
421 // *** Loop over all readers and get new event data
424 TIter next(fReaderList);
425 TObject * object = NULL;
427 while( (object = next()) ) {
429 fCurrentReader = static_cast<AliHLTHOMERReader*>(object);
431 // -- Read next event data and error handling for HOMER (error codes and empty blocks)
434 iResult = fCurrentReader->ReadNextEvent( 40000000 /*timeout in us*/);
436 if ( iResult == 111 || iResult == 32 || iResult == 6 ) {
437 HLTError(Form("No connection to source %d: %s (%d)",
438 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
441 else if ( iResult == 110 ) {
442 HLTError(Form("Timeout occured, reading event from source %d: %s (%d)",
443 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
446 else if ( iResult == 56 ) {
449 if ( iRetryCount >= 20 ) {
450 HLTError(Form("Retry Failed: Error reading event from source %d: %s (%d), returning",
451 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
455 HLTError(Form("Retry: Error reading event from source %d: %s (%d), making another attempt (no %d out of 20)",
456 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult, iRetryCount));
461 else if ( iResult ) {
462 HLTError(Form("General Error reading event from source %d: %s (%d), giving up",
463 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
468 HLTDebug("Successfully read out event from source");
474 // -- Check if event could be read
476 HLTInfo("Reading event from source failed");
480 // -- Handle Blocks from current reader
481 iResult = HandleBlocks();
483 HLTError(Form("Handling of blocks failed."));
486 } // while( (object = next()) ) {
491 /* ---------------------------------------------------------------------------------
492 * Buffer Handling - public
493 * ---------------------------------------------------------------------------------
496 //##################################################################################
497 Int_t AliHLTHOMERManager::NavigateEventBufferBack() {
498 // see header file for class documentation
500 // -- reached the end of the buffer
501 if ( fNavigateBufferIdx == fBufferLowIdx )
504 Int_t newIdx = fNavigateBufferIdx - 1;
506 newIdx = BUFFERSIZE-1;
508 fCurrentBufferIdx = fNavigateBufferIdx = newIdx;
513 //##################################################################################
514 Int_t AliHLTHOMERManager::NavigateEventBufferFwd() {
515 // see header file for class documentation
517 HLTInfo(Form("fNavigateBufferIdx: %d, fCurrentBufferIdx %d, fBufferTopIdx %d", fNavigateBufferIdx, fCurrentBufferIdx, fBufferTopIdx));
519 // -- reached the top of the buffer
520 if ( fNavigateBufferIdx == fBufferTopIdx )
523 Int_t newIdx = fNavigateBufferIdx + 1;
524 if ( newIdx == BUFFERSIZE )
527 fCurrentBufferIdx = fNavigateBufferIdx = newIdx;
528 fNEventsAvailable -= 1;
530 HLTInfo(Form("fNavigateBufferIdx: %d, fCurrentBufferIdx %d, fBufferTopIdx %d", fNavigateBufferIdx, fCurrentBufferIdx, fBufferTopIdx));
536 ///////////////////////////////////////////////////////////////////////////////////
539 * ---------------------------------------------------------------------------------
540 * Connection Handling - private
541 * ---------------------------------------------------------------------------------
544 //##################################################################################
545 void AliHLTHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort_t *sourcePorts,
546 UInt_t &sourceCount, TString detector ){
547 // see header file for class documentation
549 AliHLTHOMERSourceDesc * source= NULL;
551 // -- Read all sources and check if they should be read out
552 TIter next( fSourceList );
553 while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
555 ///Don't use sources from dev cluster
556 if(source->GetPort() > 60000) continue;
558 // -- If detector NO detector name given
559 if ( ! detector.CompareTo("ALL") ) {
560 // -- Continue if source is not selected
562 //if ( ! source->IsSelected() )
565 // -- DetectorName given
567 // -- Continue if detector name doesn't match
568 if ( detector.CompareTo(source->GetDetector()) )
574 Bool_t exists = kFALSE;
576 // -- Loop over existing entries and check if entry is already in readout list
577 for ( UInt_t ii = 0; ii < sourceCount; ii++ ){
578 if ( !strcmp( sourceHostnames[ii], source->GetHostname().Data() )
579 && sourcePorts[ii] == source->GetPort() ) {
585 // -- Add new entires to readout list
587 sourcePorts[sourceCount] = source->GetPort();
588 sourceHostnames[sourceCount] = source->GetHostname().Data();
592 } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
594 fStateHasChanged = kFALSE;
600 * ---------------------------------------------------------------------------------
601 * Buffer Handling - private
602 * ---------------------------------------------------------------------------------
605 //##################################################################################
606 void AliHLTHOMERManager::AddBlockListToBuffer() {
607 // see header file for class documentation
608 // -- Check if event is already in buffer
609 ULong_t eventID = static_cast<ULong64_t>(fCurrentReader->GetEventID());
611 if ( fEventID[fBufferTopIdx] == eventID ) {
612 HLTInfo(Form("Event 0x%016lX (%lu) already in buffer.", eventID, eventID));
616 // -- Check if event should be selected on basis of trigger string
617 if( fTriggerString.CompareTo("ALL") ){
618 if ( !CheckTriggerDecision() ) {
619 HLTInfo("Event not triggered");
622 HLTInfo("Event triggered");
626 HLTDebug("No trigger selection.");
631 if ( fBufferTopIdx == BUFFERSIZE )
634 // -- Change the low mark if necessary
635 if ( fBufferLowIdx == -1 )
637 else if ( fBufferTopIdx == fBufferLowIdx ) {
639 if ( fBufferLowIdx == BUFFERSIZE )
645 fEventID[fBufferTopIdx] = eventID;
647 // -- Clear Buffer slot
648 (reinterpret_cast<TList*>((*fEventBuffer)[fBufferTopIdx]))->Clear();
649 if(fBlockList->IsOwner()) HLTWarning("block list is owner!!");
650 HLTInfo(Form("fBlockList size %d", fBlockList->GetSize()));
651 //fBlockList->Clear();
652 fBlockList = new TList();
653 HLTInfo(Form("fBlockList size %d", fBlockList->GetSize()));
657 // -- Fill block list
660 // -- Create new block
661 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc();
662 block->SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
663 GetBlkType(), GetBlkSpecification() );
665 // -- Check sources list if block is requested
666 if ( CheckIfRequested( block ) ) {
667 (reinterpret_cast<TList*>((*fEventBuffer)[fBufferTopIdx]))->Add( block );
668 fBlockList->Add(block);
672 (reinterpret_cast<TList*>((*fEventBuffer)[fBufferTopIdx]))->Add( block );
673 fBlockList->Add(block);
678 } while( GetNextBlk() );
680 //We have one more event available
682 HLTInfo(Form("fNEventsAvailable %d", fNEventsAvailable));
686 //##################################################################################
687 void AliHLTHOMERManager::AddToAsyncBlockList() {
688 // see header file for class documentation
690 HLTInfo("Adding blocks to the asynchroneous block list");
696 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc();
697 block->SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
698 GetBlkType(), GetBlkSpecification() );
701 fAsyncBlockList->Add( block );
703 // -- Check sources list if block is requested
704 // if ( CheckIfRequested( block ) )
705 // fAsyncBlockList->Add( block );
707 // // XXX HACK Jochen
710 } while( GetNextBlk() );
714 //__________________________________________________________________________________
715 void AliHLTHOMERManager::AddToBlockList() {
716 // see header file for class documentation
717 HLTInfo("Adding blocks to the synchroneous block list");
719 ULong_t eventID = static_cast<ULong64_t>(fCurrentReader->GetEventID());
721 if ( fEventId == eventID ) {
722 HLTInfo(Form("Event 0x%016lX (%lu) already in buffer.", eventID, eventID));
731 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc();
732 block->SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
733 GetBlkType(), GetBlkSpecification() );
734 fBlockList->Add( block );
736 } while( GetNextBlk() );
739 //__________________________________________________________________________________
740 TList* AliHLTHOMERManager::GetBlockListEventBuffer( Int_t idx ) {
741 // see header file for class documentation
751 return reinterpret_cast<TList*>((*fEventBuffer)[idx]);
756 //__________________________________________________________________________________
757 Int_t AliHLTHOMERManager::HandleBlocks() {
758 // see header file for class documentation
762 // -- Get blockCnt and eventID
763 fNBlks = static_cast<ULong_t>(fCurrentReader->GetBlockCnt());
764 ULong_t eventID = static_cast<ULong64_t>(fCurrentReader->GetEventID());
767 // -- Check if blocks present
769 HLTWarning(Form("Event 0x%016lX (%lu) with no blocks", eventID, eventID));
773 HLTInfo(Form("Event 0x%016lX (%lu) with %lu blocks", eventID, eventID, fNBlks));
775 if ( IsSyncBlocks() ) {
776 //AddBlockListToBuffer();
780 AddToAsyncBlockList();
786 //__________________________________________________________________________________
787 Bool_t AliHLTHOMERManager::IsSyncBlocks() {
788 // see header file for class documentation
790 Bool_t bResult = kFALSE;
796 if ( !GetBlkType().CompareTo("ALIESDV0")) {
801 if ( !GetBlkType().CompareTo("GLOBTRIG")) {
806 if ( !GetBlkType().CompareTo("ROOTTOBJ") ) {
807 AliHLTHOMERBlockDesc blockDesc;
809 blockDesc.SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
810 GetBlkType(), GetBlkSpecification() );
811 if ( !blockDesc.GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
818 } while( GetNextBlk() );
824 //##################################################################################
825 void* AliHLTHOMERManager::GetBlk( Int_t ndx ) {
826 // see header file for class documentation
827 // Get pointer to current block in current event
829 if ( !fCurrentReader || !IsConnected() ) {
830 HLTError(Form("Not connected yet."));
833 if ( ndx < static_cast<Int_t>(fNBlks) )
834 return const_cast<void*> (fCurrentReader->GetBlockData(ndx));
839 //##################################################################################
840 ULong_t AliHLTHOMERManager::GetBlkSize( Int_t ndx ) {
841 // see header file for class documentation
843 if ( !fCurrentReader || !IsConnected() ) {
844 HLTError(Form("Not connected yet."));
848 if ( ndx < static_cast<Int_t>(fNBlks) )
849 return static_cast<ULong_t> (fCurrentReader->GetBlockDataLength(ndx));
854 //##################################################################################
855 TString AliHLTHOMERManager::GetBlkOrigin( Int_t ndx ) {
856 // see header file for class documentation
860 // -- Check for Connection
861 if ( !fCurrentReader || ! IsConnected() ) {
862 HLTError(Form("Not connected yet."));
866 // -- Check block index
867 if ( ndx >= static_cast<Int_t>(fNBlks) ) {
868 HLTError(Form("Block index %d out of range.", ndx ));
878 reverseOrigin.data = static_cast<UInt_t>(fCurrentReader->GetBlockDataOrigin(ndx));
880 // -- Reverse the order
881 for (Int_t ii = 3; ii >= 0; ii-- )
882 if ( reverseOrigin.array[ii] != ' ')
883 origin.Append( reverseOrigin.array[ii] );
885 origin.Remove( TString::kTrailing, ' ' );
890 //##################################################################################
891 TString AliHLTHOMERManager::GetBlkType( Int_t ndx ) {
892 // see header file for class documentation
896 // -- Check for Connection
897 if ( !fCurrentReader || ! IsConnected() ) {
898 HLTError(Form("Not connected yet."));
902 // -- Check block index
903 if ( ndx >= static_cast<Int_t>(fNBlks) ) {
904 HLTError(Form("Block index %d out of range.", ndx ));
914 reverseType.data = static_cast<ULong64_t> (fCurrentReader->GetBlockDataType(ndx));
916 // -- Reverse the order
917 for (Int_t ii = 7; ii >= 0; ii-- )
918 if ( reverseType.array[ii] != ' ')
919 type.Append( reverseType.array[ii] );
921 type.Remove( TString::kTrailing, ' ' );
926 //##################################################################################
927 ULong_t AliHLTHOMERManager::GetBlkSpecification( Int_t ndx ) {
928 // see header file for class documentation
930 // -- Check for Connection
931 if ( !fCurrentReader || ! IsConnected() ) {
932 HLTError(Form("Not connected yet."));
936 // -- Check block index
937 if ( ndx >= static_cast<Int_t>(fNBlks) ) {
938 HLTError(Form("Block index %d out of range.", ndx ));
942 return static_cast<ULong_t>(fCurrentReader->GetBlockDataSpec(ndx));
945 //##################################################################################
946 Bool_t AliHLTHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
947 // see header file for class documentation
949 Bool_t requested = kFALSE;
951 AliHLTHOMERSourceDesc * source= NULL;
953 // -- Read all sources and check if they should be read out
954 TIter next( fSourceList );
955 while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
957 // -- Check if source is selected
958 if ( ! source->IsSelected() )
961 // -- Check if detector matches
962 if ( source->GetSourceName().CompareTo( block->GetBlockName() ) )
968 } // while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
972 HLTInfo(Form("Block requested : %s", block->GetBlockName().Data()));
975 HLTInfo(Form("Block NOT requested : %s", block->GetBlockName().Data()));
982 /* ---------------------------------------------------------------------------------
983 * Trigger Handling - private
984 * ---------------------------------------------------------------------------------
987 //##################################################################################
988 Bool_t AliHLTHOMERManager::CheckTriggerDecision() {
989 // see header file for class documentation
991 Bool_t triggered = kFALSE;
993 if ( !fCurrentReader || !IsConnected() ) {
994 HLTError(Form("Not connected yet."));
998 AliHLTHOMERBlockDesc blockDesc;
1002 // -- Fill block list
1003 Bool_t foundTriggerBlock = kFALSE;
1006 if ( (GetBlkType().CompareTo("ROOTTOBJ") == 0) ) {
1007 blockDesc.SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
1008 GetBlkType(), GetBlkSpecification() );
1010 if ( ! blockDesc.GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
1012 foundTriggerBlock = kTRUE;
1017 } while( GetNextBlk() );
1019 if ( !foundTriggerBlock ) {
1020 HLTError(Form("No trigger decision object found"));
1024 // -- Get the global decision object
1025 AliHLTGlobalTriggerDecision* globalDecision =
1026 static_cast<AliHLTGlobalTriggerDecision*>(blockDesc.GetTObject());
1028 if ( fTriggerString.CompareTo("HLTGlobalTrigger") == 0 ) {
1029 triggered = globalDecision->EventTriggered();
1033 for (Int_t idx = 0; idx < globalDecision->NumberOfInputObjects(); idx++) {
1035 const AliHLTTriggerDecision* triggerDecision =
1036 reinterpret_cast<const AliHLTTriggerDecision*>(globalDecision->InputObject(idx));
1038 if ( !(fTriggerString.CompareTo(triggerDecision->Description())) ) {
1039 triggered = triggerDecision->EventTriggered();
1042 } // for (Int_t idx = 0; idx < globalDecision->NumberOfInputObjects(); idx++) {
1048 fRetryNextEvent = kFALSE;
1049 fNEventsNotTriggered = 0;
1052 fRetryNextEvent = kTRUE;
1053 ++fNEventsNotTriggered;