Mu2e Home

This page describes a facility that was present in Offline up to and including v0_3_4. Starting with the following release, v1_0_0, it was replaced with the File Lookup Policy.


The framework supports the concept of a search path for most files that, directly or indirectly, make up the run-time configuration of the framework. This feature goes by the name of edm::FileInPath and, as of cvs tag v0_3_3, Mu2e Offline uses FileInPath to find the following files:
  1. The geometry file, read by the GeometryService.
  2. The event generator run-time configuration file, read by the EventGenerator module.
  3. The conditions data run-time configuration file, read by the ConditionsService.
  4. Any files included into the above three files using #include.
  5. The magnetic field maps, read by the BFieldManagerMaker.
  6. The particle data table files, read by the ParticleDataTable class.
  7. The G4 macro file optionally read by
  8. The beam arrival time distribution read by FoilParticleGenerator. ( This should be moved into the conditions service ).

Input and output files of event-data are not included in the above; those are still specified by giving either a full or relative path. Nor is the framework runtime configuration file ( the .py file ) included in the above.

The Four Environment Variables

The implementation of FileInPath has been taken from an old snapshot of the CMS code; it does the job but it has a few oddities that we will need to fix some day. The header file is found in the framework source at $FRAMEWORK_DIR/FWCore/ParameterSet/interface/FileInPath.h ; many of the comments in that file are incorrect. The information on this web page is correct; in particular,
  1. The names of the environment variables start with FW_, not MU2E_.
  2. It is not possible to use . in a search path; instead one must specify the full path to the current directory.

In the following, it is presumed that the reader is familiar with the ideas of base releases and test releases.

FileInPath is driven by four environment variables defined in the table below,

FW_RELEASE_BASE      The full path of the root of the base release.
Defined in in the root of the base release.
FW_DATA_PATH      The path to disk space that files that do not belong in a release, perhaps because they are too big or perhaps because they are not logically married to particular cvs tags. Initially, only the magnetic field files have been stored in this location.
This variable is defined in $MU2E/
FW_BASE      The full path to the root of the test release. If you are not using a test release, this may remain undefined.
Defined by bin/ from the base release against which the test release was built.
FW_SEARCH_PATH      Colon delimited search path used by FileInPath; it contains the above elements in the order desired by the user. Most frequently you will want the order FW_BASE, FW_RELEASE_BASE, FW_DATA_PATH. There is an important oddity here: each element must be terminated with a / .
This variable is defined in of the base release and extended in bin/ .

This next section will work through an example to illustrate the operation of FileInPath. Consider locating the geometry file, which is specified in the runtime configuration file in the stanza that configures the GeometryService,

process.GeometryService = mu2e.Service("GeometryService",
FileInPath will look for a file named $FW_BASE/Mu2eG4/test/geom_01.txt; if that file exists, then FileInPath has finished its work and will return that filename. If it does not exist, then FileInPath will look for a file named $FW_RELEASE_BASE/Mu2eG4/test/geom_01.txt; if that file exists, then FileInPath has finished its work and will return that filename. If it does not exist, then FileInPath will look for a file named $FW_DATA_PATH/Mu2eG4/test/geom_01.txt; if that file exists, then FileInPath has finished its work and will return that filename. If that file does not exist, FileInPath will throw. One may vary the order of FW_SEARCH_PATH to cause the search to be done in a different order to exclude any subset of the three options.

Example 1: Setting up a Base Release

The table below gives example values for these variables after doing the following on ilcsim2:
> source /grid/fermiapp/products/mu2e/
> source /grid/fermiapp/mu2e/Offline/v0_3_3/

FW_DATA_PATH      /grid/fermiapp/mu2e/DataFiles
FW_BASE      undefined
FW_RELEASE_BASE      /grid/fermiapp/mu2e/Offline/v0_3_3
FW_SEARCH_PATH      /grid/fermiapp/mu2e/Offline/v0_3_3/:/grid/fermiapp/mu2e/DataFiles/

Note the trailing / in the elements of FW_SEARCH_PATH and the absense of the trailing / in the other environment variables.

Example 2: Setting up a Minimal Test Release

The table below gives the values of the environment variables after executing the following:
> source /grid/fermiapp/products/mu2e/
> source /grid/fermiapp/mu2e/Offline/v0_3_3/
> mkdir  /grid/fermiapp/mu2e/users/kutschke/test
> cd     /grid/fermiapp/mu2e/users/kutschke/test
> source /grid/fermiapp/mu2e/Offline/v0_3_3/bin/
FW_DATA_PATH      /grid/fermiapp/mu2e/DataFiles
FW_BASE      /grid/fermiapp/mu2e/users/kutschke/test
FW_RELEASE_BASE      /grid/fermiapp/mu2e/Offline/v0_3_3
FW_SEARCH_PATH      /grid/fermiapp/mu2e/users/kutschke/test/:/grid/fermiapp/mu2e/Offline/v0_3_3/:/grid/fermiapp/mu2e/DataFiles/
One must execute after doing a cd to the intended working directory.

Fermilab at Work ]  [ Mu2e Home ]  [ Mu2e @ Work ]  [ Mu2e DocDB ]  [ Mu2e Search ]

For web related questions:
For content related questions:
This file last modified Tuesday, 16-Aug-2011 18:30:06 CDT
Security, Privacy, Legal Fermi National Accelerator Laboratory