]>
Commit | Line | Data |
---|---|---|
1 | //-*- Mode: C++ -*- | |
2 | ||
3 | // $Id$ | |
4 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
5 | // Author: Jochen Thaeder <thaeder@kip.uni-heidelberg.de> * | |
6 | // for The ALICE HLT Project. * | |
7 | ||
8 | ||
9 | ||
10 | /** @file AliEveHOMERManager.cxx | |
11 | @author Jochen Thaeder | |
12 | @date | |
13 | @brief Manger for HOMER in offline | |
14 | */ | |
15 | ||
16 | #if __GNUC__>= 3 | |
17 | using namespace std; | |
18 | #endif | |
19 | ||
20 | #include "unistd.h" | |
21 | ||
22 | #include "AliEveHOMERManager.h" | |
23 | ||
24 | ||
25 | ClassImp(AliEveHOMERManager) | |
26 | ||
27 | /* | |
28 | * --------------------------------------------------------------------------------- | |
29 | * Constructor / Destructor | |
30 | * --------------------------------------------------------------------------------- | |
31 | */ | |
32 | ||
33 | //################################################################################## | |
34 | AliEveHOMERManager::AliEveHOMERManager() : | |
35 | AliHLTHOMERManager(), | |
36 | TEveElementList("Homer Manager"), | |
37 | fSrcList(NULL), | |
38 | fRetryCount(1), | |
39 | fRetrySleeptime(10) { | |
40 | // see header file for class documentation | |
41 | // or | |
42 | // refer to README to build package | |
43 | // or | |
44 | // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt | |
45 | } | |
46 | ||
47 | //################################################################################## | |
48 | AliEveHOMERManager::~AliEveHOMERManager() { | |
49 | // see header file for class documentation | |
50 | ||
51 | if (fSrcList) | |
52 | delete fSrcList; | |
53 | fSrcList = NULL; | |
54 | } | |
55 | ||
56 | /* | |
57 | * --------------------------------------------------------------------------------- | |
58 | * Source Handling | |
59 | * --------------------------------------------------------------------------------- | |
60 | */ | |
61 | ||
62 | //################################################################################## | |
63 | Int_t AliEveHOMERManager::CreateEveSourcesList() { | |
64 | // see header file for class documentation | |
65 | ||
66 | DestroyElements(); | |
67 | ||
68 | Int_t iResult = CreateSourcesList(); | |
69 | ||
70 | fStateHasChanged = kTRUE; | |
71 | ||
72 | if ( iResult ) | |
73 | return iResult; | |
74 | ||
75 | if (fSrcList) | |
76 | delete fSrcList; | |
77 | fSrcList = NULL; | |
78 | ||
79 | // -- Create new AliEVE sources list | |
80 | fSrcList = new AliEveHOMERSourceList("HLT Sources"); | |
81 | fSrcList->SetManager(this); | |
82 | ||
83 | AddElement(fSrcList); | |
84 | fSrcList->CreateByType(); | |
85 | ||
86 | return iResult; | |
87 | } | |
88 | ||
89 | //################################################################################## | |
90 | Int_t AliEveHOMERManager::CreateEveSourcesListLoop() { | |
91 | // see header file for class documentation | |
92 | ||
93 | Int_t iResult = 0; | |
94 | ||
95 | for ( Int_t retry = 0; retry < fRetryCount ; retry++ ) { | |
96 | ||
97 | iResult = CreateEveSourcesList(); | |
98 | if (!iResult) | |
99 | break; | |
100 | ||
101 | else if (iResult == 1) { | |
102 | HLTWarning( Form("Couldn't find active services, sleeping %d s\n", fRetryCount) ) ; | |
103 | } | |
104 | else if (iResult == 2) { | |
105 | HLTWarning( Form("Services List empty, sleeping %d s\n", fRetryCount) ) ; | |
106 | } | |
107 | else { | |
108 | HLTError( Form("Other problem ... \n") ); | |
109 | return iResult; | |
110 | } | |
111 | ||
112 | sleep(fRetrySleeptime); | |
113 | } | |
114 | ||
115 | if ( iResult ) { | |
116 | HLTError( Form("Couldn't find active services.\n") ); | |
117 | return iResult; | |
118 | } | |
119 | ||
120 | return iResult; | |
121 | } | |
122 | ||
123 | //################################################################################## | |
124 | Int_t AliEveHOMERManager::ConnectEVEtoHOMER() { | |
125 | // see header file for class documentation | |
126 | ||
127 | fStateHasChanged = fSrcList->GetSelectedSources(); | |
128 | ||
129 | return ConnectHOMER(); | |
130 | } |