Local geometry customization
A special XML format has been developed to make some tests with customized versions of experiment setups.
There are the following example files in the directory, which can be used as a base of an own local customization of a geometry stored in the database:
- local_geometry.xml - customization of particular setup modules: disabling a detector, replacing its geometry file, adding a new detector to the setup and replacing the magnetic field map. The paths of the local files are to be changed to the own ones.
- setup_without_detectors.xml - the setup without any detector: only the cave, the magnet, the target and the vacuum beam pipe are left (can be used as it is).
- setup_without_calorimetry.xml - the setup without FHCal, ScWall, Hodo and HGND (can be used as it is).
The file is passed to the simulation macro after the geometry tag separated by ';', e.g.
root -b -q 'run_sim_bmn.C("", "bmnsim.root", 0, 10, BOX, "run9:;$VMCWORKDIR/database/geo_db/examples/setup_without_calorimetry.xml")'
The macro splits such a geometry tag into the setup tag and the path to the XML file by the static GeoSetup::ParseGeometryTag method, which can be used in other macros as well.
The setup is not loaded and the simulation is stopped, if the file contains any wrong setting: an unknown element or attribute, a wrong value, a missing geometry file, etc. All the errors of the file are reported at once. The environment variables in the paths are expanded, e.g. $VMCWORKDIR/my_geometry.root. A relative path of a geometry file is searched for in the same directories as FairRoot does: $GEOMPATH (the storage of the Local Geometry Database) and $VMCWORKDIR/geometry, so the files of other setups can be used by their names, e.g. file_path="DCH\_Run8.root". The boolean attributes accept true, yes, 1 and false, no, 0 (case is ignored).
The root element of the XML format is "setup". It supports three types of child elements.
- editSetupModule to load an own version of the specified detector, shift it or just disable it. The customized setup modules are selected either by the tag of the setup module (tag) or by the name of their module (module). The setting for a particular module has a priority over the setting for all the modules (module="*"), so a detector can be excluded from the latter with enable="true". If the same module is customized more than once, the latest setting is used. It supports the following attributes:
- tag: tag of the setup module, which will be customized (case is ignored). The tags are printed by the simulation macro ("Loading module with tag=...")
- module: name of the module in the database (e.g. GEM, FHCal), which will be customized, * - all the detector modules of the setup, i.e. all its modules except the cave, the magnet, the target and the beam pipe. The attribute is ignored if the tag is set. One of the tag and module attributes is required
- enable: false - disable the setup module, true - use the module with the changes set by the other attributes (default is true)
- file_path: path to a new geometry file of the module (default is empty, i.e. the database geometry file is used). The module from the new file is placed at the position of the setup module, as the database one
- moveX: value in cm, which sets a shift in X direction of the module relative to its position in the setup (default is 0)
- moveY: value in cm, which sets a shift in Y direction of the module relative to its position in the setup (default is 0)
- moveZ: value in cm, which sets a shift in Z direction of the module relative to its position in the setup (default is 0)
- addSetupModule to add a new module to the current setup. The module is added after all the modules of the setup. A module with the name of a module, which is already in the setup, is not added, because a duplicate module overlaps the geometry of the setup and renames the branches of its MC points: use editSetupModule with the file_path attribute to replace the geometry of a setup module instead. It supports the following attributes:
- class_name: required name of the module class, which must be inherited from FairModule, e.g. BmnDch, FairMagnet
- object_name: required name of the module object, which is passed to the constructor of the class (the same as the object name of a module class in the Geometry Database), e.g. DCH, MAGNET. The name is used by FairRoot for the names of the branches and the parameter containers of the module, so it may contain only letters, digits, '_', '.' and '-'
- active: true - the geometry of the detector is active, i.e. its MC points are recorded, false - passive geometry (default is true). The passive FairRoot modules (FairCave, FairMagnet, FairTarget, FairPipe) have no such flag in their constructors, so they are always added as passive ones
- file_path: required path to the geometry file of the module
- moveX: value in cm, which sets a shift in X direction of the module relative to its position in the geometry file (default is 0)
- moveY: value in cm, which sets a shift in Y direction of the module relative to its position in the geometry file (default is 0)
- moveZ: value in cm, which sets a shift in Z direction of the module relative to its position in the geometry file (default is 0)
- editFieldMap to use an own magnetic field map instead of the field map of the setup from the database. The reference voltage of the setup field from the database is used to scale the map. It supports the following attribute:
- file_path: required path to the ROOT file with the magnetic field map. A file name without a directory is searched for in the storage of the Local Geometry Database
Please, take into account that the shifts are applied only to the modules defined by ROOT files: a shift of the cave or of a module in the ASCII format (.geo) is an error. Only translations are supported: the rotation of a module is kept as it is.