]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTSystem.cxx
Update of the old TRD tracker for the new raw PID representation in ESD
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTSystem.cxx
CommitLineData
f23a6e1a 1// $Id$
2
c5123824 3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
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//**************************************************************************
f23a6e1a 18
b22e91eb 19/** @file AliHLTSystem.cxx
20 @author Matthias Richter
21 @date
22 @brief Implementation of HLT module management.
23*/
f23a6e1a 24
0c0c9d99 25#if __GNUC__>= 3
f23a6e1a 26using namespace std;
27#endif
28
f3506ea2 29#include <cassert>
85869391 30#include "AliHLTStdIncludes.h"
f23a6e1a 31#include "AliHLTSystem.h"
32#include "AliHLTComponentHandler.h"
33#include "AliHLTComponent.h"
5ec8e281 34#include "AliHLTConfiguration.h"
c38ba6f9 35#include "AliHLTConfigurationHandler.h"
36#include "AliHLTTask.h"
242bb794 37#include "AliHLTModuleAgent.h"
8451168b 38#include "AliHLTOfflineInterface.h"
457ec821 39#include "AliHLTDataSource.h"
c5123824 40#include "AliHLTOUT.h"
41#include "AliHLTOUTHandler.h"
242bb794 42#include <TObjArray.h>
43#include <TObjString.h>
90ebac25 44#include <TStopwatch.h>
dba03d72 45//#include <TSystem.h>
c043fa2c 46#include <TROOT.h>
6a8e0bb4 47//#include <TInterpreter.h>
f23a6e1a 48
83670b1d 49/** HLT default component libraries */
6a8e0bb4 50const char* AliHLTSystem::fgkHLTDefaultLibs[]= {
83670b1d 51 "libAliHLTUtil.so",
8f471af0 52 "libAliHLTRCU.so",
83670b1d 53 "libAliHLTTPC.so",
54 // "libAliHLTSample.so",
511b6d88 55 //"libAliHLTPHOS.so",
83670b1d 56 //"libAliHLTMUON.so",
57 "libAliHLTTRD.so",
c5123824 58 "libAliHLTTrigger.so",
83670b1d 59 NULL
60};
61
b22e91eb 62/** ROOT macro for the implementation of ROOT specific class methods */
f23a6e1a 63ClassImp(AliHLTSystem)
64
83cb7e1d 65AliHLTSystem::AliHLTSystem(AliHLTComponentLogSeverity loglevel)
85869391 66 :
67 fpComponentHandler(new AliHLTComponentHandler()),
68 fpConfigurationHandler(new AliHLTConfigurationHandler()),
242bb794 69 fTaskList(),
c043fa2c 70 fState(0),
dee38f1b 71 fChains(),
72 fStopwatches(new TObjArray),
73 fEventCount(-1),
83cb7e1d 74 fGoodEvents(-1)
f23a6e1a 75{
70ed7d01 76 // see header file for class documentation
77 // or
78 // refer to README to build package
79 // or
80 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
5f5b708b 81
fc455fba 82 if (fgNofInstances++>0)
83 HLTWarning("multiple instances of AliHLTSystem, you should not use more than one at a time");
84
83cb7e1d 85 SetGlobalLoggingLevel(loglevel);
86 SetFrameworkLog(loglevel);
f23a6e1a 87 if (fpComponentHandler) {
88 AliHLTComponentEnvironment env;
89 memset(&env, 0, sizeof(AliHLTComponentEnvironment));
9ce4bf4a 90 env.fAllocMemoryFunc=AliHLTSystem::AllocMemory;
fc455fba 91 env.fLoggingFunc=NULL;
f23a6e1a 92 fpComponentHandler->SetEnvironment(&env);
db95fec3 93 InitAliLogFunc(fpComponentHandler);
a742f6f8 94 fpComponentHandler->AnnounceVersion();
85465857 95 } else {
96 HLTFatal("can not create Component Handler");
97 }
85465857 98 if (fpConfigurationHandler) {
99 AliHLTConfiguration::GlobalInit(fpConfigurationHandler);
100 } else {
101 HLTFatal("can not create Configuration Handler");
f23a6e1a 102 }
103}
104
f23a6e1a 105AliHLTSystem::~AliHLTSystem()
106{
70ed7d01 107 // see header file for class documentation
fc455fba 108 fgNofInstances--;
2d7ff710 109 CleanTaskList();
fc455fba 110 AliHLTConfiguration::GlobalDeinit(fpConfigurationHandler);
2d7ff710 111 if (fpConfigurationHandler) {
112 delete fpConfigurationHandler;
113 }
114 fpConfigurationHandler=NULL;
115
116 if (fpComponentHandler) {
117 delete fpComponentHandler;
118 }
119 fpComponentHandler=NULL;
f23a6e1a 120}
121
fc455fba 122int AliHLTSystem::fgNofInstances=0;
123
5ec8e281 124int AliHLTSystem::AddConfiguration(AliHLTConfiguration* pConf)
125{
70ed7d01 126 // see header file for class documentation
6a8e0bb4 127 HLTLogKeyword("configuration handling");
5ec8e281 128 int iResult=0;
53feaef5 129 if (pConf) {
6a8e0bb4 130 HLTError("function not yet implemented");
131 iResult=-ENOSYS;
53feaef5 132 } else {
133 iResult=-EINVAL;
134 }
5ec8e281 135 return iResult;
136}
137
014d39ce 138int AliHLTSystem::InsertConfiguration(AliHLTConfiguration* pConf, AliHLTConfiguration* pPrec)
139{
70ed7d01 140 // see header file for class documentation
6a8e0bb4 141 HLTLogKeyword("configuration handling");
014d39ce 142 int iResult=0;
53feaef5 143 if (pConf) {
144 if (pPrec) {
145 // find the position
6a8e0bb4 146 HLTError("function not yet implemented");
147 iResult=-ENOSYS;
53feaef5 148 }
149 } else {
150 iResult=-EINVAL;
151 }
014d39ce 152 return iResult;
153}
5ec8e281 154
155int AliHLTSystem::DeleteConfiguration(AliHLTConfiguration* pConf)
156{
70ed7d01 157 // see header file for class documentation
6a8e0bb4 158 HLTLogKeyword("configuration handling");
5ec8e281 159 int iResult=0;
53feaef5 160 if (pConf) {
6a8e0bb4 161 HLTError("function not yet implemented");
162 iResult=-ENOSYS;
53feaef5 163 } else {
164 iResult=-EINVAL;
165 }
5ec8e281 166 return iResult;
167}
168
a742f6f8 169int AliHLTSystem::BuildTaskList(const char* id)
170{
171 // see header file for class documentation
172 int iResult=0;
173 if (id) {
174 if (fpConfigurationHandler) {
175 AliHLTConfiguration* pConf=fpConfigurationHandler->FindConfiguration(id);
176 if (pConf) {
177 iResult=BuildTaskList(pConf);
178 } else {
179 HLTError("unknown configuration \"%s\"", id);
180 iResult=-EEXIST;
181 }
182 } else {
183 iResult=-EFAULT;
184 }
185 } else {
186 iResult=-EINVAL;
187 }
188 return iResult;
189}
190
5ec8e281 191int AliHLTSystem::BuildTaskList(AliHLTConfiguration* pConf)
192{
70ed7d01 193 // see header file for class documentation
f23a6e1a 194 int iResult=0;
5ec8e281 195 if (pConf) {
196 AliHLTTask* pTask=NULL;
197 if ((pTask=FindTask(pConf->GetName()))!=NULL) {
198 if (pTask->GetConf()!=pConf) {
c5123824 199 HLTError("configuration mismatch, there is already a task with configuration name \"%s\", but it is different. Most likely configuration %p is not registered properly", pConf->GetName(), pConf);
5ec8e281 200 iResult=-EEXIST;
5ec8e281 201 }
c043fa2c 202 // task for this configuration exists, terminate
203 pTask=NULL;
5ec8e281 204 } else if (pConf->SourcesResolved(1)!=1) {
85465857 205 HLTError("configuration \"%s\" has unresolved sources, aborting ...", pConf->GetName());
5ec8e281 206 iResult=-ENOLINK;
207 } else {
53feaef5 208 pTask=new AliHLTTask(pConf);
5ec8e281 209 if (pTask==NULL) {
210 iResult=-ENOMEM;
dba03d72 211 } else {
212 pTask->SetLocalLoggingLevel(GetLocalLoggingLevel());
5ec8e281 213 }
214 }
c043fa2c 215 static int iterationLevel=0;
216 if (pTask && iResult>=0) {
3b35e87c 217 // check for circular dependencies
5ec8e281 218 if ((iResult=pConf->FollowDependency(pConf->GetName()))>0) {
3b35e87c 219 HLTError("detected circular dependency for configuration \"%s\"", pTask->GetName());
5ec8e281 220 pTask->PrintDependencyTree(pTask->GetName(), 1/*use the configuration list*/);
85465857 221 HLTError("aborted ...");
5ec8e281 222 iResult=-ELOOP;
223 }
224 if (iResult>=0) {
225 // check whether all dependencies are already in the task list
226 // create the missing ones
3b35e87c 227 // this step is an iterative process which calls this function again for the missing
228 // configurations, in order to avoid the currently processed task to be created
229 // again it is added to the list temporarily and removed afterwards
230 // This is of high importance to preserve the order of the tasks. Furthermore, the
231 // InsertTask method has to be used in order to set all the cross links right
5ec8e281 232 fTaskList.Add(pTask);
233 AliHLTConfiguration* pDep=pConf->GetFirstSource();
234 while (pDep!=NULL && iResult>=0) {
c043fa2c 235 HLTDebug("iteration %d: checking dependency %s (%p)", iterationLevel, pDep->GetName(), pDep);
5ec8e281 236 if (FindTask(pDep->GetName())==NULL) {
c043fa2c 237 HLTDebug("iteration %d: building task list for configuration %s (%p)", iterationLevel, pDep->GetName(), pDep);
238 iterationLevel++;
5ec8e281 239 iResult=BuildTaskList(pDep);
c043fa2c 240 iterationLevel--;
5ec8e281 241 }
242 pDep=pConf->GetNextSource();
243 }
3b35e87c 244 // remove the temporarily added task
5ec8e281 245 fTaskList.Remove(pTask);
246
247 // insert the task and set the cross-links
248 if (iResult>=0) {
c043fa2c 249 HLTDebug("iteration %d: inserting task %s (%p)", iterationLevel, pTask->GetName(), pTask);
5ec8e281 250 iResult=InsertTask(pTask);
251 }
252 } else {
253 delete pTask;
254 pTask=NULL;
255 }
256 }
257 } else {
258 iResult=-EINVAL;
f23a6e1a 259 }
f23a6e1a 260 return iResult;
261}
262
5ec8e281 263int AliHLTSystem::CleanTaskList()
264{
70ed7d01 265 // see header file for class documentation
5ec8e281 266 int iResult=0;
267 TObjLink* lnk=NULL;
a742f6f8 268 while ((lnk=fTaskList.LastLink())!=NULL) {
5ec8e281 269 delete (lnk->GetObject());
a742f6f8 270 fTaskList.Remove(lnk);
5ec8e281 271 }
272 return iResult;
273}
274
275int AliHLTSystem::InsertTask(AliHLTTask* pTask)
276{
70ed7d01 277 // see header file for class documentation
5ec8e281 278 int iResult=0;
279 TObjLink *lnk = NULL;
280 if ((iResult=pTask->CheckDependencies())>0)
281 lnk=fTaskList.FirstLink();
282 while (lnk && iResult>0) {
283 AliHLTTask* pCurr = (AliHLTTask*)lnk->GetObject();
85465857 284 //HLTDebug("checking \"%s\"", pCurr->GetName());
5ec8e281 285 iResult=pTask->Depends(pCurr);
286 if (iResult>0) {
287 iResult=pTask->SetDependency(pCurr);
288 pCurr->SetTarget(pTask);
85465857 289 HLTDebug("set dependency \"%s\" for configuration \"%s\"", pCurr->GetName(), pTask->GetName());
f23a6e1a 290 }
5ec8e281 291 if (pCurr->Depends(pTask)) {
3b35e87c 292 // circular dependency
293 HLTError("circular dependency: can not resolve dependencies for configuration \"%s\"", pTask->GetName());
5ec8e281 294 iResult=-ELOOP;
295 } else if ((iResult=pTask->CheckDependencies())>0) {
296 lnk = lnk->Next();
297 }
298 }
299 if (iResult==0) {
300 if (lnk) {
301 fTaskList.AddAfter(lnk, pTask);
302 } else {
303 fTaskList.AddFirst(pTask);
304 }
a742f6f8 305 HLTDebug("task \"%s\" (%p) inserted (size %d)", pTask->GetName(), pTask, sizeof(AliHLTTask));
5ec8e281 306 } else if (iResult>0) {
85465857 307 HLTError("can not resolve dependencies for configuration \"%s\" (%d unresolved)", pTask->GetName(), iResult);
5ec8e281 308 iResult=-ENOLINK;
f23a6e1a 309 }
5ec8e281 310 return iResult;
f23a6e1a 311}
312
5ec8e281 313AliHLTTask* AliHLTSystem::FindTask(const char* id)
314{
70ed7d01 315 // see header file for class documentation
5ec8e281 316 AliHLTTask* pTask=NULL;
317 if (id) {
f3506ea2 318 pTask=dynamic_cast<AliHLTTask*>(fTaskList.FindObject(id));
5ec8e281 319 }
320 return pTask;
321}
f23a6e1a 322
5ec8e281 323void AliHLTSystem::PrintTaskList()
324{
70ed7d01 325 // see header file for class documentation
85465857 326 HLTLogKeyword("task list");
5ec8e281 327 TObjLink *lnk = NULL;
85465857 328 HLTMessage("Task List");
5ec8e281 329 lnk=fTaskList.FirstLink();
330 while (lnk) {
331 TObject* obj=lnk->GetObject();
332 if (obj) {
85465857 333 HLTMessage(" %s - status:", obj->GetName());
5ec8e281 334 AliHLTTask* pTask=(AliHLTTask*)obj;
335 pTask->PrintStatus();
336 } else {
337 }
338 lnk = lnk->Next();
339 }
340}
014d39ce 341
dee38f1b 342int AliHLTSystem::Run(Int_t iNofEvents, int bStop)
014d39ce 343{
70ed7d01 344 // see header file for class documentation
014d39ce 345 int iResult=0;
242bb794 346 int iCount=0;
347 SetStatusFlags(kRunning);
dee38f1b 348 if (fEventCount>=0 || (iResult=InitTasks())>=0) {
349 if (fEventCount>=0 || (iResult=StartTasks())>=0) {
350 if (fEventCount==0) {
351 InitBenchmarking(fStopwatches);
352 } else {
032c5e5e 353 ResumeBenchmarking(fStopwatches);
dee38f1b 354 }
355 for (int i=fEventCount; i<fEventCount+iNofEvents && iResult>=0; i++) {
356 if ((iResult=ProcessTasks(i))>=0) {
357 fGoodEvents++;
242bb794 358 iCount++;
9ce4bf4a 359 } else {
9ce4bf4a 360 // TODO: define different running modes to either ignore errors in
361 // event processing or not
362 // currently ignored
dee38f1b 363 iResult=0;
9ce4bf4a 364 }
2d7ff710 365 }
dee38f1b 366 fEventCount+=iNofEvents;
367 if (bStop) StopTasks();
032c5e5e 368 else PauseBenchmarking(fStopwatches);
53feaef5 369 }
dee38f1b 370 if (bStop) DeinitTasks();
9ce4bf4a 371 }
90ebac25 372 if (iResult>=0) {
373 iResult=iCount;
ba7f962b 374 } else if (iResult==-126 /*ENOKEY*/) {
83670b1d 375 iResult=0; // do not propagate the error
90ebac25 376 }
242bb794 377 ClearStatusFlags(kRunning);
9ce4bf4a 378 return iResult;
379}
380
381int AliHLTSystem::InitTasks()
382{
70ed7d01 383 // see header file for class documentation
9ce4bf4a 384 int iResult=0;
385 TObjLink *lnk=fTaskList.FirstLink();
dee38f1b 386
fc455fba 387 if (lnk==NULL) {
3d6633ff 388 HLTWarning("Task list is empty, skipping HLT");
ba7f962b 389 return -126 /*ENOKEY*/;
fc455fba 390 }
9ce4bf4a 391 while (lnk && iResult>=0) {
392 TObject* obj=lnk->GetObject();
393 if (obj) {
394 AliHLTTask* pTask=(AliHLTTask*)obj;
395 iResult=pTask->Init(NULL, fpComponentHandler);
dba03d72 396// ProcInfo_t ProcInfo;
397// gSystem->GetProcInfo(&ProcInfo);
398// HLTInfo("task %s initialized (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
9ce4bf4a 399 } else {
400 }
401 lnk = lnk->Next();
402 }
403 if (iResult<0) {
dee38f1b 404 HLTError("can not initialize task list, error %d", iResult);
53feaef5 405 }
dee38f1b 406
53feaef5 407 return iResult;
408}
409
90ebac25 410int AliHLTSystem::InitBenchmarking(TObjArray* pStopwatches)
411{
412 // see header file for class documentation
90ebac25 413 int iResult=0;
dee38f1b 414 if (pStopwatches==NULL) return 0;
415
416 for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
417 TStopwatch* pStopwatch= new TStopwatch;
418 if (pStopwatch) {
419 pStopwatch->Reset();
420 pStopwatches->AddAt(pStopwatch, i);
421 } else {
422 iResult=-ENOMEM;
423 break;
424 }
425 }
426
90ebac25 427 TObjLink *lnk=fTaskList.FirstLink();
428 while (lnk && iResult>=0) {
429 TObject* obj=lnk->GetObject();
430 if (obj) {
431 AliHLTTask* pTask=(AliHLTTask*)obj;
432 AliHLTComponent* pComp=NULL;
433 if (iResult>=0 && (pComp=pTask->GetComponent())!=NULL) {
434 switch (pComp->GetComponentType()) {
435 case AliHLTComponent::kProcessor:
436 pComp->SetStopwatches(pStopwatches);
437 break;
438 case AliHLTComponent::kSource:
439 {
440 // this switch determines whether the time consumption of the
441 // AliHLTComponent base methods should be counted to the input
442 // stopwatch or base stopwatch.
443 //int inputBase=(int)AliHLTComponent::kSWBase;
444 int inputBase=(int)AliHLTComponent::kSWInput;
445 pComp->SetStopwatch(pStopwatches->At(inputBase), AliHLTComponent::kSWBase);
446 pComp->SetStopwatch(pStopwatches->At((int)AliHLTComponent::kSWInput), AliHLTComponent::kSWDA);
447 }
448 break;
449 case AliHLTComponent::kSink:
450 {
451 // this switch determines whether the time consumption of the
452 // AliHLTComponent base methods should be counted to the output
453 // stopwatch or base stopwatch.
454 //int outputBase=(int)AliHLTComponent::kSWBase;
455 int outputBase=(int)AliHLTComponent::kSWOutput;
456 pComp->SetStopwatch(pStopwatches->At(outputBase), AliHLTComponent::kSWBase);
457 pComp->SetStopwatch(pStopwatches->At((int)AliHLTComponent::kSWOutput), AliHLTComponent::kSWDA);
458 }
459 break;
85f0cede 460 default:
461 HLTWarning("unknown component type %d", (int)pComp->GetComponentType());
90ebac25 462 }
463 }
464 } else {
465 }
466 lnk = lnk->Next();
467 }
468 return iResult;
469}
470
032c5e5e 471int AliHLTSystem::PauseBenchmarking(TObjArray* pStopwatches) const
472{
473 // see header file for class documentation
474 if (pStopwatches==NULL) return 0;
475
476 for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
477 if (!pStopwatches->At(i)) continue;
478 TStopwatch* pSw=dynamic_cast<TStopwatch*>(pStopwatches->At(i));
479 if (pSw) pSw->Stop();
480 }
481 return 0;
482}
483
484int AliHLTSystem::ResumeBenchmarking(TObjArray* pStopwatches) const
485{
486 // see header file for class documentation
487 if (pStopwatches==NULL) return 0;
488
489 for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
490 if (!pStopwatches->At(i)) continue;
491 TStopwatch* pSw=dynamic_cast<TStopwatch*>(pStopwatches->At(i));
492 if (pSw) pSw->Continue();
493 }
494 return 0;
495}
496
497int AliHLTSystem::PrintBenchmarking(TObjArray* pStopwatches, int bClean) const
dee38f1b 498{
499 // see header file for class documentation
500 int iInitialized=1;
501 if (pStopwatches==NULL) return 0;
502
503 for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
504 if (!dynamic_cast<TStopwatch*>(pStopwatches->At(i))) {
505 iInitialized=0;
506 break;
507 }
508 }
509
510 if (iInitialized!=0) {
032c5e5e 511 HLTImportant("HLT statistics:\n"
dee38f1b 512 " base: R:%.3fs C:%.3fs\n"
513 " input: R:%.3fs C:%.3fs\n"
514 " output: R:%.3fs C:%.3fs\n"
515 " event processing : R:%.3fs C:%.3fs"
516 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWBase))->RealTime()
517 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWBase))->CpuTime()
518 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWInput))->RealTime()
519 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWInput))->CpuTime()
520 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWOutput))->RealTime()
521 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWOutput))->CpuTime()
522 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWDA))->RealTime()
523 , dynamic_cast<TStopwatch*>(pStopwatches->At(AliHLTComponent::kSWDA))->CpuTime()
524 );
525 }
526
527 if (bClean) {
528 for (int i=0; i<(int)AliHLTComponent::kSWTypeCount; i++) {
529 TObject* pObj=pStopwatches->RemoveAt(i);
530 if (pObj) delete pObj;
531 }
532 }
533 return 0;
534}
535
53feaef5 536int AliHLTSystem::StartTasks()
537{
70ed7d01 538 // see header file for class documentation
53feaef5 539 int iResult=0;
540 TObjLink *lnk=fTaskList.FirstLink();
541 while (lnk && iResult>=0) {
542 TObject* obj=lnk->GetObject();
543 if (obj) {
544 AliHLTTask* pTask=(AliHLTTask*)obj;
545 iResult=pTask->StartRun();
dba03d72 546// ProcInfo_t ProcInfo;
547// gSystem->GetProcInfo(&ProcInfo);
548// HLTInfo("task %s started (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
53feaef5 549 } else {
550 }
551 lnk = lnk->Next();
552 }
553 if (iResult<0) {
dee38f1b 554 HLTError("can not start task list, error %d", iResult);
555 } else {
3dd8541e 556 SetStatusFlags(kStarted);
dee38f1b 557 fEventCount=0;
558 fGoodEvents=0;
457ec821 559 if ((iResult=SendControlEvent(kAliHLTDataTypeSOR))<0) {
560 HLTError("can not send SOR event");
561 }
53feaef5 562 }
563 return iResult;
564}
565
566int AliHLTSystem::ProcessTasks(Int_t eventNo)
567{
70ed7d01 568 // see header file for class documentation
53feaef5 569 int iResult=0;
570 HLTDebug("processing event no %d", eventNo);
571 TObjLink *lnk=fTaskList.FirstLink();
572 while (lnk && iResult>=0) {
573 TObject* obj=lnk->GetObject();
574 if (obj) {
575 AliHLTTask* pTask=(AliHLTTask*)obj;
9ce4bf4a 576 iResult=pTask->ProcessTask(eventNo);
dba03d72 577// ProcInfo_t ProcInfo;
578// gSystem->GetProcInfo(&ProcInfo);
579// HLTInfo("task %s processed (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
53feaef5 580 } else {
581 }
582 lnk = lnk->Next();
583 }
dee38f1b 584
585 if (iResult>=0) {
8f471af0 586 HLTImportant("Event %d successfully finished (%d)", eventNo, iResult);
dee38f1b 587 iResult=0;
588 } else {
589 HLTError("Processing of event %d failed (%d)", eventNo, iResult);
590 }
591
53feaef5 592 return iResult;
593}
594
595int AliHLTSystem::StopTasks()
596{
70ed7d01 597 // see header file for class documentation
53feaef5 598 int iResult=0;
457ec821 599 if ((iResult=SendControlEvent(kAliHLTDataTypeEOR))<0) {
600 HLTError("can not send EOR event");
601 }
53feaef5 602 TObjLink *lnk=fTaskList.FirstLink();
457ec821 603 while (lnk) {
53feaef5 604 TObject* obj=lnk->GetObject();
605 if (obj) {
606 AliHLTTask* pTask=(AliHLTTask*)obj;
457ec821 607 int locResult=pTask->EndRun();
608 if (iResult>=0 && locResult<0) iResult=locResult;
dba03d72 609// ProcInfo_t ProcInfo;
610// gSystem->GetProcInfo(&ProcInfo);
611// HLTInfo("task %s stopped (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
53feaef5 612 } else {
613 }
614 lnk = lnk->Next();
615 }
dee38f1b 616 PrintBenchmarking(fStopwatches, 1 /*clean*/);
3dd8541e 617 ClearStatusFlags(kStarted);
014d39ce 618 return iResult;
619}
9ce4bf4a 620
457ec821 621int AliHLTSystem::SendControlEvent(AliHLTComponentDataType dt)
622{
623 // see header file for class documentation
624
625 // disabled for the moment
626 return 0;
627
628 int iResult=0;
629 AliHLTRunDesc runDesc;
630 memset(&runDesc, 0, sizeof(AliHLTRunDesc));
631 runDesc.fStructSize=sizeof(AliHLTRunDesc);
632 AliHLTDataSource::AliSpecialEventGuard g(&runDesc, dt, kAliHLTVoidDataSpec);
633 HLTDebug("sending event %s, run descriptor %p", AliHLTComponent::DataType2Text(dt).c_str(), &runDesc);
634 TObjLink *lnk=fTaskList.FirstLink();
635 while (lnk && iResult>=0) {
636 TObject* obj=lnk->GetObject();
637 if (obj) {
638 AliHLTTask* pTask=(AliHLTTask*)obj;
639 iResult=pTask->ProcessTask(-1);
640 } else {
641 }
642 lnk = lnk->Next();
643 }
644 HLTDebug("event %s done (%d)", AliHLTComponent::DataType2Text(dt).c_str(), iResult);
645 return iResult;
646}
647
9ce4bf4a 648int AliHLTSystem::DeinitTasks()
649{
70ed7d01 650 // see header file for class documentation
9ce4bf4a 651 int iResult=0;
652 TObjLink *lnk=fTaskList.FirstLink();
653 while (lnk && iResult>=0) {
654 TObject* obj=lnk->GetObject();
655 if (obj) {
656 AliHLTTask* pTask=(AliHLTTask*)obj;
657 iResult=pTask->Deinit();
dba03d72 658// ProcInfo_t ProcInfo;
659// gSystem->GetProcInfo(&ProcInfo);
660// HLTInfo("task %s cleaned (%d), current memory usage %d %d", pTask->GetName(), iResult, ProcInfo.fMemResident, ProcInfo.fMemVirtual);
9ce4bf4a 661 } else {
662 }
663 lnk = lnk->Next();
664 }
dee38f1b 665 fEventCount=-1;
666 fGoodEvents=-1;
667
9ce4bf4a 668 return iResult;
669}
670
c043fa2c 671void* AliHLTSystem::AllocMemory( void* /*param*/, unsigned long size )
9ce4bf4a 672{
70ed7d01 673 // see header file for class documentation
c043fa2c 674 void* p=NULL;
675 try {
676 p=(void*)new char[size];
242bb794 677 }
c043fa2c 678 catch (...) {
679 AliHLTLogging log;
680 log.LoggingVarargs(kHLTLogError, "AliHLTSystem" , "AllocMemory" , __FILE__ , __LINE__ , "exeption during memory allocation" );
681 }
682 return p;
9ce4bf4a 683}
242bb794 684
685int AliHLTSystem::Reconstruct(int nofEvents, AliRunLoader* runLoader,
686 AliRawReader* rawReader)
687{
688 // see header file for class documentation
689 int iResult=0;
dee38f1b 690 if (runLoader || rawReader || nofEvents==0) {
691 if (nofEvents>0) {HLTInfo("Run Loader %p, Raw Reader %p , %d event(s)", runLoader, rawReader, nofEvents);}
242bb794 692 if (CheckStatus(kReady)) {
dee38f1b 693 if (nofEvents==0) {
694 // special case to close the reconstruction
f3506ea2 695 if (!CheckStatus(kError)) {
dee38f1b 696 StopTasks();
697 DeinitTasks();
f3506ea2 698 }
dee38f1b 699 } else {
8451168b 700 if ((iResult=AliHLTOfflineInterface::SetParamsToComponents(runLoader, rawReader))>=0) {
dee38f1b 701 // the system always remains started after event processing, a specific
f3506ea2 702 // call with nofEvents==0 is needed to execute the stop sequence
703 if ((iResult=Run(nofEvents, 0))<0) SetStatusFlags(kError);
dee38f1b 704 }
8451168b 705 }
242bb794 706 } else {
707 HLTError("wrong state %#x, required flags %#x", GetStatusFlags(), kReady);
708 }
709 } else {
0bf7536b 710 HLTError("missing RunLoader (%p)/RawReader (%p) instance", runLoader, rawReader);
242bb794 711 iResult=-EINVAL;
712 }
713 return iResult;
714}
715
af885e0f 716int AliHLTSystem::FillESD(int eventNo, AliRunLoader* runLoader, AliESDEvent* esd)
242bb794 717{
718 // see header file for class documentation
719 int iResult=0;
dee38f1b 720 if (runLoader || esd) {
242bb794 721 HLTInfo("Event %d: Run Loader %p, ESD %p", eventNo, runLoader, esd);
8451168b 722 iResult=AliHLTOfflineInterface::FillComponentESDs(eventNo, runLoader, esd);
242bb794 723 } else {
724 HLTError("missing run loader/ESD instance(s)");
725 iResult=-EINVAL;
726 }
727 return iResult;
728}
729
c5123824 730int AliHLTSystem::ProcessHLTOUT(AliHLTOUT* pHLTOUT, AliESDEvent* esd)
731{
732 // see header file for class documentation
733 int iResult=0;
734 if (!pHLTOUT) return -EINVAL;
735
736 HLTDebug("processing %d HLT data blocks", pHLTOUT->GetNofDataBlocks());
737 AliHLTOUT::AliHLTOUTHandlerListEntryVector esdHandlers;
90c37647 738
739 // first come first serve: the ESD of the first handler is also filled into
740 // the main ESD. Has to be changed later.
741 // currently, merging to the provided ESDs crashes at the level of the
742 // TTree::Fill in AliReconstruction, furthermore, the wrong ESD is passed
743 // by the framework
744 AliESDEvent* pMasterESD=NULL;
83cb7e1d 745 pMasterESD=esd;
c5123824 746 for (iResult=pHLTOUT->SelectFirstDataBlock();
747 iResult>=0;
748 iResult=pHLTOUT->SelectNextDataBlock()) {
749 AliHLTComponentDataType dt=kAliHLTVoidDataType;
750 AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
751 pHLTOUT->GetDataBlockDescription(dt, spec);
752 AliHLTOUTHandler* pHandler=pHLTOUT->GetHandler();
753 AliHLTModuleAgent::AliHLTOUTHandlerType handlerType=pHLTOUT->GetDataBlockHandlerType();
f94e8c27 754 if (!pHandler && (dt==kAliHLTDataTypeESDObject || dt==kAliHLTDataTypeESDTree)) {
c5123824 755 handlerType=AliHLTModuleAgent::kEsd;
756 }
757 const char* pMsg="invalid";
758 switch (handlerType) {
759 case AliHLTModuleAgent::kEsd:
760 {
761 if (pHandler) {
762 // preprocess and write later
763 AliHLTOUT::AliHLTOUTLockGuard g(pHLTOUT);
764 pHandler->ProcessData(pHLTOUT);
765 pHLTOUT->InsertHandler(esdHandlers, pHLTOUT->GetDataBlockHandlerDesc());
766 } else {
767 // write directly
768 const AliHLTUInt8_t* pBuffer=NULL;
769 AliHLTUInt32_t size=0;
770 if (pHLTOUT->GetDataBuffer(pBuffer, size)>=0) {
771 pHLTOUT->WriteESD(pBuffer, size, dt);
90c37647 772 if (pMasterESD) {
773 pHLTOUT->WriteESD(pBuffer, size, dt, pMasterESD);
774 pMasterESD=NULL;
775 }
c5123824 776 pHLTOUT->ReleaseDataBuffer(pBuffer);
777 }
778 }
779 }
780 break;
781 case AliHLTModuleAgent::kRawReader:
782 // handled in the AliRawReaderHLT
783 break;
784 case AliHLTModuleAgent::kRawStream:
785 HLTWarning("HLTOUT handler type 'kRawStream' not yet implemented: agent %s, data type %s, specification %#x",
786 pMsg, pHLTOUT->GetAgent()?pHLTOUT->GetAgent()->GetModuleId():"invalid",
787 AliHLTComponent::DataType2Text(dt).c_str(), spec);
788 break;
789 case AliHLTModuleAgent::kChain:
790 HLTWarning("HLTOUT handler type 'kChain' not yet implemented: agent %s, data type %s, specification %#x",
791 pMsg, pHLTOUT->GetAgent()?pHLTOUT->GetAgent()->GetModuleId():"invalid",
792 AliHLTComponent::DataType2Text(dt).c_str(), spec);
793 break;
794 case AliHLTModuleAgent::kProprietary:
795 HLTDebug("processing proprietary data: agent %s, data type %s, specification %#x",
796 pMsg, pHLTOUT->GetAgent()?pHLTOUT->GetAgent()->GetModuleId():"invalid",
797 AliHLTComponent::DataType2Text(dt).c_str(), spec);
798 if (pHandler) {
799 AliHLTOUT::AliHLTOUTLockGuard g(pHLTOUT);
800 int res=pHandler->ProcessData(pHLTOUT);
801 if (res<0) {
802 HLTWarning("processing proprietary data failed (%d): agent %s, data type %s, specification %#x",
803 res, pMsg, pHLTOUT->GetAgent()?pHLTOUT->GetAgent()->GetModuleId():"invalid",
804 AliHLTComponent::DataType2Text(dt).c_str(), spec);
805 }
806 }
807 break;
808 case AliHLTModuleAgent::kUnknownOutput:
809 pMsg="unknown";
810 // fall trough intended
811 default:
812 HLTWarning("%s handler type: agent %s, data type %s, specification %#x, ... skipping data block",
813 pMsg, pHLTOUT->GetAgent()?pHLTOUT->GetAgent()->GetModuleId():"invalid",
814 AliHLTComponent::DataType2Text(dt).c_str(), spec);
815 }
816 }
817 // TODO: the return value of SelectFirst/NextDataBlock must be
818 // changed in order to avoid this check
819 if (iResult==-ENOENT) iResult=0;
820
821 AliHLTOUT::AliHLTOUTHandlerListEntryVector::iterator esdHandler;
822 // write all postponed esd data blocks
c5123824 823 for (esdHandler=esdHandlers.begin(); esdHandler!=esdHandlers.end() && iResult>=0; esdHandler++) {
824 AliHLTOUTHandler* pHandler=*esdHandler;
825 const AliHLTUInt8_t* pBuffer=NULL;
826 AliHLTUInt32_t size=0;
827 if ((size=pHandler->GetProcessedData(pBuffer))>0) {
828 AliHLTModuleAgent::AliHLTOUTHandlerDesc desc=*esdHandler;
829 AliHLTComponentDataType dt=desc;
830 pHLTOUT->WriteESD(pBuffer, size, dt);
831 if (pMasterESD) {
832 pHLTOUT->WriteESD(pBuffer, size, dt, pMasterESD);
833 pMasterESD=NULL;
834 }
835 pHandler->ReleaseProcessedData(pBuffer, size);
836 }
837 }
838
839 return iResult;
840}
841
242bb794 842int AliHLTSystem::LoadComponentLibraries(const char* libraries)
843{
844 // see header file for class documentation
845 int iResult=0;
846 if (libraries) {
847 if (fpComponentHandler) {
848 TString libs(libraries);
849 TObjArray* pTokens=libs.Tokenize(" ");
850 if (pTokens) {
851 int iEntries=pTokens->GetEntries();
852 for (int i=0; i<iEntries && iResult>=0; i++) {
853 iResult=fpComponentHandler->LoadLibrary((((TObjString*)pTokens->At(i))->GetString()).Data());
854 }
855 delete pTokens;
856 }
857 if (iResult>=0) {
858 SetStatusFlags(kLibrariesLoaded);
859 } else {
860 // lets see if we need this, probably not
861 //fpComponentHandler->UnloadLibraries();
862 ClearStatusFlags(kLibrariesLoaded);
863 }
864 } else {
865 iResult=-EFAULT;
866 HLTFatal("no component handler available");
867 }
868 } else {
869 iResult=-EINVAL;
870 }
871 return iResult;
872}
873
874int AliHLTSystem::Configure(AliRunLoader* runloader)
dee38f1b 875{
876 // see header file for class documentation
f3506ea2 877 return Configure(NULL, runloader);
dee38f1b 878}
879
880int AliHLTSystem::Configure(AliRawReader* rawReader, AliRunLoader* runloader)
242bb794 881{
882 // see header file for class documentation
883 int iResult=0;
884 if (CheckStatus(kRunning)) {
885 HLTError("HLT system in running state, can not configure");
886 return -EBUSY;
887 }
e642a402 888 ClearStatusFlags(kTaskListCreated);
c215072c 889 if (CheckFilter(kHLTLogDebug))
890 AliHLTModuleAgent::PrintStatus();
c043fa2c 891 if (CheckStatus(kConfigurationLoaded)==0) {
dee38f1b 892 iResult=LoadConfigurations(rawReader, runloader);
c043fa2c 893 } else {
dee38f1b 894 if (fChains.Length()==0) {
c043fa2c 895 HLTError("custom configuration(s) specified, but no configuration to run in local reconstruction, use \'localrec=<conf>\' option");
896 iResult=-ENOENT;
897 }
898 }
242bb794 899 if (iResult>=0) {
900 SetStatusFlags(kConfigurationLoaded);
c043fa2c 901 if (CheckFilter(kHLTLogDebug))
902 fpConfigurationHandler->PrintConfigurations();
f3506ea2 903 iResult=BuildTaskListsFromReconstructionChains(rawReader, runloader);
242bb794 904 if (iResult>=0) {
905 SetStatusFlags(kTaskListCreated);
906 }
907 }
908 if (iResult<0) SetStatusFlags(kError);
909
910 return iResult;
911}
912
c043fa2c 913int AliHLTSystem::ScanOptions(const char* options)
914{
915 // see header file for class documentation
916 int iResult=0;
917 if (options) {
d76bc02a 918 //AliHLTComponentHandler::TLibraryMode libMode=AliHLTComponentHandler::kDynamic;
83670b1d 919 TString libs("");
c043fa2c 920 TString alloptions(options);
921 TObjArray* pTokens=alloptions.Tokenize(" ");
922 if (pTokens) {
923 int iEntries=pTokens->GetEntries();
924 for (int i=0; i<iEntries; i++) {
925 TString token=(((TObjString*)pTokens->At(i))->GetString());
926 if (token.Contains("loglevel=")) {
927 TString param=token.ReplaceAll("loglevel=", "");
928 if (param.IsDigit()) {
929 SetGlobalLoggingLevel((AliHLTComponentLogSeverity)param.Atoi());
930 } else if (param.BeginsWith("0x") &&
931 param.Replace(0,2,"",0).IsHex()) {
932 int severity=0;
933 sscanf(param.Data(),"%x", &severity);
934 SetGlobalLoggingLevel((AliHLTComponentLogSeverity)severity);
935 } else {
936 HLTWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
937 }
dba03d72 938 } else if (token.Contains("frameworklog=")) {
939 TString param=token.ReplaceAll("frameworklog=", "");
940 if (param.IsDigit()) {
941 SetFrameworkLog((AliHLTComponentLogSeverity)param.Atoi());
942 } else if (param.BeginsWith("0x") &&
943 param.Replace(0,2,"",0).IsHex()) {
944 int severity=0;
945 sscanf(param.Data(),"%x", &severity);
946 SetFrameworkLog((AliHLTComponentLogSeverity)severity);
947 } else {
948 HLTWarning("wrong parameter for option \'loglevel=\', (hex) number expected");
949 }
c043fa2c 950 } else if (token.Contains("alilog=off")) {
951 SwitchAliLog(0);
952 } else if (token.Contains("config=")) {
953 TString param=token.ReplaceAll("config=", "");
954 Int_t error=0;
955 gROOT->Macro(param.Data(), &error);
956 if (error==0) {
957 SetStatusFlags(kConfigurationLoaded);
958 } else {
959 HLTError("can not execute macro \'%s\'", param.Data());
960 iResult=-EBADF;
961 }
d85f150c 962 } else if (token.Contains("chains=")) {
dee38f1b 963 TString param=token.ReplaceAll("chains=", "");
964 fChains=param.ReplaceAll(",", " ");
dba03d72 965 } else if (token.Contains("libmode=")) {
966 TString param=token.ReplaceAll("libmode=", "");
967 param.ReplaceAll(",", " ");
968 if (fpComponentHandler) {
969 if (param.CompareTo("static")==0) {
970 fpComponentHandler->SetLibraryMode(AliHLTComponentHandler::kStatic);
971 } else if (param.CompareTo("dynamic")==0) {
972 fpComponentHandler->SetLibraryMode(AliHLTComponentHandler::kDynamic);
973 } else {
974 HLTWarning("wrong argument for option \'libmode=\', use \'static\' or \'dynamic\'");
975 }
976 }
83670b1d 977 } else if (token.BeginsWith("lib") && token.EndsWith(".so")) {
978 libs+=token;
979 libs+=" ";
c043fa2c 980 } else {
981 HLTWarning("unknown option \'%s\'", token.Data());
982 }
983 }
984 delete pTokens;
985 }
83670b1d 986
987 if (iResult>=0) {
988 if (libs.IsNull()) {
6a8e0bb4 989 const char** deflib=fgkHLTDefaultLibs;
83670b1d 990 while (*deflib) {
991 libs+=*deflib++;
992 libs+=" ";
993 }
994 }
995 if ((!CheckStatus(AliHLTSystem::kLibrariesLoaded)) &&
996 (LoadComponentLibraries(libs.Data())<0)) {
997 HLTError("error while loading HLT libraries");
998 iResult=-EFAULT;
999 }
1000 }
c043fa2c 1001 }
1002 return iResult;
1003}
1004
242bb794 1005int AliHLTSystem::Reset(int bForce)
1006{
1007 // see header file for class documentation
1008 int iResult=0;
1009 if (!bForce && CheckStatus(kRunning)) {
1010 HLTError("HLT system in running state, can not configure");
1011 return -EBUSY;
1012 }
1013 CleanTaskList();
1014 ClearStatusFlags(~kUninitialized);
1015 return iResult;
1016}
1017
dee38f1b 1018int AliHLTSystem::LoadConfigurations(AliRawReader* rawReader, AliRunLoader* runloader)
242bb794 1019{
1020 // see header file for class documentation
1021 if (CheckStatus(kRunning)) {
1022 HLTError("HLT system in running state, can not configure");
1023 return -EBUSY;
1024 }
1025 int iResult=0;
1026 AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
60b26a17 1027 while (pAgent && iResult>=0) {
1028 const char* deplibs=pAgent->GetRequiredComponentLibraries();
1029 if (deplibs) {
c215072c 1030 HLTDebug("load libraries \'%s\' for agent %s (%p)", deplibs, pAgent->GetName(), pAgent);
60b26a17 1031 iResult=LoadComponentLibraries(deplibs);
1032 }
1033 if (iResult>=0) {
1034 HLTDebug("load configurations for agent %s (%p)", pAgent->GetName(), pAgent);
dee38f1b 1035 pAgent->CreateConfigurations(fpConfigurationHandler, rawReader, runloader);
60b26a17 1036 pAgent=AliHLTModuleAgent::GetNextAgent();
1037 }
242bb794 1038 }
1039 return iResult;
1040}
1041
f3506ea2 1042int AliHLTSystem::BuildTaskListsFromReconstructionChains(AliRawReader* rawReader, AliRunLoader* runloader)
242bb794 1043{
1044 // see header file for class documentation
1045 if (CheckStatus(kRunning)) {
1046 HLTError("HLT system in running state, can not configure");
1047 return -EBUSY;
1048 }
1049 if (!CheckStatus(kConfigurationLoaded)) {
1050 HLTWarning("configurations not yet loaded");
1051 return 0;
1052 }
1053
1054 int iResult=0;
f3506ea2 1055 int bHaveOutput=0;
1056
1057 // query chains
1058 TString chains;
1059 if (fChains.Length()>0) {
1060 chains=fChains;
8f471af0 1061 HLTImportant("custom reconstruction chain: %s", chains.Data());
f3506ea2 1062 } else {
1063 AliHLTModuleAgent* pAgent=AliHLTModuleAgent::GetFirstAgent();
1064 while ((pAgent || fChains.Length()>0) && iResult>=0) {
1065 const char* agentchains=pAgent->GetReconstructionChains(rawReader, runloader);
1066 if (agentchains) {
1067 if (!chains.IsNull()) chains+="";
1068 chains+=agentchains;
1069 HLTInfo("reconstruction chains for agent %s (%p): %s", pAgent->GetName(), pAgent, agentchains);
1070 }
1071 pAgent=AliHLTModuleAgent::GetNextAgent();
c043fa2c 1072 }
f3506ea2 1073 }
1074
1075 // build task list for chains
1076 TObjArray* pTokens=chains.Tokenize(" ");
1077 if (pTokens) {
1078 int iEntries=pTokens->GetEntries();
1079 for (int i=0; i<iEntries && iResult>=0; i++) {
1080 const char* pCID=((TObjString*)pTokens->At(i))->GetString().Data();
1081 AliHLTConfiguration* pConf=fpConfigurationHandler->FindConfiguration(pCID);
1082 if (pConf) {
1083 iResult=BuildTaskList(pConf);
1084 if (runloader) {
1085 assert(fpComponentHandler!=NULL);
1086 TString cid=pConf->GetComponentID();
1087 if (cid.CompareTo("HLTOUT")==0) {
1088 // remove from the input of a global HLTOUT configuration
1089 chains.ReplaceAll(pCID, "");
1090 } else if (bHaveOutput==0) {
1091 // check whether this configuration produces data output
1092 if ((bHaveOutput=fpComponentHandler->HasOutputData(cid.Data()))<0) {
1093 bHaveOutput=0;
1094 chains.ReplaceAll(pCID, "");
1095 }
1096 }
242bb794 1097 }
f3506ea2 1098 } else {
1099 HLTWarning("can not find configuration %s", pCID);
242bb794 1100 }
242bb794 1101 }
f3506ea2 1102 delete pTokens;
1103 }
1104
1105 // build HLTOUT for simulation
1106 if (iResult>=0 && runloader) {
1107 if (bHaveOutput) {
1108 // there are components in the chain which produce data which need to be
1109 // piped to an HLTOUT
1110 if (fpComponentHandler->FindComponentIndex("HLTOUT")>=0 ||
1111 LoadComponentLibraries("libHLTsim.so")>=0) {
1112 AliHLTConfiguration globalout("_globalout_", "HLTOUT", chains.Data(), NULL);
1113 iResult=BuildTaskList("_globalout_");
1114 } else {
1115 HLTError("can not load libHLTsim.so and HLTOUT component");
1116 iResult=-EFAULT;
1117 }
c043fa2c 1118 }
242bb794 1119 }
f3506ea2 1120
242bb794 1121 if (iResult>=0) SetStatusFlags(kTaskListCreated);
1122
1123 return iResult;
1124}
1125
1126int AliHLTSystem::CheckStatus(int flag)
1127{
1128 // see header file for class documentation
1129 if (flag==kUninitialized && flag==fState) return 1;
1130 if ((fState&flag)==flag) return 1;
1131 return 0;
1132}
1133
1134int AliHLTSystem::GetStatusFlags()
1135{
1136 // see header file for class documentation
1137 return fState;
1138}
1139
1140int AliHLTSystem::SetStatusFlags(int flags)
1141{
1142 // see header file for class documentation
1143 fState|=flags;
1144 return fState;
1145}
1146
1147int AliHLTSystem::ClearStatusFlags(int flags)
1148{
1149 // see header file for class documentation
1150 fState&=~flags;
1151 return fState;
1152}
85f0cede 1153
1154void* AliHLTSystem::FindDynamicSymbol(const char* library, const char* symbol)
1155{
c043fa2c 1156 // see header file for class documentation
85f0cede 1157 if (fpComponentHandler==NULL) return NULL;
1158 return fpComponentHandler->FindSymbol(library, symbol);
1159}
dba03d72 1160
1161void AliHLTSystem::SetFrameworkLog(AliHLTComponentLogSeverity level)
1162{
6a8e0bb4 1163 // see header file for class documentation
dba03d72 1164 SetLocalLoggingLevel(level);
1165 if (fpComponentHandler) fpComponentHandler->SetLocalLoggingLevel(level);
1166 if (fpConfigurationHandler) fpConfigurationHandler->SetLocalLoggingLevel(level);
1167}