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 //**************************************************************************
20 * @file AliHLTModulePreprocessor.cxx
21 * @author Matthias Richter
23 * @brief Base class for HLT module preprocessors
28 #include "AliHLTModulePreprocessor.h"
29 #include "AliHLTShuttleInterface.h"
30 #include "TObjString.h"
34 ClassImp(AliHLTModulePreprocessor)
36 AliHLTModulePreprocessor::AliHLTModulePreprocessor()
41 // see header file for class documentation
43 // refer to README to build package
45 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
48 AliHLTModulePreprocessor::~AliHLTModulePreprocessor()
50 // see header file for function documentation
53 const Int_t AliHLTModulePreprocessor::kNDetectors = 21;
55 const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] =
71 "VZERO", // Name to be changed to V0 ?
80 void AliHLTModulePreprocessor::SetShuttleInterface(AliHLTShuttleInterface* pInterface)
82 assert(fpInterface==NULL || fpInterface==pInterface || pInterface==NULL);
83 fpInterface=pInterface;
86 Int_t AliHLTModulePreprocessor::GetRun()
88 // see header file for function documentation
91 if (!fpInterface) return 0;
92 return fpInterface->PreprocessorGetRun();
95 UInt_t AliHLTModulePreprocessor::GetStartTime()
97 // see header file for function documentation
100 if (!fpInterface) return 0;
101 return fpInterface->PreprocessorGetStartTime();
104 UInt_t AliHLTModulePreprocessor::GetEndTime()
106 // see header file for function documentation
109 if (!fpInterface) return 0;
110 return fpInterface->PreprocessorGetEndTime();
113 Bool_t AliHLTModulePreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
114 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
116 // see header file for function documentation
119 if (!fpInterface) return 0;
120 return fpInterface->PreprocessorStore(pathLevel2, pathLevel3, object, metaData, validityStart, validityInfinite);
123 Bool_t AliHLTModulePreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
124 AliCDBMetaData* metaData)
126 // see header file for function documentation
129 if (!fpInterface) return 0;
130 return fpInterface->PreprocessorStoreReferenceData(pathLevel2, pathLevel3, object, metaData);
133 Bool_t AliHLTModulePreprocessor::StoreReferenceFile(const char* localFile, const char* gridFileName)
135 // see header file for function documentation
138 if (!fpInterface) return 0;
139 return fpInterface->PreprocessorStoreReferenceFile(localFile, gridFileName);
142 Bool_t AliHLTModulePreprocessor::StoreRunMetadataFile(const char* localFile, const char* gridFileName)
144 // see header file for function documentation
147 if (!fpInterface) return 0;
148 return fpInterface->PreprocessorStoreRunMetadataFile(localFile, gridFileName);
151 const char* AliHLTModulePreprocessor::GetFile(Int_t system, const char* id, const char* source)
153 // see header file for function documentation
156 if (!fpInterface) return 0;
157 return fpInterface->PreprocessorGetFile(system, id, source);
160 TList* AliHLTModulePreprocessor::GetFileSources(Int_t system, const char* id)
162 // see header file for function documentation
165 if (!fpInterface) return 0;
166 return fpInterface->PreprocessorGetFileSources(system, id);
169 TList* AliHLTModulePreprocessor::GetFileIDs(Int_t system, const char* source)
171 // see header file for function documentation
174 if (!fpInterface) return 0;
175 return fpInterface->PreprocessorGetFileIDs(system, source);
178 const char* AliHLTModulePreprocessor::GetRunParameter(const char* param)
180 // see header file for function documentation
183 if (!fpInterface) return 0;
184 return fpInterface->PreprocessorGetRunParameter(param);
187 AliCDBEntry* AliHLTModulePreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
189 // see header file for function documentation
192 if (!fpInterface) return 0;
193 return fpInterface->PreprocessorGetFromOCDB(pathLevel2, pathLevel3);
196 const char* AliHLTModulePreprocessor::GetRunType()
198 // see header file for function documentation
201 if (!fpInterface) return 0;
202 return fpInterface->PreprocessorGetRunType();
205 void AliHLTModulePreprocessor::Log(const char* message)
207 // see header file for function documentation
210 if (!fpInterface) return;
211 fpInterface->PreprocessorLog(message);
214 Int_t AliHLTModulePreprocessor::DetectorBitMask(const char *detectorName)
216 // Return the detector index
217 // corresponding to a given
219 TString detStr = detectorName;
222 for(iDet = 0; iDet < kNDetectors; iDet++) {
223 if (detStr.CompareTo(fgkDetectorName[iDet],TString::kIgnoreCase) == 0)
226 if (iDet == kNDetectors)
228 TString errormessage;
229 errormessage.Form("Invalid detector name: %s !",detectorName);
230 Log(errormessage.Data());
234 Int_t detectorbitmask = 0;
237 TString errormessage2;
238 errormessage2.Form("Invalid detector bit position in detectorMask: %d !", iDet);
239 Log(errormessage2.Data());
243 detectorbitmask = (1 << iDet);
244 return detectorbitmask;
247 Bool_t AliHLTModulePreprocessor::GetDetectorStatus(Int_t detectorbitmask)
249 // see header file for function documentation
250 // retrieve list of active detectors from previous run.
251 fActiveDetectors = atoi(AliHLTModulePreprocessor::GetRunParameter("detectorMask"));
253 if((fActiveDetectors & detectorbitmask) != 0)
263 // function copied from AliDAQ.cxx
264 const char *AliHLTModulePreprocessor::DetectorName(Int_t detectorID)
266 // Returns the name of particular
267 // detector identified by its index
268 if (detectorID < 0 || detectorID >= kNDetectors)
270 TString errormessage;
271 errormessage.Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1);
272 Log(errormessage.Data());
275 return fgkDetectorName[detectorID];