]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/pendolino/AliHLTPendolino.h
use robust fitting
[u/mrichter/AliRoot.git] / HLT / pendolino / AliHLTPendolino.h
CommitLineData
e58fb035 1//-*- Mode: C++ -*-
2// $Id$
3
4#ifndef ALI_HLT_PENDOLINO_H
5#define ALI_HLT_PENDOLINO_H
6//* This file is property of and copyright by the ALICE HLT Project *
7//* ALICE Experiment at CERN, All rights reserved. *
8//* See cxx source for full Copyright notice *
9
10/** @file AliHLTPendolino.h
11 @author Sebastian Bablok
12 @date
13 @brief
14*/
15
16//#include <TObject.h>
17#include <TString.h>
18#include <TMap.h>
19
20
21#include <AliShuttleInterface.h>
22
23//#include "AliHLTPredictionProcessorInterface.h"
24
25
26class AliHLTPendolinoLogger;
27
28/**
29 * Class that implements the AliShuttleInterface and provides the required
30 * features for the contacting the PredictionProcessor and storing the result
31 * to the HCDB
32 *
33 * @author Sebastian Bablok
34 *
35 * @date 2007-10-22
36 */
37class AliHLTPendolino : public AliShuttleInterface {
38 public:
39
40 /**
41 * Static string that defines the local storage indicator in path
42 */
43 static const TString kLOCAL_STORAGE_DEFINE; // defines the local storage
44
45 /**
46 * Static string defining the name of this inteface module.
47 */
48 static const char* kHLTInterfaceModule; // defines the name of inteface module
49
50 /**
51 * Static value defining error value for a Pendolino exception.
52 */
53 static const Int_t kHLTPendolinoException; // error value for a Pendolino exception
54
55 /**
56 * Static value defining error value for a bad cast
57 */
58 static const Int_t kHLTPendolinoBadCast; // error value for a bad cast
59
60 /**
61 * Static value defining error value for handed in module is not
62 * implementing the PredictionProcessor interface.
63 */
64 static const Int_t kHLTPendolinoNotPredictProc; // error value for "not implementing the PredictionProcessor interface"
65
66 /**
67 * Static value defining error value for module not existing.
68 */
69 static const Int_t kHLTPendolinoModuleNotExisting; // error value for module not existing
70
71 /**
72 * Static value defining error value for PredictionProc does not
73 * process DCS values.
74 */
75 static const Int_t kHLTPendolinoNoDCS; // error value for PredictionProc does not process DCS
76
77 /**
78 * Static string that defines the base folder for the Taxi list files.
79 */
80 static const TString kTaxiListBaseFolder; // defines the base folder for the Taxi list files
81
82 /**
83 * Static string that defines list folder name for taxi list
84 */
85 static const TString kTaxiListFolderName; // defines list folder name for taxi list
86
87 /**
88 * Static string that defines the filename for the Taxi list required
89 * by the Pendolino
90 */
91 static const TString kTaxiListPendolino; // defines the filename for the Taxi list
92
93 /**
94 * Static value that defines the max length of a line that can be read
95 * when browsing through the list file
96 */
97 static const Int_t kMAX_LINE_LENGTH; // defines the max length of a line
98
99
100 /**
101 * Constructor for AliHLTPendolino.
102 *
103 * @param run the current run number
104 * @param HCDBbase path to the HCDB base folder
105 * @param runType the current run type
106 * @param logger pointer to the desired logger; default is the command
107 * line logger.
108 */
109 AliHLTPendolino(Int_t run, TString HCDBbase, TString runType = "TEST",
110 AliHLTPendolinoLogger* logger = 0);
111
112 /**
113 * Destructor for
114 */
115 virtual ~AliHLTPendolino();
116
117 /**
118 * Function to store processed data in the HCDB
119 *
120 * @param path the storage path consisting of "detector/type/objectname"
121 * where detector should be the detector name used by offline,
122 * type is something like "CALIB" or "ALIGN", while
123 * objectname the name represents, by which it can be requested
124 * from the HCDB.
125 * @param object the object to store
126 * @param metaData metaData to store
127 * @param validityStart object is valid from current run number minus
128 * validityStart
129 * @param validityInfinite if true, validity is set to infinity
130 *
131 * @return true on success, else false
132 */
133 virtual Bool_t Store(const AliCDBPath& path, TObject* object,
134 AliCDBMetaData* metaData, Int_t validityStart = 0,
135 Bool_t validityInfinite = kFALSE);
136 /**
137 * Function is required from interface, but is disbled in its
138 * implementation since additional refernce data will not be used by
139 * the DAs inside the HLT. Therefore always returns false
140 *
141 * @return always false, since function is disabled.
142 */
143 virtual Bool_t StoreReferenceData(const AliCDBPath& path,
144 TObject* object, AliCDBMetaData* metaData);
145 /**
146 * Function is required from interface, but is disbled in its
147 * implementation since additional reference data will not be used by
148 * the DAs inside the HLT. Therefore always returns false
149 *
150 * @return always false, since function is disabled.
151 */
152 virtual Bool_t StoreReferenceFile(const char* detector,
153 const char* localFile, const char* gridFileName);
154
155 /**
156 * Function is required from interface, but is disbled in its
157 * implementation since additional run meta data will only be stored
158 * by the the GPR - Preprocessor of the Offline Shuttle.
159 *
160 * @return always false, since function is disabled.
161 */
162 virtual Bool_t StoreRunMetadataFile(const char* localFile,
163 const char* gridFileName);
164
165 /**
166 * Function is required from interface, but is disbled in its
167 * implementation since additional refernce data will not be used by
168 * the DAs inside the HLT. Therefore always returns NULL.
169 * If this feature is lateron required by HLT, inherit from this class
170 * and overwrite this function with the required functionality.
171 *
172 * @return always NULL, since not used.
173 */
174// virtual const char* GetFile(Int_t system, const char* detector,
175// const char* id, const char* source); --> is private now
176
177 /**
178 * Function is required from interface, but is disbled in its
179 * implementation since additional refernce data will not be used by
180 * the DAs inside the HLT. Therefore always returns NULL.
181 * If this feature is lateron required by HLT, inherit from this class
182 * and overwrite this function with the required functionality.
183 *
184 * @return always NULL, since not used.
185 */
186// virtual TList* GetFileSources(Int_t system, const char* detector,
187// const char* id = 0); -> is priavte now
188
189 /**
190 * Function is required from interface, but is disbled in its
191 * implementation since additional refernce data will not be used by
192 * the DAs inside the HLT. Therefore always returns NULL.
193 * If this feature is lateron required by HLT, inherit from this class
194 * and overwrite this function with the required functionality.
195 *
196 * @return always NULL, since not used.
197 */
198// virtual TList* GetFileIDs(Int_t system, const char* detector,
199// const char* source); -> is private now
200
201 /**
202 * Retrieves current run parameter.
203 *
204 * @param lbEntry name of the run parameter
205 *
206 * @return value of the run parameter
207 */
208 virtual const char* GetRunParameter(const char* lbEntry);
209
210 /**
211 * Retrieves the current run type.
212 *
213 * @return the current run type
214 */
215 virtual const char* GetRunType();
216
217 /**
218 * Returns the HLT status.
219 * Since the Pendolino is part of the HLT, the function will always
220 * return true
221 *
222 * @return always true - see above
223 */
224 virtual Bool_t GetHLTStatus();
225
226 /**
227 * Retrieves a file from the OCDB, but does not uses the OCDB but the
228 * HCDB (local copy of the OCDB). - Since the HCDB only contains OCDB
229 * objects, that are included in the list the Taxi uses for fetching
230 * the data from the OCDB, it can happen, that the corresponding
231 * AliCDBEntry is missing.
232 * TODO: Think of mechanism to automatically include the object in the
233 * Taxi list.
234 *
235 * @param detector the detectorname, to which the object belongs
236 * @param path the path of the object
237 *
238 * @return pointer to the fetched HCDB entry
239 */
240 virtual AliCDBEntry* GetFromOCDB(const char* detector,
241 const AliCDBPath& path);
242
243 /**
244 * Function to allow Pendolino and PredictionProcessor to make log
245 * entries.
246 *
247 * @param detector the detector, that wants to issue this message
248 * @param message the log message
249 */
250 virtual void Log(const char* detector, const char* message);
251
252 /**
253 * Function is required from interface, but is disbled in the Pendolino
254 * because at the moment there is no Trigger configuration available
255 * for Pendolino. At the moment it just return a NULL pointer and makes
256 * some log output.
257 *
258 * @return NULL pointer, since it should not be used.
259 */
260// virtual const char* GetTriggerConfiguration(); --> is private now
261
262 /**
263 * Registers a preprocessor; actually it has to be a PredictionProcessor
264 * since the Pendolino requires a PredictionProcessor. If the registered
265 * preprocessor is not implementing a PredictionProcessor, a log entry
266 * is made and the registration discarded.
267 *
268 * @param preprocessor the PredictionProcessor that shall be registered.
269 * For more details please see above !!
270 */
271 virtual void RegisterPreprocessor(AliPreprocessor* preprocessor);
272// AliHLTPredictionProcessorInterface* preprocessor);
273
274 /**
275 * Function to get the current run number
276 *
277 * @return current run number
278 */
279 virtual Int_t GetRunNumber();
280
281 /**
282 * Function to enable prediction making in all registered
283 * PredictionProcessors, if they implement the required interface
284 *
285 * @return number of PredictionProcessor, which has been switched to
286 * prediction making (NOTE: the internal list may conatin
287 * more PredictionProcessors, but if switching on failed
288 * for one, this one is not counted.)
289 */
290 virtual UInt_t setToPredictMaking();
291
292 /**
293 * Function to get the number of registered PredictionProcessors
294 *
295 * @return number of registered PredictionProcessors
296 */
297 Int_t getNumberOfPredictProc();
298
299 /**
300 * Function to check if given PredtionProc allows for processing DCS
301 * and enable prediction making
302 *
303 * @param detector the detector in whose PredictionProcessor the
304 * prediction making shall be enabled.
305 *
306 * @return 0 on success, else an error code is returned
307 */
308 virtual Int_t setToPredictMaking(TString detector);
309
310 /**
311 * Function to initlaize a dedicated Prediction Processor
312 *
313 * @param detector the detector, whose PredictProc shall be initialized
314 * @param run the current run number
315 * @param startTime the start time of the fetched data
316 * @param endTime the end time of the fetched data
317 *
318 * @return 0 on success, else an error code is returned
319 */
320 virtual Int_t initPredictProc(TString detector, Int_t run,
321 UInt_t startTime, UInt_t endTime);
322
323 /**
324 * Function to hand in retrieved DCS values. These values are handed to
325 * the corresponding PredictionProcessor of the according detector.
326 * The PredictionProcessor should prepare the data inside and store
327 * them to the HCDB.
328 *
329 * @param detector the according detector, to whose PredictionProcessor
330 * shall prepare the handed-in data
331 * @param DCSValues pointer to the map containing the fetched DCS values
332 *
333 * @return 0 on success, else an error code is returned.
334 */
335 virtual Int_t prepareDCSValues(TString detector, TMap* DCSValues);
336
337 /**
338 * Function to retrieve dummy data for testing the Pendolino from a
339 * given PredictionProcessor. The function called is handed further to
340 * the corresponding PredictionProcessor.
341 * NOTE: The returned TMap can be NULL, if no corresponding
342 * PredictionProcessor is registered.
343 *
344 * @param detector the according detector, from whom the
345 * PredictionProcessor shall produce the dummy data.
346 * @param aliasName optional parameter to hand in a alias name for
347 * producing a DCSMap for the given alias.
348 *
349 * @return the DCSMap with the dummy data to test (given by the
350 * PredictionProcessor). NOTE: can be NULL, if no corresponding
351 * PredictionProcessor is registered.
352 */
353 virtual TMap* emulateDCSMap(TString detector, TString aliasName = "");
354
355 /**
356 * Function to add a entry request to the Taxi lists.
357 *
358 * @param entryPath the path entry, that shall be included in the
359 * list file.
360 *
361 * @return true, when successful included or entry already existing in
362 * list; else false.
363 */
364 virtual Bool_t includeAliCDBEntryInList(const TString& entryPath);
365
366 protected:
367
368
369 private:
370 /**
371 * Function is required from interface, but is disbled in its
372 * implementation since additional refernce data will not be used by
373 * the DAs inside the HLT. Therefore always returns NULL.
374 * If this feature is lateron required by HLT, inherit from this class
375 * and overwrite this function with the required functionality.
376 *
377 * @return always NULL, since not used.
378 */
379 virtual TList* GetFileIDs(Int_t system, const char* detector,
380 const char* source);
381
382 /**
383 * Function is required from interface, but is disbled in its
384 * implementation since additional refernce data will not be used by
385 * the DAs inside the HLT. Therefore always returns NULL.
386 * If this feature is lateron required by HLT, inherit from this class
387 * and overwrite this function with the required functionality.
388 *
389 * @return always NULL, since not used.
390 */
391 virtual TList* GetFileSources(Int_t system, const char* detector,
392 const char* id = 0);
393
394 /**
395 * Function is required from interface, but is disbled in its
396 * implementation since additional refernce data will not be used by
397 * the DAs inside the HLT. Therefore always returns NULL.
398 * If this feature is lateron required by HLT, inherit from this class
399 * and overwrite this function with the required functionality.
400 *
401 * @return always NULL, since not used.
402 */
403 virtual const char* GetFile(Int_t system, const char* detector,
404 const char* id, const char* source);
405
406 /**
407 * Function is required from interface, but is disbled in the Pendolino
408 * because at the moment there is no Trigger configuration available
409 * for Pendolino. At the moment it just return a NULL pointer and makes
410 * some log output.
411 *
412 * @return NULL pointer, since it should not be used.
413 */
414 virtual const char* GetTriggerConfiguration();
415
416 /**
417 * Disable the default constructor.
418 */
419 AliHLTPendolino();
420
421 /** copy constructor prohibited */
422 AliHLTPendolino(const AliHLTPendolino&);
423 /** assignment operator prohibited */
424 AliHLTPendolino& operator=(const AliHLTPendolino&);
425
426 /**
427 * Stores the current run type
428 */
bf560255 429 TString fRunType; // Stores the current run type
430
431 /**
432 * Stores the current run number
433 */
434 Int_t fRunNumber; // Stores the current run number
435
436 /**
437 * Stores the HCDBpath
438 */
439 TString fHCDBPath; // Stores the HCDBpath
e58fb035 440
441 /**
442 * Map that stores the all PredictionProcessors with their name
443 * (detector)
444 */
bf560255 445 TMap fPredictionProcessorMap; // stores the all PredictionProcessors
e58fb035 446
447 /**
448 * Pointer to the used Pendolino logger
449 */
bf560255 450 AliHLTPendolinoLogger* fpLogger; // Pointer to the used Pendolino logger
e58fb035 451
452 /**
453 * Indicates, if Logger is owned by Pendolino
454 */
bf560255 455 Bool_t fOwnLogger; // Indicates, if Logger is owned by Pendolino
e58fb035 456
bf560255 457 ClassDef(AliHLTPendolino, 5);
e58fb035 458
459};
460
461
462inline const char* AliHLTPendolino::GetRunType() {
463 // getter for run type
bf560255 464 return fRunType.Data();
e58fb035 465}
466
467inline Int_t AliHLTPendolino::GetRunNumber() {
468 // getter for run number
bf560255 469 return fRunNumber;
e58fb035 470}
471
472inline Int_t AliHLTPendolino::getNumberOfPredictProc() {
473 // getter for number of registered PredictionProcessors
bf560255 474 return fPredictionProcessorMap.GetSize();
e58fb035 475}
476
477
478#endif
479