All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Namespaces | Functions
icarus::geo Namespace Reference

Namespaces

 details
 

Functions

template<typename ChannelMapClass , typename... Args>
std::unique_ptr
<::geo::GeometryCore
SetupICARUSGeometry (fhicl::ParameterSet const &pset, Args &&...args)
 Initialization of geometry with ICARUS specific conventions. More...
 
std::unique_ptr
<::geo::GeometryCore
LoadStandardICARUSgeometry (std::string const &configPath)
 Returns an instance of geo::GeometryCore with ICARUS geometry loaded. More...
 

Function Documentation

std::unique_ptr<::geo::GeometryCore > icarus::geo::LoadStandardICARUSgeometry ( std::string const &  configPath)
inline

Returns an instance of geo::GeometryCore with ICARUS geometry loaded.

Parameters
configPathpath to a FHiCL configuration file including geometry
Returns
a unique pointer with geo::GeometryCore object

The geometry is initialized with the configuration found in the FHiCL file pointed by configPath. Within that file, the geometry service provider configuration table is expected to be found as services.Geometry or, as fallback as Geometry. If neither is present, the whole configuration will be used.

ICARUS geometry configuration has special conventions, which include:

  • a full ChannelMapping configuration in the Geometry configuration block, equivalent to the one passed to ExptGeoHelperInterface service;
  • within it, a tool_type name.

The ChannelMapping table must be present in the configuration, and the tool_type configuration atom must match ICARUSsplitInductionChannelMapSetupTool. These parameters confirm that the standard ICARUS geometry is intended.

If a configuration table service.message or message is found, message facility is initialised with it, unless it is already running.

This utility is as simple to use as:

std::unique_ptr<geo::GeometryCore> geom
= icarus::geo::LoadStandardICARUSgeometry("standard_g4_icarus.fcl");

It has been tested in Cling interpreter provided with ROOT 6.22/08.

Note that it is considered an error not to use the return value of this function.

Definition at line 88 of file LoadStandardICARUSgeometry.h.

89 {
90  /*
91  * 1. load the FHiCL configuration
92  * 2. configuration check
93  * 3. load the standard geometry
94  * 4. return the geometry object
95  */
96 
97  using namespace std::string_literals;
98 
99  // this is the name of the tool expected in the configuration
100  static std::string const MagicToolName
101  { "ICARUSsplitInductionChannelMapSetupTool"s };
102 
103  //
104  // 1. load the FHiCL configuration
105  //
106  fhicl::ParameterSet config;
107  {
108  std::unique_ptr<cet::filepath_maker> const policy
109  { cet::lookup_policy_selector{}.select("permissive", "FHICL_FILE_PATH") };
110  fhicl::make_ParameterSet(configPath, *policy, config);
111  }
112 
113 
114  //
115  // 2. configuration check
116  //
117  std::string mfConfigPath;
118  if (!mf::isMessageProcessingSetUp()) {
119  for (std::string const& path: { "services.message"s, "message"s }) {
120  if (!config.is_key_to_table(path)) continue;
121  mfConfigPath = path;
122  break;
123  }
124  } // if no message facility yet
125 
126  std::string geomConfigPath;
127  for (std::string const& path: { "services.Geometry"s, "Geometry"s }) {
128  if (!config.is_key_to_table(path)) continue;
129  geomConfigPath = path;
130  break;
131  }
132  fhicl::ParameterSet const geomConfig = geomConfigPath.empty()
133  ? config: config.get<fhicl::ParameterSet>(geomConfigPath);
134 
135  if (!geomConfig.is_key_to_table("ChannelMapping")) {
136  throw std::runtime_error("icarus::geo::LoadStandardICARUSgeometry():"
137  " FHiCL configuration does not have a `ChannelMapping` section"
138  " (this is a ICARUS convention).\nConfiguration:\n"
139  + std::string(80, '-') + '\n'
140  + geomConfig.to_indented_string(1U)
141  + std::string(80, '-') + '\n'
142  );
143  }
144 
145  std::string const channelMappingToolType
146  = geomConfig.get("ChannelMapping.tool_type", ""s);
147  if (channelMappingToolType != MagicToolName) {
148  throw std::runtime_error("icarus::geo::LoadStandardICARUSgeometry() "
149  ": unexpected value '" + channelMappingToolType
150  + "' for `ChannelMapping.tool_type` configuration parameter (expected: '"
151  + MagicToolName + "').\nConfiguration:\n"
152  + std::string(80, '-') + '\n'
153  + geomConfig.to_indented_string(1U)
154  + std::string(80, '-') + '\n'
155  );
156  }
157 
158  //
159  // 3. load the standard geometry
160  //
161 
162  // set up message facility (we can live without, output would go to std::cerr)
163  if (!mfConfigPath.empty())
164  mf::StartMessageFacility(config.get<fhicl::ParameterSet>(mfConfigPath));
165 
166 
167  // 4. return the geometry object
168  return SetupICARUSGeometry<icarus::ICARUSChannelMapAlg>(geomConfig);
169 
170 } // icarus::geo::LoadStandardICARUSgeometry()
BEGIN_PROLOG triggeremu_data_config_icarus settings PMTADCthresholds sequence::icarus_stage0_multiTPC_TPC physics sequence::icarus_stage0_EastHits_TPC physics sequence::icarus_stage0_WestHits_TPC physics producers purityana0 caloskimCalorimetryCryoE physics caloskimCalorimetryCryoW physics path
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
template<typename ChannelMapClass , typename... Args>
std::unique_ptr<::geo::GeometryCore> icarus::geo::SetupICARUSGeometry ( fhicl::ParameterSet const &  pset,
Args &&...  args 
)

Initialization of geometry with ICARUS specific conventions.

Template Parameters
ChannelMapClasstype of channel mapping to be used
Parameters
psetconfiguration of the geometry service
Returns
an initialized instance of geo::GeometryCore service provider

The conventions that are specific to ICARUS are:

  • a copy of the channel mapping algorithm configuration is kept in the Geometry service configuration table, as ChannelMapping table; because of the unusual requirement, this item is mandatory (even if it may well be empty);
  • channel mapping objects may take a ChannelMapClass::Config object as configuration, which can be wrapped in a FHiCL table;
  • channel mapping configuration may contain a spurious tool_type entry which is ignored.

Definition at line 69 of file ICARUSstandaloneGeometrySetup.h.

69  {
70 
71  auto const& config = details::ConfigObjectMaker<ChannelMapClass>::make
72  (pset.get<fhicl::ParameterSet>("ChannelMapping"));
73 
74  auto channelMap = std::make_unique<ChannelMapClass>
75  (config, std::forward<Args>(args)...);
76 
78  (pset, move(channelMap));
79 
80  } // SetupICARUSGeometry()
std::unique_ptr< geo::GeometryCore > SetupGeometryWithChannelMapping(fhicl::ParameterSet const &pset, std::unique_ptr< geo::ChannelMapAlg > channelMap)
Initializes a LArSoft geometry object.