#include "TObject.h"
#include "AliHLTStdIncludes.h"
#include "AliHLTDataTypes.h"
+#include "AliHLTLogging.h"
+#include "TClass.h"
+#include "TSystem.h"
class AliCDBManager;
class AliCDBEntry;
class AliRawReader;
class AliHLTComponentDataType;
+class AliHLTGlobalTriggerDecision;
+class TMap;
class AliHLTMisc : public TObject {
public:
~AliHLTMisc();
template<class T>
- static T* LoadInstance(const T* dummy, const char* classname, const char* library);
+ static T* LoadInstance(const T* dummy, const char* classname, const char* library=NULL);
static AliHLTMisc& Instance();
virtual int InitCDB(const char* cdbpath);
virtual int SetCDBRunNo(int runNo);
+ virtual int GetCDBRunNo() const;
- virtual AliCDBEntry* LoadOCDBEntry(const char* path, int runNo=-1, int version = -1, int subVersion = -1);
+ /// Load an OCDB object
+ virtual AliCDBEntry* LoadOCDBEntry(const char* path, int runNo=-1) const;
- virtual TObject* ExtractObject(AliCDBEntry* entry);
+ // Extract the TObject instance from the CDB object
+ virtual TObject* ExtractObject(AliCDBEntry* entry) const;
+
+ /// check the availability of the OCDB entry descriptions in the TMap
+ /// key : complete OCDB path of the entry
+ /// value : auxiliary object - short description
+ virtual int CheckOCDBEntries(const TMap* const pMap) const;
virtual int InitMagneticField() const;
+ /// extract the triggermask from the rawreader
+ /// NOTE: not to be used in the online system
virtual AliHLTUInt64_t GetTriggerMask(AliRawReader* rawReader) const;
+ /// extract the timestamp from the rawreader
+ /// NOTE: not to be used in the online system, use AliHLTComponent::GetTimeStamp()
+ virtual AliHLTUInt32_t GetTimeStamp(AliRawReader* rawReader) const;
+
+ /// extract the event type from the rawreader
+ /// NOTE: not to be used in the online system
+ virtual AliHLTUInt32_t GetEventType(AliRawReader* rawReader) const;
+
virtual Double_t GetBz();
virtual Double_t GetBz(const Double_t *r);
virtual void GetBxByBz(const Double_t r[3], Double_t b[3]);
+ virtual const TClass* IsAliESDHLTDecision() const;
+
+ using TObject::Copy; // Needed since the declaration of AliHLTMisc::Copy below is ambiguous to the compiler.
+
+ virtual int Copy(const AliHLTGlobalTriggerDecision* pDecision, TObject* pESDHLTDecision) const;
+
+ /// Init streamer info from ocdb entry
+ virtual int InitStreamerInfos(const char* ocdbEntry) const;
+
+ /// Init streamer info for a collection of classes
+ virtual int InitStreamerInfos(TObjArray* pSchemas) const;
+
+ /// set the online mode flag of AliESDtrack
+ virtual void SetAliESDtrackOnlineModeFlag(bool mode) const;
+
+ /// get status of the online mode flag of AliESDtrack
+ virtual bool GetAliESDtrackOnlineModeFlag() const;
+
+ /// guard class for switching offline software to online mode
+ class AliOnlineGuard {
+ public:
+ AliOnlineGuard(bool mode=true);
+ ~AliOnlineGuard();
+
+ private:
+ bool fMode; //! old value to be restored
+ };
+
private:
- static AliHLTMisc* fgInstance;
+ static AliHLTMisc* fgInstance; //! global instance
ClassDef(AliHLTMisc, 0)
};
}
#endif
+template<class T>
+T* AliHLTMisc::LoadInstance(const T* /*t*/, const char* classname, const char* library)
+{
+ // see header file for function documentation
+ int iLibResult=0;
+ T* pInstance=NULL;
+ AliHLTLogging log;
+ TClass* pCl=NULL;
+ ROOT::NewFunc_t pNewFunc=NULL;
+ do {
+ pCl=TClass::GetClass(classname);
+ } while (!pCl && library!=NULL && (iLibResult=gSystem->Load(library))==0);
+ if (iLibResult>=0) {
+ if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
+ void* p=(*pNewFunc)(NULL);
+ if (p) {
+ pInstance=reinterpret_cast<T*>(p);
+ } else {
+ log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not create instance of type %s from class descriptor", classname);
+ }
+ } else {
+ log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not find TClass descriptor %s", classname);
+ }
+ } else {
+ log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not load %s library in order to find class descriptor %s", library, classname);
+ }
+ return pInstance;
+}
+
// direct printout of data type struct
ostream &operator<<(ostream &str, const AliHLTComponentDataType&);