Updating the AliAnalysisFemtoTask to work with
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleConfig.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.27  2007/12/17 03:23:32  jgrosseo
19 several bugfixes
20 added "empty preprocessor" as placeholder for Acorde in FDR
21
22 Revision 1.26  2007/12/07 19:14:36  acolla
23 in AliShuttleTrigger:
24
25 Added automatic collection of new runs on a regular time basis (settable from the configuration)
26
27 in AliShuttleConfig: new members
28
29 - triggerWait: time to wait for DIM trigger (s) before starting automatic collection of new runs
30 - mode: run mode (test, prod) -> used to build log folder (logs or logs_PROD)
31
32 in AliShuttle:
33
34 - logs now stored in logs/#RUN/DET_#RUN.log
35
36 Revision 1.25  2007/11/26 16:58:37  acolla
37 Monalisa configuration added: host and table name
38
39 Revision 1.24  2007/10/24 10:44:08  acolla
40
41 debug AliInfo removed
42
43 Revision 1.23  2007/09/28 15:27:40  acolla
44
45 AliDCSClient "multiSplit" option added in the DCS configuration
46 in AliDCSMessage: variable MAX_BODY_SIZE set to 500000
47
48 Revision 1.22  2007/09/27 16:53:13  acolla
49 Detectors can have more than one AMANDA server. SHUTTLE queries the servers sequentially,
50 merges the dcs aliases/DPs in one TMap and sends it to the preprocessor.
51
52 Revision 1.21  2007/04/27 07:06:48  jgrosseo
53 GetFileSources returns empty list in case of no files, but successful query
54 No mails sent in testmode
55
56 Revision 1.20  2007/04/04 10:33:36  jgrosseo
57 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.
58 In case of an error with the Grid, the Shuttle will retry the storing later, the preprocessor does not need to be run again.
59
60 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.
61
62 3) New function StoreReferenceFile to _directly_ store a file (without opening it) to the reference storage.
63
64 4) The memory usage of the preprocessor is monitored. If it exceeds 2 GB it is terminated.
65
66 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.
67 If you always need DCS data (like before), you do not need to implement it.
68
69 6) The run type has been added to the monitoring page
70
71 Revision 1.19  2007/02/28 10:41:56  acolla
72 Run type field added in SHUTTLE framework. Run type is read from "run type" logbook and retrieved by
73 AliPreprocessor::GetRunType() function.
74 Added some ldap definition files.
75
76 Revision 1.18  2007/01/23 19:20:03  acolla
77 Removed old ldif files, added TOF, MCH ldif files. Added some options in
78 AliShuttleConfig::Print. Added in Ali Shuttle: SetShuttleTempDir and
79 SetShuttleLogDir
80
81 Revision 1.17  2007/01/18 11:17:47  jgrosseo
82 changing spaces to tabs ;-)
83
84 Revision 1.16  2007/01/18 11:10:35  jgrosseo
85 adding the possibility of defining DCS alias and data points with patterns
86 first pattern introduced: [N..M] to add all names between the two digits, this works also recursively.
87
88 Revision 1.15  2007/01/15 18:27:11  acolla
89 implementation of sending mail to subdetector expert in case the preprocessor fails.
90 shuttle.schema updated with expert's email entry
91
92 Revision 1.13  2006/12/07 08:51:26  jgrosseo
93 update (alberto):
94 table, db names in ldap configuration
95 added GRP preprocessor
96 DCS data can also be retrieved by data point
97
98 Revision 1.12  2006/11/16 16:16:48  jgrosseo
99 introducing strict run ordering flag
100 removed giving preprocessor name to preprocessor, they have to know their name themselves ;-)
101
102 Revision 1.11  2006/11/06 14:23:04  jgrosseo
103 major update (Alberto)
104 o) reading of run parameters from the logbook
105 o) online offline naming conversion
106 o) standalone DCSclient package
107
108 Revision 1.10  2006/10/20 15:22:59  jgrosseo
109 o) Adding time out to the execution of the preprocessors: The Shuttle forks and the parent process monitors the child
110 o) Merging Collect, CollectAll, CollectNew function
111 o) Removing implementation of empty copy constructors (declaration still there!)
112
113 Revision 1.9  2006/10/02 16:38:39  jgrosseo
114 update (alberto):
115 fixed memory leaks
116 storing of objects that failed to be stored to the grid before
117 interfacing of shuttle status table in daq system
118
119 Revision 1.8  2006/08/15 10:50:00  jgrosseo
120 effc++ corrections (alberto)
121
122 Revision 1.7  2006/07/20 09:54:40  jgrosseo
123 introducing status management: The processing per subdetector is divided into several steps,
124 after each step the status is stored on disk. If the system crashes in any of the steps the Shuttle
125 can keep track of the number of failures and skips further processing after a certain threshold is
126 exceeded. These thresholds can be configured in LDAP.
127
128 Revision 1.6  2006/07/19 10:09:55  jgrosseo
129 new configuration, accesst to DAQ FES (Alberto)
130
131 Revision 1.5  2006/07/10 13:01:41  jgrosseo
132 enhanced storing of last sucessfully processed run (alberto)
133
134 Revision 1.4  2006/06/12 09:11:16  jgrosseo
135 coding conventions (Alberto)
136
137 Revision 1.3  2006/06/06 14:26:40  jgrosseo
138 o) removed files that were moved to STEER
139 o) shuttle updated to follow the new interface (Alberto)
140
141 Revision 1.7  2006/05/12 09:07:16  colla
142 12/05/06
143 New configuration complete
144
145 Revision 1.2  2006/03/07 07:52:34  hristov
146 New version (B.Yordanov)
147
148 Revision 1.4  2005/11/19 14:20:31  byordano
149 logbook config added to AliShuttleConfig
150
151 Revision 1.3  2005/11/17 19:24:25  byordano
152 TList changed to TObjArray in AliShuttleConfig
153
154 Revision 1.2  2005/11/17 14:43:23  byordano
155 import to local CVS
156
157 Revision 1.1.1.1  2005/10/28 07:33:58  hristov
158 Initial import as subdirectory in AliRoot
159
160 Revision 1.1.1.1  2005/09/12 22:11:40  byordano
161 SHUTTLE package
162
163 Revision 1.3  2005/08/30 09:13:02  byordano
164 some docs added
165
166 */
167
168
169 //
170 // This class keeps the AliShuttle configuration.
171 // It reads the configuration for LDAP server.
172 // For every child entry in basedn which has schema type 'shuttleConfig'
173 // it creates a detector configuration. This configuration includes:
174 // DCS server host and port and the set of aliases for which data from
175 // will be retrieved (used by AliShuttle).
176 //
177
178
179 #include "AliShuttleConfig.h"
180 #include "AliShuttleInterface.h"
181
182 #include "AliLog.h"
183
184 #include <TSystem.h>
185 #include <TObjString.h>
186 #include <TLDAPResult.h>
187 #include <TLDAPEntry.h>
188 #include <TLDAPAttribute.h>
189
190
191 AliShuttleConfig::AliShuttleDCSConfigHolder::AliShuttleDCSConfigHolder(const TLDAPEntry* entry):
192 fDCSHost(""),
193 fDCSPort(0),
194 fMultiSplit(100),
195 fDCSAliases(0),
196 fDCSDataPoints(0),
197 fDCSAliasesComp(0),
198 fDCSDataPointsComp(0),
199 fIsValid(kFALSE)
200 {
201 // constructor of the shuttle DCS configuration holder
202
203         TLDAPAttribute* anAttribute;
204         fDCSAliases = new TObjArray();
205         fDCSAliases->SetOwner(1);
206         fDCSDataPoints = new TObjArray();
207         fDCSDataPoints->SetOwner(1);
208         fDCSAliasesComp = new TObjArray();
209         fDCSAliasesComp->SetOwner(1);
210         fDCSDataPointsComp = new TObjArray();
211         fDCSDataPointsComp->SetOwner(1);
212
213         
214         anAttribute = entry->GetAttribute("dcsHost"); 
215         if (!anAttribute)
216         {
217                 AliError("Unexpected: no DCS host!");
218                 return;
219         }
220
221         fDCSHost = anAttribute->GetValue();
222
223         anAttribute = entry->GetAttribute("dcsPort");
224         if (!anAttribute)
225         {
226                 AliError("Unexpected: no DCS port!");
227                 return;
228         }
229         TString portStr = anAttribute->GetValue();
230         fDCSPort = portStr.Atoi();
231
232         anAttribute = entry->GetAttribute("multiSplit"); // MAY
233         if (anAttribute)
234         {
235                 TString multiSplitStr = anAttribute->GetValue();
236                 fMultiSplit = multiSplitStr.Atoi();
237                 if(fMultiSplit == 0) {
238                         AliError("MultiSplit must be a positive integer!");
239                         return;
240                 }
241                 
242         }
243         
244         anAttribute = entry->GetAttribute("dcsAlias"); // MAY
245         if (anAttribute)
246         {
247                 const char* anAlias;
248                 while ((anAlias = anAttribute->GetValue()))
249                 {
250                         fDCSAliasesComp->AddLast(new TObjString(anAlias));
251                         ExpandAndAdd(fDCSAliases, anAlias);
252                 }
253         }
254
255         anAttribute = entry->GetAttribute("dcsDP"); // MAY
256         if (anAttribute)
257         {
258                 const char* aDataPoint;
259                 while ((aDataPoint = anAttribute->GetValue()))
260                 {
261                 fDCSDataPointsComp->AddLast(new TObjString(aDataPoint));
262                 ExpandAndAdd(fDCSDataPoints, aDataPoint);
263                 }
264         }
265         
266         fIsValid = kTRUE;
267 }
268
269 //______________________________________________________________________________________________
270 void AliShuttleConfig::AliShuttleDCSConfigHolder::ExpandAndAdd(TObjArray* target, const char* entry)
271 {
272         //
273         // adds <entry> to <target> applying expanding of the name
274         // [N..M] creates M-N+1 names with the corresponding digits
275         //
276
277         TString entryStr(entry);
278
279         Int_t begin = entryStr.Index("[");
280         Int_t end = entryStr.Index("]");
281         if (begin != -1 && end != -1 && end > begin)
282         {
283                 TString before(entryStr(0, begin));
284                 TString after(entryStr(end+1, entryStr.Length()));
285
286                 AliDebug(2, Form("Found [] pattern. Splitted input string %s %s", before.Data(), after.Data()));
287
288                 Int_t dotdot = entryStr.Index("..");
289
290                 TString nStr(entryStr(begin+1, dotdot-begin-1));
291                 TString mStr(entryStr(dotdot+2, end-dotdot-2));
292
293                 AliDebug(2, Form("Found [N..M] pattern. %s %s", nStr.Data(), mStr.Data()));
294
295                 if (nStr.IsDigit() && mStr.IsDigit())
296                 {
297                         Int_t n = nStr.Atoi();
298                         Int_t m = mStr.Atoi();
299
300                         Int_t nDigits = nStr.Length();
301                         TString formatStr;
302                         formatStr.Form("%%s%%0%dd%%s", nDigits);
303
304                         AliDebug(2, Form("Format string is %s", formatStr.Data()));
305
306                         for (Int_t current = n; current<=m; ++current)
307                         {
308                                 TString newEntry;
309                                 newEntry.Form(formatStr.Data(), before.Data(), current, after.Data());
310
311                                 AliDebug(2, Form("Calling recursive with %s", newEntry.Data()));
312
313                                 // and go recursive
314                                 ExpandAndAdd(target, newEntry);
315                         }
316
317                         // return here because we processed the entries already recursively.
318                         return;
319                 }
320         }
321
322         AliDebug(2, Form("Adding name %s", entry));
323         target->AddLast(new TObjString(entry));
324 }
325
326 //______________________________________________________________________________________________
327 AliShuttleConfig::AliShuttleDCSConfigHolder::~AliShuttleDCSConfigHolder()
328 {
329 // destructor of the shuttle configuration holder
330
331         delete fDCSAliases;
332         delete fDCSDataPoints;
333         delete fDCSAliasesComp;
334         delete fDCSDataPointsComp;      
335 }
336
337 //______________________________________________________________________________________________
338 AliShuttleConfig::AliShuttleDetConfigHolder::AliShuttleDetConfigHolder(const TLDAPEntry* entry):
339 fDetector(""),
340 fDCSConfig(),
341 fResponsibles(0),
342 fIsValid(kFALSE),
343 fSkipDCSQuery(kFALSE),
344 fStrictRunOrder(kFALSE)
345 {
346 // constructor of the shuttle configuration holder
347
348         TLDAPAttribute* anAttribute;
349         
350         fResponsibles = new TObjArray();
351         fResponsibles->SetOwner(1);
352         fDCSConfig = new TObjArray();
353         fDCSConfig->SetOwner(1);
354
355         anAttribute = entry->GetAttribute("det"); // MUST
356         if (!anAttribute)
357         {
358                 AliError(Form("No \"det\" attribute!"));
359                 return;
360         }
361         fDetector = anAttribute->GetValue();
362
363         anAttribute = entry->GetAttribute("strictRunOrder"); // MAY
364         if (!anAttribute)
365         {
366                 AliWarning(Form("%s did not set strictRunOrder flag - the default is FALSE",
367                                 fDetector.Data()));
368         } else {
369                 TString strictRunStr = anAttribute->GetValue();
370                 if (!(strictRunStr == "0" || strictRunStr == "1"))
371                 {
372                         AliError("strictRunOrder flag must be 0 or 1!");
373                         return;
374                 }
375                 fStrictRunOrder = (Bool_t) strictRunStr.Atoi();
376         }
377
378         anAttribute = entry->GetAttribute("responsible"); // MAY
379         if (!anAttribute)
380         {
381                 AliDebug(2, "Warning! No \"responsible\" attribute!");
382         }
383         else
384         {
385                 const char* aResponsible;
386                 while ((aResponsible = anAttribute->GetValue()))
387                 {
388                         fResponsibles->AddLast(new TObjString(aResponsible));
389                 }
390         }
391
392         fIsValid = kTRUE;
393 }
394
395 //______________________________________________________________________________________________
396 AliShuttleConfig::AliShuttleDetConfigHolder::~AliShuttleDetConfigHolder()
397 {
398 // destructor of the shuttle configuration holder
399
400         delete fResponsibles;
401         delete fDCSConfig;
402 }
403
404 //______________________________________________________________________________________________
405 const char* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSHost(Int_t iServ) const
406 {
407         //
408         // returns DCS server host 
409         //
410         
411         if (iServ < 0 || iServ >= GetNServers()) return 0;
412         
413         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
414                                                         (fDCSConfig->At(iServ));
415         
416         return aHolder->GetDCSHost();
417 }
418
419 //______________________________________________________________________________________________
420 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSPort(Int_t iServ) const
421 {
422         //
423         // returns DCS server port 
424         //
425         
426         if (iServ < 0 || iServ >= GetNServers()) return 0;
427         
428         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
429                                                         (fDCSConfig->At(iServ));
430         
431         return aHolder->GetDCSPort();
432 }
433
434 //______________________________________________________________________________________________
435 Int_t AliShuttleConfig::AliShuttleDetConfigHolder::GetMultiSplit(Int_t iServ) const
436 {
437         //
438         // returns DCS "multi split" value
439         //
440         
441         if (iServ < 0 || iServ >= GetNServers()) return 0;
442         
443         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
444                                                         (fDCSConfig->At(iServ));
445         
446         return aHolder->GetMultiSplit();
447 }
448
449 //______________________________________________________________________________________________
450 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSAliases(Int_t iServ) const
451 {
452         //
453         // returns collection of TObjString which represents the set of aliases
454         // which used for data retrieval for particular detector
455         //
456         
457         if (iServ < 0 || iServ >= GetNServers()) return 0;
458         
459         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
460                                                         (fDCSConfig->At(iServ));
461         
462         return aHolder->GetDCSAliases();
463 }
464
465 //______________________________________________________________________________________________
466 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetDCSDataPoints(Int_t iServ) const
467 {
468         //
469         // returns collection of TObjString which represents the set of aliases
470         // which used for data retrieval for particular detector
471         //
472
473         if (iServ < 0 || iServ >= GetNServers()) return 0;
474
475         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
476                                                         (fDCSConfig->At(iServ));
477         
478         return aHolder->GetDCSDataPoints();
479 }
480
481 //______________________________________________________________________________________________
482 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSAliases(Int_t iServ) const
483 {
484         //
485         // returns collection of TObjString which represents the set of aliases
486         // which used for data retrieval for particular detector (Compact style)
487         //
488
489         if (iServ < 0 || iServ >= GetNServers()) return 0;
490
491         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
492                                                         (fDCSConfig->At(iServ));
493         
494         return aHolder->GetCompactDCSAliases();
495 }
496
497 //______________________________________________________________________________________________
498 const TObjArray* AliShuttleConfig::AliShuttleDetConfigHolder::GetCompactDCSDataPoints(Int_t iServ) const
499 {
500         //
501         // returns collection of TObjString which represents the set of aliases
502         // which used for data retrieval for particular detector (Compact style)
503         //
504
505         if (iServ < 0 || iServ >= GetNServers()) return 0;
506
507         AliShuttleDCSConfigHolder *aHolder = dynamic_cast<AliShuttleDCSConfigHolder *> 
508                                                         (fDCSConfig->At(iServ));
509         
510         return aHolder->GetCompactDCSDataPoints();
511 }
512
513 //______________________________________________________________________________________________
514 void AliShuttleConfig::AliShuttleDetConfigHolder::AddDCSConfig(AliShuttleDCSConfigHolder* holder)
515 {
516         //
517         // adds a DCS configuration set in the array of DCS configurations
518         // 
519         
520         if(!holder) return;
521         fDCSConfig->AddLast(holder);
522 }
523
524 ClassImp(AliShuttleConfig)
525
526 //______________________________________________________________________________________________
527 AliShuttleConfig::AliShuttleConfig(const char* host, Int_t port,
528         const char* binddn, const char* password, const char* basedn):
529         fConfigHost(host), 
530         fDAQlbHost(""), 
531         fDAQlbPort(), 
532         fDAQlbUser(""), 
533         fDAQlbPass(""),
534         fDAQlbDB(""), 
535         fDAQlbTable(""), 
536         fShuttlelbTable(""), 
537         fRunTypelbTable(""),
538         fMaxRetries(0), 
539         fPPTimeOut(0), 
540         fDCSTimeOut(0), 
541         fPPMaxMem(0), 
542         fMonitorHost(""), 
543         fMonitorTable(""), 
544         fTriggerWait(3600),
545         fRunMode(kTest),
546         fDetectorMap(), 
547         fDetectorList(),
548         fAdmin(),
549         fShuttleInstanceHost(""), 
550         fProcessedDetectors(), 
551         fKeepDCSMap(kFALSE),
552         fKeepTempFolder(kFALSE),
553         fSendMail(kFALSE),
554         fProcessAll(kFALSE), 
555         fIsValid(kFALSE)
556
557 {
558         //
559         // host: ldap server host
560         // port: ldap server port
561         // binddn: binddn used for ldap binding (simple bind is used!).
562         // password: password for binddn
563         // basedn: this is basedn whose childeren entries which have
564         //
565
566         fDetectorMap.SetOwner(1);
567         fDetectorList.SetOwner(0); //fDetectorList and fDetectorMap share the same object!
568         fProcessedDetectors.SetOwner();
569         
570         for (int i=0; i<5; i++)
571         {
572                 fAdmin[i] = new TObjArray(); 
573                 fAdmin[i]->SetOwner();
574         }
575
576         TLDAPServer aServer(host, port, binddn, password, 3);
577
578         if (!aServer.IsConnected()) {
579                 AliError(Form("Can't connect to ldap server %s:%d",
580                                 host, port));
581                 return;
582         }
583
584         // reads configuration for the shuttle running on this machine
585         
586         TLDAPResult* aResult = 0;
587         TLDAPEntry* anEntry = 0;
588         
589         TList dcsList;
590         dcsList.SetOwner(1);
591         TList detList;
592         detList.SetOwner(1);
593         TList globalList;
594         globalList.SetOwner(1);
595         TList sysList;
596         sysList.SetOwner(1);
597         TList hostList;
598         hostList.SetOwner(1);
599         
600         aResult = aServer.Search(basedn, LDAP_SCOPE_SUBTREE, 0, 0);
601         
602         if (!aResult) 
603         {
604                 AliError(Form("Can't find configuration with base DN: %s !", basedn));
605                 return;
606         }
607         
608         while ((anEntry = aResult->GetNext())) 
609         {
610                 TString dn = anEntry->GetDn();
611                 
612                 if (dn.BeginsWith("dcsHost=")) 
613                 {
614                         dcsList.Add(anEntry);
615                 } 
616                 else if (dn.BeginsWith("det="))
617                 {
618                         detList.Add(anEntry);
619                 }
620                 else if (dn.BeginsWith("name=globalConfig"))
621                 {
622                         globalList.Add(anEntry);
623                 }
624                 else if (dn.BeginsWith("system="))
625                 {
626                         sysList.Add(anEntry);
627                 }
628                 else if (dn.BeginsWith("shuttleHost="))
629                 {
630                         hostList.Add(anEntry);
631                 }
632                 else 
633                 {
634                         delete anEntry;
635                 }
636         
637         }
638         delete aResult;
639         
640         Int_t result=0;
641         
642         result += SetGlobalConfig(&globalList);
643         result += SetSysConfig(&sysList);
644         result += SetDetConfig(&detList,&dcsList);
645         result += SetHostConfig(&hostList);
646         
647         if(result) 
648         {
649                 AliError("Configuration is INVALID!");
650         }
651         else 
652         {
653                 fIsValid = kTRUE;
654         }
655 }
656
657 //______________________________________________________________________________________________
658 AliShuttleConfig::~AliShuttleConfig()
659 {
660 // destructor
661
662         fDetectorMap.DeleteAll();
663         fDetectorList.Clear();
664         fProcessedDetectors.Delete();
665         
666         delete[] fAdmin;
667         
668 }
669
670 //______________________________________________________________________________________________
671 const TObjArray* AliShuttleConfig::GetDetectors() const
672 {
673         //
674         // returns collection of TObjString which contains the name
675         // of every detector which is in the configuration.
676         //
677
678         return &fDetectorList;
679 }
680
681 //______________________________________________________________________________________________
682 Bool_t AliShuttleConfig::HasDetector(const char* detector) const
683 {
684         //
685         // checks for paricular detector in the configuration.
686         //
687         return fDetectorMap.GetValue(detector) != NULL;
688 }
689
690 //______________________________________________________________________________________________
691 Int_t AliShuttleConfig::GetNServers(const char* detector) const
692 {
693         //
694         // returns number of DCS servers for detector
695         //
696         
697         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
698         if (!aHolder) {
699                 AliError(Form("There isn't configuration for detector: %s",
700                         detector));
701                 return 0;
702         }
703
704         return aHolder->GetNServers();
705 }
706
707
708 //______________________________________________________________________________________________
709 const char* AliShuttleConfig::GetDCSHost(const char* detector, Int_t iServ) const
710 {
711         //
712         // returns i-th DCS server host used by particular detector
713         //
714         
715         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
716         if (!aHolder) {
717                 AliError(Form("There isn't configuration for detector: %s",
718                         detector));
719                 return NULL;
720         }
721
722         return aHolder->GetDCSHost(iServ);
723 }
724
725 //______________________________________________________________________________________________
726 Int_t AliShuttleConfig::GetDCSPort(const char* detector, Int_t iServ) const
727 {
728         //
729         // returns i-th DCS server port used by particular detector
730         //
731
732
733         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
734         if (!aHolder) {
735                 AliError(Form("There isn't configuration for detector: %s",
736                         detector));
737                 return 0;
738         }
739
740         return aHolder->GetDCSPort(iServ);
741 }
742
743 //______________________________________________________________________________________________
744 Int_t AliShuttleConfig::GetMultiSplit(const char* detector, Int_t iServ) const
745 {
746         //
747         // returns i-th DCS "multi split" value
748         //
749
750
751         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
752         if (!aHolder) {
753                 AliError(Form("There isn't configuration for detector: %s",
754                         detector));
755                 return 0;
756         }
757
758         return aHolder->GetMultiSplit(iServ);
759 }
760
761 //______________________________________________________________________________________________
762 const TObjArray* AliShuttleConfig::GetDCSAliases(const char* detector, Int_t iServ) const
763 {
764         //
765         // returns collection of TObjString which represents the i-th set of aliases
766         // which used for data retrieval for particular detector
767         //
768
769         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
770         if (!aHolder) {
771                 AliError(Form("There isn't configuration for detector: %s",
772                         detector));
773                 return NULL;
774         }
775
776         return aHolder->GetDCSAliases(iServ);
777 }
778
779 //______________________________________________________________________________________________
780 const TObjArray* AliShuttleConfig::GetDCSDataPoints(const char* detector, Int_t iServ) const
781 {
782         //
783         // returns collection of TObjString which represents the set of aliases
784         // which used for data retrieval for particular detector
785         //
786
787         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
788         if (!aHolder) {
789                 AliError(Form("There isn't configuration for detector: %s",
790                         detector));
791                 return NULL;
792         }
793
794         return aHolder->GetDCSDataPoints(iServ);
795 }
796
797 //______________________________________________________________________________________________
798 const TObjArray* AliShuttleConfig::GetCompactDCSAliases(const char* detector, Int_t iServ) const
799 {
800         //
801         // returns collection of TObjString which represents the i-th set of aliases
802         // which used for data retrieval for particular detector (Compact style)
803         //
804
805         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
806         if (!aHolder) {
807                 AliError(Form("There isn't configuration for detector: %s",
808                         detector));
809                 return NULL;
810         }
811
812         return aHolder->GetCompactDCSAliases(iServ);
813 }
814
815 //______________________________________________________________________________________________
816 const TObjArray* AliShuttleConfig::GetCompactDCSDataPoints(const char* detector, Int_t iServ) const
817 {
818         //
819         // returns collection of TObjString which represents the set of aliases
820         // which used for data retrieval for particular detector (Compact style)
821         //
822
823         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
824         if (!aHolder) {
825                 AliError(Form("There isn't configuration for detector: %s",
826                         detector));
827                 return NULL;
828         }
829
830         return aHolder->GetCompactDCSDataPoints(iServ);
831 }
832
833 //______________________________________________________________________________________________
834 const TObjArray* AliShuttleConfig::GetResponsibles(const char* detector) const
835 {
836         //
837         // returns collection of TObjString which represents the list of mail addresses
838         // of the detector's responsible(s)
839         //
840
841         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
842         if (!aHolder) {
843                 AliError(Form("There isn't configuration for detector: %s",
844                         detector));
845                 return NULL;
846         }
847
848         return aHolder->GetResponsibles();
849 }
850
851 //______________________________________________________________________________________________
852 const TObjArray* AliShuttleConfig::GetAdmins(Int_t sys) const
853 {
854         //
855         // returns collection of TObjString which represents the list of mail addresses
856         // of the system's administrator(s) (DAQ, DCS, HLT, Global, Amanda)
857         //
858
859         if (sys < 0 || sys > 4) return 0;
860         return fAdmin[sys];
861 }
862
863 //______________________________________________________________________________________________
864 Bool_t AliShuttleConfig::HostProcessDetector(const char* detector) const
865 {
866         // return TRUE if detector is handled by host or if fProcessAll is TRUE
867
868         if(fProcessAll) return kTRUE;
869         TIter iter(&fProcessedDetectors);
870         TObjString* detName;
871         while((detName = (TObjString*) iter.Next())){
872                 if(detName->String() == detector) return kTRUE;
873         }
874         return kFALSE;
875 }
876
877 //______________________________________________________________________________________________
878 Bool_t AliShuttleConfig::StrictRunOrder(const char* detector) const
879 {
880         // return TRUE if detector wants strict run ordering of stored data
881
882         AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) fDetectorMap.GetValue(detector);
883         if (!aHolder)
884         {
885                 AliError(Form("There isn't configuration for detector: %s",
886                         detector));
887                 return kTRUE;
888         }
889
890         return aHolder->StrictRunOrder();
891 }
892
893 //______________________________________________________________________________________________
894 UInt_t AliShuttleConfig::SetGlobalConfig(TList* list)
895 {
896         // Set the global configuration (DAQ Logbook + preprocessor monitoring settings)
897
898         TLDAPEntry* anEntry = 0;
899         TLDAPAttribute* anAttribute = 0;
900         
901         if (list->GetEntries() == 0) 
902         {
903                 AliError("Global configuration not found!");
904                 return 1;
905         } 
906         else if (list->GetEntries() > 1)
907         {
908                 AliError("More than one global configuration found!");
909                 return 2;
910         }
911         
912         anEntry = dynamic_cast<TLDAPEntry*> (list->At(0));
913         
914         if (!anEntry)
915         {
916                 AliError("Unexpected! Global list does not contain a TLDAPEntry");
917                 return 3;
918         } 
919         
920         
921         anAttribute = anEntry->GetAttribute("daqLbHost");
922         if (!anAttribute) {
923                 AliError("Can't find daqLbHost attribute!");
924                 return 4;
925         }
926         fDAQlbHost = anAttribute->GetValue();
927
928         anAttribute = anEntry->GetAttribute("daqLbPort"); // MAY
929         if (anAttribute)
930         {
931                 fDAQlbPort = ((TString) anAttribute->GetValue()).Atoi();
932         } else {
933                 fDAQlbPort = 3306; // mysql
934         }
935
936         anAttribute = anEntry->GetAttribute("daqLbUser");
937         if (!anAttribute) {
938                 AliError("Can't find daqLbUser attribute!");
939                 return 4;
940         }
941         fDAQlbUser = anAttribute->GetValue();
942
943         anAttribute = anEntry->GetAttribute("daqLbPasswd");
944         if (!anAttribute) {
945                 AliError("Can't find daqLbPasswd attribute!");
946                 return 4;
947         }
948         fDAQlbPass = anAttribute->GetValue();
949
950         anAttribute = anEntry->GetAttribute("daqLbDB");
951         if (!anAttribute) {
952                 AliError("Can't find daqLbDB attribute!");
953                 return 4;
954         }
955         fDAQlbDB = anAttribute->GetValue();
956
957         anAttribute = anEntry->GetAttribute("daqLbTable");
958         if (!anAttribute) {
959                 AliError("Can't find daqLbTable attribute!");
960                 return 4;
961         }
962         fDAQlbTable = anAttribute->GetValue();
963
964         anAttribute = anEntry->GetAttribute("shuttleLbTable");
965         if (!anAttribute) {
966                 AliError("Can't find shuttleLbTable attribute!");
967                 return 4;
968         }
969         fShuttlelbTable = anAttribute->GetValue();
970
971         anAttribute = anEntry->GetAttribute("runTypeLbTable");
972         if (!anAttribute) {
973                 AliError("Can't find runTypeLbTable attribute!");
974                 return 4;
975         }
976         fRunTypelbTable = anAttribute->GetValue();
977
978         anAttribute = anEntry->GetAttribute("ppmaxRetries");
979         if (!anAttribute) {
980                 AliError("Can't find ppmaxRetries attribute!");
981                 return 4;
982         }
983         TString tmpStr = anAttribute->GetValue();
984         fMaxRetries = tmpStr.Atoi();
985
986         anAttribute = anEntry->GetAttribute("ppTimeOut");
987         if (!anAttribute) {
988                 AliError("Can't find ppTimeOut attribute!");
989                 return 4;
990         }
991         tmpStr = anAttribute->GetValue();
992         fPPTimeOut = tmpStr.Atoi();
993
994         anAttribute = anEntry->GetAttribute("dcsTimeOut");
995         if (!anAttribute) {
996                 AliError("Can't find dcsTimeOut attribute!");
997                 return 4;
998         }
999         tmpStr = anAttribute->GetValue();
1000         fDCSTimeOut = tmpStr.Atoi();
1001
1002         anAttribute = anEntry->GetAttribute("nDCSretries");
1003         if (!anAttribute) {
1004                 AliError("Can't find dcsTimeOut attribute!");
1005                 return 4;
1006         }
1007         tmpStr = anAttribute->GetValue();
1008         fDCSRetries = tmpStr.Atoi();
1009
1010         anAttribute = anEntry->GetAttribute("ppMaxMem");
1011         if (!anAttribute) {
1012                 AliError("Can't find ppMaxMem attribute!");
1013                 return 4;
1014         }
1015         tmpStr = anAttribute->GetValue();
1016         fPPMaxMem = tmpStr.Atoi();
1017         
1018         anAttribute = anEntry->GetAttribute("monitorHost");
1019         if (!anAttribute) {
1020                 AliError("Can't find monitorHost attribute!");
1021                 return 4;
1022         }
1023         fMonitorHost = anAttribute->GetValue();
1024         
1025         anAttribute = anEntry->GetAttribute("monitorTable");
1026         if (!anAttribute) {
1027                 AliError("Can't find monitorTable attribute!");
1028                 return 4;
1029         }
1030         fMonitorTable = anAttribute->GetValue();
1031
1032         anAttribute = anEntry->GetAttribute("triggerWait"); // MAY
1033         if (!anAttribute) {
1034                 AliWarning(Form("triggerWait not set! default = ", fTriggerWait));
1035         }
1036         tmpStr = anAttribute->GetValue();
1037         fTriggerWait = tmpStr.Atoi();
1038         
1039         anAttribute = anEntry->GetAttribute("mode");
1040         if (!anAttribute) {
1041                 AliWarning("Run mode not set! Running in test mode.");
1042         } else {
1043           tmpStr = anAttribute->GetValue();
1044           if (tmpStr == "test")
1045           {
1046             fRunMode = kTest;
1047           } else if (tmpStr == "prod") {
1048             fRunMode = kProd;
1049           } else {
1050             AliWarning(Form("Not a valid run mode: %s", tmpStr.Data()));                
1051             AliWarning("Valid run modes are \"test\" and \"prod\". Running in test mode.");
1052           }
1053         }
1054
1055         anAttribute = anEntry->GetAttribute("keepDCSMap"); // MAY
1056         if (!anAttribute)
1057         {
1058                 AliWarning("keepDCSMap flag not set - default is FALSE");
1059         } else {
1060                 TString keepDCSMapStr = anAttribute->GetValue();
1061                 if (!(keepDCSMapStr == "0" || keepDCSMapStr == "1"))
1062                 {
1063                         AliError("keepDCSMap flag must be 0 or 1!");
1064                         return 4;
1065                 }
1066                 fKeepDCSMap = (Bool_t) keepDCSMapStr.Atoi();
1067         }
1068         
1069         anAttribute = anEntry->GetAttribute("keepTempFolder"); // MAY
1070         if (!anAttribute)
1071         {
1072                 AliWarning("keepTempFolder flag not set - default is FALSE");
1073         } else {
1074                 TString keepTempFolderStr = anAttribute->GetValue();
1075                 if (!(keepTempFolderStr == "0" || keepTempFolderStr == "1"))
1076                 {
1077                         AliError("keepTempFolder flag must be 0 or 1!");
1078                         return 4;
1079                 }
1080                 fKeepTempFolder = (Bool_t) keepTempFolderStr.Atoi();
1081         }
1082         
1083
1084         anAttribute = anEntry->GetAttribute("shuttleAdmin"); // MAY
1085         if (!anAttribute)
1086         {
1087                 AliDebug(2, "Warning! No \"shuttleAdmin\" attribute!");
1088         }
1089         else
1090         {
1091                 const char* anAdmin;
1092                 while ((anAdmin = anAttribute->GetValue()))
1093                 {
1094                         fAdmin[kGlobal]->AddLast(new TObjString(anAdmin));
1095                 }
1096         }
1097
1098         anAttribute = anEntry->GetAttribute("amandaAdmin"); // MAY
1099         if (!anAttribute)
1100         {
1101                 AliDebug(2, "Warning! No \"amandaAdmin\" attribute!");
1102         }
1103         else
1104         {
1105                 const char* anAdmin;
1106                 while ((anAdmin = anAttribute->GetValue()))
1107                 {
1108                         fAdmin[kAmanda]->AddLast(new TObjString(anAdmin));
1109                 }
1110         }
1111         
1112         anAttribute = anEntry->GetAttribute("sendMail"); // MAY
1113         if (!anAttribute)
1114         {
1115                 AliWarning("sendMail flag not set - default is FALSE");
1116         } else {
1117                 TString sendMailStr = anAttribute->GetValue();
1118                 if (!(sendMailStr == "0" || sendMailStr == "1"))
1119                 {
1120                         AliError("sendMail flag must be 0 or 1!");
1121                         return 4;
1122                 }
1123                 fSendMail = (Bool_t) sendMailStr.Atoi();
1124         }
1125                                                 
1126         return 0;
1127 }
1128
1129 //______________________________________________________________________________________________
1130 UInt_t AliShuttleConfig::SetSysConfig(TList* list)
1131 {
1132         // Set the online FXS configuration (DAQ + DCS + HLT)
1133         
1134         TLDAPEntry* anEntry = 0;
1135         TLDAPAttribute* anAttribute = 0;
1136         
1137         if (list->GetEntries() != 3) 
1138         {
1139                 AliError(Form("Wrong number of online systems found: %d !", list->GetEntries()));
1140                 return 1;
1141         } 
1142
1143         TIter iter(list);
1144         Int_t count = 0;
1145         SystemCode iSys=kDAQ;
1146         
1147         while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1148         {
1149                 anAttribute = anEntry->GetAttribute("system");
1150                 TString sysName = anAttribute->GetValue();
1151                 
1152                 if (sysName == "DAQ") 
1153                 {
1154                         iSys = kDAQ;
1155                         count += 1;
1156                 }
1157                 else if (sysName == "DCS")
1158                 {
1159                         iSys = kDCS;
1160                         count += 10;
1161                 }
1162                 else if (sysName == "HLT")
1163                 {
1164                         iSys = kHLT;
1165                         count += 100;
1166                 }
1167                 
1168                 anAttribute = anEntry->GetAttribute("dbHost");
1169                 if (!anAttribute) {
1170                         AliError(Form ("Can't find dbHost attribute for %s!!",
1171                                                 AliShuttleInterface::GetSystemName(iSys)));
1172                         return 5;
1173                 }
1174                 fFXSdbHost[iSys] = anAttribute->GetValue();
1175
1176                 anAttribute = anEntry->GetAttribute("dbPort"); // MAY
1177                 if (anAttribute)
1178                 {
1179                         fFXSdbPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1180                 } else {
1181                         fFXSdbPort[iSys] = 3306; // mysql
1182                 }
1183
1184                 anAttribute = anEntry->GetAttribute("dbUser");
1185                 if (!anAttribute) {
1186                         AliError(Form ("Can't find dbUser attribute for %s!!",
1187                                                 AliShuttleInterface::GetSystemName(iSys)));
1188                         return 5;
1189                 }
1190                 fFXSdbUser[iSys] = anAttribute->GetValue();
1191
1192                 anAttribute = anEntry->GetAttribute("dbPasswd");
1193                 if (!anAttribute) {
1194                         AliError(Form ("Can't find dbPasswd attribute for %s!!",
1195                                                 AliShuttleInterface::GetSystemName(iSys)));
1196                         return 5;
1197                 }
1198                 fFXSdbPass[iSys] = anAttribute->GetValue();
1199
1200                 anAttribute = anEntry->GetAttribute("dbName");
1201                 if (!anAttribute) {
1202                         AliError(Form ("Can't find dbName attribute for %s!!",
1203                                                 AliShuttleInterface::GetSystemName(iSys)));
1204                         return 5;
1205                 }
1206
1207                 fFXSdbName[iSys] = anAttribute->GetValue();
1208                 anAttribute = anEntry->GetAttribute("dbTable");
1209                 if (!anAttribute) {
1210                         AliError(Form ("Can't find dbTable attribute for %s!!",
1211                                                 AliShuttleInterface::GetSystemName(iSys)));
1212                         return 5;
1213                 }
1214                 fFXSdbTable[iSys] = anAttribute->GetValue();
1215
1216                 anAttribute = anEntry->GetAttribute("fxsHost");
1217                 if (!anAttribute) {
1218                         AliError(Form ("Can't find fxsHost attribute for %s!!",
1219                                                 AliShuttleInterface::GetSystemName(iSys)));
1220                         return 5;
1221                 }
1222                 fFXSHost[iSys] = anAttribute->GetValue();
1223
1224                 anAttribute = anEntry->GetAttribute("fxsPort"); // MAY
1225                 if (anAttribute)
1226                 {
1227                         fFXSPort[iSys] = ((TString) anAttribute->GetValue()).Atoi();
1228                 } else {
1229                         fFXSPort[iSys] = 22; // scp port number
1230                 }
1231
1232                 anAttribute = anEntry->GetAttribute("fxsUser");
1233                 if (!anAttribute) {
1234                         AliError(Form ("Can't find fxsUser attribute for %s!!",
1235                                                 AliShuttleInterface::GetSystemName(iSys)));
1236                         return 5;
1237                 }
1238                 fFXSUser[iSys] = anAttribute->GetValue();
1239
1240                 anAttribute = anEntry->GetAttribute("fxsPasswd");
1241                 if (anAttribute) fFXSPass[iSys] = anAttribute->GetValue();
1242         
1243                 anAttribute = anEntry->GetAttribute("fxsAdmin"); // MAY
1244                 if (!anAttribute)
1245                 {
1246                         AliDebug(2, "Warning! No \"fxsAdmin\" attribute!");
1247                 }
1248                 else
1249                 {
1250                         const char* anAdmin;
1251                         while ((anAdmin = anAttribute->GetValue()))
1252                         {
1253                                 fAdmin[iSys]->AddLast(new TObjString(anAdmin));
1254                         }
1255                 }
1256         
1257         }
1258         
1259         if(count != 111) {
1260                 AliError(Form("Wrong system configuration! (code = %d)", count));
1261                 return 6;
1262         }
1263         
1264         return 0;
1265 }
1266
1267 //______________________________________________________________________________________________
1268 UInt_t AliShuttleConfig::SetDetConfig(TList* detList, TList* dcsList)
1269 {
1270         // Set the detector configuration (general settings + DCS amanda server and alias/DP lists)
1271
1272         TLDAPEntry* anEntry = 0;
1273         
1274         TIter iter(detList);
1275         while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1276         {
1277                 
1278                 AliShuttleDetConfigHolder* detHolder = new AliShuttleDetConfigHolder(anEntry);
1279
1280                 if (!detHolder->IsValid()) {
1281                         AliError("Detector configuration error!");
1282                         delete detHolder;
1283                         return 7;
1284                 }
1285
1286                 TObjString* detStr = new TObjString(detHolder->GetDetector());
1287                 
1288                 // Look for DCS Configuration
1289                 TIter dcsIter(dcsList);
1290                 TLDAPEntry *dcsEntry = 0;
1291                 while ((dcsEntry = dynamic_cast<TLDAPEntry*> (dcsIter.Next())))
1292                 {
1293                         TString dn = dcsEntry->GetDn();
1294                         if(dn.Contains(detStr->GetName())) {
1295                                 AliDebug(2, Form("Found DCS configuration: dn = %s",dn.Data()));
1296                                 AliShuttleDCSConfigHolder* dcsHolder = new AliShuttleDCSConfigHolder(dcsEntry);
1297                                 if (!dcsHolder->IsValid()) {
1298                                         AliError("DCS configuration error!");
1299                                         delete detHolder;
1300                                         delete dcsHolder;
1301                                         return 7;
1302                                 }
1303                                 detHolder->AddDCSConfig(dcsHolder);
1304                         }
1305                 }
1306                 
1307                 
1308                 fDetectorMap.Add(detStr, detHolder);
1309                 fDetectorList.AddLast(detStr);
1310         }
1311         
1312         return 0;
1313 }
1314
1315 //______________________________________________________________________________________________
1316 UInt_t AliShuttleConfig::SetHostConfig(TList* list)
1317 {
1318         // Set the Shuttle machines configuration (which detectors processes each machine)
1319         
1320         TLDAPEntry* anEntry = 0;
1321         TLDAPAttribute* anAttribute = 0;
1322         
1323         fShuttleInstanceHost = gSystem->HostName();
1324         
1325         TIter iter(list);
1326         while ((anEntry = dynamic_cast<TLDAPEntry*> (iter.Next())))
1327         {
1328         
1329                 TString dn(anEntry->GetDn());
1330                 if (!dn.Contains(Form("shuttleHost=%s", fShuttleInstanceHost.Data()))) continue;
1331                 
1332                 if (!fProcessAll)
1333                 {
1334                         anAttribute = anEntry->GetAttribute("detectors");
1335                         const char *detName;
1336                         while((detName = anAttribute->GetValue())){
1337                                 TObjString *objDet= new TObjString(detName);
1338                                 fProcessedDetectors.Add(objDet);
1339                         }
1340                 }
1341         }       
1342         
1343         return 0;
1344 }
1345
1346
1347 //______________________________________________________________________________________________
1348 void AliShuttleConfig::Print(Option_t* option) const
1349 {
1350 // print configuration
1351 // options : "": print configuration for all detectors, aliases and DPs in compacted format
1352 //           "uncompact": print configuration for all detectors, aliases and DPs in uncompacted format
1353 //           "DET": print configuration for DET, aliases and DPs in compacted format
1354 //           "DET, uncompact": print configuration for DET, aliases and DPs in uncompacted format
1355
1356         TString result;
1357         result += '\n';
1358         
1359         TString mode = "test";
1360         if (fRunMode == kProd) mode = "production";
1361
1362         result += "########################################################################\n";
1363         result += Form(" Shuttle configuration from %s - Run Mode: <%s> \n", 
1364                                         fConfigHost.Data(), mode.Data());
1365         result += "########################################################################\n";
1366         result += Form("\nShuttle running on %s \n", fShuttleInstanceHost.Data());
1367
1368         if(fProcessAll) {
1369                 result += Form("All detectors will be processed! \n");
1370         } else {
1371                 result += "Detectors processed by this host: ";
1372                 TIter it(&fProcessedDetectors);
1373                 TObjString* aDet;
1374                 while ((aDet = (TObjString*) it.Next())) {
1375                         result += Form("%s ", aDet->String().Data());
1376                 }
1377                 result += "\n";
1378         }
1379
1380         result += Form("PP time out = %d - DCS time out = %d - max PP mem size = %d KB - max retries = %d "
1381                        "- DIM trigger waiting timeout = %d\n", 
1382                                 fPPTimeOut, fDCSTimeOut, fPPMaxMem, fMaxRetries, fTriggerWait);
1383         result += Form("FLAGS: keepDCSMap = %d - keepTempFolder = %d - SendMail = %d \n", 
1384                                 fKeepDCSMap, fKeepTempFolder, fSendMail);
1385         const TObjArray* shuttleAdmins = GetAdmins(kGlobal);
1386         if (shuttleAdmins->GetEntries() != 0)
1387         {
1388                 result += "SHUTTLE administrator(s): ";
1389                 TIter it(shuttleAdmins);
1390                 TObjString* anAdmin;
1391                 while ((anAdmin = (TObjString*) it.Next()))
1392                 {
1393                         result += Form("%s ", anAdmin->String().Data());
1394                 }
1395                 result += "\n";
1396         }
1397         const TObjArray* amandaAdmins = GetAdmins(kAmanda);
1398         if (amandaAdmins->GetEntries() != 0)
1399         {
1400                 result += "Amanda server administrator(s): ";
1401                 TIter it(amandaAdmins);
1402                 TObjString* anAdmin;
1403                 while ((anAdmin = (TObjString*) it.Next()))
1404                 {
1405                         result += Form("%s ", anAdmin->String().Data());
1406                 }
1407                 result += "\n\n";
1408         }
1409         result += "------------------------------------------------------\n";
1410
1411         result += Form("Logbook Configuration \n\n \tHost: %s:%d; \tUser: %s; ",
1412                 fDAQlbHost.Data(), fDAQlbPort, fDAQlbUser.Data());
1413
1414 //      result += "Password: ";
1415 //      result.Append('*', fDAQlbPass.Length());
1416         result += Form("\tDB: %s; \tTables: %s, %s, %s\n",
1417                 fDAQlbDB.Data(), fDAQlbTable.Data(), fShuttlelbTable.Data(), fRunTypelbTable.Data());
1418
1419         result += "\n\n";
1420         
1421         result += "------------------------------------------------------\n";
1422         result += "FXS configuration\n\n";
1423
1424         for(int iSys=0;iSys<3;iSys++){
1425                 result += Form("*** %s ***\n", AliShuttleInterface::GetSystemName(iSys));
1426                 result += Form("\tDB  host: %s:%d; \tUser: %s; \tName: %s; \tTable: %s\n",
1427                                                 fFXSdbHost[iSys].Data(), fFXSdbPort[iSys], fFXSdbUser[iSys].Data(),
1428                                                 fFXSdbName[iSys].Data(), fFXSdbTable[iSys].Data());
1429                 // result += Form("DB Password:",fFXSdbPass[iSys].Data());
1430                 result += Form("\tFXS host: %s:%d; \tUser: %s\n", fFXSHost[iSys].Data(), fFXSPort[iSys],
1431                                                 fFXSUser[iSys].Data());
1432                 // result += Form("FXS Password:",fFXSPass[iSys].Data());
1433                 const TObjArray* fxsAdmins = GetAdmins(iSys);
1434                 if (fxsAdmins->GetEntries() != 0)
1435                 {
1436                         result += "\tAdministrator(s): ";
1437                         TIter it(fxsAdmins);
1438                         TObjString* anAdmin;
1439                         while ((anAdmin = (TObjString*) it.Next()))
1440                         {
1441                                 result += Form("%s ", anAdmin->String().Data());
1442                         }
1443                         result += "\n\n";
1444                 }
1445         }
1446
1447         result += "------------------------------------------------------\n";
1448         result += "MonaLisa configuration\n\n";
1449         
1450         result += Form("\tHost: %s; \tTable name: %s",
1451                 fMonitorHost.Data(), fMonitorTable.Data());
1452                 
1453         result += "\n\n";
1454                 
1455         TString optStr(option);
1456
1457         result += "------------------------------------------------------\n";
1458         result += "Detector-specific configuration\n\n";
1459         
1460         TIter iter(fDetectorMap.GetTable());
1461         TPair* aPair = 0;
1462         
1463         while ((aPair = (TPair*) iter.Next())) {
1464                 AliShuttleDetConfigHolder* aHolder = (AliShuttleDetConfigHolder*) aPair->Value();
1465                 if (optStr != "" && !optStr.Contains(aHolder->GetDetector()) && 
1466                                 optStr.CompareTo("uncompact",TString::kIgnoreCase) != 0 )
1467                                 continue;
1468                 
1469                 result += Form("*** %s *** \n", aHolder->GetDetector());
1470
1471                 const TObjArray* responsibles = aHolder->GetResponsibles();
1472                 if (responsibles->GetEntries() != 0)
1473                 {
1474                         result += "\tDetector responsible(s): ";
1475                         TIter it(responsibles);
1476                         TObjString* aResponsible;
1477                         while ((aResponsible = (TObjString*) it.Next()))
1478                         {
1479                                 result += Form("%s ", aResponsible->String().Data());
1480                         }
1481                         result += "\n";
1482                 }
1483
1484                 result += Form("\tStrict run ordering: %s \n\n", aHolder->StrictRunOrder() ? "YES" : "NO");
1485                 
1486                 const TObjArray* dcsConfig = aHolder->GetDCSConfig();
1487                 
1488                 AliShuttleDCSConfigHolder* dcsHolder = 0;
1489                 TIter dcsIter(dcsConfig);
1490                 Int_t count=0;
1491                 while ((dcsHolder = dynamic_cast<AliShuttleDCSConfigHolder*> (dcsIter.Next())))
1492                 {
1493                         result += Form("\tAmanda server [%d]: %s:%d - MultiSplit = %d\n", count,
1494                                 dcsHolder->GetDCSHost(), dcsHolder->GetDCSPort(), dcsHolder->GetMultiSplit());
1495
1496                         const TObjArray* aliases = 0;
1497                         if (optStr.Contains("uncompact",TString::kIgnoreCase))
1498                         {
1499                                 aliases = dcsHolder->GetDCSAliases();
1500                         } else {
1501                                 aliases = dcsHolder->GetCompactDCSAliases();
1502                         }
1503
1504                         if (aliases->GetEntries() != 0)
1505                         {
1506                                 result += Form("\tDCS Aliases [%d]: ", count);
1507                                 TIter it(aliases);
1508                                 TObjString* anAlias;
1509                                 while ((anAlias = (TObjString*) it.Next()))
1510                                 {
1511                                         result += Form("%s ", anAlias->String().Data());
1512                                 }
1513                                 result += "\n";
1514                         }
1515
1516                         const TObjArray* dataPoints = 0;
1517                         if (optStr.Contains("uncompact",TString::kIgnoreCase))
1518                         {
1519                                 dataPoints = dcsHolder->GetDCSDataPoints();
1520                         } else {
1521                                 dataPoints = dcsHolder->GetCompactDCSDataPoints();
1522                         }
1523                         if (dataPoints->GetEntries() != 0)
1524                         {
1525                                 result += Form("\tDCS Data Points [%d]: ", count);
1526                                 TIter it(dataPoints);
1527                                 TObjString* aDataPoint;
1528                                 while ((aDataPoint = (TObjString*) it.Next())) {
1529                                         result += Form("%s ", aDataPoint->String().Data());
1530                                 }
1531                                 result += "\n";
1532                         }
1533                         count++;
1534                         result += "\n";
1535                 }
1536         }
1537         if(!fIsValid) result += "\n\n********** !!!!! Configuration is INVALID !!!!! **********\n";
1538
1539         AliInfo(result);
1540 }