Project

General

Profile

Support #24134

Including large numbers of files

Added by Antoni Aduszkiewicz 5 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
03/05/2020
Due date:
% Done:

0%

Estimated time:
Duration:

Description

I am developing fhicl file structure to store DAQ parameters for ICARUS CRT front end boards. We need tens of fhicl files, each configuring several boards (total over a hundreds of boards), each board having about hundreds parameters, many of which are common.

Schematically, a fhicl file looks like this:

daq: {
   fragment_receiver: {
      board100: {
         parameter1: 3
         parameter2: 5e-1
         parameter3: 0
         parameter4: false
      }
      board101: {
         parameter1: 4
         parameter2: 7.2
         parameter3: 0
         parameter4: false
      }
   }
}

In order to make it easier to manage I would like to break it down into several files. With trial and error I found the following works:

#fhicl_base.fcl
daq : {
  fragment_receiver : {
#include "board100.fcl" 
#include "board101.fcl" 
  }
}
#board100.fcl
board100 : {
  parameter1: 3
  parameter2: 0.5
#include "common_board_parameters.fcl" 
}
#board101.fcl
board101 : {
  parameter1: 4
  parameter2: 7.2
#include "common_board_parameters.fcl" 
}
#common_board_parameters.fcl
parameter3: 0
parameter4: false

I like the solution, because it minimizes redundancy and thus possibilities to make a mistake. However I'm not sure if it's OK to use #include directive inside a curly bracket block. Is it something that may cause issues in the future?

History

#1 Updated by Kyle Knoepfel 5 months ago

  • Assignee set to Kyle Knoepfel
  • Status changed from New to Feedback
  • Project changed from fhicl-cpp to fhicl

FHiCL does support what you require, but it's spelled differently. Here, the concept of a prolog and the @table:: splicing operator will be of help (see the quick start guide).

# common_board_parameters.fcl
BEGIN_PROLOG
common_board_parameters: {
  parameter3: 0
  parameter4: false
}
END_PROLOG
# board100.fcl
#include "common_board_parameters.fcl" 

BEGIN_PROLOG
board100 : {
  parameter1: 3
  parameter2: 0.5
  @table::common_board_parameters
}
END_PROLOG
# board101.fcl
#include "common_board_parameters.fcl" 

BEGIN_PROLOG
board101 : {
  parameter1: 4
  parameter2: 7.2
  @table::common_board_parameters
}
END_PROLOG
# fhicl_base.fcl
#include "board100.fcl" 
#include "board101.fcl" 
daq : {
  fragment_receiver : {
    @table::board100
    @table::board101
  }
}

Please let me know if you encounter any other issues.

#2 Updated by Kyle Knoepfel 3 months ago

Antoni, unless we hear from you in the next week, we'd like to close this issue.

#3 Updated by Kyle Knoepfel about 2 months ago

  • Status changed from Feedback to Closed

No more feedback has been received, so we are closing this issue.



Also available in: Atom PDF