Line data Source code
1 : // $Id$
2 :
3 : //**************************************************************************
4 : //* This file is property of and copyright by the *
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"
26 :
27 : /** ROOT macro for the implementation of ROOT specific class methods */
28 126 : ClassImp(AliHLTMisc);
29 :
30 2 : AliHLTMisc::AliHLTMisc()
31 6 : {
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.
38 2 : }
39 :
40 : AliHLTMisc::~AliHLTMisc()
41 0 : {
42 : // destructor
43 0 : }
44 :
45 : AliHLTMisc* AliHLTMisc::fgInstance=NULL;
46 :
47 : AliHLTMisc& AliHLTMisc::Instance()
48 : {
49 : // get global instance of the interface implementation
50 36 : if (!fgInstance) {
51 2 : fgInstance=LoadInstance((AliHLTMisc*)NULL, "AliHLTMiscImplementation", ALIHLTMISC_LIBRARY);
52 2 : }
53 18 : if (!fgInstance) {
54 0 : AliHLTLogging log;
55 0 : fgInstance=new AliHLTMisc;
56 0 : log.Logging(kHLTLogError, "AliHLTMisc::Instance", "HLT Analysis", "falling back to default AliHLTMisc instance");
57 0 : }
58 18 : return *fgInstance;
59 0 : }
60 :
61 : int AliHLTMisc::InitCDB(const char* /*cdbpath*/, const char* /*cdbsnapshot*/)
62 : {
63 : // default method, functionality is implemented in the child class
64 0 : return -EFAULT;
65 : }
66 :
67 : int AliHLTMisc::SetCDBRunNo(int /*runNo*/)
68 : {
69 : // default method, functionality is implemented in the child class
70 0 : return -EFAULT;
71 : }
72 :
73 : int AliHLTMisc::GetCDBRunNo() const
74 : {
75 : // default method, functionality is implemented in the child class
76 0 : return -1;
77 : }
78 :
79 : AliCDBEntry* AliHLTMisc::LoadOCDBEntry(const char* /*path*/, int /*runNo*/) const
80 : {
81 : // default method, functionality is implemented in the child class
82 0 : return NULL;
83 : }
84 :
85 : TObject* AliHLTMisc::ExtractObject(AliCDBEntry* /*entry*/) const
86 : {
87 : // default method, functionality is implemented in the child class
88 0 : return NULL;
89 : }
90 :
91 : int AliHLTMisc::CheckOCDBEntries(const TMap* const /*pMap*/) const
92 : {
93 : // default method, functionality is implemented in the child class
94 0 : return -ENOENT;
95 : }
96 :
97 : int AliHLTMisc::InitMagneticField() const
98 : {
99 : // default method, functionality is implemented in the child class
100 0 : return -EFAULT;
101 : }
102 :
103 : AliHLTTriggerMask_t AliHLTMisc::GetTriggerMask(AliRawReader* /*rawReader*/) const
104 : {
105 : // default method, functionality is implemented in the child class
106 0 : return AliHLTTriggerMask_t(0);
107 : }
108 :
109 : AliHLTUInt32_t AliHLTMisc::GetTimeStamp(AliRawReader* /*rawReader*/) const
110 : {
111 : // default method, functionality is implemented in the child class
112 0 : return kMaxUInt;
113 : }
114 :
115 : AliHLTUInt32_t AliHLTMisc::GetEventType(AliRawReader* /*rawReader*/) const
116 : {
117 : // default method, functionality is implemented in the child class
118 0 : return 0;
119 : }
120 :
121 : Double_t AliHLTMisc::GetBz()
122 : {
123 : // default method, functionality is implemented in the child class
124 0 : return 0.0;
125 : }
126 :
127 : Double_t AliHLTMisc::GetBz(const Double_t */*r*/)
128 : {
129 : // default method, functionality is implemented in the child class
130 0 : return 0.0;
131 : }
132 :
133 : void AliHLTMisc::GetBxByBz(const Double_t r[3], Double_t b[3])
134 : {
135 : // default method, functionality is implemented in the child class
136 0 : if (!r || !b) return;
137 : return;
138 0 : }
139 :
140 : const TClass* AliHLTMisc::IsAliESDHLTDecision() const
141 : {
142 : // default method, functionality is implemented in the child class
143 0 : return NULL;
144 : }
145 :
146 : int AliHLTMisc::Copy(const AliHLTGlobalTriggerDecision* /*pDecision*/, TObject* /*pESDHLTDecision*/) const
147 : {
148 : // default method, functionality is implemented in the child class
149 0 : return -EFAULT;
150 : }
151 :
152 : int AliHLTMisc::InitStreamerInfos(const char* /*ocdbEntry*/) const
153 : {
154 : // default method, functionality is implemented in the child class
155 0 : return -EFAULT;
156 : }
157 :
158 : int AliHLTMisc::InitStreamerInfos(TObjArray* /*pSchemas*/) const
159 : {
160 : // default method, functionality is implemented in the child class
161 0 : return -EFAULT;
162 : }
163 :
164 : int AliHLTMisc::MergeStreamerInfo(TObjArray* /*tgt*/, const TObjArray* /*src*/, int /*iVerbosity*/) const
165 : {
166 : // default method, functionality is implemented in the child class
167 0 : return 0;
168 : }
169 :
170 : void AliHLTMisc::SetAliESDtrackOnlineModeFlag(bool /*mode*/) const
171 : {
172 : // default method, functionality is implemented in the child class
173 0 : }
174 :
175 : bool AliHLTMisc::GetAliESDtrackOnlineModeFlag() const
176 : {
177 : // default method, functionality is implemented in the child class
178 0 : return false;
179 : }
180 :
181 : AliHLTMisc::AliOnlineGuard::AliOnlineGuard(bool mode)
182 0 : : fMode(false)
183 0 : {
184 : // store the current value and set the flag
185 0 : fMode=AliHLTMisc::Instance().GetAliESDtrackOnlineModeFlag();
186 0 : AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(mode);
187 0 : }
188 :
189 : AliHLTMisc::AliOnlineGuard::~AliOnlineGuard()
190 0 : {
191 : // restore old value of the flag
192 0 : AliHLTMisc::Instance().SetAliESDtrackOnlineModeFlag(fMode);
193 0 : }
194 :
195 : ostream &operator<<(ostream &out, const AliHLTComponentDataType &dt)
196 : {
197 : // printout of AliHLTComponentDataType struct
198 0 : char id[kAliHLTComponentDataTypefIDsize+1];
199 0 : strncpy(id, dt.fID, kAliHLTComponentDataTypefIDsize);
200 0 : id[kAliHLTComponentDataTypefIDsize]=0;
201 0 : char origin[kAliHLTComponentDataTypefOriginSize+1];
202 0 : strncpy(origin, dt.fOrigin, kAliHLTComponentDataTypefOriginSize);
203 0 : origin[kAliHLTComponentDataTypefOriginSize]=0;
204 0 : out << "{" << id << ":" << origin << "}";
205 0 : return out;
206 0 : }
|