rat-pac/rat-pac — pull request #9 by BenLand100 (2014-11-26 21:52:29+00:00)
Title: Add DetectorFactory and dynamic specification of Watchman coverage

No merging until I've written proper documentation for new functionality, but so people can see and comment:

This adds a new type of factory which can build a DB defined geometry on the fly (less useful), or modify an existing DB defined geometry template (more useful) before the geometry itself is built. I decided to add this because there was no nice way to have a property of a geometry component defined as a formula (a function of other geometry parameters) in the ```.geo``` file, and no nice way to algorithmicly define PMT positions. The ```DetectorFactory``` to use is specified by name in the ```DETECTOR``` table under the field ```detector_factory``` and supersedes the ```geo_file``` field if used. If no ```DetectorFactory``` is specified, previous behavior is preserved. A ```DetectorFactory``` should define tables in the DB in the same way a ```.geo``` file would and make use of existing ```GeoFactory``` components. Intended use would be to load a normal (statically defined) ```.geo``` file into the DB and modify it as necessary for the dynamic functionality.

The second commit adds a ```DetectorFactory``` called ```Watchman``` which loads the default ```Watchman/Watchman.geo``` and modifies the geometry to give a desired covering fraction as specified by the field ```covering_fraction``` in the ```DETECTOR``` table. One must also specify the effective area of the PMTs as mm^2 in ```pmt_area```. It sounds complicated, but usage is simple. To run simulations in a Watchman style detector with 20% PMT coverage use this template:

```
/rat/db/set DETECTOR experiment "Watchman"
/rat/db/set DETECTOR detector_factory "Watchman"
/rat/db/set DETECTOR covering_fraction 0.2
/rat/db/set DETECTOR pmt_area 72966.0 #12" diameter in mm^2

/run/initialize
```

The default geometry will be completely rebuilt on the fly, and the resulting PMT positions will be stored in the output .root file in the usual way.