]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTMisc.h
minor cleanup to avoid compilation warning
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTMisc.h
index 7ddb8435327d3ff385ba95162292a368f93e5cbc..a9cfe5c966e8b249f5c789e039b24e05e353c68e 100644 (file)
@@ -23,8 +23,9 @@
 class AliCDBManager;
 class AliCDBEntry;
 class AliRawReader;
-class AliHLTComponentDataType;
+struct AliHLTComponentDataType;
 class AliHLTGlobalTriggerDecision;
+class TMap;
 
 class AliHLTMisc : public TObject {
  public:
@@ -32,31 +33,74 @@ class AliHLTMisc : public TObject {
   ~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)
 };
@@ -108,20 +152,17 @@ T* AliHLTMisc::LoadInstance(const T* /*t*/, const char* classname, const char* l
   ROOT::NewFunc_t pNewFunc=NULL;
   do {
     pCl=TClass::GetClass(classname);
-  } while (!pCl && (iLibResult=gSystem->Load(library))==0);
+  } 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);
-       if (!pInstance) {
-         log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "type cast (%s) to instance failed", classname);
-       }
       } 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 class descriptor %s", classname);
+      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);