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