GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » General » Moving the Geometry from data file to the parameters
Moving the Geometry from data file to the parameters [message #9440] Wed, 23 September 2009 00:08 Go to next message
Mohammad Al-Turany is currently offline  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
icon14.gif  Re: Moving the Geometry from data file to the parameters [message #9441 is a reply to message #9440] Wed, 23 September 2009 09:33 Go to previous messageGo to next message
Tobias Stockmanns is currently offline  Tobias Stockmanns
Messages: 489
Registered: May 2007
first-grade participant
From: *ikp.kfa-juelich.de
Hi Mohammad,

thank you for this important step.

Do you have some example macros where one can see the use of the parameter file with the geometry data?

Cheers,

Tobias
Re: Moving the Geometry from data file to the parameters [message #9442 is a reply to message #9441] Wed, 23 September 2009 10:21 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
HI,

Yes, for the sim macros nothing changed, all reco macros which use the parameters are also not effected, the geometry is build automatically. I had only to add the parameter file handling to the event display macro (macro/run/eventdisplay.C).

Anyway for Geane and some code there will be some small changes, and this work is ongoing.

Mohammad
Re: Moving the Geometry from data file to the parameters [message #9445 is a reply to message #9440] Wed, 23 September 2009 16:55 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  Mohammad Al-Turany
Messages: 518
Registered: April 2004
Location: GSI, Germany
first-grade participant
From: *gsi.de
Hi,

For those who wants to see or use the geometry from plain root I found an easy way to do it, namely:

Quote:

gROOT->LoadMacro("$VMCWORKDIR/gconfig/rootlogon.C");
rootlogon();

TFile* file = new TFile("testparams.root");
file->Get("FairBaseParSet");

// now the geometry is available as TGeo in memory

gGeoManager->GetMasterVolume()->Draw("ogl");


regards

Mohammad
Re: Moving the Geometry from data file to the parameters [message #9528 is a reply to message #9440] Wed, 07 October 2009 18:47 Go to previous messageGo to next message
Dima Melnychuk is currently offline  Dima Melnychuk
Messages: 213
Registered: April 2004
Location: National Centre for Nucle...
first-grade participant
From: *fuw.edu.pl
Hi Mohammad,

I tried to access geometry from the parameter file in the following way:

	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");
	fRun->Init();
	
	TString parFile = "simparams.root"; 
	FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
	FairParRootFileIo* parInput1 = new FairParRootFileIo();
	parInput1->open(parFile.Data());
	rtdb->setFirstInput(parInput1);
	
	
	FairBaseParSet* par=(FairBaseParSet*) (rtdb->getContainer("FairBaseParSet"));
	geom = par->GetGeometry(); 


sim_emc.root and simparams.root are files produced by /macro/emc/sim_emc.C

I supposed that "geom" should be a pointer to TGeoManager. But it is 0 in this case. What is wrong here?

I tried to create emc initialization task to initialize properly EmcMapper and I need access to TGeoManager there.

Dima
Re: Moving the Geometry from data file to the parameters [message #9529 is a reply to message #9528] Wed, 07 October 2009 18:51 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *to.infn.it
Hi Dima,
I think that after your:

FairBaseParSet* par=(FairBaseParSet*) (rtdb->getContainer("FairBaseParSet"));


you access to the geometry with gGeoManager, without geom = par->GetGeometry();

Try to use gGeoManager and let me know. This global object should be created automatically just after the parameter call, and then you can use it without creating it.
Re: Moving the Geometry from data file to the parameters [message #9530 is a reply to message #9529] Wed, 07 October 2009 19:30 Go to previous messageGo to next message
Mohammad Al-Turany is currently offline  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 Go to previous message
Mohammad Al-Turany is currently offline  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.
Previous Topic: New version of DPM
Next Topic: GENFIT restructuring in development branch is done - merge needed
Goto Forum:
  


Current Time: Tue Nov 26 00:56:26 CET 2024

Total time taken to generate the page: 0.00670 seconds