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