4 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 *
5 // Author: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> *
6 // Author: 2010 Svein Lindal <slindal@fys.uio.no> *
7 // for The ALICE HLT Project. *
11 /** @file AliEveHOMERManager.cxx
12 @author Jochen Thaeder,
13 @author Svein Lindal <slindal@fys.uio.no>
15 @brief Manager for HOMER events
24 #include "AliHLTTriggerDecision.h"
25 #include "AliEveHOMERManager.h"
26 #include "AliHLTHOMERBlockDesc.h"
27 #include "AliHLTHOMERManager.h"
28 #include "AliEveHOMERSourceList.h"
32 ClassImp(AliEveHOMERManager)
34 //____________________________________________________________________________________
35 AliEveHOMERManager::AliEveHOMERManager() :
36 TEveElementList("Homer Manager"),
41 fSourceListTimer(NULL)
43 fSourceListTimer = new TTimer();
44 fSourceListTimer->Connect("Timeout()", "AliEveHOMERManager", this, "CreateEveSourcesListLoop()");
47 //____________________________________________________________________________________
48 AliEveHOMERManager::~AliEveHOMERManager() {
49 // see header file for class documentation
60 //____________________________________________________________________________________
61 Int_t AliEveHOMERManager::CreateEveSourcesList() {
62 // see header file for class documentation
66 Int_t iResult = CreateSourcesList();
68 fStateHasChanged = kTRUE;
70 HLTDebug(Form("iResult XXX %d", iResult));
76 HLTDebug(Form("iResult %d", iResult));
78 HLTInfo("delete source list");
83 HLTInfo("cleared source list");
87 // -- Create new AliEVE sources list
89 HLTInfo("no source list");
90 fSrcList = new AliEveHOMERSourceList("HLT Sources");
91 fSrcList->SetManager(this);
95 //HLTInfo(Form("createbytype", iResult));
96 fSrcList->CreateByDet();
98 HLTDebug(Form("Done creating source list %d", iResult));
103 ///_______________________________________________________________
104 void AliEveHOMERManager::StartEveSourceListLoop() {
105 HLTInfo("Starting source list timer");
106 fSourceListTimer->Start(1000);
108 ///_______________________________________________________________
109 void AliEveHOMERManager::StopEveSourceListLoop() {
110 fSourceListTimer->Stop();
114 //________________________________________________________________###
115 Int_t AliEveHOMERManager::CreateEveSourcesListLoop() {
116 // see header file for class documentation
118 HLTInfo("Attempting to create source list");
119 Int_t iResult = CreateEveSourcesList();
122 HLTInfo("Source list successfully created.");
123 StopEveSourceListLoop();
124 HLTInfo("Conneting to sources");
125 return ConnectEVEtoHOMER();
129 else if (iResult == 1) {
130 HLTWarning( Form("Couldn't find active services,"));
132 } else if (iResult == 2) {
133 HLTWarning( Form("Services List empty, sleeping %d s before making new attempt.", fRetrySleeptime) ) ;
136 HLTError( Form("Other problem ... \n") );
142 //________________________________________________________________
143 Int_t AliEveHOMERManager::ConnectEVEtoHOMER( TString detector ) {
144 // see header file for class documentation
146 fStateHasChanged = fSrcList->GetSelectedSources();
147 HLTInfo(Form("has state changed % d", fStateHasChanged));
148 return ConnectHOMER(detector);
152 //________________________________________________________________
153 Int_t AliEveHOMERManager::ReConnectHOMER( TString /*detector*/ ){
154 // see header file for class documentation
156 if (Connected()) DisconnectHOMER();
157 CreateEveSourcesListLoop();
161 //_____________________________________________________________________________________
162 TList * AliEveHOMERManager::NextHOMEREvent() {
163 //See header file for documentation
166 HLTInfo("Homer is not connected, trying to reconnect!");
167 Int_t iResult = ReConnectHOMER();
169 HLTError("Error establishing connection to sources");
172 HLTInfo("New connection established, trying again to fetch event");
173 return NextHOMEREvent();
180 HLTInfo("Failed getting next event, trying to reconnect");
181 Int_t iResult = ReConnectHOMER();
183 HLTError("Error establishing connection to sources");
188 return GetBlockList();