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