Re: Moving the Geometry from data file to the parameters [message #9530 is a reply to message #9529] |
Wed, 07 October 2009 19:30 |
Mohammad Al-Turany
Messages: 518 Registered: April 2004 Location: GSI, Germany
|
first-grade participant |
From: *dip.t-dialin.net
|
|
Hallo Dima and Stefano,
Dima, in the macro you show here you should set the Runtime data base before the init of the run, and the last two lines are not needed because this is done internally, so you macro will look like:
Quote: |
gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
gROOT->LoadMacro("$VMCWORKDIR/gconfig/basiclibs.C");
rootlogon();
basiclibs();
FairRunAna *fRun= new FairRunAna();
fRun->SetInputFile("sim_emc.root");
fRun->SetOutputFile("test.root");
TString parFile = "simparams.root";
FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
FairParRootFileIo* parInput1 = new FairParRootFileIo();
parInput1->open(parFile.Data());
rtdb->setFirstInput(parInput1);
fRun->Init();
geom = gGeoManager;
|
In fact the geometry is now a parameter like any other parameter, except that it is a parameter of a RUN, just like the field or beam momentum, and because ROOT has the global variable gGeoManager which is set internally, there is no need to you or anybody to try to get himself from the parameter file. So in any Task which is added to the run you can simply use the gGeoManager in the init of your task or anywhere except in the ctor or the method SetParTask() because at the time when they are called the Parameter containers are still not initialized.
regards
Mohammad
|
|
|