The new geometry interface

(Preliminary Documentation)

by Ilse Koenig, GSI May 8, 2004

The main aim of this preminary documentation is to show, how to run the new geometry interface. A more detailed documentation will follow soon.


Content

Changes in HYDRA and HGEANT


Necessary changes to run HYDRA and HGEANT
HYDRA
To run HYDRA the new HYDRA library libSimulation.so must be added in the hadenv shell script and in the rootlogon.
The new library libOraSim.so must be only loaded in cases, where the full GEANT geometry should be read from Oracle. This library is not needed for the initialization of the geometry parameter containers in the analysis. Additionally the ROOT library geom must be loaded, it is be loaded by default. Typically both libraries are loaded only in the macros.

HGEANT
To compile and run HGEANT only the HYDRA libraryies libHydra.so and libSimulation.so are needed and additionally libOraSim.so, if you want to compile and run with the Oracle interface (Flag WITHORACLE in hgeanthef.h). An appropriate rootlogon should be added in the same directory as the hgeant executable (otherwise all HYDRA libaries would be loaded).


Initialization file for HGEANT: geaini.dat
Geometry read from files
All old initialization files with read the geometry from files (*.geo) can be used without changes with one restriction concerning the detector setup: The old geom-files (typically the files for the MDC and the TOF/Tofino may contain an inout flag for modules, which defines, if this module should be created in the geometry or not. This flag is ignored in the new interface. To define subsets an additional setup file ( with extension ".setup") must me added in the geaini file.
The default setup for the MDC in the new interface are 24 modules and for the TOF the 8 outer TOF modules plus the 4 Tofino modules in each sector. Most old simulations where done with full detector setups (except NOV02SIM with alignment). There is no need to change the geaini files.

Below are two examples who to define subsets:
Line 1 containes the detector name in brackets.
Line 1 - 6 specifiy the setup in each sector with 1 = "in sectup", 0 = "not in setup".

// TOF with 22 modules without Tofino
// (in HGEANT: TOF modules 1 - 22, Tofino 23 - 26)
[tof]
SEC1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
SEC2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
SEC3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
SEC4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
SEC5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
SEC6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0
//
// NOV02 MDC setup
[mdc]
SEC1 1 1 1 1
SEC2 1 1 0 0
SEC3 1 1 1 0
SEC4 1 1 1 1
SEC5 1 1 0 0
SEC6 1 1 1 0
Geometry read from Oracle
If you want to read the whole or part of the geometry from Oracle, you must specify the simulation reference run (by name). This defines the geometry version.
As in the analysis you may additionally specify a history date, to get an older (e.g. "01-DEC-2003 12:00:00") or the latest version ("now"). The default history date is the last parameter release or "now", in case no parameter release exists for this simulation project.
The interface reads from Oracle allways the full detector setups. A setup-file must be added to define subsets.
The following geaini file with read the whole geometry, media and hit definition parameters from Oracle. (Keywords are marked red.)
! GEANT key words
!
!
PMCF 1
AUTO 1
KINE 0
CKOV 1
FMAP 2
RNDM 123 456
FPOL 0.7215    ! // scaling of full field
MXST 25000
SECO 3 1
JVER 2 2 0     ! // smeared vertex
BEAM 1 2 2000 0 0 0 
LOSS 1
DRAY 1
TRIG 20000
!RUNG 2332 1
SPLIT 2
FILE 1
SWIT 0 0
TIME 0 1000000 1000000
END            ! End of gffread
//
// ******************************************************************
//
// geometry for NOV02SIM DST production for high field + alignment
//
SimulRefRunDb:   nov02sim_highfieldalign_gen1
//HistoryDateDb:   now
//
// MDC setup for nov02
/misc/ilse/analdev/macros/Geom/detector.setup
//
/misc/halo/field/fldrpz_unf.map
//
/scratch.local/ilse/test/c2c.v1.3.f14.19.evt
//
kine.tup
rich.tup
mdc.tup
tof.tup
shower.tup
/scratch.local/ilse/test/c2c.v1.3.f14.19.root
You may specify the run id in the GEANT flags (keyword RUNG). But you risk to use a run id, which already exists in Oracle. At least for official simulations, one should leave it up to the build-in runid-generator (as used also by the daq), to create a unique run id.

You may also mix input from Oracle (extension _gdb) and input from file (extension .geo) as in the old interface. In this following example the rich and target geometry would be read from local files and all the rest from Oracle.

....
END            ! End of gffread
//
// ******************************************************************
//
// ideal geometry since oct03
//
SimulRefRunDb:  sep03sim_highfield_3gev_gen1
HistoryDateDb:  now
//
mediaAll_gdb
cave_gdb
sect_gdb
coils_gdb
mdc_gdb
tof_gdb
show_gdb
frames_gdb
/misc/ilse/simul/geodat/rich_oct03.geo
/misc/ilse/simul/geodat/LH2_target.geo
//
// ******************************************************************
....


Example Macros for HYDRA
Creation of the geometry in ROOT
{
  gSystem->Load("libGeom");
  gSystem->Load("libOraSim");

  TString configFile="/misc/ilse/simul/geainiora.dat";

  HGeomInterface* interface=new HGeomInterface;

  HGeomOraIo* oraInput=new HGeomOraIo;
  oraInput->open();
  interface->setOracleInput(oraInput);

  TGeoManager* geom = new TGeoManager("HadesGeom", "HADES geometry");
  HGeomRootBuilder* builder=new HGeomRootBuilder("builder","geom builder");
  builder->setGeoManager(geom);
  interface->setGeomBuilder(builder);

  Bool_t rc=interface->readGeomConfig(configFile.Data());
  if (rc) rc=interface->createGeometry();
  if (!rc) printf("Creation of geometry failed!\n");

  if (rc) builder->checkOverlaps();
  if (rc) TBrowser* browser=new TBrowser;
  else {
    delete interface;
    delete geom;
    return;
  }

/*
  delete interface;
  delete browser;
  delete geom;
*/
}

Creation of ASCII geo-files from Oracle

{
  gSystem->Load("libGeom");
  gSystem->Load("libOraSim");

  TString configFile="/misc/ilse/simul/geainiora.dat";

  HGeomInterface* interface=new HGeomInterface;

  HGeomOraIo* oraInput=new HGeomOraIo;
  oraInput->open();
  interface->setOracleInput(oraInput);

  HGeomAsciiIo* output=new HGeomAsciiIo;
  output->setDirectory("/tmp/ilse/ora");
  interface->setOutput(output);

  interface->readGeomConfig(configFile.Data());
  Bool_t rc=interface->readAll();  
  if (rc) interface->writeAll();
  delete interface;
}

Overlap checking for alignment

Comparison of two versions