6 //* This file is property of and copyright by the ALICE HLT Project *
7 //* ALICE Experiment at CERN, All rights reserved. *
8 //* See cxx source for full Copyright notice */
10 /// @file AliHLTMisc.h
11 /// @author Matthias Richter
13 /// @brief Definition of various glue functions implemented in dynamically
17 #include "AliHLTStdIncludes.h"
18 #include "AliHLTDataTypes.h"
19 #include "AliHLTLogging.h"
26 class AliHLTComponentDataType;
27 class AliHLTGlobalTriggerDecision;
29 class AliHLTMisc : public TObject {
35 static T* LoadInstance(const T* dummy, const char* classname, const char* library);
37 static AliHLTMisc& Instance();
39 virtual int InitCDB(const char* cdbpath);
41 virtual int SetCDBRunNo(int runNo);
43 virtual AliCDBEntry* LoadOCDBEntry(const char* path, int runNo=-1, int version = -1, int subVersion = -1);
45 virtual TObject* ExtractObject(AliCDBEntry* entry);
47 virtual int InitMagneticField() const;
49 virtual AliHLTUInt64_t GetTriggerMask(AliRawReader* rawReader) const;
51 virtual Double_t GetBz();
52 virtual Double_t GetBz(const Double_t *r);
53 virtual void GetBxByBz(const Double_t r[3], Double_t b[3]);
55 virtual const TClass* IsAliESDHLTDecision() const;
56 virtual int Copy(const AliHLTGlobalTriggerDecision* pDecision, TObject* pESDHLTDecision) const;
59 static AliHLTMisc* fgInstance;
61 ClassDef(AliHLTMisc, 0)
64 #define ALIHLTMISC_LIBRARY "libHLTrec.so"
65 #define ALIHLTMISC_INIT_CDB "AliHLTMiscInitCDB"
66 #define ALIHLTMISC_SET_CDB_RUNNO "AliHLTMiscSetCDBRunNo"
73 * Init the CDB access for the running instance.
74 * The method is used from the C wrapper interface utilized by the on-line
75 * framework. The path of the (H)CDB is set to the specified path.<br>
76 * When running from AliRoot, the CDB path is set in the startup of the
78 * If cdbpath is nil or empty and the CDB is not already initialized, the
79 * CDB storage is set to local://$ALICE_ROOT/OCDB and the run no to 0.
80 * @param cdbpath path to the CDB
81 * @return neg. error code if failed
82 * @note function implemented in libHLTrec
84 int AliHLTMiscInitCDB(const char* cdbpath);
85 typedef int (*AliHLTMiscInitCDB_t)(const char* cdbpath);
88 * Init the Run no for the CDB access.
89 * @param runNo the run no
90 * @return neg. error code if failed
91 * @note function implemented in libHLTrec
93 int AliHLTMiscSetCDBRunNo(int runNo);
94 typedef int (*AliHLTMiscSetCDBRunNo_t)(int runNo);
101 T* AliHLTMisc::LoadInstance(const T* /*t*/, const char* classname, const char* library)
103 // see header file for function documentation
108 ROOT::NewFunc_t pNewFunc=NULL;
110 pCl=TClass::GetClass(classname);
111 } while (!pCl && (iLibResult=gSystem->Load(library))==0);
113 if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
114 void* p=(*pNewFunc)(NULL);
116 pInstance=reinterpret_cast<T*>(p);
118 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "type cast (%s) to instance failed", classname);
121 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not create instance of type %s from class descriptor", classname);
124 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not find class descriptor %s", classname);
127 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not load %s library in order to find class descriptor %s", library, classname);
132 // direct printout of data type struct
133 ostream &operator<<(ostream &str, const AliHLTComponentDataType&);
135 #endif //ALIHLTMISC_H