All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FixBeamGateInfo_module.cc
Go to the documentation of this file.
1 /**
2  * @file FixBeamGateInfo_module.cc
3  * @brief Rewrites a collection of sim::BeamGateInfo.
4  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
5  * @date March 9, 2022
6  */
7 
8 // LArSoft libraries
9 #include "lardataalg/Utilities/intervals_fhicl.h" // microseconds from FHiCL
10 #include "lardataalg/Utilities/quantities/spacetime.h" // microseconds
11 #include "lardataalg/DetectorInfo/DetectorTimingTypes.h" // simulation_time
15 
16 // framework libraries
17 #include "art/Framework/Core/SharedProducer.h"
18 #include "art/Framework/Core/ModuleMacros.h"
19 #include "art/Framework/Principal/Event.h"
20 #include "canvas/Utilities/InputTag.h"
21 #include "messagefacility/MessageLogger/MessageLogger.h"
22 #include "fhiclcpp/types/TableAs.h"
23 #include "fhiclcpp/types/OptionalTable.h"
24 #include "fhiclcpp/types/OptionalAtom.h"
25 #include "fhiclcpp/types/Sequence.h"
26 #include "fhiclcpp/types/Atom.h"
27 
28 // C/C++ standard libraries
29 #include <vector>
30 #include <string>
31 #include <optional>
32 #include <memory> // std::make_unique()
33 
34 
35 //------------------------------------------------------------------------------
36 namespace icarus::trigger { class FixBeamGateInfo; }
37 
38 /**
39  * @brief Rewrites a set collection of beam gates into each event.
40  *
41  * This module allows to perform fixed transformations to an existing beam
42  * gate data product (`sim::BeamGateInfo`), producing a new set of gates.
43  *
44  *
45  * Output data products
46  * =====================
47  *
48  * * `std::vector<sim::BeamGateInfo>`: a collection of as many
49  * `sim::BeamGateInfo` as in the input.
50  *
51  *
52  * Configuration parameters
53  * =========================
54  *
55  * A terse online description of the parameters is printed by running
56  * `lar --print-description FixBeamGateInfo`.
57  *
58  * * `BeamGateTag` (input tag, mandatory): data product with the beam gates to
59  * be "fixed"
60  * * `Changes` (list of tables): a list of beam gate changes to be performed;
61  * the changes are performed in the order of this list, all the ones which
62  * apply (e.g. not stopping at the first that applies). Each item must
63  * specify at least an action to be taken (changing either start or width
64  * of the gate). Each element in the list is a table including:
65  * * `Select` (optional table): if specified, the following changes apply
66  * only to the gates that match the constraints as follows.
67  * * `Types` (list of gate types): if specified, the changes will be
68  * applied only to gates of type specified in the list; the gate type
69  * is specified by name (e.g. `"BNB"`, `"NuMI"`). If not specified,
70  * the changes are applied to all types of gates.
71  * * `Width` (optional table): a table with the operations affecting the
72  * duration of the gate. The end of the gate is modified accordingly,
73  * while the start point is not changed. The following options are
74  * exclusive:
75  * * `SetTo` (time): duration is set to this interval;
76  * * `Change` (time): this value is added to the duration (negative
77  * decreases it, but never below `0`).
78  * * `Start` (optional table): a table with the operations affecting the
79  * start of the gate. The duration of the gate is always preserved.
80  * The following options are exclusive:
81  * * `SetTo` (time): start of the beam gate is moved to this time point,
82  * set on the electronics time scale;
83  * * `Change` (time): this value is added to the start time (negative
84  * anticipates it).
85  * * `KeepInstanceName` (flag, default: `false`): if set, the output beam gate
86  * data product will have the same instance name as the input one specified
87  * in `BeamGateTag`.
88  * * `OutputInstanceName` (string, default: empty): the instance name of the
89  * output data product (exclusive with `KeepInstanceName`).
90  * * `LogCategory` (string, default: `FixBeamGateInfo`): name of the output
91  * stream category for console messages (managed by MessageFacility
92  * library).
93  *
94  * Times must be specified as strings with their unit, e.g. `"0.6 us"` for 0.6
95  * microseconds.
96  */
97 class icarus::trigger::FixBeamGateInfo: public art::SharedProducer {
98 
100 
101  /// All directions to change a beam gate.
103 
104  struct GateSelector_t {
105 
106  std::vector<sim::BeamType_t> beamTypes; ///< Match these beam types.
107 
108  bool empty() const { return beamTypes.empty(); }
109  bool isValid() const { return true; }
110  }; // GateSelector_t
111 
112  /// Set of instructions for a change.
113  template <typename P, typename I = typename P::interval_t>
114  struct ChangeRecipe_t {
115  std::optional<P> setValue; ///< Value to set.
116  std::optional<I> addValue; ///< Value to add.
117 
118  bool empty() const { return !setValue && !addValue; }
119  bool valid() const { return !(setValue && addValue); }
120  }; // ChangeRecipe_t
121 
122  GateSelector_t selectGates; ///< Which gates to apply this recipe on.
123 
124  /// Instructions on how to change the gate start.
125  std::optional<ChangeRecipe_t<simulation_time>> const start;
126 
127  /// Instructions on how to change the gate width.
128  std::optional<ChangeRecipe_t<simulation_time::interval_t>> const width;
129 
130  bool empty() const
131  { return (!width || width->empty()) && (!start || start->empty()); }
132  bool valid() const
133  {
134  // validity checks
135  if (!selectGates.isValid()) return false;
136  if (start && !start->valid()) return false;
137  if (width && !width->valid()) return false;
138  // minimum requirement checks
139  if (!start && !width) return false;
140  return true;
141  }
142  }; // struct BeamChangeRecipe
143 
144 
145  public:
146 
147 
148  // --- BEGIN Configuration ---------------------------------------------------
149  struct Config {
150 
151  enum class BeamType_t { // we need to translate enum into a strong type
153  , kBNB = sim::kBNB
154  , kNuMI = sim::kNuMI
155  };
156 
157  using Name = fhicl::Name;
158  using Comment = fhicl::Comment;
159 
162 
163  /// Settings to change a gate.
164  struct ChangeGate {
165 
166  template <typename P, typename I = typename P::interval_t>
167  struct ChangeConfig {
168  fhicl::OptionalAtom<P> SetTo {
169  Name{ "SetTo" },
170  Comment{ "set to the specified time, regardless of the previous one" }
171  };
172  fhicl::OptionalAtom<I> Add {
173  Name{ "Add" },
174  Comment{ "add the specified time to the existing one" }
175  };
176  }; // ChangeConfig<>
177 
178  /// Configuration to select a gate to be changed.
180 
181  fhicl::Sequence<std::string> Types {
182  Name("Types"),
183  Comment(
184  "gate type to apply the changes on: "
186  ),
187  std::vector<std::string>
189  };
190 
191  std::vector<sim::BeamType_t> getBeamTypes() const
192  { return Config::getBeamTypes(Types); }
193 
194  }; // struct SelectGateConfig
195 
196  fhicl::Table<SelectGateConfig> Select {
197  Name{ "Select" },
198  Comment
199  { "apply these settings only to gates satisfying these criteria" }
200  };
201 
202  fhicl::OptionalTable<ChangeConfig<simulation_time>> Start {
203  Name{ "Start" },
204  Comment{ "changes to the start of the beam gate" }
205  };
206 
207  fhicl::OptionalTable<ChangeConfig<microseconds>> Width {
208  Name{ "Width" },
209  Comment{ "changes to the width of the beam gate" }
210  };
211 
212 
213  /// Converts a configuration table into a `ChangeRecipe_t`.
214  template <typename P, typename I>
215  static std::optional<BeamChangeRecipe::ChangeRecipe_t<P, I>> convert
216  (std::optional<ChangeConfig<P, I>> const& config);
217 
218  /// Converts a configuration table into a `GateSelector_t`.
220  (SelectGateConfig const& config);
221 
222  }; // struct ChangeGate
223 
224 
225  fhicl::Atom<art::InputTag> BeamGateTag {
226  Name{ "BeamGateTag" },
227  Comment{ "beam gate data product to operate on" }
228  // mandatory
229  };
230 
231  fhicl::Sequence<fhicl::TableAs<BeamChangeRecipe, ChangeGate>> Changes {
232  Name{ "Changes" },
233  Comment{ "sets of changes to apply to the beam gate" }
234  // mandatory
235  };
236 
237  fhicl::Atom<bool> KeepInstanceName {
238  Name{ "KeepInstanceName" },
239  Comment
240  { "output data product has the same instance name as in BeamGateTag" },
241  false // default
242  };
243 
244  fhicl::Atom<std::string> OutputInstanceName {
245  Name{ "OutputInstanceName" },
246  Comment{ "instance name for the output data product" },
247  ""
248  };
249 
250  fhicl::Atom<std::string> LogCategory {
251  Name{ "LogCategory" },
252  Comment{ "name of the category used for the output" },
253  "FixBeamGateInfo" // default
254  };
255 
256 
257  /// Selector for `Type` parameter.
259 
260  /// Converts a FHiCL atom into a beam type.
261  static sim::BeamType_t getBeamType(fhicl::Atom<std::string> const& type);
262 
263  /// Converts a FHiCL sequence into a vector of beam types.
264  static std::vector<sim::BeamType_t> getBeamTypes
265  (fhicl::Sequence<std::string> const& type);
266 
267  }; // struct Config
268 
269  using Parameters = art::SharedProducer::Table<Config>;
270 
271  // --- END Configuration -----------------------------------------------------
272 
273 
274  // --- BEGIN Constructors ----------------------------------------------------
275 
276  explicit FixBeamGateInfo
277  (Parameters const& config, art::ProcessingFrame const&);
278 
279  // --- END Constructors ------------------------------------------------------
280 
281 
282  // --- BEGIN Framework hooks -------------------------------------------------
283 
284  virtual void produce(art::Event& event, art::ProcessingFrame const&) override;
285 
286  // --- END Framework hooks ---------------------------------------------------
287 
288 
289  private:
290 
291 
292  // --- BEGIN Configuration variables -----------------------------------------
293 
294  art::InputTag const fBeamGateTag; ///< Input beam gate data product.
295 
296  /// Changes on beam gate.
297  std::vector<BeamChangeRecipe> const fChanges;
298 
299  std::string const fInstanceName; ///< Instance name for the output product.
300 
301  /// Message facility stream category for output.
302  std::string const fLogCategory;
303 
304  // --- END Configuration variables -------------------------------------------
305 
306 
307  /// Returns a "fixed" beam gate based on the input `beamGate` one.
308  sim::BeamGateInfo fixBeamGate(sim::BeamGateInfo const& beamGate) const;
309 
310 
311  /// Returns whether `gate` passes the specified `selection`.
312  static bool acceptGate(
313  sim::BeamGateInfo const& gate,
314  BeamChangeRecipe::GateSelector_t const& selection
315  );
316 
317  /// Applies the changes in `recipe` on the `target` value.
318  template <typename T, typename P, typename I>
319  static T& applyRecipe(
320  T& target,
321  std::optional<BeamChangeRecipe::ChangeRecipe_t<P, I>> const& recipe
322  );
323 
324 
325  friend BeamChangeRecipe convert(Config::ChangeGate const& config);
326  friend struct dumpRecipe;
327 
328 }; // class icarus::trigger::FixBeamGateInfo
329 
330 
331 //------------------------------------------------------------------------------
332 namespace icarus::trigger {
333 
334  struct dumpRecipe {
336  std::string indent, firstIndent;
339  std::string indent, std::string firstIndent
340  )
341  : recipe(recipe)
342  , indent(std::move(indent)), firstIndent(std::move(firstIndent))
343  {}
346  std::string const& indent = ""
347  )
348  : recipe(recipe), indent(indent), firstIndent(indent)
349  {}
350 
351  }; // dumpRecipe
352 
353  std::ostream& operator<< (std::ostream& out, dumpRecipe const& dr);
354 
355 } // icarus::trigger
356 
357 
358 //------------------------------------------------------------------------------
359 namespace icarus::trigger {
360 
361  // configuration conversions automatically picked by fhicl::TableAs<>
362 
363  FixBeamGateInfo::BeamChangeRecipe convert
365  {
366  using ChangeGate = FixBeamGateInfo::Config::ChangeGate;
368  ChangeGate::convert(config.Select()) // selectGates
369  , ChangeGate::convert(config.Start()) // start
370  , ChangeGate::convert(config.Width()) // width
371  };
372  } // convert(FixBeamGateInfo::Config::ChangeGate)
373 
374 
375 } // namespace icarus::trigger
376 
377 
378 //------------------------------------------------------------------------------
379 //--- Implementation
380 //------------------------------------------------------------------------------
381 namespace {
382 
383  /// Returns whether any of the elements of `coll` compares equal to `value`.
384  template <typename Coll, typename T>
385  bool contains(Coll const& coll, T const& value) {
386  using std::begin, std::end;
387  auto const b = begin(coll); auto const e = end(coll);
388  return std::find(b, e, value) != e;
389  } // contains()
390 
391 } // local namespace
392 //------------------------------------------------------------------------------
393 namespace icarus::trigger {
394 
397  {
398  { BeamType_t::kUnknown, "unknown" }
399  , { BeamType_t::kBNB, "BNB" }
400  , { BeamType_t::kNuMI, "NuMI" }
401  };
402 
403 } // namespace icarus::trigger
404 
405 
406 //------------------------------------------------------------------------------
408  (Parameters const& config, art::ProcessingFrame const&)
409  : art::SharedProducer(config)
410  // configuration
411  , fBeamGateTag{ config().BeamGateTag() }
412  , fChanges{ config().Changes() }
413  , fInstanceName{
414  config().KeepInstanceName()
415  ? fBeamGateTag.instance(): config().OutputInstanceName()
416  }
417  , fLogCategory(config().LogCategory())
418 {
419  using namespace util::quantities::time_literals;
420 
421  //
422  // parameter validation
423  //
424  if (config().KeepInstanceName() && !config().OutputInstanceName().empty()) {
425  throw art::Exception{ art::errors::Configuration }
426  << "Can't set both '" << config().KeepInstanceName.name()
427  << " (" << std::boolalpha << config().KeepInstanceName() << ")"
428  << "' and '" << config().OutputInstanceName.name() << "' ('"
429  << config().OutputInstanceName() << "') at the same time.\n";
430  }
431 
432  for (auto const& [ iChange, change ]: util::enumerate(fChanges)) {
433  if (change.valid()) continue;
434  throw art::Exception{ art::errors::Configuration }
435  << "Incompatible requests for '" << config().Changes.name()
436  << "' item [" << iChange << "] " << dumpRecipe(change, " ", "")
437  << "\n";
438  } // for changes
439 
440  //
441  // input data declaration
442  //
443  consumes<std::vector<sim::BeamGateInfo>>(fBeamGateTag);
444 
445  //
446  // output data declaration
447  //
448  produces<std::vector<sim::BeamGateInfo>>(fInstanceName);
449 
450  async<art::InEvent>();
451 
452  //
453  // configuration report (short)
454  //
455  {
456  mf::LogInfo log { fLogCategory };
457  log << "New beam gates based on '" << fBeamGateTag.encode()
458  << "' following " << fChanges.size() << " rules:";
459  for (auto const& [iChange, change]: util::enumerate(fChanges)) {
460  log << "\n[" << iChange << "] " << dumpRecipe(change, " ", "");
461  } // for all change sets
462  }
463 
464 } // icarus::trigger::FixBeamGateInfo::FixBeamGateInfo()
465 
466 
467 //------------------------------------------------------------------------------
469  (art::Event& event, art::ProcessingFrame const&)
470 {
471 
472  //
473  // read input data product
474  //
475  auto const& beamGates
476  = event.getProduct<std::vector<sim::BeamGateInfo>>(fBeamGateTag);
477 
478  //
479  // "fix"
480  //
481  std::vector<sim::BeamGateInfo> fixedBeamGates;
482  fixedBeamGates.reserve(beamGates.size());
483  for (sim::BeamGateInfo const& beamGate: beamGates)
484  fixedBeamGates.push_back(fixBeamGate(beamGate));
485 
486  //
487  // put into the event
488  //
489  event.put(
490  std::make_unique<std::vector<sim::BeamGateInfo>>
491  (std::move(fixedBeamGates)),
492  fInstanceName
493  );
494 
495 } // icarus::trigger::FixBeamGateInfo::produce()
496 
497 
498 //------------------------------------------------------------------------------
500  (sim::BeamGateInfo const& beamGate) const
501 {
504 
505  // beamGate is supposed to be stored in simulation_time units (nanoseconds)
506  simulation_time start { nanosecond{ beamGate.Start() }};
507  simulation_time::interval_t width { nanoseconds{ beamGate.Width() }};
508 
509  for (BeamChangeRecipe const& change: fChanges) {
510  if (!acceptGate(beamGate, change.selectGates)) continue;
511  applyRecipe(start, change.start);
512  applyRecipe(width, change.width);
513  } // for all changes
514 
515  return sim::BeamGateInfo{
516  nanosecond{ start }.value(),
517  nanoseconds{ width }.value(),
518  beamGate.BeamType()
519  };
520 
521 } // icarus::trigger::FixBeamGateInfo::fixBeamGate()
522 
523 
524 //------------------------------------------------------------------------------
526  (sim::BeamGateInfo const& gate, BeamChangeRecipe::GateSelector_t const& selection)
527 {
528  if (!selection.beamTypes.empty()) {
529  if (!contains(selection.beamTypes, gate.BeamType())) return false;
530  }
531  return true;
532 } // icarus::trigger::FixBeamGateInfo::acceptGate()
533 
534 
535 //------------------------------------------------------------------------------
536 template <typename T, typename P, typename I>
538  T& target, std::optional<BeamChangeRecipe::ChangeRecipe_t<P, I>> const& recipe
539 ) {
540  if (recipe) {
541  if (recipe->setValue) target = *recipe->setValue;
542  if (recipe->addValue) target += *recipe->addValue;
543  }
544  return target;
545 } // icarus::trigger::FixBeamGateInfo::applyRecipe()
546 
547 
548 //------------------------------------------------------------------------------
550  (fhicl::Atom<std::string> const& type)
551 {
552  try {
553  return static_cast<sim::BeamType_t>
554  (BeamTypeSelector.parse(type()).value());
555  }
557  {
558  throw art::Exception(art::errors::Configuration)
559  << "Invalid value for '" << type.name()
560  << "' parameter: '" << e.label() << "'; valid options: "
561  << BeamTypeSelector.optionListString() << ".\n";
562  }
563 } // icarus::trigger::FixBeamGateInfo::Config::getBeamType()
564 
565 
566 //------------------------------------------------------------------------------
568  (fhicl::Sequence<std::string> const& types) -> std::vector<sim::BeamType_t>
569 {
570  std::vector<sim::BeamType_t> beamTypes;
571  beamTypes.reserve(types.size());
572  for (std::string const& type: types()) {
573  try {
574  beamTypes.push_back
575  (static_cast<sim::BeamType_t>(BeamTypeSelector.parse(type).value()));
576  }
578  {
579  throw art::Exception(art::errors::Configuration)
580  << "Invalid value for '" << types.name()
581  << "' parameter: '" << e.label() << "'; valid options: "
582  << BeamTypeSelector.optionListString() << ".\n";
583  }
584  }
585  return beamTypes;
586 } // icarus::trigger::FixBeamGateInfo::Config::getBeamTypes()
587 
588 
589 //------------------------------------------------------------------------------
590 template <typename P, typename I>
592  (std::optional<Config::ChangeGate::ChangeConfig<P, I>> const& config)
593  -> std::optional<BeamChangeRecipe::ChangeRecipe_t<P, I>>
594 {
595  return config
597  config->SetTo(), config->Add()
598  }}
599  : std::nullopt
600  ;
601 } // icarus::trigger::FixBeamGateInfo::Config::ChangeGate::convert(ChangeConfig)
602 
603 
604 //------------------------------------------------------------------------------
608 {
610 } // icarus::trigger::FixBeamGateInfo::..::ChangeGate::convert(SelectGateConfig)
611 
612 
613 //------------------------------------------------------------------------------
614 std::ostream& icarus::trigger::operator<<
615  (std::ostream& out, dumpRecipe const& dr)
616 {
617  using namespace util::quantities::time_literals;
618 
619  auto printChangeRecipe = [&out, &indent=dr.indent]
620  (std::string const& name, auto const& recipe)
621  {
622  if (!recipe || recipe->empty()) return;
623  out << "\n" << indent << "- " << name << ":";
624  if (recipe->setValue) out << " set to " << (*recipe->setValue);
625  if (recipe->addValue) {
626  if (*recipe->addValue < 0_ns) out << " remove " << (-*recipe->addValue);
627  else out << " add " << (*recipe->addValue);
628  } // if adding
629  }; // printChangeRecipe()
630 
631  // selection
632  if (dr.recipe.empty()) {
633  out << "(no action)";
634  }
635  else {
636  out << dr.firstIndent;
637  if (dr.recipe.selectGates.empty()) out << "(always)";
638  else {
639  out << "(only on gates of type:";
640  for (sim::BeamType_t const gate: dr.recipe.selectGates.beamTypes) {
641  // to query BeamTypeSelector we need its own strong index type as key...
643  .get(static_cast<FixBeamGateInfo::Config::BeamType_t>(gate)).name();
644  }
645  out << ")";
646  }
647 
648  printChangeRecipe("start", dr.recipe.start);
649  printChangeRecipe("width", dr.recipe.width);
650  }
651 
652  return out;
653 } // icarus::trigger::operator<<(dumpRecipe)
654 
655 
656 //------------------------------------------------------------------------------
657 DEFINE_ART_MODULE(icarus::trigger::FixBeamGateInfo)
658 
659 
660 //------------------------------------------------------------------------------
Rewrites a set collection of beam gates into each event.
art::SharedProducer::Table< Config > Parameters
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
std::vector< sim::BeamType_t > beamTypes
Match these beam types.
DiscriminatePMTwaveformsByChannel::ChannelInfo_t convert(DiscriminatePMTwaveformsByChannel::ChannelConfig const &config)
std::string const fInstanceName
Instance name for the output product.
Helper to select an string option among a set of allowed choices.
icarus::trigger::FixBeamGateInfo::BeamChangeRecipe const & recipe
Definition of util::enumerate().
FixBeamGateInfo(Parameters const &config, art::ProcessingFrame const &)
microseconds_as<> microseconds
Type of time interval stored in microseconds, in double precision.
Definition: spacetime.h:259
std::ostream & operator<<(std::ostream &out, icarus::trigger::ApplyBeamGateClass const &gate)
virtual void produce(art::Event &event, art::ProcessingFrame const &) override
static bool acceptGate(sim::BeamGateInfo const &gate, BeamChangeRecipe::GateSelector_t const &selection)
Returns whether gate passes the specified selection.
sim::BeamGateInfo fixBeamGate(sim::BeamGateInfo const &beamGate) const
Returns a &quot;fixed&quot; beam gate based on the input beamGate one.
std::optional< ChangeRecipe_t< simulation_time::interval_t > > const width
Instructions on how to change the gate width.
std::string optionListString(std::string const &sep=", ") const
Returns a string with the (main) name of all options.
static util::MultipleChoiceSelection< BeamType_t > const BeamTypeSelector
Selector for Type parameter.
double Start() const
Definition: BeamGateInfo.h:30
constexpr value_t value() const
Returns the value of the quantity.
Definition: quantities.h:609
std::string const fLogCategory
Message facility stream category for output.
std::optional< ChangeRecipe_t< simulation_time > > const start
Instructions on how to change the gate start.
std::vector< BeamChangeRecipe > const fChanges
Changes on beam gate.
fhicl::OptionalTable< ChangeConfig< microseconds > > Width
Unknown beam type.
Definition: BeamTypes.h:10
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:69
NuMI.
Definition: BeamTypes.h:12
fDetProps &fDetProps fDetProps &fDetProps fLogCategory
dumpRecipe(icarus::trigger::FixBeamGateInfo::BeamChangeRecipe const &recipe, std::string indent, std::string firstIndent)
dumpRecipe(icarus::trigger::FixBeamGateInfo::BeamChangeRecipe const &recipe, std::string const &indent="")
microsecond_as<> microsecond
Type of time point stored in microseconds, in double precision.
Definition: spacetime.h:328
Option_t const & get(Choices_t value) const
Returns the specified option.
timescale_traits< SimulationTimeCategory >::time_point_t simulation_time
A point in time on the simulation time scale.
std::vector< SelDef > types
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
static T & applyRecipe(T &target, std::optional< BeamChangeRecipe::ChangeRecipe_t< P, I >> const &recipe)
Applies the changes in recipe on the target value.
BEGIN_PROLOG vertical distance to the surface Name
static std::vector< sim::BeamType_t > getBeamTypes(fhicl::Sequence< std::string > const &type)
Converts a FHiCL sequence into a vector of beam types.
GateSelector_t selectGates
Which gates to apply this recipe on.
fhicl::OptionalTable< ChangeConfig< simulation_time > > Start
An interval (duration, length, distance) between two quantity points.
Definition: intervals.h:114
std::string name() const
Returns the name of the option (i.e. the main label).
nanoseconds_as<> nanoseconds
Type of time interval stored in nanoseconds, in double precision.
Definition: spacetime.h:270
auto begin(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:573
static std::optional< BeamChangeRecipe::ChangeRecipe_t< P, I > > convert(std::optional< ChangeConfig< P, I >> const &config)
Converts a configuration table into a ChangeRecipe_t.
Utilities to read interval and point quantity FHiCL configuration.
BNB.
Definition: BeamTypes.h:11
Dimensioned variables representing space or time quantities.
double Width() const
Definition: BeamGateInfo.h:31
Data types for detinfo::DetectorTimings.
nanosecond_as<> nanosecond
Type of time stored in nanoseconds, in double precision.
Definition: spacetime.h:136
do i e
nanosecond_as<> nanosecond
Type of time point stored in nanoseconds, in double precision.
Definition: spacetime.h:339
fhicl::Sequence< fhicl::TableAs< BeamChangeRecipe, ChangeGate > > Changes
then echo fcl name
detinfo::timescales::simulation_time simulation_time
temporary value
art::InputTag const fBeamGateTag
Input beam gate data product.
BeamType_t BeamType() const
Definition: BeamGateInfo.h:32
bool empty(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:555
BeamType_t
Defines category of beams to be stored in sim::BeamGateInfo.
Definition: BeamTypes.h:9
friend BeamChangeRecipe convert(Config::ChangeGate const &config)
static sim::BeamType_t getBeamType(fhicl::Atom< std::string > const &type)
Converts a FHiCL atom into a beam type.
TimeTrackTreeStorage::TriggerInputSpec_t convert(TimeTrackTreeStorage::Config::TriggerSpecConfig const &config)
nanosecond nanoseconds
Alias for common language habits.
Definition: spacetime.h:139