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 AliHLTMisc.h
20 /// @author Matthias Richter
22 /// @brief Definition of various glue functions implemented in dynamically
25 #include "AliHLTMisc.h"
26 #include "AliHLTLogging.h"
30 /** ROOT macro for the implementation of ROOT specific class methods */
33 AliHLTMisc::AliHLTMisc()
35 // see header file for function documentation
38 AliHLTMisc::~AliHLTMisc()
40 // see header file for function documentation
43 AliHLTMisc* AliHLTMisc::fgInstance=NULL;
46 T* AliHLTMisc::LoadInstance(const T* /*t*/, const char* classname, const char* library)
48 // see header file for function documentation
53 ROOT::NewFunc_t pNewFunc=NULL;
55 pCl=TClass::GetClass(classname);
56 } while (!pCl && (iLibResult=gSystem->Load(library))==0);
58 if (pCl && (pNewFunc=pCl->GetNew())!=NULL) {
59 void* p=(*pNewFunc)(NULL);
61 pInstance=reinterpret_cast<T*>(p);
63 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "type cast (%s) to instance failed", classname);
66 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not create instance of type %s from class descriptor", classname);
69 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not find class descriptor %s", classname);
72 log.Logging(kHLTLogError, "AliHLTMisc::LoadInstance", "HLT Analysis", "can not load %s library in order to find class descriptor %s", library, classname);
77 AliHLTMisc& AliHLTMisc::Instance()
79 // see header file for function documentation
81 fgInstance=LoadInstance((AliHLTMisc*)NULL, "AliHLTMiscImplementation", ALIHLTMISC_LIBRARY);
85 fgInstance=new AliHLTMisc;
86 log.Logging(kHLTLogError, "AliHLTMisc::Instance", "HLT Analysis", "falling back to default AliHLTMisc instance");
91 int AliHLTMisc::InitCDB(const char* /*cdbpath*/)
93 // default method, functionality is implemented in the child class
97 int AliHLTMisc::SetCDBRunNo(int /*runNo*/)
99 // default method, functionality is implemented in the child class
103 AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/, int /*version*/, int /*subVersion*/)
105 // default method, functionality is implemented in the child class
109 TObject* AliHLTMisc::ExtractObject(AliCDBEntry* /*entry*/)
111 // default method, functionality is implemented in the child class
115 int AliHLTMisc::InitMagneticField() const
117 // default method, functionality is implemented in the child class
121 AliHLTUInt64_t AliHLTMisc::GetTriggerMask(AliRawReader* /*rawReader*/) const
123 // default method, functionality is implemented in the child class
127 Double_t AliHLTMisc::GetBz()
129 // default method, functionality is implemented in the child class
133 Double_t AliHLTMisc::GetBz(const Double_t *r)
135 // default method, functionality is implemented in the child class
139 void AliHLTMisc::GetBxByBz(const Double_t r[3], Double_t b[3])
141 // default method, functionality is implemented in the child class
145 ostream &operator<<(ostream &out, const AliHLTComponentDataType &dt)
147 // printout of AliHLTComponentDataType struct
148 char id[kAliHLTComponentDataTypefIDsize+1];
149 strncpy(id, dt.fID, kAliHLTComponentDataTypefIDsize);
150 id[kAliHLTComponentDataTypefIDsize]=0;
151 char origin[kAliHLTComponentDataTypefOriginSize+1];
152 strncpy(origin, dt.fOrigin, kAliHLTComponentDataTypefOriginSize);
153 origin[kAliHLTComponentDataTypefOriginSize]=0;
154 out << "{" << id << ":" << origin << "}";