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;
30 class AliHLTMisc : public TObject {
36 static T* LoadInstance(const T* dummy, const char* classname, const char* library=NULL);
38 static AliHLTMisc& Instance();
40 virtual int InitCDB(const char* cdbpath);
42 virtual int SetCDBRunNo(int runNo);
43 virtual int GetCDBRunNo() const;
45 /// Load an OCDB object
46 virtual AliCDBEntry* LoadOCDBEntry(const char* path, int runNo=-1, int version = -1, int subVersion = -1) const;
48 // Extract the TObject instance from the CDB object
49 virtual TObject* ExtractObject(AliCDBEntry* entry) const;
51 /// check the availability of the OCDB entry descriptions in the TMap
52 /// key : complete OCDB path of the entry
53 /// value : auxiliary object - short description
54 virtual int CheckOCDBEntries(const TMap* const pMap) const;
56 virtual int InitMagneticField() const;
58 virtual AliHLTUInt64_t GetTriggerMask(AliRawReader* rawReader) const;
60 virtual AliHLTUInt32_t GetTimeStamp(AliRawReader* rawReader) const;
61 virtual AliHLTUInt32_t GetEventType(AliRawReader* rawReader) const;
63 virtual Double_t GetBz();
64 virtual Double_t GetBz(const Double_t *r);
65 virtual void GetBxByBz(const Double_t r[3], Double_t b[3]);
67 virtual const TClass* IsAliESDHLTDecision() const;
68 virtual int Copy(const AliHLTGlobalTriggerDecision* pDecision, TObject* pESDHLTDecision) const;
70 /// Init streamer info from ocdb entry
71 virtual int InitStreamerInfos(const char* ocdbEntry) const;
73 /// Init streamer info for a collection of classes
74 virtual int InitStreamerInfos(TObjArray* pSchemas) const;
77 static AliHLTMisc* fgInstance;
79 ClassDef(AliHLTMisc, 0)
82 #define ALIHLTMISC_LIBRARY "libHLTrec.so"
83 #define ALIHLTMISC_INIT_CDB "AliHLTMiscInitCDB"
84 #define ALIHLTMISC_SET_CDB_RUNNO "AliHLTMiscSetCDBRunNo"
91 * Init the CDB access for the running instance.
92 * The method is used from the C wrapper interface utilized by the on-line
93 * framework. The path of the (H)CDB is set to the specified path.<br>
94 * When running from AliRoot, the CDB path is set in the startup of the
96 * If cdbpath is nil or empty and the CDB is not already initialized, the
97 * CDB storage is set to local://$ALICE_ROOT/OCDB and the run no to 0.
98 * @param cdbpath path to the CDB
99 * @return neg. error code if failed
100 * @note function implemented in libHLTrec
102 int AliHLTMiscInitCDB(const char* cdbpath);
103 typedef int (*AliHLTMiscInitCDB_t)(const char* cdbpath);
106 * Init the Run no for the CDB access.
107 * @param runNo the run no
108 * @return neg. error code if failed
109 * @note function implemented in libHLTrec
111 int AliHLTMiscSetCDBRunNo(int runNo);
112 typedef int (*AliHLTMiscSetCDBRunNo_t)(int runNo);
119 T* AliHLTMisc::LoadInstance(const T* /*t*/, const char* classname, const char* library)
121 // see header file for function documentation
126 ROOT::NewFunc_t pNewFunc=NULL;
128 pCl=TClass::GetClass(classname);
129 } while (!pCl && library!=NULL && (iLibResult=gSystem->Load(library))==0);
131 if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
132 void* p=(*pNewFunc)(NULL);
134 pInstance=reinterpret_cast<T*>(p);
136 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "type cast (%s) to instance failed", classname);
139 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not create instance of type %s from class descriptor", classname);
142 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not find TClass descriptor %s", classname);
145 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not load %s library in order to find class descriptor %s", library, classname);
150 // direct printout of data type struct
151 ostream &operator<<(ostream &str, const AliHLTComponentDataType&);
153 #endif //ALIHLTMISC_H