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