#include "AliDetector.h"
#include "AliGenerator.h"
#include "AliLoader.h"
+#include "AliLog.h"
enum
{
}
return fgInstance;
}
-
-//____________________________________________________________________________
-AliConfig::AliConfig():
- fTopFolder(0x0),
- fTaskFolder(0x0),
- fConstFolder(0x0),
- fDetectorTask(0x0),
- fDetectorFolder(0x0)
-{
- //
- // Default constructor, mainly to keep coding conventions
- //
- fgInstance=0;//never mind, its going to exit in next step
- Fatal("ctor","Constructor should not be called for a singleton\n");
-}
-//____________________________________________________________________________
-
-AliConfig::AliConfig(const AliConfig& conf):
- TNamed(conf),
- fTopFolder(0x0),
- fTaskFolder(0x0),
- fConstFolder(0x0),
- fDetectorTask(0x0),
- fDetectorFolder(0x0)
-{
- //
- // Copy constructor, mainly to keep coding conventions
- //
- fgInstance=0;
-
- Fatal("copy ctor",
- "Copy constructor should not be called for a singleton\n");
-}
-//____________________________________________________________________________
-
-AliConfig& AliConfig::operator=(const AliConfig& /*conf*/)
-{
- //
- // Assignment, mainly to keep coding conventions
- //
- fgInstance=0;
-
- Fatal("Assignment operator",
- "Assignment operator should not be called for a singleton\n");
- return *this;
-}
//____________________________________________________________________________
AliConfig::AliConfig(const char *name, const char *title):
//Main AliRoot Folder
if (fTopFolder == 0x0)
{
- Fatal("AliConfig(const char*, const char*)","Can not create Top Alice Folder.");
+ AliFatal("Can not create Top Alice Folder.");
return;//never reached
}
fTopFolder->SetOwner();
gROOT->GetListOfBrowsables()->Add(fTopFolder, name);
//Constants folder
- TFolder *fConstFolder = fTopFolder->AddFolder (fgkConstantsFolderName, "Constant parameters");
+ fConstFolder = fTopFolder->AddFolder (fgkConstantsFolderName, "Constant parameters");
fConstFolder->AddFolder("DatabasePDG", "PDG database");
// Add the tasks to //Folders
//Create new task named 'name' and titled 'title'
//as a subtask of the task named 'taskname'
- if (AliLoader::GetDebug()) Info("AddSubTask","Try to get folder named %s",taskname);
+ AliDebug(1, Form("Try to get folder named %s",taskname));
TObject* obj = fTopFolder->FindObject(taskname);
TTask * task = (obj)?dynamic_cast<TTask*>(obj):0x0;
if (task)
{
- if (AliLoader::GetDebug()) Info("AddSubTask"," Got");
+ AliDebug(1, " Got");
TTask * subtask = static_cast<TTask*>(task->GetListOfTasks()->FindObject(name));
if (!subtask)
{
}
else
{
- Warning("AddSubTask","Task named \"%s\" already exists in Task %s\n",name,taskname);
+ AliWarning(Form("Task named \"%s\" already exists in Task %s",name,taskname));
}
}
else
{
- Error("AddSubTask","Can not find task %s to put a new task in.",taskname);
+ AliError(Form("Can not find task %s to put a new task in.",taskname));
return 1;
}
return 0;
// Adds module to the event folder
TString path(eventfolder);
path = path + "/" + fgkModuleFolderName;
- if (AliLoader::GetDebug())
- Info("Add(AliModule*)","module name = %s, Ev. Fold. Name is %s.",
- obj->GetName(),eventfolder);
+ AliDebug(1, Form("module name = %s, Ev. Fold. Name is %s.",
+ obj->GetName(),eventfolder));
AddInFolder(path, obj);
}
//____________________________________________________________________________
retval = CreateDetectorFolders(evntfolder,name,title);
if (retval)
{
- Error("AddDetector","CreateDetectorFolders returned error for detector %s",name);
+ AliError(Form("CreateDetectorFolders returned error for detector %s",name));
return retval;
}
return 0;
retval = CreateDetectorFolders(evntfoldername,name,title);
if (retval)
{
- Error("AddDetector","CreateDetectorFolders returned error for detector %s",name);
+ AliError(Form("CreateDetectorFolders returned error for detector %s",name));
return retval;
}
// retval = CreateDetectorTasks(name,title);
void AliConfig::Add(AliDetector * obj,const char* eventfolder)
{
// Adds new AliDetector objest to the correspondent event folder
- if (AliLoader::GetDebug())
- Info("Add(AliDetector*)","detector name = %s, Ev. Fold. Name is %s.",
- obj->GetName(),eventfolder);
+ AliDebug(1, Form("detector name = %s, Ev. Fold. Name is %s.",
+ obj->GetName(),eventfolder));
TObject* foundobj = GetTopFolder()->FindObject(eventfolder);
TFolder* evfolder = (foundobj)?dynamic_cast<TFolder*>(foundobj):0x0;
if (evfolder == 0x0)
{
- Fatal("Add(AliDetector * obj,const char* eventfolder)",
- "Can not find folder %s while adding detector %s",eventfolder,obj->GetName());
+ AliFatal(Form("Can not find folder %s while adding detector %s",eventfolder,obj->GetName()));
return;
}
CreateDetectorFolders(evfolder, obj->GetName(), obj->GetTitle());
TFolder* evfolder = dynamic_cast<TFolder*>(GetTopFolder()->FindObject(evntfoldername));
if (evfolder == 0x0)
{
- Error("CreateDetectorFolders",
- "Can not find folder %s while adding detector %s",evntfoldername,name);
+ AliError(Form("Can not find folder %s while adding detector %s",evntfoldername,name));
return 1;
}
return CreateDetectorFolders(evfolder,name,title);
tmp = AddSubFolder(evntfolder,fDetectorFolder[i],name,title);
if (tmp)
{
- Error("AddDetector(TFolder*","Failed to create subfolder of %s for detector %s",fDetectorFolder[i].Data(),name);
+ AliError(Form("Failed to create subfolder of %s for detector %s",fDetectorFolder[i].Data(),name));
return 1;
}
i++;
name+fDetectorTask[i],(fDetectorTask[i]+" for ")+title);
if (tmp)
{
- Error("CreateDetectorTasks","Error occured while creating task for %s in %s.",
- name,fDetectorTask[i-1].Data());
+ AliError(Form("Error occured while creating task for %s in %s.",
+ name,fDetectorTask[i-1].Data()));
return 1;
}
i++;
return 0;
}
-//____________________________________________________________________________
-void AliConfig::Add (char *list)
-{
- // Adds space separated list of objects to the
- // configuration macro (?)
- char *path;
-
- const char *confPath = gSystem->Getenv ("ALICE_CONFIG_PATH");
- if (confPath) {
- path = new char[strlen (confPath)];
- strcpy (path, confPath);
- } else {
- const char *alice = gSystem->Getenv ("ALICE_ROOT");
- path = new char[strlen (alice) + 32];
-
- strcpy (path, ".:");
- if (alice) {
- strcat (path, alice);
- }
- strcat (path, "/macros/config");
- }
-
- char *token = strtok (path, ":");
-
- TList *dirlist = new TList;
-
- while (token != NULL)
- {
- dirlist->Add (new TObjString(token));
- token = strtok (NULL, ":");
- }
-
- token = strtok (list, " ");
-
- while (token != NULL)
- {
- Info("Add(char *list)","Configuring token=%s",token);
-
- TObject *obj;
- TIter next (dirlist);
- TString found = "\0";
-
- while ((obj = next ()))
- {
- TString dir(obj->GetName());
- TString path = dir + "/" + token;
- TString macro = path + ".C";
- if (!gSystem->AccessPathName (macro.Data()))
- {
- gInterpreter->ExecuteMacro (macro.Data());
- found = "(" + macro + ")";
- if (macro.Contains("/"))
- {
- TString dirname = gSystem->DirName(macro.Data());
- TString macroConfigure = dirname + "/Configure.C";
- if (!gSystem->AccessPathName (macroConfigure.Data()))
- {
- gInterpreter->ExecuteMacro (macroConfigure.Data());
- found += " => Configured";
- }
- }
- break;
- }
- else
- {
- TString macroDefault = path + "/Default.C";
- if (!gSystem->AccessPathName (macroDefault.Data()))
- {
- gInterpreter->ExecuteMacro (macroDefault.Data());
- found = "(" + macro + ")";
- TString macroConfigure = path + "/Configure.C";
- if (!gSystem->AccessPathName (macroConfigure.Data()))
- {
- gInterpreter->ExecuteMacro (macroConfigure.Data());
- found += " => Configured";
- }
- break;
- }
- }
- }
-
- if (strlen(found.Data()))
- {
- Info("Add(char *list)","found=%s => OK",found.Data());
- }
- else
- {
- Error("Add(char *list)"," => FAILED.");
- exit(1);
- }
-
- token = strtok (NULL," ");
- }
-
- if (dirlist) delete dirlist;
-
-}
-
/*****************************************************************************/
TFolder* AliConfig::BuildEventFolder(const char* name,const char* title)
TFolder *configuration = eventfolder->AddFolder(fgkConfigurationFolderName, "Run configuration");
configuration->AddFolder(fgkFieldFolderName, "Magnetic field maps");
configuration->AddFolder(fgkGeneratorsFolderName,"list of generator objects");
- configuration->AddFolder(fgkVirtualMCFolderName,"the Virtual MC");
+ //PH configuration->AddFolder(fgkVirtualMCFolderName,"the Virtual MC");
eventfolder->AddFolder(fgkHeaderFolderName,"MonteCarlo event header");
if (topfolder == 0x0)//check if exists top folder
{
- Error("AddSubFodler(TFolder*, ....","Parameter TFolder* points to NULL.");
+ AliError("Parameter TFolder* points to NULL.");
return 1;
}
folder = dynamic_cast<TFolder*>(topfolder->FindObject(infoler));
if (folder == 0x0) //check if we got inolder
{
- Error("AddSubFodler(TFolder*, ....","Can not find folder %s in folder %s.",infoler,topfolder->GetName());
+ AliError(Form("Can not find folder %s in folder %s.",infoler,topfolder->GetName()));
return 1;
}
obj = folder->FindObject(newfoldname); //see if such a subfolder already exists
TFolder *newfolder = folder->AddFolder(newfoldname,newfoldtitle);//add the desired subfolder
if (newfolder == 0x0) //check if we managed
{
- Error("AddSubFodler(TFolder*, ....","Can not create folder %s in folder %s",newfoldname,infoler);
+ AliError(Form("Can not create folder %s in folder %s",newfoldname,infoler));
return 2;
}
else return 0;//success
TFolder* fol = dynamic_cast<TFolder*>(obj);
if (fol == 0x0)
{
- Error("AddSubFodler(TFolder*, ....",
- "Object named %s already exists in folder %s AND IT IS NOT A FOLDER",newfoldname,infoler);
+ AliError(Form("Object named %s already exists in folder %s AND IT IS NOT A FOLDER",newfoldname,infoler));
return 3;
}
- Warning("AddSubFodler(TFolder*, ....",
- "Folder named %s already exists in folder %s",newfoldname,infoler);
+ AliWarning(Form("Folder named %s already exists in folder %s",newfoldname,infoler));
return 0;
}