]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/TestShuttle/AliTestShuttle.cxx
nano config for LHC10hx
[u/mrichter/AliRoot.git] / SHUTTLE / TestShuttle / AliTestShuttle.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.14  2007/08/06 12:25:47  acolla
19 Function Bool_t GetHLTStatus added to preprocessor. It returns the status of HLT
20 read from the run logbook.
21 TestShuttle setup updated.
22 TRD data point configuration updated.
23
24 Revision 1.13  2007/05/30 06:35:21  jgrosseo
25 Adding functionality to the Shuttle/TestShuttle:
26 o) Function to retrieve list of sources from a given system (GetFileSources with id=0)
27 o) Function to retrieve list of IDs for a given source      (GetFileIDs)
28 These functions are needed for dealing with the tag files that are saved for the GRP preprocessor
29 Example code has been added to the TestProcessor in TestShuttle
30
31 Revision 1.12  2007/04/27 07:06:48  jgrosseo
32 GetFileSources returns empty list in case of no files, but successful query
33 No mails sent in testmode
34
35 Revision 1.11  2007/04/04 10:33:36  jgrosseo
36 1) Storing of files to the Grid is now done _after_ your preprocessors succeeded. This is transparent, which means that you can still use the same functions (Store, StoreReferenceData) to store files to the Grid. However, the Shuttle first stores them locally and transfers them after the preprocessor finished. The return code of these two functions has changed from UInt_t to Bool_t which gives you the success of the storing.
37 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
38
39 2) The meaning of the return code of the preprocessor has changed. 0 is now success and any other value means failure. This value is stored in the log and you can use it to keep details about the error condition.
40
41 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
42
43 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
44
45 5) New function AliPreprocessor::ProcessDCS(). If you do not need to have DCS data in all cases, you can skip the processing by implemting this function and returning kFALSE under certain conditions. E.g. if there is a certain run type.
46 If you always need DCS data (like before), you do not need to implement it.
47
48 6) The run type has been added to the monitoring page
49
50 Revision 1.10  2007/02/28 10:41:01  acolla
51 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
52 AliPreprocessor::GetRunType() function.
53 Added some ldap definition files.
54
55 Revision 1.8  2007/02/13 11:22:25  acolla
56 Shuttle getters and setters of main/local OCDB/Reference storages, temp and log
57 folders moved to AliShuttleInterface
58
59 Revision 1.6  2006/11/06 14:22:47  jgrosseo
60 major update (Alberto)
61 o) reading of run parameters from the logbook
62 o) online offline naming conversion
63 o) standalone DCSclient package
64
65 Revision 1.5  2006/10/02 12:58:52  jgrosseo
66 Small interface change in StoreReferenceData
67
68 Revision 1.4  2006/08/08 14:19:07  jgrosseo
69 Update to shuttle classes (Alberto)
70
71 - Possibility to set the full object's path in the Preprocessor's and
72 Shuttle's  Store functions
73 - Possibility to extend the object's run validity in the same classes
74 ("startValidity" and "validityInfinite" parameters)
75 - Implementation of the StoreReferenceData function to store reference
76 data in a dedicated CDB storage.
77
78 Revision 1.3  2006/07/11 12:44:32  jgrosseo
79 adding parameters for extended validity range of data produced by preprocessor
80
81 Revision 1.2  2006/06/06 14:20:05  jgrosseo
82 o) updated test preprocessor (alberto)
83 o) added comments to example macro
84 o) test shuttle implements new interface
85
86 Revision 1.2  2006/03/07 07:52:34  hristov
87 New version (B.Yordanov)
88
89 Revision 1.3  2005/11/17 17:47:34  byordano
90 TList changed to TObjArray
91
92 Revision 1.2  2005/11/17 14:43:22  byordano
93 import to local CVS
94
95 Revision 1.1.1.1  2005/10/28 07:33:58  hristov
96 Initial import as subdirectory in AliRoot
97
98 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
99 SHUTTLE package
100
101 Revision 1.2  2005/08/29 21:15:47  byordano
102 some docs added
103
104 */
105
106 //
107 // test implementation of the AliShuttleInterface, to be used for local tests of preprocessors
108 //
109 // reads files from the local disk
110 // stores to local CDB
111 // logs to the screen
112 //
113
114 #include "AliTestShuttle.h"
115 #include "AliLog.h"
116
117 #include "AliCDBManager.h"
118 #include "AliCDBStorage.h"
119 #include "AliCDBMetaData.h"
120 #include "AliCDBPath.h"
121 #include "AliCDBId.h"
122 #include "AliPreprocessor.h"
123 #include "AliLTUConfig.h"
124 #include "AliDAQ.h"
125 #include "AliTriggerInput.h"
126
127 #include <TMap.h>
128 #include <TList.h>
129 #include <TObjString.h>
130 #include <TSystem.h>
131 #include <TTimeStamp.h>
132 #include <TObjArray.h>
133
134 ClassImp(AliTestShuttle)
135
136 //______________________________________________________________________________________________
137 AliTestShuttle::AliTestShuttle(Int_t run, UInt_t startTime, UInt_t endTime) :
138   fRun(run),
139   fStartTime(startTime),
140   fEndTime(endTime),
141   fTimeCreated(startTime),
142   fDCSQueryOffset(0),
143   fInputFiles(0),
144   fRunParameters(0),
145   fRunType(),
146   fPreprocessors(0),
147   fDcsAliasMap(0),
148   fTriggerConfiguration(""),
149   fTriggerDetectorMask(""),
150   fCTPtiming(""),
151   fltuConfig(0x0)
152 {
153   // constructor
154
155   fInputFiles = new TMap;
156   fRunParameters = new TMap;
157   fPreprocessors = new TObjArray;
158
159   fInputFiles->SetOwner(1);
160   fRunParameters->SetOwner(1);
161   fPreprocessors->SetOwner(1);
162
163   fltuConfig = new TObjArray();
164   fltuConfig->SetOwner(1);
165 }
166
167 //______________________________________________________________________________________________
168 AliTestShuttle::~AliTestShuttle()
169 {
170   // destructor
171
172   delete fInputFiles;
173   fInputFiles = 0;
174
175   delete fRunParameters;
176   fRunParameters = 0;
177
178   delete fPreprocessors;
179   fPreprocessors = 0;
180
181   delete fDcsAliasMap;
182   fDcsAliasMap = 0;
183
184   delete fltuConfig;
185   fltuConfig = 0;
186 }
187
188 //______________________________________________________________________________________________
189 Bool_t AliTestShuttle::Store(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData,
190                                 Int_t validityStart, Bool_t validityInfinite)
191 {
192   // Stores the CDB object
193   // This function should be called at the end of the preprocessor cycle
194   //
195   // This implementation just stores it on the local disk, the full AliShuttle
196   // puts it to the Grid FileCatalog
197
198   Int_t startRun = fRun - validityStart;
199   if(startRun < 0) {
200         AliError("First valid run happens to be less than 0! Setting it to 0...");
201         startRun=0;
202   }
203
204   Int_t endRun = -1;
205   if(validityInfinite) {
206         endRun = AliCDBRunRange::Infinity();
207   } else {
208         endRun = fRun;
209   }
210
211   AliCDBId id(path, startRun, endRun);
212
213   return AliCDBManager::Instance()->GetStorage(fgkMainCDB)->Put(object, id, metaData);
214 }
215
216 //______________________________________________________________________________________________
217 Bool_t AliTestShuttle::StoreReferenceData(const AliCDBPath& path, TObject* object, AliCDBMetaData* metaData)
218 {
219   // Stores the object as reference data
220   // This function should be called at the end of the preprocessor cycle
221   //
222   // This implementation just stores it on the local disk, the full AliShuttle
223   // puts it to the Grid FileCatalog
224
225   AliCDBId id(path, fRun, fRun);
226
227   return AliCDBManager::Instance()->GetStorage(fgkMainRefStorage)->Put(object, id, metaData);
228 }
229
230 //______________________________________________________________________________________________
231 Bool_t AliTestShuttle::StoreReferenceFile(const char* detector, const char* localFile, const char* gridFileName)
232 {
233         //
234         // Stores reference file directly (without opening it). 
235         //
236         // This implementation just stores it on the local disk, the full AliShuttle 
237         // puts it to the Grid FileCatalog
238         
239         AliCDBManager* man = AliCDBManager::Instance();
240         AliCDBStorage* sto = man->GetStorage(fgkLocalRefStorage);
241         
242         TString localBaseFolder = sto->GetBaseFolder();
243         
244         TString targetDir = GetRefFilePrefix(localBaseFolder.Data(), detector); 
245         
246         return CopyFileLocally(targetDir, localFile, gridFileName);
247 }
248
249 //______________________________________________________________________________________________
250 Bool_t AliTestShuttle::StoreRunMetadataFile(const char* localFile, const char* gridFileName)
251 {
252         //
253         // Stores Run metadata file to the Grid, in the run folder
254         //
255         // Only GRP can call this function.
256         
257         AliCDBManager* man = AliCDBManager::Instance();
258         AliCDBStorage* sto = man->GetStorage(fgkLocalRefStorage);
259         
260         TString localBaseFolder = sto->GetBaseFolder();
261         
262         // Build Run level folder
263         // folder = /alice/data/year/lhcPeriod/runNb/Raw
264         
265         TTimeStamp startTime(fStartTime);
266                 
267         TString year =  Form("%d",startTime.GetDate());
268         year = year(0,4);
269                 
270         TString lhcPeriod = GetRunParameter("LHCperiod");
271         
272         if (lhcPeriod.Length() == 0) 
273         {
274                 Log("SHUTTLE","StoreRunMetaDataFile - LHCPeriod not found in logbook!");
275                 return 0;
276         }
277         
278         // TODO: currently SHUTTLE cannot write in /alice/data/ !!!!!
279         //TString targetDir = Form("%s/GRP/RunMetadata/alice/data/%s/%s/%d/Raw", 
280         //                      localBaseFolder.Data(), year.Data(), 
281         //                      lhcPeriod.Data(), fRun);
282         
283         TString targetDir = Form("%s/GRP/RunMetadata/alice/simulation/%s/%s/%d/Raw", 
284                                 localBaseFolder.Data(), year.Data(), 
285                                 lhcPeriod.Data(), fRun);
286                                         
287         return CopyFileLocally(targetDir, localFile, gridFileName);
288 }
289
290 //______________________________________________________________________________________________
291 Bool_t AliTestShuttle::CopyFileLocally(TString& targetDir, const char* localFile, const char* gridFileName)
292 {
293         //
294         // Stores file locally. Called by StoreReferenceFile and StoreRunMetadataFile
295         //
296         
297         //try to open folder, if it does not exist
298         void* dir = gSystem->OpenDirectory(targetDir.Data());
299         if (dir == NULL) {
300                 if (gSystem->mkdir(targetDir.Data(), kTRUE)) {
301                         Log("SHUTTLE", Form("StoreFileLocally - Can't open directory <%s>", targetDir.Data()));
302                         return kFALSE;
303                 }
304
305         } else {
306                 gSystem->FreeDirectory(dir);
307         }
308
309         TString target = Form("%s/%s", targetDir.Data(), gridFileName);
310         
311         Int_t result = gSystem->GetPathInfo(localFile, 0, (Long64_t*) 0, 0, 0);
312         if (result)
313         {
314                 Log("SHUTTLE", Form("StoreFileLocally - %s does not exist", localFile));
315                 return kFALSE;
316         }
317
318         result = gSystem->CopyFile(localFile, target);
319
320         if (result == 0)
321         {
322                 Log("SHUTTLE", Form("StoreFileLocally - File %s stored locally to %s", localFile, target.Data()));
323                 return kTRUE;
324         }
325         else
326         {
327                 Log("SHUTTLE", Form("StoreFileLocally - Could not store file %s to %s!. Error code = %d", 
328                                 localFile, target.Data(), result));
329                 return kFALSE;
330         }       
331
332
333
334 }
335
336 //______________________________________________________________________________________________
337 const char* AliTestShuttle::GetRefFilePrefix(const char* base, const char* detector)
338 {
339         //
340         // Get folder name of reference files 
341         //
342
343         TString offDetStr(GetOfflineDetName(detector));
344         static TString dir;
345         if (offDetStr == "ITS" || offDetStr == "MUON" || offDetStr == "PHOS")
346         {
347                 dir.Form("%s/%s/%s", base, offDetStr.Data(), detector);
348         } else {
349                 dir.Form("%s/%s", base, offDetStr.Data());
350         }
351         
352         return dir.Data();
353 }
354
355 //______________________________________________________________________________________________
356 const char* AliTestShuttle::GetFile(Int_t system, const char* detector, const char* id, const char* source)
357 {
358   // This function retrieves a file from the given system (kDAQ, kDCS, kHLT, kDQM) with the given file id
359   // and from the given source in the system.
360   // The function returnes the path to the local file.
361   //
362   // test implementation of GetFile
363   // takes files from the local disks, files are passen in a TMap in the constructor
364
365   TString key;
366   key.Form("%s-%s-%s", fkSystemNames[system], detector, id);
367   TPair* sourceListPair = dynamic_cast<TPair*> (fInputFiles->FindObject(key.Data()));
368   TMap* sourceList = 0;
369   if (sourceListPair)
370     sourceList = dynamic_cast<TMap*> (sourceListPair->Value());
371   if (!sourceList)
372   {
373     AliError(Form("Could not find any file in %s with id %s (%s)", fkSystemNames[system], id, key.Data()));
374     return 0;
375   }
376
377   TObjString* fileName = 0;
378   TPair* fileNamePair = dynamic_cast<TPair*> (sourceList->FindObject(source));
379   if (fileNamePair)
380         fileName = dynamic_cast<TObjString*> (fileNamePair->Value());
381   if (!fileName)
382   {
383     AliError(Form("Could not find files from source %s in %s with id %s",
384                         source, fkSystemNames[system], id));
385     return 0;
386   }
387
388   return fileName->String().Data();
389 }
390
391 //______________________________________________________________________________________________
392 TList* AliTestShuttle::GetFileSources(Int_t system, const char* detector, const char* id)
393 {
394   // Returns a list of sources in a given system that saved a file with the given id
395   //
396   // test implementation of GetFileSources
397   // takes files from the local disks, files are passen in a TMap in the constructor
398
399   TString key;
400   if (id)
401     key.Form("%s-%s-%s", fkSystemNames[system], detector, id);
402   else
403     key.Form("%s-%s", fkSystemNames[system], detector);
404   
405   TList* list = new TList;
406   
407   TIterator* iter = fInputFiles->MakeIterator();
408   TObject* obj = 0;
409   while ((obj = iter->Next()))
410   {
411         TObjString* objStr = dynamic_cast<TObjString*> (obj);
412         if (objStr)
413         {
414                 Bool_t found = kFALSE;
415                 if (id)
416                 {
417                         found = (objStr->String().CompareTo(key) == 0);
418                 }
419                 else
420                         found = objStr->String().BeginsWith(key);
421                 
422                 if (found)
423                 {
424                         TPair* sourceListPair = dynamic_cast<TPair*> (fInputFiles->FindObject(objStr->String().Data()));
425                         TMap* sourceList = dynamic_cast<TMap*> (sourceListPair->Value());
426         
427                         TIterator* iter2 = sourceList->GetTable()->MakeIterator();
428                         TObject* obj2 = 0;
429                         while ((obj2 = iter2->Next()))
430                         {
431                                 TPair* pair = dynamic_cast<TPair*> (obj2);
432                                 if (pair)
433                                 {
434                                         if (!list->FindObject(pair->Key()))
435                                                 list->Add(new TObjString(pair->Key()->GetName()));
436                                 }
437                         }
438                         
439                         delete iter2;
440                 }
441         }
442   }
443   
444   if (list->GetEntries() == 0)
445     AliInfo(Form("Could not find any file in %s with id %s (%s)", fkSystemNames[system], id, key.Data()));
446   
447   return list;
448 }
449
450 //______________________________________________________________________________________________
451 TList* AliTestShuttle::GetFileIDs(Int_t system, const char* detector, const char* source)
452 {
453   // Returns a list of ids in a given system that saved a file with the given source
454   //
455   // test implementation of GetFileSources
456   // takes files from the local disks, files are passen in a TMap in the constructor
457
458
459   TString key;
460   key.Form("%s-%s", fkSystemNames[system], detector);
461   
462   TList* list = new TList;
463   
464   TIterator* iter = fInputFiles->MakeIterator();
465   TObject* obj = 0;
466   while ((obj = iter->Next()))
467   {
468         TObjString* objStr = dynamic_cast<TObjString*> (obj);
469         if (objStr)
470         {
471                 if (objStr->String().BeginsWith(key))
472                 {
473                         Bool_t found = kFALSE;
474                 
475                         TPair* sourceListPair = dynamic_cast<TPair*> (fInputFiles->FindObject(objStr->String().Data()));
476                         TMap* sourceList = dynamic_cast<TMap*> (sourceListPair->Value());
477         
478                         TIterator* iter2 = sourceList->GetTable()->MakeIterator();
479                         TObject* obj2 = 0;
480                         while ((obj2 = iter2->Next()))
481                         {
482                                 TPair* pair = dynamic_cast<TPair*> (obj2);
483                                 if (pair)
484                                 {
485                                         if (strcmp(pair->Key()->GetName(), source) == 0)
486                                                 found = kTRUE;
487                                 }
488                         }
489                         
490                         delete iter2;
491                         
492                         if (found)
493                         {
494                                 TObjArray* tokens = objStr->String().Tokenize("-");
495                                 if (tokens->GetEntries() == 3)
496                                 {
497                                         TObjString* id = dynamic_cast<TObjString*> (tokens->At(2));
498                                         if (id && !list->FindObject(id->String()))
499                                                 list->Add(new TObjString(id->String()));
500                                 }
501                                 
502                                 delete tokens;
503         
504                         }
505                 }
506         }
507   }
508   
509   if (list->GetEntries() == 0)
510     AliInfo(Form("Could not find any file in %s with source %s (%s)", fkSystemNames[system], source, key.Data()));
511   
512   return list;
513 }
514
515 //______________________________________________________________________________________________
516 void AliTestShuttle::Log(const char* detector, const char* message, UInt_t level)
517 {
518   // test implementation of Log
519   // just prints to the screen
520
521   TString fullMessage = detector;
522   fullMessage.Append(Form(": %s",message));
523   AliLog::Message(level, fullMessage, MODULENAME(), ClassName(), FUNCTIONNAME(), __FILE__, __LINE__);
524 }
525
526 //______________________________________________________________________________________________
527 void AliTestShuttle::AddInputFile(Int_t system, const char* detector, const char* id, const char* source, const char* fileName)
528 {
529   //
530   // This function adds a file to the list of input files
531   // the list is stored in fInputFiles 
532   // fInputFiles: TMap (key -> value)
533   //    <system>-<detector>-<id> -> TMap (key -> value)
534   //                                <source> -> <filename>
535   //  
536   
537   TString key;
538   key.Form("%s-%s-%s", fkSystemNames[system], detector, id);
539   TPair* sourceListPair = dynamic_cast<TPair*> (fInputFiles->FindObject(key.Data()));
540   TMap* sourceList = 0;
541   if (sourceListPair)
542     sourceList = dynamic_cast<TMap*> (sourceListPair->Value());
543   if (!sourceList)
544   {
545     sourceList = new TMap;
546     fInputFiles->Add(new TObjString(key), sourceList);
547   }
548
549   sourceList->Add(new TObjString(source), new TObjString(fileName));
550 }
551
552 //______________________________________________________________________________________________
553 Bool_t AliTestShuttle::AddInputCDBEntry(AliCDBEntry* entry)
554 {
555   // This function adds an object in the OCDB to be later retrieved with GetFromOCDB
556
557         AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB);
558         if (!sto)
559         {
560                 Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!");
561                 return 0;
562         }
563
564         return sto->Put(entry);
565 }
566
567 //______________________________________________________________________________________________
568 AliCDBEntry* AliTestShuttle::GetFromOCDB(const char* detector, const AliCDBPath& path)
569 {
570 // returns obiect from OCDB valid for current run
571
572         AliCDBStorage *sto = AliCDBManager::Instance()->GetStorage(fgkMainCDB);
573         if (!sto)
574         {
575                 Log("SHUTTLE", "GetFromOCDB - Cannot activate main OCDB for query!");
576                 return 0;
577         }
578
579         return (AliCDBEntry*) sto->Get(path, fRun);
580 }
581
582 //______________________________________________________________________________________________
583 void AliTestShuttle::Process()
584 {
585   // This function tests all preprocessors that are registered to it
586   // All preprocessors get the same dcs alias map and have access to the same list of files.
587
588   for (Int_t i=0; i<fPreprocessors->GetEntries(); ++i)
589   {
590     AliPreprocessor* preprocessor = dynamic_cast<AliPreprocessor*> (fPreprocessors->At(i));
591     if (preprocessor)
592     {
593       if (preprocessor->ProcessRunType())
594               {
595                       preprocessor->Initialize(fRun, fStartTime, fEndTime);
596                       preprocessor->Process(fDcsAliasMap);
597               }
598       
599     }
600   }
601 }
602
603 //______________________________________________________________________________________________
604 void AliTestShuttle::RegisterPreprocessor(AliPreprocessor* preprocessor)
605 {
606   // registers a preprocessor
607
608         const char* detName = preprocessor->GetName();
609         if(strcmp("DET", detName) != 0) {
610                 if(GetDetPos(detName) < 0)
611                         AliFatal(Form("********** !!!!! Invalid detector name: %s !!!!! **********", detName));
612         }
613
614         fPreprocessors->Add(preprocessor);
615 }
616
617 //______________________________________________________________________________________________
618 void AliTestShuttle::AddInputRunParameter(const char* key, const char* value){
619 // set a run parameter (in reality it will be read from the DAQ logbook)
620
621         TObjString* keyObj = new TObjString(key);
622         if (fRunParameters->Contains(key)) {
623                 AliWarning(Form("Parameter %s already existing and it will be replaced.", key));
624                 delete fRunParameters->Remove(keyObj);
625
626         }
627         fRunParameters->Add(keyObj, new TObjString(value));
628         AliDebug(2, Form("Number of parameters: %d", fRunParameters->
629         GetEntries()));
630 }
631
632 //______________________________________________________________________________________________
633 const char* AliTestShuttle::GetRunType()
634 {
635         //
636         // get a run parameter
637         //
638
639         return fRunType.Data();
640 }
641
642 //______________________________________________________________________________________________
643 const char* AliTestShuttle::GetRunParameter(const char* key){
644 // get a run parameter
645
646         TObjString* value = dynamic_cast<TObjString*> (fRunParameters->GetValue(key));
647         if(!value) {
648                 AliError(Form("No such parameter: %s", key));
649                 return 0;
650         }
651         return value->GetName();
652 }
653
654 //______________________________________________________________________________________________
655 void AliTestShuttle::SetShuttleTempDir(const char* tmpDir)
656 {
657 // sets Shuttle temp directory
658
659         fgkShuttleTempDir = gSystem->ExpandPathName(tmpDir);
660 }
661
662 //______________________________________________________________________________________________
663 void AliTestShuttle::SetShuttleLogDir(const char* logDir)
664 {
665 // sets Shuttle log directory
666
667         fgkShuttleLogDir = gSystem->ExpandPathName(logDir);
668 }
669
670 //______________________________________________________________________________________________
671 const char* AliTestShuttle::GetTriggerConfiguration()
672 {
673         //returns trigger configuration
674         if (fTriggerConfiguration.Length()>0){
675                 return fTriggerConfiguration;
676         }
677         return NULL;
678 }
679 //______________________________________________________________________________________________
680 const char* AliTestShuttle::GetCTPTimeParams()
681 {
682         //returns trigger configuration
683         if (fCTPtiming.Length()>0){
684                 return fCTPtiming;
685         }
686         return NULL;
687 }
688 //______________________________________________________________________________________________
689 const char* AliTestShuttle::GetTriggerDetectorMask()
690 {
691         //returns trigger detector mask
692         if (fTriggerDetectorMask.Length()>0){
693                 return fTriggerDetectorMask;
694         }
695         return NULL;
696 }
697 //______________________________________________________________________________________________
698 UInt_t AliTestShuttle::GetStartTimeDCSQuery()
699 {
700         // Return Start Time for the DCS query
701         //
702         // The call is delegated to AliShuttleInterface
703
704         return fTimeCreated-fDCSQueryOffset;
705 }
706 //______________________________________________________________________________________________
707 UInt_t AliTestShuttle::GetEndTimeDCSQuery()
708 {
709         // Return End Time for the DCS query
710         //
711         // The call is delegated to AliShuttleInterface
712
713         return fEndTime+fDCSQueryOffset;
714 }
715 //______________________________________________________________________________________________
716 void AliTestShuttle::SendMLFromDet(const char* value)
717 {
718         // 
719         // Sending an information coming from the current detector to ML
720         //
721         
722         Printf("%s will be sent to monalisa in the $currentdetector_RunCondition tag",value); 
723         return;
724 }
725 //______________________________________________________________________________________________
726 void AliTestShuttle::SetLTUConfig(TString* ltuConfig, const char* det){
727
728         // 
729         // Setting LTU configuration for detector det
730         //
731
732         AliInfo(Form("LTU Config will be added for detector %s",det));
733         AliInfo(Form("First element of the array of strings will correspond to LTUFineDelay1 --> %s",ltuConfig[0].Data()));
734         AliInfo(Form("Second element of the array of strings will correspond to LTUFineDelay2 --> %s",ltuConfig[1].Data()));
735         AliInfo(Form("Third element of the array of strings will correspond to LTUBCDelayAdd --> %s",ltuConfig[2].Data()));
736         Float_t ltuFineDelay1 = ltuConfig[0].Atof();
737         Float_t ltuFineDelay2 = ltuConfig[1].Atof();
738         Float_t ltuBCDelayAdd = ltuConfig[2].Atof();
739         AliLTUConfig* ltu = new AliLTUConfig((UChar_t)AliDAQ::DetectorID(det),ltuFineDelay1,ltuFineDelay2,ltuBCDelayAdd);
740         Int_t idet = AliDAQ::DetectorID(det);
741         fltuConfig->AddAtAndExpand(ltu,idet);
742         return;
743 }
744 //______________________________________________________________________________________________
745 TString* AliTestShuttle::GetLTUConfig(const char* det){
746
747         // 
748         // Getting LTU configuration for detector det
749         //
750
751         TString* ltuConfigString = new TString[3];
752         Int_t idet = -1;
753         for (Int_t index = 0; index < AliDAQ::kNDetectors; index++){
754                 AliDebug(3,Form("index = %d, det = %s, CTP name = %s",index,det,AliTriggerInput::fgkCTPDetectorName[index]));
755                 if (strcmp(det,AliTriggerInput::fgkCTPDetectorName[index]) == 0){
756                         AliInfo(Form("Getting LTU configuration for detector %s",AliTriggerInput::fgkCTPDetectorName[index]));
757                         idet = index;
758                         break;
759                 }
760         }
761         if (idet != -1){
762                 AliLTUConfig* ltu = (AliLTUConfig*)fltuConfig->At(idet);
763                 if (!ltu){
764                         AliInfo(Form("ltu for detector %s not added in the simulated run, returning a null pointer",det));
765                         return 0x0;
766                 }
767                 else{
768                         ltuConfigString[0]=Form("%f",ltu->GetFineDelay1());
769                         ltuConfigString[1]=Form("%f",ltu->GetFineDelay2());
770                         ltuConfigString[0]=Form("%f",ltu->GetBCDelayAdd());
771                 }
772         }
773         else{
774                 AliError(Form("Detector %s not found in the list of CTP detector names",det));
775         }
776         return ltuConfigString;
777
778 }
779
780