Project

General

Profile

Feature #3202

Parameter set helper methods

Added by Rob Kutschke about 7 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Low
Assignee:
Target version:
Start date:
Due date:
09/30/2013
% Done:

100%

Estimated time:
8.00 h
Spent time:
Scope:
Internal
Experiment:
-
SSI Package:
fhicl-cpp
Co-Assignees:
Duration:

Description

Andrei has created a specialization for the fhicl::ParameterSet::get_if_present templated method that allows us to write code like:

CLHEP::Hep3Vector pos = pset.get<CLHEP::Hep3Vector>("position");

to read FHiCL written as:

position : [ -3904., 0., 10200. ]

The header and implementation are in the Mu2e GeneralUtilities library

ParameterSetHelpers.hh

ParameterSetHelpers.cc

We think that this code might be of use outside of Mu2e and propose it for inclusion into one of the libraries supported by the art team, cetlib? art?

Some other classes that could benefit from this include G4ThreeVector, CLHEP::HepLorentzVector, art::InputTag and perhaps some of the HepRotation/G4Rotation classes. I am sure there are many more that are of general use and that each experiment will find the basic technology useful for their own classes.

It's great that this sort of thing was designed into FHICLCPP.

What do the other experiments and the art team think of this proposal? We can talk about it at one of the stakeholders' meetings in early 2013.


Related issues

Related to art - Feature #6097: Propose that art take over this helper function Closed02/05/2015

History

#1 Updated by Christopher Green over 6 years ago

  • Due date set to 09/30/2013
  • Category set to Infrastructure
  • Target version set to 1.09.00
  • Estimated time set to 16.00 h
  • Scope set to Internal
  • Experiment - added
  • SSI Package - added

We are a little leery of implementing this exactly as specified, because we are unsure of whether it is possible to break the One Definition Rule this way. We would prefer to provide the ability for a user to add to the overload set for a free function, and then implement the facility for this CLHEP object in art to avoid adding a CLHEP dependency to fhicl-cpp. That said, we believe this solution has a simple implementation.

#2 Updated by Christopher Green over 6 years ago

  • Status changed from New to Accepted
  • Start date deleted (12/21/2012)

#3 Updated by Christopher Green almost 6 years ago

  • Target version changed from 1.09.00 to 521

#4 Updated by Kyle Knoepfel about 5 years ago

  • Related to Feature #6097: Propose that art take over this helper function added

#5 Updated by Kyle Knoepfel almost 5 years ago

  • Project changed from art to cet-is
  • Category deleted (Infrastructure)
  • Target version changed from 521 to 1.14.00

#6 Updated by Kyle Knoepfel almost 5 years ago

  • SSI Package fhicl-cpp added
  • SSI Package deleted (-)

#7 Updated by Kyle Knoepfel almost 5 years ago

  • Assignee set to Kyle Knoepfel
  • Estimated time changed from 16.00 h to 8.00 h

Based on discussion with Rob, the scope of this issue is now confined to support for CLHEP vectors (and possibly matrices).

#8 Updated by Kyle Knoepfel almost 5 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

The following statements are now supported:

// C++ code                                // Assumed convention (as specified in FHiCL file)
//===========================================================================================
pset.get< CLHEP::Hep2Vector       >(...);  //       vector : [ x, y       ]
pset.get< CLHEP::Hep3Vector       >(...);  //       vector : [ x, y, z    ]
pset.get< CLHEP::HepLorentzVector >(...);  //       vector : [ x, y, z, t ] 

as well as their corresponding pset.get_if_present functions. To use them, the following must be present in the user's code:

#include "art/Utilities/ParameterSetHelpers/CLHEP_ps.h" 

Support has not been included for any of the CLHEP::Rotation* matrix classes as the matrix classes are constructed with arguments that need to be more carefully specified and understood. Providing a simple pset.get interface does not seem appropriate in this case.

Implemented with art:9052b3891782ad211618e2f51fc14fcb71f8384b.

#9 Updated by Kyle Knoepfel almost 5 years ago

  • Status changed from Resolved to Closed


Also available in: Atom PDF