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
27 #include "AliHLTModulePreprocessor.h"
28 #include "AliHLTShuttleInterface.h"
29 #include "TObjString.h"
33 ClassImp(AliHLTModulePreprocessor)
35 AliHLTModulePreprocessor::AliHLTModulePreprocessor()
40 // see header file for class documentation
42 // refer to README to build package
44 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
47 AliHLTModulePreprocessor::~AliHLTModulePreprocessor()
49 // see header file for function documentation
52 const Int_t AliHLTModulePreprocessor::kNDetectors = 21;
54 const char* AliHLTModulePreprocessor::fgkDetectorName[kNDetectors] =
70 "VZERO", // Name to be changed to V0 ?
79 void AliHLTModulePreprocessor::SetShuttleInterface(AliHLTShuttleInterface* pInterface)
81 assert(fpInterface==NULL || fpInterface==pInterface || pInterface==NULL);
82 fpInterface=pInterface;
85 Int_t AliHLTModulePreprocessor::GetRun()
87 // see header file for function documentation
90 if (!fpInterface) return 0;
91 return fpInterface->PreprocessorGetRun();
94 UInt_t AliHLTModulePreprocessor::GetStartTime()
96 // see header file for function documentation
99 if (!fpInterface) return 0;
100 return fpInterface->PreprocessorGetStartTime();
103 UInt_t AliHLTModulePreprocessor::GetEndTime()
105 // see header file for function documentation
108 if (!fpInterface) return 0;
109 return fpInterface->PreprocessorGetEndTime();
112 Bool_t AliHLTModulePreprocessor::Store(const char* pathLevel2, const char* pathLevel3, TObject* object,
113 AliCDBMetaData* metaData, Int_t validityStart, Bool_t validityInfinite)
115 // see header file for function documentation
118 if (!fpInterface) return 0;
119 return fpInterface->PreprocessorStore(pathLevel2, pathLevel3, object, metaData, validityStart, validityInfinite);
122 Bool_t AliHLTModulePreprocessor::StoreReferenceData(const char* pathLevel2, const char* pathLevel3, TObject* object,
123 AliCDBMetaData* metaData)
125 // see header file for function documentation
128 if (!fpInterface) return 0;
129 return fpInterface->PreprocessorStoreReferenceData(pathLevel2, pathLevel3, object, metaData);
132 Bool_t AliHLTModulePreprocessor::StoreReferenceFile(const char* localFile, const char* gridFileName)
134 // see header file for function documentation
137 if (!fpInterface) return 0;
138 return fpInterface->PreprocessorStoreReferenceFile(localFile, gridFileName);
141 Bool_t AliHLTModulePreprocessor::StoreRunMetadataFile(const char* localFile, const char* gridFileName)
143 // see header file for function documentation
146 if (!fpInterface) return 0;
147 return fpInterface->PreprocessorStoreRunMetadataFile(localFile, gridFileName);
150 const char* AliHLTModulePreprocessor::GetFile(Int_t system, const char* id, const char* source)
152 // see header file for function documentation
155 if (!fpInterface) return 0;
156 return fpInterface->PreprocessorGetFile(system, id, source);
159 TList* AliHLTModulePreprocessor::GetFileSources(Int_t system, const char* id)
161 // see header file for function documentation
164 if (!fpInterface) return 0;
165 return fpInterface->PreprocessorGetFileSources(system, id);
168 TList* AliHLTModulePreprocessor::GetFileIDs(Int_t system, const char* source)
170 // see header file for function documentation
173 if (!fpInterface) return 0;
174 return fpInterface->PreprocessorGetFileIDs(system, source);
177 const char* AliHLTModulePreprocessor::GetRunParameter(const char* param)
179 // see header file for function documentation
182 if (!fpInterface) return 0;
183 return fpInterface->PreprocessorGetRunParameter(param);
186 AliCDBEntry* AliHLTModulePreprocessor::GetFromOCDB(const char* pathLevel2, const char* pathLevel3)
188 // see header file for function documentation
191 if (!fpInterface) return 0;
192 return fpInterface->PreprocessorGetFromOCDB(pathLevel2, pathLevel3);
195 const char* AliHLTModulePreprocessor::GetRunType()
197 // see header file for function documentation
200 if (!fpInterface) return 0;
201 return fpInterface->PreprocessorGetRunType();
204 void AliHLTModulePreprocessor::Log(const char* message)
206 // see header file for function documentation
209 if (!fpInterface) return;
210 fpInterface->PreprocessorLog(message);
213 Int_t AliHLTModulePreprocessor::DetectorBitMask(const char *detectorName)
215 // Return the detector index
216 // corresponding to a given
218 TString detStr = detectorName;
221 for(iDet = 0; iDet < kNDetectors; iDet++) {
222 if (detStr.CompareTo(fgkDetectorName[iDet],TString::kIgnoreCase) == 0)
225 if (iDet == kNDetectors)
227 TString errormessage;
228 errormessage.Form("Invalid detector name: %s !",detectorName);
229 Log(errormessage.Data());
233 Int_t detectorbitmask = 0;
236 TString errormessage2;
237 errormessage2.Form("Invalid detector bit position in detectorMask: %d !", iDet);
238 Log(errormessage2.Data());
242 detectorbitmask = (1 << iDet);
243 return detectorbitmask;
246 Bool_t AliHLTModulePreprocessor::GetDetectorStatus(Int_t detectorbitmask)
248 // see header file for function documentation
249 // retrieve list of active detectors from previous run.
250 fActiveDetectors = atoi(AliHLTModulePreprocessor::GetRunParameter("detectorMask"));
252 if((fActiveDetectors & detectorbitmask) != 0)
262 // function copied from AliDAQ.cxx
263 const char *AliHLTModulePreprocessor::DetectorName(Int_t detectorID)
265 // Returns the name of particular
266 // detector identified by its index
267 if (detectorID < 0 || detectorID >= kNDetectors)
269 TString errormessage;
270 errormessage.Form("Invalid detector index: %d (%d -> %d) !",detectorID,0,kNDetectors-1);
271 Log(errormessage.Data());
274 return fgkDetectorName[detectorID];