Project

General

Profile

Feature #8962

Feature #9078: ParameterSet validation enhancements

Create 'TupleAs' class that supports FHiCL-to-C++ conversion

Added by Kyle Knoepfel about 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
12/08/2015
Due date:
% Done:

100%

Estimated time:
(Total: 60.00 h)
Spent time:
22.00 h (Total: 82.00 h)
Duration:

Description

In some cases, it is useful for experiments to be able to interpret FHiCL parameters as C++ types other than those that are commonly retrieved. For example, it is currently possible to do:

auto vec = pset.get<CLHEP::HepLorentzVector>("vector");

where the pset.get invocation retrieves a sequence and converts it into a CLHEP::HepLorentzVector object. In order to support this functionality with the new C++-typed FHiCL parameter registration, an additional type should be added:

TupleAs < U(T...) >  // ==> tuple of types 'T...' is converted to type 'U'

The above CLHEP example would then look like:

TupleAs < CLHEP::HepLorentzVector(double,double,double,double) > asVec { Key("vector") };

// Retrieval of the types is then
CLHEP::HepLorentzVector vec1 = asVec();

This implementation is admittedly a bit "wordier" than the 'pset.get' interface. However, it is much more explicit as to what is being done. If the long sequence of characters is difficult to read, the following is also allowed:

using HepLorentzVector_ft = CLHEP::HepLorentzVector(double,double,double,double);
TupleAs < HepLorentzVector_ft > asVec { Key("vector") };

The time estimate reflects 8 hours for implementing the feature and 16 hours for testing it and its interface with the other FHiCL C++ types.


Subtasks

Feature #11106: Redesign fhiclcpp parameter registration systemClosedKyle Knoepfel

History

#1 Updated by Kyle Knoepfel about 4 years ago

  • Parent task changed from #8773 to #9078

#2 Updated by Kyle Knoepfel about 4 years ago

  • Subject changed from Create FHiCL types that support conversion to Create fhiclcpp types that support conversion

#3 Updated by Kyle Knoepfel about 4 years ago

  • Target version deleted (1.18.00)

#4 Updated by Kyle Knoepfel about 4 years ago

  • Category set to Infrastructure
  • Target version set to 2.01.00
  • SSI Package fhicl-cpp added
  • SSI Package deleted (FHiCL)

#5 Updated by Kyle Knoepfel almost 4 years ago

  • Subject changed from Create fhiclcpp types that support conversion to Create 'TupleAs' class that supports FHiCL-to-C++ conversion
  • Description updated (diff)

#6 Updated by Kyle Knoepfel almost 4 years ago

  • Project changed from art to fhicl-cpp
  • Category deleted (Infrastructure)

#7 Updated by Kyle Knoepfel over 3 years ago

  • % Done changed from 0 to 30

#8 Updated by Kyle Knoepfel over 3 years ago

  • % Done changed from 30 to 80

#9 Updated by Kyle Knoepfel over 3 years ago

  • Status changed from Assigned to Resolved

Implemented with commit fhicl-cpp:babb40b.

#10 Updated by Kyle Knoepfel over 3 years ago

  • Target version changed from 2.01.00 to 1.17.05

#11 Updated by Kyle Knoepfel over 3 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF