Skip to content

Commit

Permalink
Merge pull request #82 from fmauger/feature-urn-management-support
Browse files Browse the repository at this point in the history
Feature urn management support
  • Loading branch information
drbenmorgan authored Feb 5, 2018
2 parents 859e649 + 512b948 commit fd289cf
Show file tree
Hide file tree
Showing 43 changed files with 2,256 additions and 659 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ endif()
# CMake/project requirements and configuration
#
cmake_minimum_required(VERSION 3.3 FATAL_ERROR)
project(Falaise VERSION "3.1.1")
project(Falaise VERSION "3.1.2")

# - Load custom modules
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -94,7 +94,7 @@ option(FALAISE_WITH_DOCS "Build documentation for Falaise" ON)
# - GSL
# - ROOT
# - Geant4
set(FALAISE_BAYEUX_MIN_VERSION 3.0.0)
set(FALAISE_BAYEUX_MIN_VERSION 3.1.1)
message( STATUS "Searching Bayeux ${FALAISE_BAYEUX_MIN_VERSION} ...")
find_package(Bayeux ${FALAISE_BAYEUX_MIN_VERSION} REQUIRED geant4)
# message( STATUS "Bayeux_VERSION = '${Bayeux_VERSION}'")
Expand Down
2 changes: 2 additions & 0 deletions documentation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ set(FALAISE_MARKDOWN_DOCS
flreconstruct/UsingServices.md
flreconstruct/DocumentingFLReconstructModules.md
flvisualize/FLVisualize.md
resource_file_management/FLResourceFileManagement.md
tag_management/FLTagManagement.md
)

set(FALAISE_ABSOLUTE_MARKDOWN_DOCS)
Expand Down
3 changes: 2 additions & 1 deletion documentation/Mainpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ introductions to using and extending the core applications:
- [Working with Run/Event Data in plugin modules](@ref workingwitheventrecords).
- [Using Services to access metadata](@ref usingservices).
- [FLVisualize](@ref usingflvisualize) guide for viewing simulated and reconstructed data.
- [Resource files](@ref manageresourcefiles): guide for the management of resource files published in Falaise
- [FLTags](@ref managetags): guide for using registered tags as identifiers for entities

Contributing to Falaise Development
===================================
Contributions to the core of Falaise are welcome. Please visit our [GitHub repo](https://github.com/SuperNEMO-DBD/Falaise)
for further information.

3 changes: 1 addition & 2 deletions documentation/flreconstruct/FLReconstruct.md
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ dependency scheme associated to this specific FLReconstruct script is:
+-- urn:snemo:demonstrator:setup:1.0:services
| +-- urn:snemo:demonstrator:geometry:4.0 (used geometry model)
+-- urn:snemo:demonstrator:setup:1.0:variants (used variant configuration)
| +-- urn:snemo:demonstrator:setup:1.0:variants:profiles:basic-1.0.0 (variant profile is fixed)
+-- urn:snemo:demonstrator:setup:1.0:variants:profiles:basic-1.0.0 (variant profile is fixed)
+-- urn:snemo:demonstrator:reconstruction:1.0.0:pipeline (reconstruction pipeline)
~~~~~

Expand Down Expand Up @@ -855,4 +855,3 @@ reconstruction via tuning existing modules or adding new ones then
custom pipeline scripts and modules can be used in `flreconstruct`. The
[Writing FLReconstruct Pipeline Scripts](@ref writingflreconstructpipelinescripts) tutorial covers the syntax and
structure of custom pipeline scripts.

6 changes: 3 additions & 3 deletions documentation/flsimulate/FLSimulate.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ displayed on the table below:
+-- urn:snemo:demonstrator:simulation:2.1:services (used service configuration)
| +-- urn:snemo:demonstrator:geometry:4.0 (used geometry model)
+-- urn:snemo:demonstrator:simulation:2.1:variants (used variant configuration)
| +-- urn:snemo:demonstrator:simulation:2.1:variants:profiles:default (default variant profile)
+-- urn:snemo:demonstrator:simulation:2.1:variants:profiles:default (default variant profile)
+-- urn:snemo:demonstrator:simulation:vertexes:4.1 (used vertex generation setup)
+-- urn:snemo:demonstrator:simulation:decays:1.2 (used decay generation setup)
~~~~~
Expand Down Expand Up @@ -948,8 +948,8 @@ List of available simulation setups {#usingflsimulate_summaryofavailablesimulati
* Associated to:
+ Services system: `"urn:snemo:demonstrator:simulation:2.1:services"`
+ Variant system: `"urn:snemo:demonstrator:simulation:2.1:variants"`
- Blessed profiles: the default one below
- Default profile: `"urn:snemo:demonstrator:simulation:2.1:variants:profiles:default"`
+ Blessed profiles: `"urn:snemo:demonstrator:simulation:2.1:variants:profiles:basic-1.0"`
+ Default profile: `"urn:snemo:demonstrator:simulation:2.1:variants:profiles:default"`


Available MC hits output profiles {#usingflsimulate_hits_output_profiles}
Expand Down
87 changes: 87 additions & 0 deletions documentation/resource_file_management/FLResourceFileManagement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
Manage resource files in Falaise {#manageresourcefiles}
=================================

\tableofcontents

Introduction to resource files {#manageresourcefiles_intro}
==============================

Each version of Falaise is delivered with a set of resource files,
stored from the `resources/` source directory.

A resource file is typically a *configuration file* used by the
simulation or the reconstruction pipeline to setup some specific
components of the data processing software chain. It may also consist
in a *data* file that must be loaded at program startup to initiate
some algorithms or functionalities.

Most of the configuration files published in Falaise use a text format
compatible with the ``datatools::properties`` or
``datatools::multi_properties`` classes provided by the Bayeux
library.

Resource files directory {#manageresourcefiles_resourcefilesdirectory}
========================

The resources/ source directory is located at the root of the
Falaise's source tree. After installation, the resources files will
be stored from the ̀̀{Falaise install path}/share/Falaise-{falaise
version}/resources/`` path.

The resources/ source directory is organized by topics :
configuration files, examples, tags (URN management). Each time a new
resource file has to be published, it must be stored in the relevant
subdirectory.

For example, the
``config/snemo/demonstrator/geometry/4.0/manager.conf`` file is the
top configuration file for the SuperNEMO demonstrator's virtual
geometry model identified with the tag ``4.0``. Should one add an
improved geometry model typically tagged ``4.1``, it would make sense
to store its new main configuration file as:
``config/snemo/demonstrator/geometry/4.1/manager.conf``.

Usually, building a new configuration for a given application
(simulation, reconstruction...) or service (geometry...) in Falaise
implies publishing several new resource files at the same time.
Developers or experts of the new functionality have to populate the
relevant files in specific possibly new subdirectories.

Resource file registration {#manageresourcefiles_resourcefileregistration}
==========================


Once stored in the `resources/` source directory, the new files must
be registered in Falaise. Falaise provides a dedicated script to
generate automatically the list of all resource files that are part of
a given release: the `resources/_BuildResourceList.sh` script. This
script must be run every time a resource file is added in or removed
from the `resources/` source directory. It builds the updated
official list of resource files associated to a given Falaise release.
This list is stored in the `resources/_resources.cmake` file which in
turn is read by CMake during the build & installation process.

Note that files of which the names start with an underscore (example:
``_foo.txt``) are *not* registered in the official list of resource
files. This convention enables to store in the ``resources/``
directory some files that are not intended to be published but only
used by experts during the development process.

Details are given in the `resources/_README_DEVELOPERS.rst` file.

Resource file path in Falaise {#manageresourcefiles_resourcefilepathinfalaise}
=============================

Falaise has a special mechanism to automatically locate the
installation path of any resource file. A special syntax is used to
describe the path of a resource file relatively to the resource
installation top directory. The syntax simply uses the ``@falaise:``
prefix in front of the relative path of the resource file. The
``datatools::fetch_path_with_env(std::string &)`` function, provided
by Bayeux, is used to resolve the real installation path of the file.
Essentially, this prefix acts as an environment variable storing the
installation path of the resource file directory.

Example: the real path of the main configuration file of the SuperNEMO geometry model
tagged 4.0 can be addressed with the following string:
``"@falaise:config/geometry/snemo/demonstrator/3.0/manager.conf"``
159 changes: 159 additions & 0 deletions documentation/tag_management/FLTagManagement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
Manage tags in Falaise {#managetags}
======================

\tableofcontents


Introduction to tags {#managetags_intro}
====================

A tag is the unique identifier of an official configuration of the
SuperNEMO experiment. Such a configuration may concern a specific
geometry model, the version of a software component, a model of the
experiment in the context of the Monte Carlo simulation, an assembly
of data processing modules for the reconstruction pipeline, a special
hardware setup for data collection runs... A tag can also be used to
identify some specific set of resources provided by/stored in a unique
resource file.

Tag are thus associated to some *logical entities*. The tag does not
provide the address, if any, of the tagged entity it is associated to.
However, a tag **may** be associated to some concrete resource (i.e. a
file). The real location of such a resource must be provided by a
*resolver* tool, when this makes sense. Such a location can be the path
of a resource file in the Falaise installation directory. It can be an
URL to be accessed through a network, using a specific protocol.

A tag is implemented through the URN concept (see
https://fr.wikipedia.org/wiki/Uniform_Resource_Name). An URN is a
simple character string which uses the **urn** scheme.

Example: the "urn:snemo:demonstrator:setup:1.0" tag is associated to a
specific model of the SuperNEMO demonstrator experiment, including its
geometry model and possibly the configuration of the electronics, the
database, the control and monitoring system. The
"urn:snemo:demonstrator:setup:1.0" tag is thus **unique**. Once the
model of the experiment, built as the assembly of several core
components, is represented in the Falaise library and/or companion
tools, its unique tag is officially published. The relationship
between a specific setup and its tag is bijective. This is a strict
rule that must be applied during the full lifecycle of the experiment.



Tag categories {#managetags_tagcategories}
==============

As mentioned above, a tag is associated to a logical entity, i.e. something that makes sense
to remember, store, associate to some other entities.

A tag must be associated to a **category**. A category is represented by a simple character string which identify
a concept or topic. Falaise supports several tag categories:

* ``experiment`` : this category is used to address a specific experiment.

Example: BiPo3, SuperNEMO demonstrator and ATLAS can be considered as experiments.
It is thus possible to associate an unique tag/URN to each of these entities:

* Atlas: ``"urn:atlas"``
* SuperNEMO Demonstrator: ``"urn:snemo:demonstrator"``
* BiPo3: ``"urn:bipo3"

An experiment entity provides the general context or framework used to operate
a specific data processing.

* ``geosetup`` : this category is associated to any *geometry model/setup*.

Example: the SuperNEMO Demonstrator experiment may have distinct
geometry models which can be chosen from an offical list (this is a mock example):

* Simple and naive geometry : ``"urn:snemo:demonstrator:geometry:1.0"``
* R&D model : ``"urn:snemo:demonstrator:geometry:2.0"``
* Idealised geometry : ``"urn:snemo:demonstrator:geometry:4.0"``
* Improved geometry model (but still approximated) : ``"urn:snemo:demonstrator:geometry:4.2"``
* Realistic geometry of the detector : ``"urn:snemo:demonstrator:geometry:5.0"``
* Realistic geometry of the detector including a realistic model of the detector's environment : ``"urn:snemo:demonstrator:geometry:5.2"``

Depending on the context and the goal to be reached, the user can choose any of these list of geometry setups
to operate some data processing (simulation, reconstruction...).

* ``expsetup`` : this category is associated to a model of the full *experimental setup*.
An experimental setup generally includes:

* a specific geometry model
* a specific configuration of the electronics, trigger system and DAQ
* a specific configuration of the control and monitoring system
* a specific configuration of various companion services (database...)

As an assembly of more fondamental entities, a specific experimental setup is expected
to depends on its components. An experimental setup is associated to its unique tag.
This tag automatically implies the tags (if any) of the components.

Example: the configuration of the SuperNEMO Demonstrator experimental setup during
the commissioning phase of the experiment is tagged : ``"urn:snemo:demonstrator:setup:0.2"``.
It implies the core components with the following list of tags (this is a mock example):

* ``"urn:snemo:demonstrator:geometry:5.0"``
* ``"urn:snemo:demonstrator:electronics:0.9-com"``
* ``"urn:snemo:demonstrator:cms:0.1"``
* ``"urn:snemo:demonstrator:db:0.3"``

Any change in the setup of at least one component implies a new experimental setup and thus
a new tag of the ``expsetup`` category.

* ``simsetup`` : this category is associated to a *simulation setup*
* ``recsetup`` : this category is associated to a *reconstruction setup*
* ``services`` : this category is associated to the configuration of a
*service management system*
* ``configuration`` : the category associated to the configuration
of some generic system or service which is not classified/specialized as the category listed above
* ``variants`` : the category associated to the configuration of a
*variant service*
* ``varprofile`` : the category associated to a *variant profile*.




Tag registration {#managetags_tagregistration}
================

When a tag is publised as the offical and unique identifier of some
entity used within Falaise, it must be registered in a special
database. A dedicated *URN database service* is provided by the
Falaise library to manage the registration of all tags used in the
library.

Practically, tags are described in files stored in the
``resources/urn/db/`` source directory. A new URN entry must be added
in one of the existing files from this directory in order to update
the list of published tags. Eventually, additional files can be added
to address some new categories of tags. These files are named *URN DB
files*. They use the ``datatools::multi_properties`` format.

As a minimum, a tag record provides the URN of the tag, its category
and a short description of the entity identified by the tag. It can
also contains other informations such as the dependees of the entity,
addressed by topic (see below).

The ``resources/urn/db/snemo_setup_db.conf`` files defines the full
list of tag registration *URN DB* files to be loaded when the Falaise
library starts.


Tag dependencies {#managetags_tagdependencies}
================

TBD


Tag to file resolver {#managetags_tagtofileresolver}
====================


The fltags application {#managetags_fltags}
=======================

Print usage :
~~~~~~
$ fltags --help
~~~~~~
9 changes: 5 additions & 4 deletions modules/EventBrowser/programs/FLVisualizeArgs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

// This project:
#include <falaise/app/metadata_utils.h>
#include <falaise/tags.h>
#include <falaise/snemo/detector/detector_manager.h>
#include <falaise/snemo/view/options_manager.h>
#include "FLVisualizeCommandLine.h"
Expand Down Expand Up @@ -202,7 +203,7 @@ void FLVisualizeArgs::do_postprocess(FLVisualizeArgs& flVisParameters) {
<< flVisParameters.experimentalSetupUrn << "'...");
// Check URN registration from the system URN query service:
{
std::string conf_category = "expsetup";
std::string conf_category = falaise::tags::experimental_setup_category();
DT_THROW_IF(!dtkUrnQuery.check_urn_info(flVisParameters.experimentalSetupUrn, conf_category),
std::logic_error,
"Cannot query URN='" << flVisParameters.experimentalSetupUrn << "'!");
Expand Down Expand Up @@ -233,7 +234,7 @@ void FLVisualizeArgs::do_postprocess(FLVisualizeArgs& flVisParameters) {
"Services configuration URN='" << flVisParameters.servicesConfigUrn << "'...");
// Check URN registration from the system URN query service:
{
std::string conf_category = "service";
std::string conf_category = falaise::tags::services_category();
DT_THROW_IF(!dtkUrnQuery.check_urn_info(servicesConfigUrn, conf_category), std::logic_error,
"Cannot query URN='" << servicesConfigUrn << "'!");
}
Expand Down Expand Up @@ -266,7 +267,7 @@ void FLVisualizeArgs::do_postprocess(FLVisualizeArgs& flVisParameters) {
geometryConfigUrn = servicesConfigUrnInfo.get_component("geometry");
// Check URN registration from the system URN query service:
{
std::string conf_category = "configuration";
std::string conf_category = falaise::tags::geometry_setup_category();
DT_THROW_IF(!dtkUrnQuery.check_urn_info(geometryConfigUrn, conf_category), std::logic_error,
"Cannot query URN='" << geometryConfigUrn << "'!");
}
Expand Down Expand Up @@ -330,7 +331,7 @@ void FLVisualizeArgs::do_postprocess(FLVisualizeArgs& flVisParameters) {
"Variant configuration URN='" << variantConfigUrn << "'...");
// Check URN registration from the system URN query service:
{
std::string conf_category = "variant";
std::string conf_category = falaise::tags::variant_service_category();
DT_THROW_IF(!dtkUrnQuery.check_urn_info(flVisParameters.variantConfigUrn, conf_category),
std::logic_error,
"Cannot query URN='" << flVisParameters.variantConfigUrn << "'!");
Expand Down
Loading

0 comments on commit fd289cf

Please sign in to comment.