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