]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/pendolino/AliHLTPendolino.cxx
adding more default configurations
[u/mrichter/AliRoot.git] / HLT / pendolino / AliHLTPendolino.cxx
1 // $Id$
2
3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE HLT Project        * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //*                                                                        *
7 //* Primary Authors: Sebastian Bablok <Sebastian.Bablok@ift.uib.no>        *
8 //*                  for The ALICE HLT Project.                            *
9 //*                                                                        *
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 //**************************************************************************
18
19 /** @file   AliHLTPendolino.cxx
20     @author Sebastian Bablok
21     @date   
22     @brief  
23 */
24
25 #include "AliHLTPendolino.h"
26
27 #include "AliHLTPredictionProcessorInterface.h"
28 #include "AliHLTPendolinoLogger.h"
29 #include "AliHLTPendolinoLoggerOStream.h"
30
31 #include <AliCDBPath.h>
32 #include <AliCDBEntry.h>
33 #include <AliCDBManager.h>
34 #include <AliCDBStorage.h>
35 #include <AliPreprocessor.h>
36 #include <AliCDBId.h>
37
38 #include <TObjString.h>
39 #include <TTimeStamp.h>
40
41 #include <fstream>
42 #include <stdexcept>
43 #include <cstdlib>
44
45
46 using namespace std;
47
48
49 ClassImp(AliHLTPendolino)
50                 
51
52 /** Static string to define a local storage for the OCDB contact. */
53 const TString AliHLTPendolino::kLOCAL_STORAGE_DEFINE = "local://";
54
55 const char* AliHLTPendolino::kHLTInterfaceModule = "Pendolino-Core";
56
57 const TString AliHLTPendolino::kTaxiListBaseFolder = getenv("ALIHLT_T_HCDBDIR"); 
58 //"/opt/T-HCDB/lists/lists-taxi/";
59
60 const TString AliHLTPendolino::kTaxiListFolderName = "lists/lists-taxi/";
61
62 const TString AliHLTPendolino::kTaxiListPendolino = "Pendolino.list";
63
64 const Int_t AliHLTPendolino::kMAX_LINE_LENGTH = 256;
65
66 const Int_t AliHLTPendolino::kHLTPendolinoException = -10;
67
68 const Int_t AliHLTPendolino::kHLTPendolinoBadCast = -9;
69
70 const Int_t AliHLTPendolino::kHLTPendolinoNotPredictProc = -8;
71
72 const Int_t AliHLTPendolino::kHLTPendolinoModuleNotExisting = -7;
73
74 const Int_t AliHLTPendolino::kHLTPendolinoNoDCS = -6;
75
76 //const Int_t AliHLTPendolino::
77
78
79
80 AliHLTPendolino::AliHLTPendolino(Int_t run, TString HCDBbase, TString runType,
81                            AliHLTPendolinoLogger* logger, UInt_t startTime, UInt_t endTime) :
82                         fRunType(runType), fRunNumber(run),
83                         fHCDBPath(""), fPredictionProcessorMap(),
84                         fpLogger(0), fOwnLogger(kFALSE),
85                         fStartTime(startTime), fEndTime(endTime) {
86         // C-tor of AliHLTPendolino
87         fHCDBPath = kLOCAL_STORAGE_DEFINE + HCDBbase;
88         if (logger == 0) {
89                 fpLogger = new AliHLTPendolinoLoggerOStream();
90                 fOwnLogger = kTRUE;
91         } else {
92                 fpLogger = logger;
93                 fOwnLogger = kFALSE;
94         }
95 }
96
97
98 AliHLTPendolino::~AliHLTPendolino() {
99         // D-tor of AliHLTPendolino
100         // clean up registered PredicitonProcs
101     TMapIter iter(&fPredictionProcessorMap, kIterForward);
102     AliHLTPredictionProcessorInterface* aPredict;
103     TObject* key = 0;
104
105     // get each key inside the map
106     while ((key = iter.Next())) {
107         TString detector = key->GetName();
108
109         try {
110             // get value for the key
111             aPredict = dynamic_cast<AliHLTPredictionProcessorInterface*>
112                     (fPredictionProcessorMap.GetValue(key));
113
114             if (aPredict == 0) {
115                 Log(kHLTInterfaceModule, 
116                                                 " *** ERROR, cannot delete registered processor '"
117                                                 + detector + "'; does not seem to be a PredictionProcessor.");
118                 continue;
119             }
120                         Log(kHLTInterfaceModule, " ### [DEBUG] deleting PredictProc '" + 
121                                         detector + "'.");
122                         delete aPredict;
123         } catch (std::bad_cast) {
124             // failed -> is not a AliHLTPredictionProcessorInterface implementation
125             // -> discarding call
126             Log(kHLTInterfaceModule, " *** ERROR, cannot delete registered processor '"
127                     + detector + "'; does not seem to be a PredictionProcessor..");
128             continue;
129
130         } catch (std::exception& e) {
131             Log(kHLTInterfaceModule, 
132                                         " *** Exception in call for deleting PrecitionProcessor '"
133                     + detector + "'.");
134             continue;
135         }
136     }
137         Log(kHLTInterfaceModule, " ### [DEBUG] Deleting of PredictionProcessors finished.");
138
139         // clean up logger
140         if ((fOwnLogger) && (fpLogger != 0)) {
141                 delete fpLogger;
142         }
143         
144 }
145
146
147 // inherited virtual functions, maybe use them from base class
148 Bool_t AliHLTPendolino::Store(const AliCDBPath& path, TObject* object,
149                         AliCDBMetaData* metaData, Int_t validityStart, 
150                         Bool_t validityInfinite) {
151         // stores a entry in HCDB
152         Bool_t retVal = kFALSE;
153         Int_t startNumber = 0;
154         Int_t endNumber = 0;
155         AliCDBManager* man = 0; 
156         AliCDBStorage* local_hcdb = 0;  
157
158         startNumber = ((fRunNumber - validityStart) <= 0) ? 0 : (fRunNumber - validityStart);
159         endNumber = (validityInfinite) ? AliCDBRunRange::Infinity() : fRunNumber;
160
161         man = AliCDBManager::Instance();
162     if (man == 0) {
163                 Log(kHLTInterfaceModule, " *** ERROR cannot obtain a CDB Manager reference.");
164                 return kFALSE;
165         }
166
167     // contact local storage (HCDB)
168     local_hcdb = man->GetStorage(fHCDBPath.Data());
169     if (local_hcdb == 0) {
170                 TString msg(" *** ERROR in initiating HCDB: ");
171                 msg += fHCDBPath;
172         Log(kHLTInterfaceModule, msg.Data());
173         man->DestroyActiveStorages();
174         return kFALSE;
175     }
176
177         // taken from AliShuttle
178         if (! dynamic_cast<TObjString*> (metaData->GetProperty("RunUsed(TObjString)"))) {
179         TObjString runUsed = Form("%d", fRunNumber);
180         metaData->SetProperty("RunUsed(TObjString)", runUsed.Clone());
181     }
182
183
184     // Version is set to current run, it will be used later to transfer data to Grid
185     // Why using current run number as version number ???
186         AliCDBId entryID(path, startNumber, endNumber, fRunNumber, -1);
187         
188         if (local_hcdb->Put(object, entryID, metaData)) {
189                 retVal = kTRUE;
190         } else {
191                 TString msg(" *** Unable to store DCS data to HCDB: ");
192                 msg += entryID.ToString();
193         Log(kHLTInterfaceModule, msg.Data());
194     }
195
196         man->DestroyActiveStorages();
197
198         return retVal;
199 }
200
201
202 Bool_t AliHLTPendolino::StoreReferenceData(const AliCDBPath& path,
203                                            TObject* /*object*/, AliCDBMetaData* /*metaData*/) {
204         // Disabled Function inherited from interface
205         TString msg(" ~~~ PredictProc tries to store reference data to '" 
206                         + path.GetPath() + "'. Discarding call in Pendolino.");
207         Log(kHLTInterfaceModule, msg.Data());
208
209         return kFALSE;
210 }
211
212
213 Bool_t AliHLTPendolino::StoreReferenceFile(const char* detector,
214                         const char* localFile, const char* gridFileName) {
215     // Disabled Function inherited from interface
216     TString msg;
217         TString det(detector);
218         TString filename(localFile);
219         TString gridname(gridFileName);
220         msg = " ~~~ PredictProc (" + det + ") tries to store reference file (" +
221                         filename + ") to '" + gridname + 
222                         "'. Discarding call in Pendolino.";
223     Log(kHLTInterfaceModule, msg.Data());
224
225     return kFALSE;
226 }
227
228
229 Bool_t AliHLTPendolino::StoreRunMetadataFile(const char* localFile,
230                         const char* gridFileName) {
231     // Disabled Function inherited from interface
232     TString msg;
233
234     TString filename(localFile);
235     TString gridname(gridFileName);
236     msg = " ~~~ PredictProc tries to store 'run meta data' file (" +
237             filename + ") to '" + gridname + "'. Discarding call in Pendolino.";
238     Log(kHLTInterfaceModule, msg.Data());
239
240     return kFALSE;
241 }
242
243
244 const char* AliHLTPendolino::GetFile(Int_t system, const char* detector,
245                         const char* id, const char* source) {
246     // Disabled Function inherited from interface
247     TString msg;
248         TString det(detector);
249         TString filename(id);
250         TString src(source);
251         TString from(GetSystemName(system));
252         msg = " ~~~ PredictProc (" + det + ") requests file (" + filename + ") from '" 
253                         + src + "' at " + from + ". Discarding call in Pendolino.";
254         Log(kHLTInterfaceModule, msg.Data());
255
256         return NULL;
257 }
258
259 const char* AliHLTPendolino::GetTriggerConfiguration() {
260     // Disabled Function inherited from interface
261     TString msg;
262     msg = " ~~~ PredictProc tries to request Trigger configuration, this is disabled. Discarding call in Pendolino.";
263         Log(kHLTInterfaceModule, msg.Data());
264
265         return NULL;
266 }
267
268 const char* AliHLTPendolino::GetTriggerDetectorMask() {
269     // Disabled Function inherited from interface
270     TString msg;
271     msg = " ~~~ PredictProc tries to request Trigger configuration, this is disabled. Discarding call in Pendolino.";
272         Log(kHLTInterfaceModule, msg.Data());
273
274         return NULL;
275 }
276
277
278 TList* AliHLTPendolino::GetFileSources(Int_t system, const char* detector,
279                         const char* id) {
280         // Disabled Function inherited from interface
281     TString msg;
282     TString det(detector);
283     TString filename(id);
284     TString from(GetSystemName(system));
285     msg = " ~~~ PredictProc (" + det + ") requests file sources for (" + filename 
286                         + ") from '" + from + ". Discarding call in Pendolino.";
287     Log(kHLTInterfaceModule, msg.Data());
288
289     return NULL;
290 }
291
292
293 TList* AliHLTPendolino::GetFileIDs(Int_t system, const char* detector,
294                         const char* source) {
295     // Disabled Function inherited from interface
296     TString msg;
297     TString det(detector);
298     TString filename(source);
299     TString from(GetSystemName(system));
300     msg = " ~~~ PredictProc (" + det + ") requests file IDs for (" + filename
301             + ") from '" + from + ". Discarding call in Pendolino.";
302     Log(kHLTInterfaceModule, msg.Data());
303
304     return NULL;
305 }
306
307
308 const char* AliHLTPendolino::GetRunParameter(const char* /*lbEntry*/) {
309         // getter for run parameter
310                 
311 // TODO
312 // maybe using a parameter file, where these settings are stored at start up by
313 // the starting script and a dedicated class read and stores its content.
314
315         Log(kHLTInterfaceModule, 
316                         " ### GetRunParameter are not defined, yet. Feature will be available soon.");
317         return NULL;
318 }
319
320
321 Bool_t AliHLTPendolino::GetHLTStatus() {
322         // getter for HLT status
323         // since this is the Pendolino -> always true
324         return kTRUE;
325 }
326
327
328 AliCDBEntry* AliHLTPendolino::GetFromOCDB(const char* detector,
329                         const AliCDBPath& path) {
330         // fetches entry from HCDB
331         AliCDBManager *man = AliCDBManager::Instance();
332         AliCDBEntry* entry = 0;
333         
334         if (man == 0) {
335                 TString msg(" *** ERROR, cannot obtain a CDB Manager reference for: ");
336                 msg += detector;
337                 Log(kHLTInterfaceModule, msg.Data());
338                 return NULL;
339         }
340
341         AliCDBStorage *hcdb = man->GetStorage(fHCDBPath.Data());
342         if (hcdb == 0) {
343                 TString msg(" *** ERROR, cannot acquire HCDB storage (");
344                 msg += fHCDBPath + ") for fetching data for Pendolino.";
345                 Log(kHLTInterfaceModule, msg.Data());
346                 return NULL;
347         }
348         
349         entry = hcdb->Get(path, fRunNumber);
350
351         if (entry == 0) {
352                 TString msg(" ~~~ WARNING: no valid entry for '");
353                 msg += path.GetPath() + "' in HCDB for run number ";
354                 msg += fRunNumber;
355                 Log(kHLTInterfaceModule, msg.Data());
356         }
357
358         return entry;
359         
360 /*
361         AliCDBEntry* entry = 0;
362         try {
363                 entry = dynamic_cast<AliCDBEntry*> (hcdb->Get(path, fRunNumber));
364         } catch (std::bad_cast) {
365                 TString msg(" *** ERROR, bad cast of HCDB entry (");
366                 msg += path.GetPath() + ") after fetching from HCDB.";
367                 Log(kHLTInterfaceModule, msg.Data());
368                 return NULL;
369         }
370         return entry;
371 */
372
373 }
374
375
376 Bool_t AliHLTPendolino::includeAliCDBEntryInList(const TString& entryPath) {
377         // includes entry in Taxi list (objects to be fetched from OCDB)
378         Bool_t bRet = kFALSE;
379         ifstream infile;
380         ofstream outfile;
381         TString filename;
382         TTimeStamp ts;
383
384         filename = kTaxiListBaseFolder + "/" + kTaxiListFolderName + 
385                         kTaxiListPendolino;
386         Log(kHLTInterfaceModule, filename + " [DEBUG] filename");
387
388         infile.open(filename, ios_base::in);
389         if (infile.is_open()) {
390                 char line[kMAX_LINE_LENGTH];
391
392                 while (!infile.eof()) {
393                         infile.getline(line, kMAX_LINE_LENGTH);
394                         if (strncmp(line, entryPath.Data(), entryPath.Length()) == 0) {
395                                         // entry already exists, leave function after proper clean up
396                                 TString msg(" --- Entry '");
397                                 msg += entryPath + "' is already included in Taxi list file.";
398                                 Log(kHLTInterfaceModule, msg.Data());   
399                                 infile.close();
400                                 return kTRUE;
401                         }
402                 }
403                 infile.close();
404                 
405                 // include entry to list
406                 outfile.open(filename, ios_base::out | ios_base::app);
407                 if (!outfile.is_open()) {
408                         TString msg(" *** Unable to create Pendolino list file '");
409                         msg += filename + "' for Taxi. Continueing without list update...";
410                         Log(kHLTInterfaceModule, msg.Data());
411                         return kFALSE;
412                 }
413 //              outfile.seekp(-1, ios::end);
414                 outfile << endl;
415                 outfile << "#HLT (Pendolino) - Run: " << fRunNumber << ", Time: " <<
416                                 ts.AsString() << endl;
417                 outfile << entryPath.Data() << endl;
418                 outfile.close();
419
420                 TString msg(" +++ Included missing entry '");
421                 msg += entryPath + "' in Taxi list file.";
422                 Log(kHLTInterfaceModule, msg.Data());
423                 bRet = kTRUE;
424                 
425         } else {
426                 TString msg(" ~~~ Unable to open Pendolino list file '");
427                 msg += filename + "' for Taxi. Creating new one.";
428                 Log(kHLTInterfaceModule, msg.Data());
429                 outfile.open(filename, ios_base::out);
430                 
431                 if (outfile.is_open()) {
432                         outfile << "# Automatic generated Taxi list." << endl;
433                         outfile << "# It contains the OCDB entries required by the Pendolino." 
434                                         << endl << "#" << endl;
435                         outfile << "#    !!! DON'T EDIT THIS FILE (if you don't know what you are doing) !!!"
436                                         << endl << endl;
437                         outfile << "#HLT (Pendolino) - Run: " << fRunNumber << ", Time: " << 
438                                         ts.AsString() << endl;
439                         outfile << entryPath.Data() << endl;
440                         outfile.close();
441                         bRet = kTRUE;
442                 
443                 } else {
444                         msg=" *** Unable to create Pendolino list file '";
445                         msg += filename + "' for Taxi. Continueing without list update...";
446                         Log(kHLTInterfaceModule, msg.Data());
447                 }       
448         }
449         
450         return bRet;
451 }
452
453
454 void AliHLTPendolino::Log(const char* detector, const char* message) {
455         // logging function
456         fpLogger->log(detector, message);
457         // refer data to a Pendolino Logger, which can take care of it
458 }
459
460
461 void AliHLTPendolino::RegisterPreprocessor(AliPreprocessor* preprocessor) {
462         // registers a PredictionProcessor
463         if (preprocessor == 0) {
464                 Log(kHLTInterfaceModule, 
465                                 " *** ERROR: Cannot register NULL pointer as PredictionProcessor.");
466                 return; 
467         }
468
469     TString detector(preprocessor->GetName());
470
471     if (fPredictionProcessorMap.GetValue(detector.Data())) {
472         Log(kHLTInterfaceModule, " ~~~ Already registered PredictionProcessor '" +
473                 detector + "'. Ignoring call.");
474         return;
475     }
476         // store as AliPreprocessor* and make cast to AliHLTPredictionProcessorInterface*
477         // later, when accesing them.
478     fPredictionProcessorMap.Add(new TObjString(detector), preprocessor);
479
480 /*      
481         TString detector(preprocessor->GetName());
482         AliHLTPredictionProcessorInterface* predictProc = 0;
483 //      UInt_t retVal = 0;
484
485         // TODO move this in seperated call outside RegisterPreprocessor(..)
486         // safety reason, since preprocessor is not completely generated yet
487         if (!preprocessor->ProcessDCS()) {
488                 Log(kHLTInterfaceModule, " *** PredictionProcessor '" + detector +
489                                 "' not registered, because it will not process DCS values.");
490                 return;
491         }
492         Log(kHLTInterfaceModule, "Module Processes DCS values, Registering PredictionProc " 
493                         + detector);
494         
495         // don't use this check, if there are several PreProcs from one detector
496         // they will have all have different names
497         //if (GetDetPos(detector.Data()) < 0) {
498         //      Log(kHLTInterfaceModule, "   *** Invalid detector name: " + detector);
499         //}
500
501         // Check if preprocessor is actually PredictionProcessor
502         try {
503
504                 predictProc = reinterpret_cast<AliHLTPredictionProcessorInterface*> 
505                                 (preprocessor);
506 // Don't use dynamic_cast or C-style cast, they only rename the pointer/object, 
507 // but don't import the extended members -> use reinterpret_cast. Maybe perform 
508 // dynamic_cast check in  other function, which is not called inside a C-tor 
509 // of AliHLTPredictionProcessorInterface.
510                 
511 // ATTENTION: Don't call any functions of AliHLTPredictionProcessorInterface here
512 // the object has not been completely generated yet, only AliPreprocessor part
513 // is available. Call of these function should be performed in seperate call outside
514 // RegisterPreprocessor(..).)
515
516         } catch (std::bad_cast) { 
517                 // failed -> is not a AliHLTPredictionProcessorInterface implementation
518                 // -> discarding call
519                 Log(kHLTInterfaceModule, " *** Cannot register PredictionProcessor '" + detector +
520                                 "'. Does not implement the AliHLTPredictionProcessorInterface.");
521                 return;
522         } catch (std::exception& e) {
523                 Log(kHLTInterfaceModule, " *** Exception in the registering of the PredictProc.");              
524         }
525
526         if (fPredictionProcessorMap.GetValue(detector.Data())) {
527                 Log(kHLTInterfaceModule, " ~~~ Already registered PredictionProcessor '" +
528                                 detector + "'. Ignoring call.");
529                 return;
530         }
531
532         fPredictionProcessorMap.Add(new TObjString(detector), predictProc);
533 */
534 }
535
536
537 UInt_t AliHLTPendolino::setToPredictMaking() {
538         // switches prdiction making on in all registered PredictioProcessors
539         UInt_t retVal = 0;
540
541         // get an iterator for the map
542         TMapIter iter(&fPredictionProcessorMap, kIterForward);
543         AliHLTPredictionProcessorInterface* aPredict;
544         TObject* key = 0;       
545         
546         // get each key inside the map
547         while ((key = iter.Next())) {
548                 TString detector = key->GetName();
549                 
550                 try {
551                         // get value for the key
552                         aPredict = dynamic_cast<AliHLTPredictionProcessorInterface*>
553                                         (fPredictionProcessorMap.GetValue(key));
554                 
555                         if (aPredict == 0) {
556                                 Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
557                                                 + detector +
558                                                 "'. Does not implement the AliHLTPredictionProcessorInterface.");
559                                 continue;
560                         }
561 //                      detector = aPredict->GetName();
562                         
563                         if ((aPredict->ProcessDCS()) && (aPredict->makePrediction() == 0)) {
564                                 retVal++;
565                         } else {
566                                 Log(kHLTInterfaceModule, " *** PredictionProcessor '" + detector
567                                                 + "' does not allow DCS processing or failed to init prediction making.");
568                         }
569                 } catch (std::bad_cast) {
570                 // failed -> is not a AliHLTPredictionProcessorInterface implementation
571             // -> discarding call
572                 Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '" 
573                                         + detector +
574                     "'. Does not implement the AliHLTPredictionProcessorInterface.");
575                 continue;
576
577                 } catch (std::exception& e) {
578                         Log(kHLTInterfaceModule, " *** Exception in call for makePrediction of " 
579                                         + detector + ".");
580                         continue;
581                 }
582         }
583         return retVal;
584 }
585
586
587 Int_t AliHLTPendolino::setToPredictMaking(TString detector) {
588         // switches prediction making on in chosen PreditionProcessor
589         Int_t retVal = 0;
590         AliHLTPredictionProcessorInterface* aPredict = 0;
591         
592         try {
593                 // get the value for the key
594                 TObject* object = fPredictionProcessorMap.GetValue(detector.Data());
595
596                 if (object == 0) {
597                         Log(kHLTInterfaceModule, " *** No PredictionProcessor for '" +
598                                         detector + "' registered.");
599                         return kHLTPendolinoModuleNotExisting;
600                 }
601                                 
602                 aPredict = dynamic_cast<AliHLTPredictionProcessorInterface*> (object);
603
604                 if (aPredict == 0) {
605                         Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
606                                         + detector +
607                                         "'. Does not implement the AliHLTPredictionProcessorInterface.");
608                         return kHLTPendolinoNotPredictProc;
609                 }
610 //            detector = aPredict->GetName();
611
612                 if (!((aPredict->ProcessDCS()) && (aPredict->makePrediction() == 0))) {
613                         Log(kHLTInterfaceModule, " *** PredictionProcessor '" + detector +
614                                         "' does not allow DCS processing or failed to init prediction making.");
615                         retVal = kHLTPendolinoNoDCS;
616                 }
617                 
618         } catch (std::bad_cast) {
619                 // failed -> is not a AliHLTPredictionProcessorInterface implementation
620                 // -> discarding call
621                 Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
622                                 + detector +
623                                 "'. Does not implement the AliHLTPredictionProcessorInterface.");
624                 retVal = kHLTPendolinoBadCast;
625
626         } catch (std::exception& e) {
627                 Log(kHLTInterfaceModule, " *** Exception in call for makePrediction of "
628                                 + detector + ".");
629                 retVal = kHLTPendolinoException;
630     }
631         
632     return retVal;
633 }
634
635
636 Int_t AliHLTPendolino::prepareDCSValues(TString detector, TMap* DCSValues) {
637         // function to prepare retrieved DCS values
638         Int_t retVal = 0;
639         AliHLTPredictionProcessorInterface* aPredict = 0;
640
641         try {
642                 // get the value for the key
643                 TObject* object = fPredictionProcessorMap.GetValue(detector.Data());
644                 
645                 if (object == 0) {
646                         Log(kHLTInterfaceModule, " *** No PredictionProcessor for '" +
647                                         detector + "' registered.");
648                         return kHLTPendolinoModuleNotExisting;
649                 }
650                                 
651                 aPredict = dynamic_cast<AliHLTPredictionProcessorInterface*> (object);
652
653                 if (aPredict == 0) {
654                         Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
655                                         + detector +
656                                         "'. Does not implement the AliHLTPredictionProcessorInterface.");
657                         return kHLTPendolinoNotPredictProc;
658                 }
659
660                 retVal = aPredict->Process(DCSValues);
661
662
663         } catch (std::bad_cast) {
664                 // failed -> is not a AliHLTPredictionProcessorInterface implementation
665                 // -> discarding call
666                 Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
667                                 + detector +
668                                 "'. Does not implement the AliHLTPredictionProcessorInterface.");
669                 retVal = kHLTPendolinoBadCast;
670
671         } catch (std::exception& e) {
672                 Log(kHLTInterfaceModule, " *** Exception in call prepareDCSValues of "
673                                 + detector + ".");
674                 retVal = kHLTPendolinoException;
675         }
676         
677         return retVal;  
678 }
679
680 TMap* AliHLTPendolino::emulateDCSMap(TString detector, TString aliasName) {
681         // function to generate test data of given PredictionProcessor
682         TMap* result = NULL;
683         AliHLTPredictionProcessorInterface* aPredict = 0;
684
685     try {
686         // get the value for the key
687         TObject* object = fPredictionProcessorMap.GetValue(detector.Data());
688
689         if (object == 0) {
690             Log(kHLTInterfaceModule, " *** No PredictionProcessor for '" +
691                     detector + "' registered.");
692             return result;
693         }
694
695         aPredict = dynamic_cast<AliHLTPredictionProcessorInterface*> (object);
696
697         if (aPredict == 0) {
698             Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
699                     + detector +
700                     "'. Does not implement the AliHLTPredictionProcessorInterface.");
701             return result;
702         }
703
704         result = aPredict->produceTestData(aliasName);
705
706
707     } catch (std::bad_cast) {
708         // failed -> is not a AliHLTPredictionProcessorInterface implementation
709         // -> discarding call
710         Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
711                 + detector +
712                 "'. Does not implement the AliHLTPredictionProcessorInterface.");
713
714     } catch (std::exception& e) {
715         Log(kHLTInterfaceModule, " *** Exception in call emulateDCSMap of "
716                 + detector + ".");
717     }
718         return result;
719 }
720
721
722 Int_t AliHLTPendolino::initPredictProc(TString detector, Int_t run, 
723                         UInt_t startTime, UInt_t endTime) {
724         // initializes given PredictionProcessor (defined by detector name)
725     Int_t retVal = 0;
726     AliHLTPredictionProcessorInterface* aPredict = 0;
727
728     try {
729         // get the value for the key
730         TObject* object = fPredictionProcessorMap.GetValue(detector.Data());
731
732         if (object == 0) {
733             Log(kHLTInterfaceModule, " *** No PredictionProcessor for '" +
734                     detector + "' registered.");
735             return kHLTPendolinoModuleNotExisting;
736         }
737
738         aPredict = dynamic_cast<AliHLTPredictionProcessorInterface*> (object);
739
740         if (aPredict == 0) {
741             Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
742                     + detector +
743                     "'. Does not implement the AliHLTPredictionProcessorInterface.");
744             return kHLTPendolinoNotPredictProc;
745         }
746                 
747                 // Initialize Prediction Processor
748                 aPredict->Initialize(run, startTime, endTime);
749
750     } catch (std::bad_cast) {
751         // failed -> is not a AliHLTPredictionProcessorInterface implementation
752         // -> discarding call
753         Log(kHLTInterfaceModule, " *** Cannot use PredictionProcessor '"
754                 + detector +
755                 "'. Does not implement the AliHLTPredictionProcessorInterface.");
756         retVal = kHLTPendolinoBadCast;
757
758     } catch (std::exception& e) {
759         Log(kHLTInterfaceModule, " *** Exception in call prepareDCSValues of "
760                 + detector + ".");
761         retVal = kHLTPendolinoException;
762     }
763
764     return retVal;
765 }
766
767
768 #ifdef SHUTTLE_PRE_REV29388_INTERFACE
769 const UInt_t AliHLTPendolino::GetStartTimeDCSQuery()
770 #else
771 UInt_t AliHLTPendolino::GetStartTimeDCSQuery()
772 #endif
773 {
774         return fStartTime;
775 }
776
777 #ifdef SHUTTLE_PRE_REV29388_INTERFACE
778 const UInt_t AliHLTPendolino::GetEndTimeDCSQuery()
779 #else
780 UInt_t AliHLTPendolino::GetEndTimeDCSQuery()
781 #endif
782 {
783         return fEndTime;
784 }
785
786