3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* for The ALICE HLT Project. *
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 //**************************************************************************
19 /// @file AliHLTDAQ.cxx
20 /// @author Matthias Richter
22 /// @brief Virtual Interface to the AliDAQ class.
25 #include "AliHLTDAQ.h"
26 #include "AliHLTLogging.h"
27 #include "AliHLTDataTypes.h"
31 /** ROOT macro for the implementation of ROOT specific class methods */
34 AliHLTDAQ::AliHLTDAQ()
36 // see header file for class documentation
38 // refer to README to build package
40 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
43 AliHLTDAQ* AliHLTDAQ::fgpInstance=NULL;
44 const char* AliHLTDAQ::fgkImplName="AliHLTDAQInterfaceImplementation";
45 const char* AliHLTDAQ::fgkImplLibrary="libHLTrec.so";
46 const char* AliHLTDAQ::fgkOriginMapping[] = {
47 kAliHLTDataOriginITSSPD,
48 kAliHLTDataOriginITSSDD,
49 kAliHLTDataOriginITSSSD,
53 kAliHLTDataOriginHMPID,
54 kAliHLTDataOriginPHOS,
57 kAliHLTDataOriginMUON,
61 kAliHLTDataOriginVZERO,
63 kAliHLTDataOriginACORDE,
65 kAliHLTDataOriginEMCAL,
69 AliHLTDAQ::~AliHLTDAQ()
71 // see header file for class documentation
74 Int_t AliHLTDAQ::NumberOfDetectors()
76 // see header file for class documentation
77 if (!fgpInstance) GetInstance();
78 if (fgpInstance) return fgpInstance->VirtNumberOfDetectors();
82 Int_t AliHLTDAQ::DetectorID(const char *detectorName)
84 // see header file for class documentation
85 if (!fgpInstance) GetInstance();
86 if (fgpInstance) return fgpInstance->VirtDetectorID(detectorName);
90 const char *AliHLTDAQ::DetectorName(Int_t detectorID)
92 // see header file for class documentation
93 if (!fgpInstance) GetInstance();
94 if (fgpInstance) return fgpInstance->VirtDetectorName(detectorID);
98 const char *AliHLTDAQ::DetectorName(const char dataorigin[4])
100 // see header file for class documentation
101 for (int i=0; fgkOriginMapping[i]!=NULL; i++) {
102 if (strncmp(fgkOriginMapping[i], dataorigin, kAliHLTComponentDataTypefOriginSize)==0) {
103 return DetectorName(i);
110 Int_t AliHLTDAQ::DdlIDOffset(const char *detectorName)
112 // see header file for class documentation
113 if (!fgpInstance) GetInstance();
114 if (fgpInstance) return fgpInstance->VirtDdlIDOffset(detectorName);
118 Int_t AliHLTDAQ::DdlIDOffset(Int_t detectorID)
120 // see header file for class documentation
121 if (!fgpInstance) GetInstance();
122 if (fgpInstance) return fgpInstance->VirtDdlIDOffset(detectorID);
126 const char *AliHLTDAQ::DetectorNameFromDdlID(Int_t ddlID, Int_t &ddlIndex)
128 // see header file for class documentation
129 if (!fgpInstance) GetInstance();
130 if (fgpInstance) return fgpInstance->VirtDetectorNameFromDdlID(ddlID, ddlIndex);
134 Int_t AliHLTDAQ::DetectorIDFromDdlID(Int_t ddlID, Int_t &ddlIndex)
136 // see header file for class documentation
137 if (!fgpInstance) GetInstance();
138 if (fgpInstance) return fgpInstance->VirtDetectorIDFromDdlID(ddlID, ddlIndex);
142 Int_t AliHLTDAQ::DdlID(const char *detectorName, Int_t ddlIndex)
144 // see header file for class documentation
145 if (!fgpInstance) GetInstance();
146 if (fgpInstance) return fgpInstance->VirtDdlID(detectorName, ddlIndex);
150 Int_t AliHLTDAQ::DdlID(Int_t detectorID, Int_t ddlIndex)
152 // see header file for class documentation
153 if (!fgpInstance) GetInstance();
154 if (fgpInstance) return fgpInstance->VirtDdlID(detectorID, ddlIndex);
158 const char *AliHLTDAQ::DdlFileName(const char *detectorName, Int_t ddlIndex)
160 // see header file for class documentation
161 if (!fgpInstance) GetInstance();
162 if (fgpInstance) return fgpInstance->VirtDdlFileName(detectorName, ddlIndex);
166 const char *AliHLTDAQ::DdlFileName(Int_t detectorID, Int_t ddlIndex)
168 // see header file for class documentation
169 if (!fgpInstance) GetInstance();
170 if (fgpInstance) return fgpInstance->VirtDdlFileName(detectorID, ddlIndex);
174 Int_t AliHLTDAQ::NumberOfDdls(const char *detectorName)
176 // see header file for class documentation
177 if (!fgpInstance) GetInstance();
178 if (fgpInstance) return fgpInstance->VirtNumberOfDdls(detectorName);
182 Int_t AliHLTDAQ::NumberOfDdls(Int_t detectorID)
184 // see header file for class documentation
185 if (!fgpInstance) GetInstance();
186 if (fgpInstance) return fgpInstance->VirtNumberOfDdls(detectorID);
190 const char *AliHLTDAQ::ListOfTriggeredDetectors(UInt_t detectorPattern)
192 // see header file for class documentation
193 if (!fgpInstance) GetInstance();
194 if (fgpInstance) return fgpInstance->VirtListOfTriggeredDetectors(detectorPattern);
198 UInt_t AliHLTDAQ::DetectorPattern(const char *detectorList)
200 // see header file for class documentation
201 if (!fgpInstance) GetInstance();
202 if (fgpInstance) return fgpInstance->VirtDetectorPattern(detectorList);
206 const char *AliHLTDAQ::OfflineModuleName(const char *detectorName)
208 // see header file for class documentation
209 if (!fgpInstance) GetInstance();
210 if (fgpInstance) return fgpInstance->VirtOfflineModuleName(detectorName);
213 const char *AliHLTDAQ::OfflineModuleName(Int_t detectorID)
215 // see header file for class documentation
216 if (!fgpInstance) GetInstance();
217 if (fgpInstance) return fgpInstance->VirtOfflineModuleName(detectorID);
221 const char *AliHLTDAQ::OnlineName(const char *detectorName)
223 // see header file for class documentation
224 if (!fgpInstance) GetInstance();
225 if (fgpInstance) return fgpInstance->VirtOnlineName(detectorName);
228 const char *AliHLTDAQ::OnlineName(Int_t detectorID)
230 // see header file for class documentation
231 if (!fgpInstance) GetInstance();
232 if (fgpInstance) return fgpInstance->VirtOnlineName(detectorID);
236 string AliHLTDAQ::HLTOrigin(const char *detectorName)
238 // get HLT origin from detector name
239 return HLTOrigin(DetectorID(detectorName));
242 string AliHLTDAQ::HLTOrigin(Int_t detectorID)
244 // get HLT origin from detector ID
246 if (detectorID>=0 && (unsigned)detectorID<sizeof(fgkOriginMapping)/sizeof(const char*)) {
247 origin.append(fgkOriginMapping[detectorID], kAliHLTComponentDataTypefOriginSize);
252 AliHLTDAQ* AliHLTDAQ::GetInstance()
254 // see header file for class documentation
259 ROOT::NewFunc_t pNewFunc=NULL;
261 pCl=TClass::GetClass(fgkImplName);
262 } while (!pCl && (iLibResult=gSystem->Load(fgkImplLibrary))==0);
264 if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
265 void* p=(*pNewFunc)(NULL);
267 fgpInstance=reinterpret_cast<AliHLTDAQ*>(p);
269 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "type cast to AliHLTDAQ instance failed");
272 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not create AliHLTDAQ instance from class descriptor");
275 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not find AliHLTDAQ class descriptor");
278 log.Logging(kHLTLogError, "AliHLTDAQ::Instance", "HLT Analysis", "can not load libHLTrec library");