Moving the Geometry from data file to the parameters [message #9440] |
Wed, 23 September 2009 00:08 |
Mohammad Al-Turany
Messages: 518 Registered: April 2004 Location: GSI, Germany
|
first-grade participant |
From: *dip.t-dialin.net
|
|
Hello,
As was discussed a few months ago, the geometry is moved from the data files to the parameter file, this make the fRun->LoadGeomerty() method obsolete, and requires loading the parameters wherever the geometry is needed. usually this is the case for digi and reco macro, and I modify the event display macro to do the same.
please test it and let me know.
Mohammad
|
|
|
|
|
|
|
|
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
|
|
|
Re: Moving the Geometry from data file to the parameters [message #9531 is a reply to message #9530] |
Wed, 07 October 2009 19:36 |
Mohammad Al-Turany
Messages: 518 Registered: April 2004 Location: GSI, Germany
|
first-grade participant |
From: *dip.t-dialin.net
|
|
Hallo again,
Stefano: the line of code you wrote before:
Quote: |
FairBaseParSet* par=(FairBaseParSet*) (rtdb->getContainer("FairBaseParSet"));
|
is called in the FairRunAna, so there is no need to call it yourself! Moreover after connecting a parameter file and calling the FairRunAna::Init(), the gGeoManager should be a valid pointer (if there was a geometry used in the parameters!). and can be used.
Mohammad.
|
|
|