]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/BASE/AliHLTModulePreprocessor.cxx
avoid compilation warning on some architectures
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTModulePreprocessor.cxx
CommitLineData
3dd8541e 1// $Id$
12ec5482 2
3//**************************************************************************
4//* This file is property of and copyright by the ALICE HLT Project *
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
aa8989c7 19// @file AliHLTModulePreprocessor.cxx
20// @author Matthias Richter
21// @date 2008-01-22
22// @brief Base class for HLT module preprocessors
23//
12ec5482 24
b09247a2 25#include <cstdlib>
12ec5482 26#include <cassert>
27#include "AliHLTModulePreprocessor.h"
310c7637 28#include "AliHLTShuttleInterface.h"
d83b59c6 29#include "TObjString.h"
30#include "TString.h"
aa8989c7 31#include "TMap.h"
32#include "TObject.h"
33#include "TObjArray.h"
d83b59c6 34
12ec5482 35
36ClassImp(AliHLTModulePreprocessor)
37
83cb7e1d 38AliHLTModulePreprocessor::AliHLTModulePreprocessor()
39 :
40 fpInterface(NULL),
41 fActiveDetectors(0)
42{
43 // see header file for class documentation
44 // or
45 // refer to README to build package
46 // or
47 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
48}
49
50AliHLTModulePreprocessor::~AliHLTModulePreprocessor()
51{
52 // see header file for function documentation
53}
54
aa8989c7 55// TODO: map this constants to AliHLTDAQ class
820b4d9e 56#ifndef MFT_UPGRADE
57const Int_t AliHLTModulePreprocessor::kNDetectors = 22;
58#else
d83b59c6 59const Int_t AliHLTModulePreprocessor::kNDetectors = 21;
820b4d9e 60#endif
d83b59c6 61
62const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] =
63{
64 "ITSSPD",
65 "ITSSDD",
66 "ITSSSD",
67 "TPC",
68 "TRD",
69 "TOF",
70 "HMPID",
71 "PHOS",
72 "CPV",
73 "PMD",
74 "MUONTRK",
75 "MUONTRG",
76 "FMD",
77 "T0",
78 "VZERO", // Name to be changed to V0 ?
79 "ZDC",
80 "ACORDE",
81 "TRG",
82 "EMCAL",
83 "DAQ_TEST",
84 "HLT"
820b4d9e 85 #ifndef MFT_UPGRADE
86 , "MFT"
87 #endif
d83b59c6 88};
89
310c7637 90void AliHLTModulePreprocessor::SetShuttleInterface(AliHLTShuttleInterface* pInterface)
12ec5482 91{
310c7637 92 assert(fpInterface==NULL || fpInterface==pInterface || pInterface==NULL);
93 fpInterface=pInterface;
12ec5482 94}
95
5b2ee212 96Int_t AliHLTModulePreprocessor::GetRun() const
12ec5482 97{
98 // see header file for function documentation
99
310c7637 100 assert(fpInterface);
101 if (!fpInterface) return 0;
102 return fpInterface->PreprocessorGetRun();
12ec5482 103}
104
5b2ee212 105UInt_t AliHLTModulePreprocessor::GetStartTime() const
12ec5482 106{
107 // see header file for function documentation
108
310c7637 109 assert(fpInterface);
110 if (!fpInterface) return 0;
111 return fpInterface->PreprocessorGetStartTime();
12ec5482 112}
113
5b2ee212 114UInt_t AliHLTModulePreprocessor::GetEndTime() const
12ec5482 115{
116 // see header file for function documentation
117
310c7637 118 assert(fpInterface);
119 if (!fpInterface) return 0;
120 return fpInterface->PreprocessorGetEndTime();
12ec5482 121}
122
123Bool_t AliHLTModulePreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
124 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
125{
126 // see header file for function documentation
127
310c7637 128 assert(fpInterface);
129 if (!fpInterface) return 0;
130 return fpInterface->PreprocessorStore(pathLevel2, pathLevel3, object, metaData, validityStart, validityInfinite);
12ec5482 131}
132
133Bool_t AliHLTModulePreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
134 AliCDBMetaData* metaData)
135{
136 // see header file for function documentation
137
310c7637 138 assert(fpInterface);
139 if (!fpInterface) return 0;
140 return fpInterface->PreprocessorStoreReferenceData(pathLevel2, pathLevel3, object, metaData);
12ec5482 141}
142
143Bool_t AliHLTModulePreprocessor::StoreReferenceFile(const char* localFile, const char* gridFileName)
144{
145 // see header file for function documentation
146
310c7637 147 assert(fpInterface);
148 if (!fpInterface) return 0;
149 return fpInterface->PreprocessorStoreReferenceFile(localFile, gridFileName);
12ec5482 150}
151
152Bool_t AliHLTModulePreprocessor::StoreRunMetadataFile(const char* localFile, const char* gridFileName)
153{
154 // see header file for function documentation
155
310c7637 156 assert(fpInterface);
157 if (!fpInterface) return 0;
158 return fpInterface->PreprocessorStoreRunMetadataFile(localFile, gridFileName);
12ec5482 159}
160
161const char* AliHLTModulePreprocessor::GetFile(Int_t system, const char* id, const char* source)
162{
163 // see header file for function documentation
164
310c7637 165 assert(fpInterface);
166 if (!fpInterface) return 0;
167 return fpInterface->PreprocessorGetFile(system, id, source);
12ec5482 168}
169
170TList* AliHLTModulePreprocessor::GetFileSources(Int_t system, const char* id)
171{
172 // see header file for function documentation
173
310c7637 174 assert(fpInterface);
175 if (!fpInterface) return 0;
176 return fpInterface->PreprocessorGetFileSources(system, id);
12ec5482 177}
178
179TList* AliHLTModulePreprocessor::GetFileIDs(Int_t system, const char* source)
180{
181 // see header file for function documentation
182
310c7637 183 assert(fpInterface);
184 if (!fpInterface) return 0;
185 return fpInterface->PreprocessorGetFileIDs(system, source);
12ec5482 186}
187
188const char* AliHLTModulePreprocessor::GetRunParameter(const char* param)
189{
190 // see header file for function documentation
191
310c7637 192 assert(fpInterface);
193 if (!fpInterface) return 0;
194 return fpInterface->PreprocessorGetRunParameter(param);
12ec5482 195}
196
197AliCDBEntry* AliHLTModulePreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
198{
199 // see header file for function documentation
200
310c7637 201 assert(fpInterface);
202 if (!fpInterface) return 0;
203 return fpInterface->PreprocessorGetFromOCDB(pathLevel2, pathLevel3);
12ec5482 204}
205
206const char* AliHLTModulePreprocessor::GetRunType()
207{
208 // see header file for function documentation
209
310c7637 210 assert(fpInterface);
211 if (!fpInterface) return 0;
212 return fpInterface->PreprocessorGetRunType();
12ec5482 213}
214
215void AliHLTModulePreprocessor::Log(const char* message)
216{
217 // see header file for function documentation
218
310c7637 219 assert(fpInterface);
220 if (!fpInterface) return;
221 fpInterface->PreprocessorLog(message);
12ec5482 222}
d83b59c6 223
224Int_t AliHLTModulePreprocessor::DetectorBitMask(const char *detectorName)
225{
226 // Return the detector index
227 // corresponding to a given
228 // detector name
229 TString detStr = detectorName;
230
231 Int_t iDet;
232 for(iDet = 0; iDet < kNDetectors; iDet++) {
233 if (detStr.CompareTo(fgkDetectorName[iDet],TString::kIgnoreCase) == 0)
234 break;
235 }
236 if (iDet == kNDetectors)
237 {
238 TString errormessage;
239 errormessage.Form("Invalid detector name: %s !",detectorName);
240 Log(errormessage.Data());
241 return -1;
242 }
243
244 Int_t detectorbitmask = 0;
245 if(iDet > 32)
246 {
247 TString errormessage2;
248 errormessage2.Form("Invalid detector bit position in detectorMask: %d !", iDet);
249 Log(errormessage2.Data());
250 return -1;
251 }
252
253 detectorbitmask = (1 << iDet);
254 return detectorbitmask;
255}
256
257Bool_t AliHLTModulePreprocessor::GetDetectorStatus(Int_t detectorbitmask)
258{
259 // see header file for function documentation
260 // retrieve list of active detectors from previous run.
261 fActiveDetectors = atoi(AliHLTModulePreprocessor::GetRunParameter("detectorMask"));
262
263 if((fActiveDetectors & detectorbitmask) != 0)
264 {
265 return 1;
266 }
267 else
268 {
269 return 0;
270 }
271}
272
273// function copied from AliDAQ.cxx
274const char *AliHLTModulePreprocessor::DetectorName(Int_t detectorID)
275{
276 // Returns the name of particular
277 // detector identified by its index
278 if (detectorID < 0 || detectorID >= kNDetectors)
279 {
280 TString errormessage;
281 errormessage.Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1);
282 Log(errormessage.Data());
283 return "";
284 }
285 return fgkDetectorName[detectorID];
286}
aa8989c7 287
288TObject* AliHLTModulePreprocessor::GetFromMap(TMap* dcsAliasMap, const char* stringId) const
289{
290 /// extract object from the alias map
291 /// return the last object from the value set
292 TObject* object=dcsAliasMap->FindObject(stringId);
293 if (!object) return NULL;
294 TPair* pair = dynamic_cast<TPair*>(object);
295 if (pair && pair->Value()) {
296 TObjArray* valueSet = dynamic_cast<TObjArray*>(pair->Value());
297 if (!valueSet) return NULL;
298 Int_t nentriesDCS = valueSet->GetEntriesFast() - 1;
299 if(nentriesDCS>=0 && valueSet->At(nentriesDCS)){
300 return valueSet->At(nentriesDCS);
301 }
302 }
303 return NULL;
304}