-
Notifications
You must be signed in to change notification settings - Fork 43
Trigger simulation modules now support input tags with process name [private] #870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -192,9 +192,9 @@ class icarus::trigger::LVDSgates: public art::EDProducer { | |||||||||||
| { ComboMode::OR, "OR" } | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| fhicl::OptionalAtom<std::string> TriggerGatesTag { | ||||||||||||
| fhicl::OptionalAtom<art::InputTag> TriggerGatesTag { | ||||||||||||
| Name("TriggerGatesTag"), | ||||||||||||
| Comment("label of trigger gate extraction module (no instance name)") | ||||||||||||
| Comment("tag of trigger gate extraction module (no instance name)") | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| fhicl::Sequence<std::string> Thresholds { | ||||||||||||
|
|
@@ -386,11 +386,11 @@ class icarus::trigger::LVDSgates: public art::EDProducer { | |||||||||||
|
|
||||||||||||
| /// Converts a threshold string into an input tag. | ||||||||||||
| static art::InputTag makeTag | ||||||||||||
| (std::string const& thresholdStr, std::string const& defModule); | ||||||||||||
| (std::string const& thresholdStr, art::InputTag const& defModule); | ||||||||||||
|
|
||||||||||||
| /// Converts an input tag into an instance name for the corresponding output. | ||||||||||||
| static std::string makeOutputInstanceName | ||||||||||||
| (art::InputTag const& inputTag, std::string const& defModule); | ||||||||||||
| (art::InputTag const& inputTag, art::InputTag const& defModule); | ||||||||||||
|
|
||||||||||||
| }; // class icarus::trigger::LVDSgates | ||||||||||||
|
|
||||||||||||
|
|
@@ -412,11 +412,11 @@ icarus::trigger::LVDSgates::LVDSgates | |||||||||||
| // | ||||||||||||
| // more complex parameter parsing | ||||||||||||
| // | ||||||||||||
| std::string const discrModuleLabel = config().TriggerGatesTag().value_or(""); | ||||||||||||
| art::InputTag const discrModuleTag = config().TriggerGatesTag().value_or(""); | ||||||||||||
| for (std::string const& thresholdStr: config().Thresholds()) { | ||||||||||||
| art::InputTag const inputTag = makeTag(thresholdStr, discrModuleLabel); | ||||||||||||
| art::InputTag const inputTag = makeTag(thresholdStr, discrModuleTag); | ||||||||||||
| fADCthresholds[thresholdStr] | ||||||||||||
| = { inputTag, makeOutputInstanceName(inputTag, discrModuleLabel) }; | ||||||||||||
| = { inputTag, makeOutputInstanceName(inputTag, discrModuleTag) }; | ||||||||||||
| } // for all thresholds | ||||||||||||
|
|
||||||||||||
| // | ||||||||||||
|
|
@@ -863,34 +863,38 @@ auto icarus::trigger::LVDSgates::ReadTriggerGates( | |||||||||||
|
|
||||||||||||
| //------------------------------------------------------------------------------ | ||||||||||||
| art::InputTag icarus::trigger::LVDSgates::makeTag | ||||||||||||
| (std::string const& thresholdStr, std::string const& defModule) | ||||||||||||
| (std::string const& thresholdStr, art::InputTag const& defModule) | ||||||||||||
| { | ||||||||||||
| auto const isNumber = [pattern=std::regex{ "[+-]?[0-9]+" }] | ||||||||||||
| (std::string const& s) -> bool | ||||||||||||
| { return std::regex_match(s, pattern); }; | ||||||||||||
| return | ||||||||||||
| if (!thresholdStr.empty() && !defModule.instance().empty()) { | ||||||||||||
| throw art::Exception(art::errors::Configuration) | ||||||||||||
| << "Both the input gate module tag instance name (`TriggerGatesTag`: '" | ||||||||||||
| << defModule.encode() << "') and the threshold '" << thresholdStr | ||||||||||||
| << "' are set. One of them must be empty.\n"; | ||||||||||||
| } | ||||||||||||
| return | ||||||||||||
| ((thresholdStr.find(':') != std::string::npos) || !isNumber(thresholdStr)) | ||||||||||||
| ? art::InputTag{ thresholdStr } | ||||||||||||
| : defModule.empty() | ||||||||||||
| : defModule.label().empty() | ||||||||||||
| ? throw (art::Exception(art::errors::Configuration) | ||||||||||||
| << "No default module label (`TriggerGatesTag`) specified" | ||||||||||||
| ", and it's needed for threshold '" | ||||||||||||
| << thresholdStr << "'.\n") | ||||||||||||
| : art::InputTag{ defModule, thresholdStr } | ||||||||||||
| << "Default module label (`TriggerGatesTag`) specified" | ||||||||||||
| ", and it's needed for threshold '" << thresholdStr << "'.\n") | ||||||||||||
| : art::InputTag{ defModule.label(), thresholdStr, defModule.process() } | ||||||||||||
| ; | ||||||||||||
| } // icarus::trigger::LVDSgates::makeTag() | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| //------------------------------------------------------------------------------ | ||||||||||||
| std::string icarus::trigger::LVDSgates::makeOutputInstanceName | ||||||||||||
| (art::InputTag const& inputTag, std::string const& defModule) | ||||||||||||
| (art::InputTag const& inputTag, art::InputTag const& defModule) | ||||||||||||
| { | ||||||||||||
| return (inputTag.label() == defModule) | ||||||||||||
| return (inputTag.label() == defModule.label()) | ||||||||||||
| ? inputTag.instance() | ||||||||||||
| : inputTag.instance().empty() | ||||||||||||
| ? inputTag.label(): inputTag.label() + inputTag.instance() | ||||||||||||
| : inputTag.label() + inputTag.instance() | ||||||||||||
| ; | ||||||||||||
|
Comment on lines
+895
to
896
|
||||||||||||
| : inputTag.label() + inputTag.instance() | |
| ; | |
| : (inputTag.instance().empty() | |
| ? inputTag.label() | |
| : inputTag.label() + inputTag.instance()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code appears to me fully equivalent, still returning inputTag.label() + inputTag.instance() if the instance is not empty, and inputTag.label() if the instance is empty (in which case it is the same as inputTag.label() + inputTag.instance()).
Uh oh!
There was an error while loading. Please reload this page.