]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RAW/AliRawHLTManager.cxx
new task to find jet trigger candidates (loop over EMCal L1 patches over threshold...
[u/mrichter/AliRoot.git] / RAW / AliRawHLTManager.cxx
CommitLineData
eb808725 1// $Id: AliRawHLTManager.cxx 23039 2007-12-13 20:53:02Z richterm $
2
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//**************************************************************************
18
19/** @file AliRawHLTManager.cxx
20 @author Matthias Richter
21 @date
22 @brief dynamic generation of HLT RAW readers and streams
23*/
24
25#include "AliRawHLTManager.h"
eb808725 26#include "AliLog.h"
27#include "TSystem.h"
28#include "TClass.h"
29
30ClassImp(AliRawHLTManager)
31
32AliRawHLTManager::AliRawHLTManager()
33{
34 // The class gives dynamic access to creater methods for HLT RAW readers and
35 // streams without any library dependencies to HLT libraries.
36 //
37 // The AliRawReaderHLT allows the redirection of input from the HLT DDL links
38 // to the detector equipment ids. To access the data, the AliRawReaderHLT
39 // needs a valid RAW reader (parent).
40 // usage:
41 // AliRawReader* pHLTReader=AliRawHLTManager::CreateRawReaderHLT(pParent, "TPC");
42}
43
44AliRawHLTManager::~AliRawHLTManager()
45{
46 // destructor
47}
48
49int AliRawHLTManager::fLibraryStatus=kUnloaded;
34dc81a4 50AliRawReaderHLTCreateInstance_t AliRawHLTManager::fFctCreateRawReaderHLT=NULL;
eb808725 51void* AliRawHLTManager::fFctCreateRawStream=NULL;
52
53AliRawReader* AliRawHLTManager::CreateRawReaderHLT(AliRawReader* pParent, const char* detectors)
54{
55 // see header file for class documentation
56 if (fLibraryStatus==kUnloaded) fLibraryStatus=LoadLibrary();
57 if (fLibraryStatus==kUnavailable) return NULL;
58
59 if (!fFctCreateRawReaderHLT) {
60 AliErrorClass("internal error, library loaded but function entry not known");
61 return NULL;
62 }
63 return ((AliRawReaderHLTCreateInstance_t)fFctCreateRawReaderHLT)(pParent, detectors);
64}
65
66TObject* AliRawHLTManager::CreateRawStream(const char* /*className*/)
67{
68 // see header file for class documentation
69
70 // not yet implemented
71 return NULL;
72}
73
74int AliRawHLTManager::LoadLibrary()
75{
76 // see header file for class documentation
77 int iResult=kUnavailable;
78 if (fLibraryStatus!=kUnloaded) return fLibraryStatus;
79
80 // strictly speaken we do not need a trial counter as gSystem->Load only returns 1 if the
81 // library has been loaded. If it was already loaded we get 0
82 int iTrials=0;
83 do {
34dc81a4 84 fFctCreateRawReaderHLT=(AliRawReaderHLTCreateInstance_t)gSystem->DynFindSymbol(ALIHLTREC_LIBRARY, ALIRAWREADERHLT_CREATE_INSTANCE);
eb808725 85 } while (fFctCreateRawReaderHLT==NULL && gSystem->Load(ALIHLTREC_LIBRARY)==0 && iTrials++<1);
86 if (fFctCreateRawReaderHLT) {
87 iResult=kLoaded;
88 } else {
89 AliErrorClass(Form("can not find library/entry %s/%s", ALIHLTREC_LIBRARY, ALIRAWREADERHLT_CREATE_INSTANCE));
90 iResult=kUnavailable;
91 }
92 return iResult;
93}