Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

org.lcsim Conditions Database

Overview

The conditions database is designed to allow a running analysis or reconstruction module to access information about the run "conditions". In our current environment the "conditions" includes the entire detector description, since this is not hardwired into the framework at all.

...

The recommended format for storing conditions file collections is in a zip file. The conditions database includes facilities for downloading .zip files from the web and caching them on the user's machine, so no web connection is required when running analysis or reconstruction, as long as the required conditions have been previously accessed.

Accessing Conditions

The current system uses the following algorithm for accessing conditions based on detector name.

As an example we will use the name "myDetector" sdjan03 detector.

Recursively translate the detector name using alias files. The alias files are property files stored in one or more of the following locations.

...

  1. If the name is a URL with a file: protocol, the file or directory specified is assumed to contain the conditions.
    Here is an example zipfile location.
    No Format
    myDetector: file:/path/to/myDetectorsdjan03.zip
    
    Here is an example directory.
    No Format
    myDetector: file:/path/to/myDetectorsdjan03
    
  2. If the name is a remote URL then an attempt is made to download a zip file from that location (if the zip file is already in the local cache and up-to-date it is used from there).
  3. If the name is not a URL, we search for a directory or zip file in the following locations:
    1. ~/.lcsim/detectors
    2. In the lcsim.jar file itself
    3. In
      No Format
      http://www.lcsim.org/detectors/

If none of these succeed in finding the conditions for the specied detector the program will terminate.

Java Example

Here is an example of accessing conditions of the sdjan03 detector from Java code.

First, retrieve the default instance of the ConditionsManager.

No Format

ConditionsManager mgr = ConditionsManager.defaultInstance();

Then look up the conditions. The base location is http://www.lcsim.org/detectors/sdjan03.zip.

No Format

mgr.setDetector(testDet, 0);

Conditions are stored in sets, usually organized by single files or directories.

For example, sampling fractions can be found in the SamplingFractions.properties file, which is referred to as SamplingFractions when using the ConditionsManager.

No Format

ConditionsSet cs = _mgr.getConditions("SamplingFractions");

Now, the sampling fractions are available by their keys.

This code simply iterates over the keys and prints their keys and values.

No Format

for ( Object o : cs.keySet() )
{
    System.out.println(o.toString() + "=" + cs.getString(o.toString()) );
}