ALIROOT-5433 Transition to CDHv3 in HLT
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTMisc.cxx
CommitLineData
2b545cdd 1// $Id$
2
3//**************************************************************************
aac26979 4//* This file is property of and copyright by the *
2b545cdd 5//* ALICE Experiment at CERN, All rights reserved. *
6//* *
7//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8//* for The ALICE HLT Project. *
9//* *
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//**************************************************************************
18
19/// @file AliHLTMisc.h
20/// @author Matthias Richter
21/// @date 2009-07-07
22/// @brief Definition of various glue functions implemented in dynamically
23/// loaded libraries
24
25#include "AliHLTMisc.h"
2b545cdd 26
27/** ROOT macro for the implementation of ROOT specific class methods */
28ClassImp(AliHLTMisc);
29
30AliHLTMisc::AliHLTMisc()
31{
aac26979 32 // Abstract interface of various glue functions implemented in dynamically
33 // loaded libraries.
34 //
35 // The HLT base library is independent from AliRoot and binds AliRoot
36 // functionality via dynamic libraries. The provided methods can be used
37 // from any module library without introducing additional dependencies.
2b545cdd 38}
39
40AliHLTMisc::~AliHLTMisc()
41{
aac26979 42 // destructor
2b545cdd 43}
44
45AliHLTMisc* AliHLTMisc::fgInstance=NULL;
46
2b545cdd 47AliHLTMisc& AliHLTMisc::Instance()
48{
aac26979 49 // get global instance of the interface implementation
2b545cdd 50 if (!fgInstance) {
51 fgInstance=LoadInstance((AliHLTMisc*)NULL, "AliHLTMiscImplementation", ALIHLTMISC_LIBRARY);
52 }
53 if (!fgInstance) {
54 AliHLTLogging log;
55 fgInstance=new AliHLTMisc;
56 log.Logging(kHLTLogError, "AliHLTMisc::Instance", "HLT Analysis", "falling back to default AliHLTMisc instance");
57 }
58 return *fgInstance;
59}
60
61int AliHLTMisc::InitCDB(const char* /*cdbpath*/)
62{
cc484ed9 63 // default method, functionality is implemented in the child class
2b545cdd 64 return -EFAULT;
65}
66
67int AliHLTMisc::SetCDBRunNo(int /*runNo*/)
68{
cc484ed9 69 // default method, functionality is implemented in the child class
2b545cdd 70 return -EFAULT;
71}
72
74c1905c 73int AliHLTMisc::GetCDBRunNo() const
df5d2b78 74{
75 // default method, functionality is implemented in the child class
76 return -1;
77}
78
5df320bf 79AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/) const
2b545cdd 80{
cc484ed9 81 // default method, functionality is implemented in the child class
2b545cdd 82 return NULL;
83}
84
74c1905c 85TObject* AliHLTMisc::ExtractObject(AliCDBEntry* /*entry*/) const
2b545cdd 86{
cc484ed9 87 // default method, functionality is implemented in the child class
2b545cdd 88 return NULL;
89}
5bc495ef 90
74c1905c 91int AliHLTMisc::CheckOCDBEntries(const TMap* const /*pMap*/) const
92{
93 // default method, functionality is implemented in the child class
94 return -ENOENT;
95}
96
cc484ed9 97int AliHLTMisc::InitMagneticField() const
98{
99 // default method, functionality is implemented in the child class
100 return -EFAULT;
101}
102
16e6f752 103AliHLTTriggerMask_t AliHLTMisc::GetTriggerMask(AliRawReader* /*rawReader*/) const
73305a93 104{
105 // default method, functionality is implemented in the child class
16e6f752 106 return AliHLTTriggerMask_t(0);
73305a93 107}
108
21c25cf3 109AliHLTUInt32_t AliHLTMisc::GetTimeStamp(AliRawReader* /*rawReader*/) const
110{
111 // default method, functionality is implemented in the child class
462b8b22 112 return kMaxUInt;
21c25cf3 113}
114
115AliHLTUInt32_t AliHLTMisc::GetEventType(AliRawReader* /*rawReader*/) const
116{
117 // default method, functionality is implemented in the child class
118 return 0;
119}
120
a5e775ec 121Double_t AliHLTMisc::GetBz()
122{
123 // default method, functionality is implemented in the child class
124 return 0.0;
125}
126
70bd63a2 127Double_t AliHLTMisc::GetBz(const Double_t */*r*/)
a5e775ec 128{
129 // default method, functionality is implemented in the child class
130 return 0.0;
131}
132
133void AliHLTMisc::GetBxByBz(const Double_t r[3], Double_t b[3])
134{
135 // default method, functionality is implemented in the child class
70bd63a2 136 if (!r || !b) return;
a5e775ec 137 return;
138}
139
95ea76b5 140const TClass* AliHLTMisc::IsAliESDHLTDecision() const
141{
142 // default method, functionality is implemented in the child class
143 return NULL;
144}
145
146int AliHLTMisc::Copy(const AliHLTGlobalTriggerDecision* /*pDecision*/, TObject* /*pESDHLTDecision*/) const
147{
148 // default method, functionality is implemented in the child class
149 return -EFAULT;
150}
151
79c426cf 152int AliHLTMisc::InitStreamerInfos(const char* /*ocdbEntry*/) const
153{
154 // default method, functionality is implemented in the child class
155 return -EFAULT;
156}
157
158int AliHLTMisc::InitStreamerInfos(TObjArray* /*pSchemas*/) const
159{
160 // default method, functionality is implemented in the child class
161 return -EFAULT;
162}
163
aac26979 164int AliHLTMisc::MergeStreamerInfo(TObjArray* /*tgt*/, const TObjArray* /*src*/, int /*iVerbosity*/) const
165{
166 // default method, functionality is implemented in the child class
167 return 0;
168}
169
ee15809c 170void AliHLTMisc::SetAliESDtrackOnlineModeFlag(bool /*mode*/) const
171{
172 // default method, functionality is implemented in the child class
173}
174
175bool AliHLTMisc::GetAliESDtrackOnlineModeFlag() const
176{
177 // default method, functionality is implemented in the child class
178 return false;
179}
180
181AliHLTMisc::AliOnlineGuard::AliOnlineGuard(bool mode)
182 : fMode(false)
183{
184 // store the current value and set the flag
185 fMode=AliHLTMisc::Instance().GetAliESDtrackOnlineModeFlag();
186 AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(mode);
187}
188
189AliHLTMisc::AliOnlineGuard::~AliOnlineGuard()
190{
191 // restore old value of the flag
192 AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(fMode);
193}
194
5bc495ef 195ostream &operator<<(ostream &out, const AliHLTComponentDataType &dt)
196{
197 // printout of AliHLTComponentDataType struct
198 char id[kAliHLTComponentDataTypefIDsize+1];
199 strncpy(id, dt.fID, kAliHLTComponentDataTypefIDsize);
200 id[kAliHLTComponentDataTypefIDsize]=0;
201 char origin[kAliHLTComponentDataTypefOriginSize+1];
202 strncpy(origin, dt.fOrigin, kAliHLTComponentDataTypefOriginSize);
203 origin[kAliHLTComponentDataTypefOriginSize]=0;
204 out << "{" << id << ":" << origin << "}";
205 return out;
206}