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
33 #include "AliHLTHOMERManager.h"
34 // -- -- -- -- -- -- --
35 #include "AliHLTHOMERLibManager.h"
36 #include "AliHLTHOMERSourceDesc.h"
37 #include "AliHLTHOMERBlockDesc.h"
38 // -- -- -- -- -- -- --
39 #include "AliHLTGlobalTriggerDecision.h"
40 #include "AliHLTTriggerDecision.h"
41 //---------------------------
45 ClassImp(AliHLTHOMERManager)
48 * ---------------------------------------------------------------------------------
49 * Constructor / Destructor
50 * ---------------------------------------------------------------------------------
53 //##################################################################################
54 AliHLTHOMERManager::AliHLTHOMERManager() :
55 fLibManager(new AliHLTHOMERLibManager),
56 fStateHasChanged(kTRUE),
65 fAsyncBlockList(NULL),
70 fCurrentBufferIdx(-1),
71 fNavigateBufferIdx(-1),
74 fTriggerString("ALL"),
75 fNEventsNotTriggered(0),
76 fRetryNextEvent(kFALSE),
79 // see header file for class documentation
81 // refer to README to build package
83 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
87 //##################################################################################
88 AliHLTHOMERManager::~AliHLTHOMERManager() {
89 // see header file for class documentation
94 TIter next(fReaderList);
95 TObject * object = NULL;
96 while ( ( object = next()) )
97 fLibManager->DeleteReader(static_cast<AliHLTHOMERReader*>(object) );
108 if ( fProxyHandler != NULL )
109 delete fProxyHandler;
110 fProxyHandler = NULL;
112 if ( fSourceList != NULL )
116 if ( fEventBuffer ) {
117 fEventBuffer->Clear();
128 if ( fAsyncBlockList ) {
129 fAsyncBlockList->Delete();
130 delete fAsyncBlockList;
132 fAsyncBlockList = NULL;
135 //##################################################################################
136 Int_t AliHLTHOMERManager::Initialize() {
137 // see header file for class documentation
139 HLTInfo("Initializing");
143 // -- Initialize ProxyHandler
144 if ( !fProxyHandler )
145 fProxyHandler = new AliHLTHOMERProxyHandler();
147 if ( fProxyHandler ) {
148 iResult = fProxyHandler->Initialize();
150 HLTError("Initialize of ProxyHandler failed.");
154 HLTError("Creating of ProxyHandler failed.");
157 // -- Initialize ReaderList
158 // List ist not owner, as reader have to be created/deleted by the LibManager
160 fReaderList = new TList();
162 // -- Initialize asynchronous BlockList
163 if( !fAsyncBlockList ) {
164 fAsyncBlockList = new TList();
165 fAsyncBlockList->SetOwner(kTRUE);
168 //initialize normal block list
170 fBlockList = new TList();
171 fBlockList->SetOwner(kFALSE);
174 // -- Initialize Event Buffer and EventID array
175 if ( !fEventBuffer ) {
176 fEventBuffer = new TClonesArray( "TList", BUFFERSIZE );
179 for ( Int_t idx = 0; idx < BUFFERSIZE; ++idx ) {
180 new ((*fEventBuffer)[idx]) TList( );
181 (reinterpret_cast<TList*>((*fEventBuffer)[idx]))->SetOwner(kTRUE);
190 * ---------------------------------------------------------------------------------
192 * ---------------------------------------------------------------------------------
195 //##################################################################################
196 Int_t AliHLTHOMERManager::CreateSourcesList() {
197 // see header file for class documentation
199 if (fProxyHandler == NULL)
201 HLTError("The object must first be initialised with a call to Initialize().");
207 if ( fSourceList != NULL )
211 fSourceList = new TList();
212 fSourceList->SetOwner( kTRUE );
214 iResult = fProxyHandler->FillSourceList( fSourceList );
216 HLTWarning("There have been errors, while creating the sources list.");
218 else if ( iResult > 0 ) {
219 HLTWarning("No active services found.");
221 else if ( fSourceList->IsEmpty() ) {
222 HLTWarning("No active services in the list.");
226 HLTInfo("New sources list created.");
228 // -- New SourceList has been created
229 // --> All Sources are new --> State has changed
230 fStateHasChanged = kTRUE;
236 //##################################################################################
237 void AliHLTHOMERManager::SetSourceState( AliHLTHOMERSourceDesc * source, Bool_t state ) {
238 // see header file for class documentation
240 if ( source->IsSelected() != state ) {
241 source->SetState( state );
242 fStateHasChanged = kTRUE;
249 * ---------------------------------------------------------------------------------
250 * Connection Handling - public
251 * ---------------------------------------------------------------------------------
254 //##################################################################################
255 Int_t AliHLTHOMERManager::ConnectHOMER( TString detector ){
256 // see header file for class documentation
258 if (fReaderList == NULL or fSourceList == NULL)
260 HLTError("Must first create a source list with a call to CreateSourcesList().");
270 // -- Check if LibManager is present
271 if ( ! fLibManager ) {
272 HLTError("No LibManager present.");
276 // -- Check if already connected and state has not changed
277 if ( fStateHasChanged == kFALSE && IsConnected() ) {
278 HLTInfo("No need for reconnection.");
282 // -- If already connected, disconnect before connect
283 // or if ReaderList already filled
284 if ( IsConnected() || fReaderList->GetSize() != 0 ) {
285 HLTInfo(Form("IsConnected: %d fReaderList.Size: %d", IsConnected(), fReaderList->GetSize()));
288 // -- Create the Readoutlist
289 UShort_t* sourcePorts = new UShort_t [fSourceList->GetEntries()];
290 const Char_t ** sourceHostnames = new const Char_t* [fSourceList->GetEntries()];
291 for(Int_t i = 0; i < fSourceList->GetEntries(); i++) {
292 sourceHostnames[i] = "";
294 UInt_t sourceCount = 0;
296 CreateReadoutList( sourceHostnames, sourcePorts, sourceCount, detector );
297 if ( sourceCount == 0 ) {
298 HLTError("No sources selected, aborting.");
299 delete [] sourcePorts;
300 delete [] sourceHostnames;
305 // *** Connect to data sources
308 for (UInt_t idx = 0; idx < sourceCount; idx++) {
310 if (sourcePorts[idx] > 60000)
313 HLTInfo(Form("Adding source %d as %s : %d", idx, sourceHostnames[idx], sourcePorts[idx]));
315 fReaderList->Add(dynamic_cast<TObject*>(fLibManager->OpenReader(sourceHostnames[idx], sourcePorts[idx])));
316 AliHLTHOMERReader *reader = static_cast<AliHLTHOMERReader*>(fReaderList->Last());
318 HLTError("Adding reader failed, aborting");
319 delete [] sourcePorts;
320 delete [] sourceHostnames;
324 if ( (iResult = reader->GetConnectionStatus()) ) {
326 // -- Connection to source failed
328 HLTError(Form("Error establishing connection to TCP source %s:%hu: %s (%d)",
329 sourceHostnames[idx], sourcePorts[idx], strerror(iResult), iResult));
331 if( !(TString(sourceHostnames[idx]).CompareTo("localhost")) ) {
332 HLTInfo("The failed connection is on localhost. is SSH tunnel up????? ");
333 HLTInfo(Form("Do: 'ssh -L %d:alihlt-vobox0.cern.ch:%d cernUser@lxplus.cern.ch -fN'",
334 sourcePorts[idx], sourcePorts[idx]));
338 fReaderList->RemoveLast();
341 fLibManager->DeleteReader( reader );
344 HLTInfo(Form("Removed source %d, %s : %d from sourceList", idx, sourceHostnames[idx], sourcePorts[idx]));
348 // -- Connection succeded
351 HLTInfo(Form("Connection established to source %s on port %d", sourceHostnames[idx], sourcePorts[idx]));
354 } // for (Int_t idx = 0; idx < sourceCount; idx++) {
356 delete[] sourceHostnames;
357 delete[] sourcePorts;
363 //##################################################################################
364 void AliHLTHOMERManager::DisconnectHOMER(){
365 // see header file for class documentation
367 HLTInfo("Disconnecting");
369 if ( fReaderList && fLibManager ) {
370 HLTInfo("Deleting readerlist and libmanager");
371 TIter next(fReaderList);
372 TObject * object = NULL;
373 while ( ( object = next()) )
374 fLibManager->DeleteReader(static_cast<AliHLTHOMERReader*>(object) );
377 HLTInfo(Form("fReaderList size %d", fReaderList->GetSize()));
378 fReaderList->Clear();
379 HLTInfo(Form("fReaderList size %d", fReaderList->GetSize()));
381 fReaderList = new TList ();
382 HLTInfo(Form("fReaderList size %d", fReaderList->GetSize()));
385 fStateHasChanged = kTRUE;
388 HLTInfo("Connection closed.");
393 //##################################################################################
394 Int_t AliHLTHOMERManager::ReconnectHOMER( TString detector="" ){
395 // see header file for class documentation
402 iResult = ConnectHOMER(detector);
404 HLTError("Error reconnecting.");
411 * ---------------------------------------------------------------------------------
412 * Event Handling - public
413 * ---------------------------------------------------------------------------------
416 //##################################################################################
417 Int_t AliHLTHOMERManager::NextEvent(){
419 // see header file for class documentation
422 Int_t iRetryCount = 0;
424 if ( !IsConnected() || fStateHasChanged ) {
425 HLTInfo("Not connected or state has changed, returning to AliEveHOMERManager, which will deal with this situation");
426 // cout << "connectecd " << IsConnected() << "haschanged "<<fStateHasChanged << endl;
427 return 55;//ConnectHOMER();
429 if ( !IsConnected() ) {
430 HLTWarning("Not connected yet.");
434 // -- Reset asyncronous BlockList
435 fAsyncBlockList->Delete();
438 // *** Loop over all readers and get new event data
441 TIter next(fReaderList);
442 TObject * object = NULL;
444 while( (object = next()) ) {
446 fCurrentReader = static_cast<AliHLTHOMERReader*>(object);
448 // -- Read next event data and error handling for HOMER (error codes and empty blocks)
451 iResult = fCurrentReader->ReadNextEvent( 40000000 /*timeout in us*/);
453 if ( iResult == 111 || iResult == 32 || iResult == 6 ) {
454 HLTError(Form("No connection to source %d: %s (%d)",
455 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
458 else if ( iResult == 110 ) {
459 HLTError(Form("Timeout occured, reading event from source %d: %s (%d)",
460 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
463 else if ( iResult == 56 ) {
466 if ( iRetryCount >= 20 ) {
467 HLTError(Form("Retry Failed: Error reading event from source %d: %s (%d), returning",
468 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
472 HLTError(Form("Retry: Error reading event from source %d: %s (%d), making another attempt (no %d out of 20)",
473 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult, iRetryCount));
478 else if ( iResult ) {
479 HLTError(Form("General Error reading event from source %d: %s (%d), giving up",
480 fCurrentReader->GetErrorConnectionNdx(), strerror(iResult), iResult));
485 HLTDebug("Successfully read out event from source");
491 // -- Check if event could be read
493 HLTInfo("Reading event from source failed");
497 // -- Handle Blocks from current reader
498 iResult = HandleBlocks();
500 HLTError("Handling of blocks failed.");
503 } // while( (object = next()) ) {
508 /* ---------------------------------------------------------------------------------
509 * Buffer Handling - public
510 * ---------------------------------------------------------------------------------
513 //##################################################################################
514 Int_t AliHLTHOMERManager::NavigateEventBufferBack() {
515 // see header file for class documentation
517 // -- reached the end of the buffer
518 if ( fNavigateBufferIdx == fBufferLowIdx )
521 Int_t newIdx = fNavigateBufferIdx - 1;
523 newIdx = BUFFERSIZE-1;
525 fCurrentBufferIdx = fNavigateBufferIdx = newIdx;
530 //##################################################################################
531 Int_t AliHLTHOMERManager::NavigateEventBufferFwd() {
532 // see header file for class documentation
534 HLTInfo(Form("fNavigateBufferIdx: %d, fCurrentBufferIdx %d, fBufferTopIdx %d", fNavigateBufferIdx, fCurrentBufferIdx, fBufferTopIdx));
536 // -- reached the top of the buffer
537 if ( fNavigateBufferIdx == fBufferTopIdx )
540 Int_t newIdx = fNavigateBufferIdx + 1;
541 if ( newIdx == BUFFERSIZE )
544 fCurrentBufferIdx = fNavigateBufferIdx = newIdx;
545 fNEventsAvailable -= 1;
547 HLTInfo(Form("fNavigateBufferIdx: %d, fCurrentBufferIdx %d, fBufferTopIdx %d", fNavigateBufferIdx, fCurrentBufferIdx, fBufferTopIdx));
553 ///////////////////////////////////////////////////////////////////////////////////
556 * ---------------------------------------------------------------------------------
557 * Connection Handling - private
558 * ---------------------------------------------------------------------------------
561 //##################################################################################
562 void AliHLTHOMERManager::CreateReadoutList( const char** sourceHostnames, UShort_t *sourcePorts,
563 UInt_t &sourceCount, TString detector ){
564 // see header file for class documentation
566 AliHLTHOMERSourceDesc * source= NULL;
568 // -- Read all sources and check if they should be read out
569 TIter next( fSourceList );
570 while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
572 ///Don't use sources from dev cluster
573 if(source->GetPort() > 60000) continue;
575 // -- If detector NO detector name given
576 if ( ! detector.CompareTo("ALL") ) {
577 // -- Continue if source is not selected
579 //if ( ! source->IsSelected() )
582 // -- DetectorName given
584 // -- Continue if detector name doesn't match
585 if ( detector.CompareTo(source->GetDetector()) )
591 Bool_t exists = kFALSE;
593 // -- Loop over existing entries and check if entry is already in readout list
594 for ( UInt_t ii = 0; ii < sourceCount; ii++ ){
595 if ( !strcmp( sourceHostnames[ii], source->GetHostname().Data() )
596 && sourcePorts[ii] == source->GetPort() ) {
602 // -- Add new entires to readout list
604 sourcePorts[sourceCount] = source->GetPort();
605 sourceHostnames[sourceCount] = source->GetHostname().Data();
609 } // while ( ( source = (AliHLTHOMERSourceDesc*)next() ) ) {
611 fStateHasChanged = kFALSE;
617 * ---------------------------------------------------------------------------------
618 * Buffer Handling - private
619 * ---------------------------------------------------------------------------------
622 //##################################################################################
623 void AliHLTHOMERManager::AddBlockListToBuffer() {
624 // see header file for class documentation
625 // -- Check if event is already in buffer
626 ULong_t eventID = static_cast<ULong64_t>(fCurrentReader->GetEventID());
628 if ( fEventID[fBufferTopIdx] == eventID ) {
629 HLTInfo(Form("Event 0x%016lX (%lu) already in buffer.", eventID, eventID));
633 // -- Check if event should be selected on basis of trigger string
634 if( fTriggerString.CompareTo("ALL") ){
635 if ( !CheckTriggerDecision() ) {
636 HLTInfo("Event not triggered");
639 HLTInfo("Event triggered");
643 HLTDebug("No trigger selection.");
648 if ( fBufferTopIdx == BUFFERSIZE )
651 // -- Change the low mark if necessary
652 if ( fBufferLowIdx == -1 )
654 else if ( fBufferTopIdx == fBufferLowIdx ) {
656 if ( fBufferLowIdx == BUFFERSIZE )
662 fEventID[fBufferTopIdx] = eventID;
664 // -- Clear Buffer slot
665 (reinterpret_cast<TList*>((*fEventBuffer)[fBufferTopIdx]))->Clear();
666 if(fBlockList->IsOwner()) HLTWarning("block list is owner!!");
667 HLTInfo(Form("fBlockList size %d", fBlockList->GetSize()));
668 //fBlockList->Clear();
669 fBlockList = new TList();
670 HLTInfo(Form("fBlockList size %d", fBlockList->GetSize()));
674 // -- Fill block list
677 // -- Create new block
678 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc();
679 block->SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
680 GetBlkType(), GetBlkSpecification() );
682 // -- Check sources list if block is requested
683 if ( CheckIfRequested( block ) ) {
684 (reinterpret_cast<TList*>((*fEventBuffer)[fBufferTopIdx]))->Add( block );
685 fBlockList->Add(block);
689 (reinterpret_cast<TList*>((*fEventBuffer)[fBufferTopIdx]))->Add( block );
690 fBlockList->Add(block);
695 } while( GetNextBlk() );
697 //We have one more event available
699 HLTInfo(Form("fNEventsAvailable %d", fNEventsAvailable));
703 //##################################################################################
704 void AliHLTHOMERManager::AddToAsyncBlockList() {
705 // see header file for class documentation
707 HLTInfo("Adding blocks to the asynchroneous block list");
713 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc();
714 block->SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
715 GetBlkType(), GetBlkSpecification() );
718 fAsyncBlockList->Add( block );
720 } while( GetNextBlk() );
724 //__________________________________________________________________________________
725 void AliHLTHOMERManager::AddToBlockList() {
726 // see header file for class documentation
727 HLTInfo("Adding blocks to the synchroneous block list");
729 ULong_t eventID = static_cast<ULong64_t>(fCurrentReader->GetEventID());
731 if ( fEventId == eventID ) {
732 HLTInfo(Form("Event 0x%016lX (%lu) already in buffer.", eventID, eventID));
741 AliHLTHOMERBlockDesc * block = new AliHLTHOMERBlockDesc();
742 block->SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
743 GetBlkType(), GetBlkSpecification() );
744 fBlockList->Add( block );
746 } while( GetNextBlk() );
749 //__________________________________________________________________________________
750 TList* AliHLTHOMERManager::GetBlockListEventBuffer() {
751 // see header file for class documentation
762 //__________________________________________________________________________________
763 Int_t AliHLTHOMERManager::HandleBlocks() {
764 // see header file for class documentation
768 // -- Get blockCnt and eventID
769 fNBlks = static_cast<ULong_t>(fCurrentReader->GetBlockCnt());
770 ULong_t eventID = static_cast<ULong64_t>(fCurrentReader->GetEventID());
773 // -- Check if blocks present
775 HLTWarning(Form("Event 0x%016lX (%lu) with no blocks", eventID, eventID));
779 HLTInfo(Form("Event 0x%016lX (%lu) with %lu blocks", eventID, eventID, fNBlks));
781 if ( IsSyncBlocks() ) {
782 //AddBlockListToBuffer();
786 AddToAsyncBlockList();
792 //__________________________________________________________________________________
793 Bool_t AliHLTHOMERManager::IsSyncBlocks() {
794 // see header file for class documentation
796 Bool_t bResult = kFALSE;
802 if ( !GetBlkType().CompareTo("ALIESDV0")) {
807 if ( !GetBlkType().CompareTo("GLOBTRIG")) {
812 if ( !GetBlkType().CompareTo("ROOTTOBJ") ) {
813 AliHLTHOMERBlockDesc blockDesc;
815 blockDesc.SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
816 GetBlkType(), GetBlkSpecification() );
817 if ( !blockDesc.GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
824 } while( GetNextBlk() );
830 //##################################################################################
831 void* AliHLTHOMERManager::GetBlk( Int_t ndx ) {
832 // see header file for class documentation
833 // Get pointer to current block in current event
835 if ( !fCurrentReader || !IsConnected() ) {
836 HLTError("Not connected yet.");
839 if ( ndx < static_cast<Int_t>(fNBlks) )
840 return const_cast<void*> (fCurrentReader->GetBlockData(ndx));
845 //##################################################################################
846 ULong_t AliHLTHOMERManager::GetBlkSize( Int_t ndx ) {
847 // see header file for class documentation
849 if ( !fCurrentReader || !IsConnected() ) {
850 HLTError("Not connected yet.");
854 if ( ndx < static_cast<Int_t>(fNBlks) )
855 return static_cast<ULong_t> (fCurrentReader->GetBlockDataLength(ndx));
860 //##################################################################################
861 TString AliHLTHOMERManager::GetBlkOrigin( Int_t ndx ) {
862 // see header file for class documentation
866 // -- Check for Connection
867 if ( !fCurrentReader || ! IsConnected() ) {
868 HLTError("Not connected yet.");
872 // -- Check block index
873 if ( ndx >= static_cast<Int_t>(fNBlks) ) {
874 HLTError(Form("Block index %d out of range.", ndx ));
884 reverseOrigin.data = static_cast<UInt_t>(fCurrentReader->GetBlockDataOrigin(ndx));
886 // -- Reverse the order
887 for (Int_t ii = 3; ii >= 0; ii-- )
888 if ( reverseOrigin.array[ii] != ' ')
889 origin.Append( reverseOrigin.array[ii] );
891 origin.Remove( TString::kTrailing, ' ' );
896 //##################################################################################
897 TString AliHLTHOMERManager::GetBlkType( Int_t ndx ) {
898 // see header file for class documentation
902 // -- Check for Connection
903 if ( !fCurrentReader || ! IsConnected() ) {
904 HLTError("Not connected yet.");
908 // -- Check block index
909 if ( ndx >= static_cast<Int_t>(fNBlks) ) {
910 HLTError(Form("Block index %d out of range.", ndx ));
920 reverseType.data = static_cast<ULong64_t> (fCurrentReader->GetBlockDataType(ndx));
922 // -- Reverse the order
923 for (Int_t ii = 7; ii >= 0; ii-- )
924 if ( reverseType.array[ii] != ' ')
925 type.Append( reverseType.array[ii] );
927 type.Remove( TString::kTrailing, ' ' );
932 //##################################################################################
933 ULong_t AliHLTHOMERManager::GetBlkSpecification( Int_t ndx ) {
934 // see header file for class documentation
936 // -- Check for Connection
937 if ( !fCurrentReader || ! IsConnected() ) {
938 HLTError("Not connected yet.");
942 // -- Check block index
943 if ( ndx >= static_cast<Int_t>(fNBlks) ) {
944 HLTError(Form("Block index %d out of range.", ndx ));
948 return static_cast<ULong_t>(fCurrentReader->GetBlockDataSpec(ndx));
951 //##################################################################################
952 Bool_t AliHLTHOMERManager::CheckIfRequested( AliHLTHOMERBlockDesc * block ) {
953 // see header file for class documentation
955 Bool_t requested = kFALSE;
957 AliHLTHOMERSourceDesc * source= NULL;
959 // -- Read all sources and check if they should be read out
960 TIter next( fSourceList );
961 while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
963 // -- Check if source is selected
964 if ( ! source->IsSelected() )
967 // -- Check if detector matches
968 if ( source->GetSourceName().CompareTo( block->GetBlockName() ) )
974 } // while ( ( source = dynamic_cast<AliHLTHOMERSourceDesc*>(next()) ) ) {
978 HLTInfo(Form("Block requested : %s", block->GetBlockName().Data()));
981 HLTInfo(Form("Block NOT requested : %s", block->GetBlockName().Data()));
988 /* ---------------------------------------------------------------------------------
989 * Trigger Handling - private
990 * ---------------------------------------------------------------------------------
993 //##################################################################################
994 Bool_t AliHLTHOMERManager::CheckTriggerDecision() {
995 // see header file for class documentation
997 Bool_t triggered = kFALSE;
999 if ( !fCurrentReader || !IsConnected() ) {
1000 HLTError("Not connected yet.");
1004 AliHLTHOMERBlockDesc blockDesc;
1008 // -- Fill block list
1009 Bool_t foundTriggerBlock = kFALSE;
1012 if ( (GetBlkType().CompareTo("ROOTTOBJ") == 0) ) {
1013 blockDesc.SetBlock( GetBlk(), GetBlkSize(), GetBlkOrigin(),
1014 GetBlkType(), GetBlkSpecification() );
1016 if ( ! blockDesc.GetClassName().CompareTo("AliHLTGlobalTriggerDecision") ) {
1018 foundTriggerBlock = kTRUE;
1023 } while( GetNextBlk() );
1025 if ( !foundTriggerBlock ) {
1026 HLTError("No trigger decision object found");
1030 // -- Get the global decision object
1031 AliHLTGlobalTriggerDecision* globalDecision =
1032 static_cast<AliHLTGlobalTriggerDecision*>(blockDesc.GetTObject());
1034 if ( fTriggerString.CompareTo("HLTGlobalTrigger") == 0 ) {
1035 triggered = globalDecision->EventTriggered();
1039 for (Int_t idx = 0; idx < globalDecision->NumberOfInputObjects(); idx++) {
1041 const AliHLTTriggerDecision* triggerDecision =
1042 reinterpret_cast<const AliHLTTriggerDecision*>(globalDecision->InputObject(idx));
1044 if ( !(fTriggerString.CompareTo(triggerDecision->Description())) ) {
1045 triggered = triggerDecision->EventTriggered();
1048 } // for (Int_t idx = 0; idx < globalDecision->NumberOfInputObjects(); idx++) {
1054 fRetryNextEvent = kFALSE;
1055 fNEventsNotTriggered = 0;
1058 fRetryNextEvent = kTRUE;
1059 ++fNEventsNotTriggered;