]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliConfig.cxx
Obsolete class AliFMDv2 removed
[u/mrichter/AliRoot.git] / STEER / AliConfig.cxx
CommitLineData
9e1a0ddb 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
acd84897 16/* $Id$ */
9e1a0ddb 17
88cb7938 18// Description:
19// This class is responsible for creating folder structure
20// All stuff of aliroot sits in one folder with name defined by
21// fgkTopFolderName data wich do not very trough event to event are
22// sitting in directly in "top folder" all data which changes from
23// event to event are sitting in one folder (which has more subfolders)
24// Idea is to have more than one event in folder structure which allows
25// usage of standard procedures in merging
26// Add(AliDetector*) calls Add(AliModule*) as AliDetector is a AliModule
27// as well and should be listed in module list
5d8718b8 28
b16a1b1e 29#include <TDatabasePDG.h>
30#include <TFolder.h>
31#include <TInterpreter.h>
88cb7938 32#include <TObjString.h>
b16a1b1e 33#include <TROOT.h>
88cb7938 34#include <TString.h>
b16a1b1e 35#include <TSystem.h>
88cb7938 36#include <TTask.h>
98490ea9 37#include <TVirtualMC.h>
b16a1b1e 38
9e1a0ddb 39#include "AliConfig.h"
40#include "AliDetector.h"
b16a1b1e 41#include "AliGenerator.h"
88cb7938 42#include "AliLoader.h"
43
44enum
45 {
46 kDetTaskQA = 0,
47 kDetTaskSDigitizer,
48 kDetTaskDigitizer,
49 kDetTaskRecontructioner,
50 kDetTaskTracker,
51 kDetTaskPID,
52 kDetTaskLast
53 };
54
55enum
56 {
57 kDetFolderData = 0,
58 kDetFolderCalibration,
59 kDetFolderAligmnet,
60 kDetFolderQA,
61 kDetFolderLast
62 };
9e1a0ddb 63ClassImp(AliConfig)
64
88cb7938 65AliConfig* AliConfig::fInstance = 0;
66
67//0 level folder
68const TString AliConfig::fgkTopFolderName("Folders");
69
70//1st level folder
71const TString AliConfig::fgkTasksFolderName("Tasks"); //task folder, commn
72const TString AliConfig::fgkConstantsFolderName("Constants");
73const TString AliConfig::fgkDefaultEventFolderName("Event"); //default folder for event, always used except merging
74
75//2st level folder
76//subfolder of event folder
77const TString AliConfig::fgkDataFolderName("Data");//folder for data (hits, digits, points, tracks) grouped by detectors
78const TString AliConfig::fgkModuleFolderName("Modules");//folder with modules objects
79const TString AliConfig::fgkConditionsFolderName("Conditions");//folder with conditions (mag. field etc.)
80const TString AliConfig::fgkConfigurationFolderName("Configuration");//folder with configuration (setup) of the detector
81const TString AliConfig::fgkHeaderFolderName("Header");//folder with header and other MC information
82
83//Tasks names, goes into fgkTasksFolderName folder
84const TString AliConfig::fgkDigitizerTaskName("Digitizer");
85const TString AliConfig::fgkSDigitizerTaskName("SDigitizer");
86const TString AliConfig::fgkReconstructionerTaskName("Reconstructioner");
87const TString AliConfig::fgkTrackerTaskName("Tracker");
88const TString AliConfig::fgkPIDTaskName("PIDTask");//;=) PIDer???
89const TString AliConfig::fgkQATaskName("QAtask");
90
91//3rd level folder
92//fgkConditionsFolderName subfolders
93const TString AliConfig::fgkCalibrationFolderName("Calibration");
94const TString AliConfig::fgkAligmentFolderName("Aligment");
95const TString AliConfig::fgkQAFolderName("QAout");
96
97//3rd level folder
98//fgkConfigurationFolderName subfolders
99const TString AliConfig::fgkFieldFolderName("Field");
100const TString AliConfig::fgkGeneratorsFolderName("Generators");
101const TString AliConfig::fgkVirtualMCFolderName("VirtualMC");
102
103
104const TString AliConfig::fgkPDGFolderName("Constants/DatabasePDG");//folder with PDG Database
105const TString AliConfig::fgkGeneratorFolderName("Configuration/Generators");//folder with generators
106const TString AliConfig::fgkMCFolderName("Configuration/VirtualMC");
9e1a0ddb 107
7e90ff59 108//____________________________________________________________________________
9e1a0ddb 109AliConfig* AliConfig::Instance ()
110{
111 //
112 // Instance method for singleton class
113 //
88cb7938 114 if(fInstance == 0)
115 {
116 fInstance = new AliConfig (fgkTopFolderName,"Alice data exchange board");
117 }
118 return fInstance;
b16a1b1e 119}
120
121//____________________________________________________________________________
6644b9ca 122AliConfig::AliConfig():
88cb7938 123 fTopFolder(0x0),
124 fTaskFolder(0x0),
125 fConstFolder(0x0),
126 fDetectorTask(0x0),
127 fDetectorFolder(0x0)
b16a1b1e 128{
129 //
130 // Default constructor, mainly to keep coding conventions
131 //
88cb7938 132 fInstance=0;//never mind, its going to exit in next step
133 Fatal("ctor","Constructor should not be called for a singleton\n");
9e1a0ddb 134}
b16a1b1e 135//____________________________________________________________________________
88cb7938 136
e2afb3b6 137AliConfig::AliConfig(const AliConfig& conf):
88cb7938 138 fTopFolder(0x0),
139 fTaskFolder(0x0),
140 fConstFolder(0x0),
141 fDetectorTask(0x0),
142 fDetectorFolder(0x0)
b16a1b1e 143{
144 //
145 // Copy constructor, mainly to keep coding conventions
146 //
88cb7938 147 fInstance=0;
b16a1b1e 148
149 Fatal("copy ctor",
150 "Copy constructor should not be called for a singleton\n");
151}
b16a1b1e 152//____________________________________________________________________________
88cb7938 153
b16a1b1e 154AliConfig::AliConfig(const char *name, const char *title):
155 TNamed(name,title),
88cb7938 156 fTopFolder(gROOT->GetRootFolder()->AddFolder(name,title)),
157 fTaskFolder(fTopFolder->AddFolder(fgkTasksFolderName, "ALICE Tasks")),
158 fConstFolder(0x0),
159 fDetectorTask(0x0),
160 fDetectorFolder(new TString[kDetFolderLast+1])
9e1a0ddb 161{
88cb7938 162// Constructor
163
164 //Main AliRoot Folder
165 if (fTopFolder == 0x0)
166 {
167 Fatal("AliConfig(const char*, const char*)","Can not create Top Alice Folder.");
168 return;//never reached
169 }
170 fTopFolder->SetOwner();
7e90ff59 171
88cb7938 172 fDetectorFolder[kDetFolderData] = fgkDataFolderName;
173 fDetectorFolder[kDetFolderCalibration] = fgkConditionsFolderName+"/"+fgkCalibrationFolderName;
174 fDetectorFolder[kDetFolderAligmnet] = fgkConditionsFolderName+"/"+fgkAligmentFolderName;
175 fDetectorFolder[kDetFolderQA] = fgkConditionsFolderName+"/"+fgkQAFolderName;
176 fDetectorFolder[kDetFolderLast] = "";
7e90ff59 177
88cb7938 178 gROOT->GetListOfBrowsables()->Add(fTopFolder, name);
7e90ff59 179
88cb7938 180 //Constants folder
181 TFolder *fConstFolder = fTopFolder->AddFolder (fgkConstantsFolderName, "Constant parameters");
182 fConstFolder->AddFolder("DatabasePDG", "PDG database");
7e90ff59 183
184 // Add the tasks to //Folders
185
88cb7938 186 TTask * qa = new TTask(fgkQATaskName, "Alice QA tasks");
187 fTaskFolder->Add(qa);
188 TTask * sd = new TTask(fgkSDigitizerTaskName, "Alice SDigitizer") ;
189 fTaskFolder->Add(sd);
190 TTask * di = new TTask(fgkDigitizerTaskName, "Alice Digitizer") ;
191 fTaskFolder->Add(di);
192 TTask * re = new TTask(fgkReconstructionerTaskName, "Alice Reconstructioner") ;
193 fTaskFolder->Add(re);
194 TTask * tr = new TTask(fgkTrackerTaskName,"Alice Tracker");
195 fTaskFolder->Add(tr);
196 TTask * pid = new TTask(fgkPIDTaskName,"Alice Particle Identification Task");
197 fTaskFolder->Add(pid);
198 fDetectorTask = new TString[kDetTaskLast+1];
199
200 fDetectorTask[kDetTaskQA] = fgkQATaskName;
201 fDetectorTask[kDetTaskSDigitizer] = fgkSDigitizerTaskName;
202 fDetectorTask[kDetTaskDigitizer] = fgkDigitizerTaskName;
203 fDetectorTask[kDetTaskRecontructioner] = fgkReconstructionerTaskName;
204 fDetectorTask[kDetTaskTracker] = fgkTrackerTaskName;
205 fDetectorTask[kDetTaskPID] = fgkPIDTaskName;
206 fDetectorTask[kDetTaskLast] = "";
207
208 fInstance=this;
9e1a0ddb 209}
210
7e90ff59 211//____________________________________________________________________________
9e1a0ddb 212AliConfig::~AliConfig()
213{
536b07c2 214 delete [] fDetectorFolder ;
88cb7938 215 delete [] fDetectorTask;
216 if (fTopFolder)
217 {
218 fTopFolder->SetOwner();
219 delete fTopFolder;
220 }
9e1a0ddb 221}
7e90ff59 222//____________________________________________________________________________
88cb7938 223
e2afb3b6 224void AliConfig::AddInFolder (const char *dir, TObject *obj)
9e1a0ddb 225{
88cb7938 226 TFolder *folder = dynamic_cast<TFolder *>(fTopFolder->FindObject(dir));
7e90ff59 227 if (folder)
228 folder->Add (static_cast<TObject *>(obj));
9e1a0ddb 229}
7e90ff59 230//____________________________________________________________________________
9e1a0ddb 231
88cb7938 232Int_t AliConfig::AddSubTask(const char *taskname, const char* name,const char* title)
7e90ff59 233{
88cb7938 234//Create new task named 'name' and titled 'title'
235//as a subtask of the task named 'taskname'
236
237 if (AliLoader::fgDebug) Info("AddSubTask","Try to get folder named %s",taskname);
238 TObject* obj = fTopFolder->FindObject(taskname);
239 TTask * task = (obj)?dynamic_cast<TTask*>(obj):0x0;
240 if (task)
241 {
242 if (AliLoader::fgDebug) Info("AddSubTask"," Got");
243 TTask * subtask = static_cast<TTask*>(task->GetListOfTasks()->FindObject(name));
244 if (!subtask)
245 {
246 subtask = new TTask(name,title);
247 task->Add(subtask);
248 }
249 else
250 {
251 Warning("AddSubTask","Task named \"%s\" already exists in Task %s\n",name,taskname);
252 }
253 }
254 else
255 {
256 Error("AddSubTask","Can not find task %s to put a new task in.",taskname);
257 return 1;
258 }
259 return 0;
9e1a0ddb 260}
261
7e90ff59 262//____________________________________________________________________________
e2afb3b6 263TObject* AliConfig::FindInFolder (const char *dir, const char *name)
9e1a0ddb 264{
7e90ff59 265 if(!name) return(fTopFolder->FindObject(name));
266 TFolder * folder = dynamic_cast<TFolder *>(fTopFolder->FindObject(dir));
267 if (!folder) return (NULL);
268 return(folder->FindObject(name));
9e1a0ddb 269}
270
7e90ff59 271//____________________________________________________________________________
88cb7938 272void AliConfig::Add (AliGenerator * obj,const char* eventfolder)
9e1a0ddb 273{
88cb7938 274 TString path(eventfolder);
275 path = path + "/" + fgkGeneratorsFolderName;
276 AddInFolder(path,obj);
9e1a0ddb 277}
278
7e90ff59 279//____________________________________________________________________________
88cb7938 280void AliConfig::Add (TVirtualMC * obj,const char* eventfolder)
9e1a0ddb 281{
88cb7938 282 TString path(eventfolder);
283 path = path + "/" + fgkMCFolderName;
284 AddInFolder(path, obj);
9e1a0ddb 285}
286
7e90ff59 287//____________________________________________________________________________
88cb7938 288void AliConfig::Add (TDatabasePDG * obj)
9e1a0ddb 289{
88cb7938 290 AddInFolder(fgkPDGFolderName, obj);
9e1a0ddb 291}
292
7e90ff59 293//____________________________________________________________________________
88cb7938 294void AliConfig::Add(AliModule* obj,const char* eventfolder)
9e1a0ddb 295{
88cb7938 296
297 TString path(eventfolder);
298 path = path + "/" + fgkModuleFolderName;
299 if (AliLoader::fgDebug)
300 Info("Add(AliModule*)","module name = %s, Ev. Fold. Name is %s.",
301 obj->GetName(),eventfolder);
302 AddInFolder(path, obj);
9e1a0ddb 303}
88cb7938 304//____________________________________________________________________________
9e1a0ddb 305
88cb7938 306Int_t AliConfig::AddDetector(TFolder* evntfolder, const char *name, const char* title)
307{
308//creates folders and tasks for the detector 'name'
309 Int_t retval;//returned value
310 retval = CreateDetectorFolders(evntfolder,name,title);
311 if (retval)
312 {
313 Error("AddDetector","CreateDetectorFolders returned error for detector %s",name);
314 return retval;
315 }
316 return 0;
317}
7e90ff59 318//____________________________________________________________________________
88cb7938 319
320Int_t AliConfig::AddDetector(const char* evntfoldername,const char *name, const char* title)
9e1a0ddb 321{
88cb7938 322//creates folders and tasks for the detector 'name'
323 Int_t retval;//returned value
324 retval = CreateDetectorFolders(evntfoldername,name,title);
325 if (retval)
326 {
327 Error("AddDetector","CreateDetectorFolders returned error for detector %s",name);
328 return retval;
329 }
330// retval = CreateDetectorTasks(name,title);
331// if (retval)
332// {
333// Error("AddDetector","CreateDetectorTasks returned error for detector %s",name);
334// return retval;
335// }
336 return 0;
9e1a0ddb 337}
88cb7938 338//____________________________________________________________________________
9e1a0ddb 339
88cb7938 340void AliConfig::Add(AliDetector * obj,const char* eventfolder)
341{
342 if (AliLoader::fgDebug)
343 Info("Add(AliDetector*)","detector name = %s, Ev. Fold. Name is %s.",
344 obj->GetName(),eventfolder);
345
346 TObject* foundobj = GetTopFolder()->FindObject(eventfolder);
347 TFolder* evfolder = (foundobj)?dynamic_cast<TFolder*>(foundobj):0x0;
348 if (evfolder == 0x0)
349 {
350 Fatal("Add(AliDetector * obj,const char* eventfolder)",
351 "Can not find folder %s while adding detector %s",eventfolder,obj->GetName());
352 return;
353 }
354 CreateDetectorFolders(evfolder, obj->GetName(), obj->GetTitle());
355
356// CreateDetectorTasks(obj->GetName(),obj->GetTitle());
357
358}
359//____________________________________________________________________________
360
361Int_t AliConfig::CreateDetectorFolders(const char* evntfoldername,const char *name, const char* title)
362{
363//creates a folders for detector named 'name' and titled 'title'
364//in a event folder named 'evntfoldername'
365//list of folder names where new folders are created is defined in fDetectorFolder array
366//detector folders are named 'name' and titled 'title' as well
367
368 TFolder* evfolder = dynamic_cast<TFolder*>(GetTopFolder()->FindObject(evntfoldername));
369 if (evfolder == 0x0)
370 {
371 Error("CreateDetectorFolders",
372 "Can not find folder %s while adding detector %s",evntfoldername,name);
373 return 1;
374 }
375 return CreateDetectorFolders(evfolder,name,title);
376}
377//____________________________________________________________________________
378Int_t AliConfig::CreateDetectorFolders(TFolder* evntfolder,const char *name, const char* title)
379{
380//creates a folders for detector named 'name' and titled 'title'
381//in a event folder 'evntfolder'
382//list of folder names where new folders are created is defined in fDetectorFolder array
383//detector folders are named 'name' and titled 'title' as well
384//Here we add only detector not an modules
385
386 Int_t tmp;
387 Int_t i = 0;//iterator
388 while(!fDetectorFolder[i].IsNull())
389 {
390 tmp = AddSubFolder(evntfolder,fDetectorFolder[i],name,title);
391 if (tmp)
392 {
393 Error("AddDetector(TFolder*","Failed to create subfolder of %s for detector %s",fDetectorFolder[i].Data(),name);
394 return 1;
395 }
396 i++;
397 }
398 return 0;
399}
400//____________________________________________________________________________
401Int_t AliConfig::CreateDetectorTasks(const char *name, const char* title)
402{
403 Int_t i = 0;
404 Int_t tmp;
405 while (i < kDetTaskLast)
406 {
407 tmp = AddSubTask(fgkTasksFolderName+"/"+fDetectorTask[i],
408 name+fDetectorTask[i],(fDetectorTask[i]+" for ")+title);
409 if (tmp)
410 {
411 Error("CreateDetectorTasks","Error occured while creating task for %s in %s.",
412 name,fDetectorTask[i-1].Data());
413 return 1;
414 }
415 i++;
416 }
417 return 0;
418}
9e1a0ddb 419
7e90ff59 420//____________________________________________________________________________
421void AliConfig::Add (char *list)
422{
423 char *path;
424
88cb7938 425 const char *conf_path = gSystem->Getenv ("ALICE_CONFIG_PATH");
426 if (conf_path) {
427 path = new char[strlen (conf_path)];
428 strcpy (path, conf_path);
7e90ff59 429 } else {
430 const char *alice = gSystem->Getenv ("ALICE_ROOT");
431 path = new char[strlen (alice) + 32];
432
433 strcpy (path, ".:");
434 if (alice) {
435 strcat (path, alice);
436 }
437 strcat (path, "/macros/config");
438 }
439
440 char *token = strtok (path, ":");
441
442 TList *dirlist = new TList;
443
444 while (token != NULL)
445 {
446 dirlist->Add (new TObjString(token));
447 token = strtok (NULL, ":");
448 }
449
450 token = strtok (list, " ");
451
452 while (token != NULL)
88cb7938 453 {
454 Info("Add(char *list)","Configuring token=%s",token);
7e90ff59 455
456 TObject *obj;
457 TIter next (dirlist);
458 TString found = "\0";
459
460 while ((obj = next ()))
88cb7938 461 {
462 TString dir(obj->GetName());
463 TString path = dir + "/" + token;
464 TString macro = path + ".C";
465 if (!gSystem->AccessPathName (macro.Data()))
466 {
467 gInterpreter->ExecuteMacro (macro.Data());
468 found = "(" + macro + ")";
469 if (macro.Contains("/"))
470 {
471 TString dirname = gSystem->DirName(macro.Data());
472 TString macroConfigure = dirname + "/Configure.C";
473 if (!gSystem->AccessPathName (macroConfigure.Data()))
474 {
475 gInterpreter->ExecuteMacro (macroConfigure.Data());
476 found += " => Configured";
477 }
478 }
479 break;
480 }
481 else
482 {
483 TString macroDefault = path + "/Default.C";
484 if (!gSystem->AccessPathName (macroDefault.Data()))
485 {
486 gInterpreter->ExecuteMacro (macroDefault.Data());
487 found = "(" + macro + ")";
488 TString macroConfigure = path + "/Configure.C";
489 if (!gSystem->AccessPathName (macroConfigure.Data()))
490 {
491 gInterpreter->ExecuteMacro (macroConfigure.Data());
492 found += " => Configured";
493 }
494 break;
495 }
496 }
497 }
7e90ff59 498
88cb7938 499 if (strlen(found.Data()))
500 {
501 Info("Add(char *list)","found=%s => OK",found.Data());
502 }
503 else
504 {
505 Error("Add(char *list)"," => FAILED.");
506 exit(1);
507 }
7e90ff59 508
88cb7938 509 token = strtok (NULL," ");
7e90ff59 510 }
511
512 if (dirlist) delete dirlist;
513
9e1a0ddb 514}
515
88cb7938 516/*****************************************************************************/
517
518TFolder* AliConfig::BuildEventFolder(const char* name,const char* title)
519{
520/*
521 creates the folder structure for one event
522 TopFolder_
523 | \
524 | Tasks
525 |_
526 | \
527 | Constants
528 |_
529 | \
530 | Event_
531 | | \
532 | | Modules(detector objects)
533 | |_
534 | | \
535 | | Header
536 | |_
537 | | \
538 | | Data_
539 | | | \
540 | | | TPC_
541 | | | | \
542 | | | | Hits(object;e.g. tree)
543 | | | |_
544 | | | | \
545 | | | | SDigits(object)
546 | | | |_
547 | | | | \
548 | | | | Digits(object)
549 | | | |_
550 | | | | \
551 | | | | RecPoints(object)
552 | | | |_
553 | | | \
554 | | | Tracks(object)
555 | | |_
556 | | \
557 | | ITS_
558 | | | \
559 | | | Hits(object;e.g. tree)
560 | | |_
561 | | | \
562 | | | SDigits(object)
563 | | |_
564 | | | \
565 | | | Digits(object)
566 | | |_
567 | | | \
568 | | | RecPoints(object)
569 | | |_
570 | | \
571 | | Tracks(object)
572 | |_
573 | \
574 | Configuration
575 |
576 |_
577 \
578 Event2_ (to be merged with event)
579 | \
580 | Modules(detector objects)
581 |_
582 | \
583 | Header
584 |_
585 | \
586 | Data_
587 | | \
588 | | TPC_
589 | | | \
590 | | | Hits(object;e.g. tree)
591 | | |_
592 | | | \
593 | | | SDigits(object)
594 | | |_
595 | | | \
596 | | | Digits(object)
597 | | |_
598 | | | \
599 | | | RecPoints(object)
600 | | |_
601 | | \
602 | | Tracks(object)
603 | |_
604 | \
605 | ITS_
606 | | \
607 | | Hits(object;e.g. tree)
608 | |_
609 | | \
610 | | SDigits(object)
611 | |_
612 | | \
613 | | Digits(object)
614 | |_
615 | | \
616 | | RecPoints(object)
617 | |_
618 | \
619 | Tracks(object)
620 |_
621 \
622 Configuration
623
624*/
625 TFolder* eventfolder = fTopFolder->AddFolder(name,title);
626
627 //modules
628 eventfolder->AddFolder(fgkModuleFolderName, "Detector objects");
629 //event data
630 eventfolder->AddFolder(fgkDataFolderName, "Detector data");
631
632 //Conditions
633 TFolder *conditions = eventfolder->AddFolder(fgkConditionsFolderName, "Run conditions");
634 conditions->AddFolder(fgkCalibrationFolderName,"Detector calibration data");
635 conditions->AddFolder(fgkAligmentFolderName,"Detector aligment");
636 conditions->AddFolder(fgkQAFolderName,"Quality Asurance Output"); //Folder with output of the QA task(s)
637 //Configuration
638 TFolder *configuration = eventfolder->AddFolder(fgkConfigurationFolderName, "Run configuration");
639 configuration->AddFolder(fgkFieldFolderName, "Magnetic field maps");
640 configuration->AddFolder(fgkGeneratorsFolderName,"list of generator objects");
641 configuration->AddFolder(fgkVirtualMCFolderName,"the Virtual MC");
642
643 eventfolder->AddFolder(fgkHeaderFolderName,"MonteCarlo event header");
644
645 eventfolder->SetOwner();
646
647 return eventfolder;
648}
649
650/*****************************************************************************/
9e1a0ddb 651
88cb7938 652TString AliConfig::GetQATaskName() const
653 {
654 //returns task name
655 return fDetectorTask[kDetTaskQA];
656 }
657/*****************************************************************************/
658
659TString AliConfig::GetDigitizerTaskName() const
660 {
661 //returns task name
662 return fDetectorTask[kDetTaskDigitizer];
663 }
664/*****************************************************************************/
665
666TString AliConfig::GetSDigitizerTaskName() const
667 {
668 //returns task name
669 return fDetectorTask[kDetTaskSDigitizer];
670 }
671/*****************************************************************************/
672
673TString AliConfig::GetReconstructionerTaskName() const
674 {
675 //returns task name
676 return fDetectorTask[kDetTaskRecontructioner];
677 }
678/*****************************************************************************/
679
680TString AliConfig::GetTrackerTaskName() const
681 {
682 //returns task name
683 return fDetectorTask[kDetTaskTracker];
684 }
685/*****************************************************************************/
686
687TString AliConfig::GetPIDTaskName() const
688 {
689 //returns task name
690 return fDetectorTask[kDetTaskPID];
691 }
692/*****************************************************************************/
693
694const TString& AliConfig::GetQAFolderName() const
695{
696//returns pathname of folder with QA output relative to Top Alice Folder
697 return fDetectorFolder[kDetFolderQA];
698}
699/*****************************************************************************/
700
701const TString& AliConfig::GetDataFolderName()
702{
703//returns name of data folder path relative to event folder
704 return fgkDataFolderName;
705}
706/*****************************************************************************/
707
708Int_t AliConfig::AddSubFolder(TFolder* topfolder, const char* infoler,
709 const char* newfoldname, const char* newfoldtitle)
710{
711//helper method
712//in topfolder looks for folder named 'infolder'
713//and if it exist it creates inside a new folder named 'newfoldname' and titled 'newfoldtitle'
714
715 if (topfolder == 0x0)//check if exists top folder
716 {
717 Error("AddSubFodler(TFolder*, ....","Parameter TFolder* points to NULL.");
718 return 1;
719 }
720
721 TObject *obj;
722 TFolder* folder;
723
724 folder = dynamic_cast<TFolder*>(topfolder->FindObject(infoler));
725 if (folder == 0x0) //check if we got inolder
726 {
727 Error("AddSubFodler(TFolder*, ....","Can not find folder %s in folder %s.",infoler,topfolder->GetName());
728 return 1;
729 }
730 obj = folder->FindObject(newfoldname); //see if such a subfolder already exists
731 if (obj == 0x0) //nope
732 {
733 TFolder *newfolder = folder->AddFolder(newfoldname,newfoldtitle);//add the desired subfolder
734 if (newfolder == 0x0) //check if we managed
735 {
736 Error("AddSubFodler(TFolder*, ....","Can not create folder %s in folder %s",newfoldname,infoler);
737 return 2;
738 }
739 else return 0;//success
740 }
0798b21e 741 //such an object already exists
742 TFolder* fol = dynamic_cast<TFolder*>(obj);
743 if (fol == 0x0)
744 {
745 Error("AddSubFodler(TFolder*, ....",
746 "Object named %s already exists in folder %s AND IT IS NOT A FOLDER",newfoldname,infoler);
747 return 3;
748 }
749 Warning("AddSubFodler(TFolder*, ....",
750 "Folder named %s already exists in folder %s",newfoldname,infoler);
751 return 0;
88cb7938 752}