]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTDAQ.cxx
Use GRP from event-directory if:
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDAQ.cxx
CommitLineData
7c4d1228 1// $Id$
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 AliHLTDAQ.cxx
20 @author Matthias Richter
21 @date 24.10.2008
22 @brief Virtual Interface to the AliDAQ class.
23*/
24
25#include "AliHLTDAQ.h"
26#include "AliHLTLogging.h"
27#include "TClass.h"
28#include "TSystem.h"
29
30/** ROOT macro for the implementation of ROOT specific class methods */
31ClassImp(AliHLTDAQ)
32
33AliHLTDAQ::AliHLTDAQ()
34{
35 // see header file for class documentation
36 // or
37 // refer to README to build package
38 // or
39 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
40}
41
42AliHLTDAQ* AliHLTDAQ::fgpInstance=NULL;
43const char* AliHLTDAQ::fgkImplName="AliHLTDAQInterfaceImplementation";
44const char* AliHLTDAQ::fgkImplLibrary="libHLTrec.so";
45
46AliHLTDAQ::~AliHLTDAQ()
47{
48 // see header file for class documentation
49}
50
51Int_t AliHLTDAQ::DetectorID(const char *detectorName)
52{
53 // see header file for class documentation
54 if (!fgpInstance) GetInstance();
55 if (fgpInstance) return fgpInstance->VirtDetectorID(detectorName);
56 return -1;
57}
58
59const char *AliHLTDAQ::DetectorName(Int_t detectorID)
60{
61 // see header file for class documentation
62 if (!fgpInstance) GetInstance();
63 if (fgpInstance) return fgpInstance->VirtDetectorName(detectorID);
64 return NULL;
65}
66
67Int_t AliHLTDAQ::DdlIDOffset(const char *detectorName)
68{
69 // see header file for class documentation
70 if (!fgpInstance) GetInstance();
71 if (fgpInstance) return fgpInstance->VirtDdlIDOffset(detectorName);
72 return -1;
73}
74
75Int_t AliHLTDAQ::DdlIDOffset(Int_t detectorID)
76{
77 // see header file for class documentation
78 if (!fgpInstance) GetInstance();
79 if (fgpInstance) return fgpInstance->VirtDdlIDOffset(detectorID);
80 return -1;
81}
82
83const char *AliHLTDAQ::DetectorNameFromDdlID(Int_t ddlID, Int_t &ddlIndex)
84{
85 // see header file for class documentation
86 if (!fgpInstance) GetInstance();
87 if (fgpInstance) return fgpInstance->VirtDetectorNameFromDdlID(ddlID, ddlIndex);
88 return NULL;
89}
90
91Int_t AliHLTDAQ::DetectorIDFromDdlID(Int_t ddlID, Int_t &ddlIndex)
92{
93 // see header file for class documentation
94 if (!fgpInstance) GetInstance();
95 if (fgpInstance) return fgpInstance->VirtDetectorIDFromDdlID(ddlID, ddlIndex);
96 return -1;
97}
98
99Int_t AliHLTDAQ::DdlID(const char *detectorName, Int_t ddlIndex)
100{
101 // see header file for class documentation
102 if (!fgpInstance) GetInstance();
103 if (fgpInstance) return fgpInstance->VirtDdlID(detectorName, ddlIndex);
104 return -1;
105}
106
107Int_t AliHLTDAQ::DdlID(Int_t detectorID, Int_t ddlIndex)
108{
109 // see header file for class documentation
110 if (!fgpInstance) GetInstance();
111 if (fgpInstance) return fgpInstance->VirtDdlID(detectorID, ddlIndex);
112 return -1;
113}
114
115const char *AliHLTDAQ::DdlFileName(const char *detectorName, Int_t ddlIndex)
116{
117 // see header file for class documentation
118 if (!fgpInstance) GetInstance();
119 if (fgpInstance) return fgpInstance->VirtDdlFileName(detectorName, ddlIndex);
120 return NULL;
121}
122
123const char *AliHLTDAQ::DdlFileName(Int_t detectorID, Int_t ddlIndex)
124{
125 // see header file for class documentation
126 if (!fgpInstance) GetInstance();
127 if (fgpInstance) return fgpInstance->VirtDdlFileName(detectorID, ddlIndex);
128 return NULL;
129}
130
131Int_t AliHLTDAQ::NumberOfDdls(const char *detectorName)
132{
133 // see header file for class documentation
134 if (!fgpInstance) GetInstance();
135 if (fgpInstance) return fgpInstance->VirtNumberOfDdls(detectorName);
136 return -1;
137}
138
139Int_t AliHLTDAQ::NumberOfDdls(Int_t detectorID)
140{
141 // see header file for class documentation
142 if (!fgpInstance) GetInstance();
143 if (fgpInstance) return fgpInstance->VirtNumberOfDdls(detectorID);
144 return -1;
145}
146
147AliHLTDAQ* AliHLTDAQ::GetInstance()
148{
149 // see header file for class documentation
150 int iLibResult=0;
151 if (!fgpInstance) {
152 AliHLTLogging log;
153 TClass* pCl=NULL;
154 ROOT::NewFunc_t pNewFunc=NULL;
155 do {
156 pCl=TClass::GetClass(fgkImplName);
157 } while (!pCl && (iLibResult=gSystem->Load(fgkImplLibrary))==0);
158 if (iLibResult>=0) {
159 if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
160 void* p=(*pNewFunc)(NULL);
161 if (p) {
162 fgpInstance=reinterpret_cast<AliHLTDAQ*>(p);
163 if (!fgpInstance) {
164 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "type cast to AliHLTDAQ instance failed");
165 }
166 } else {
167 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not create AliHLTDAQ instance from class descriptor");
168 }
169 } else {
170 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not find AliHLTDAQ class descriptor");
171 }
172 } else {
173 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not load libHLTrec library");
174 }
175 }
176 return fgpInstance;
177}