Skip to content
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

GetObservableValue input obs name without process name prefix #290

Merged
merged 3 commits into from
Sep 9, 2022

Conversation

nkx111
Copy link
Member

@nkx111 nkx111 commented Sep 4, 2022

nkx111 Medium: 104

This closes issue rest-for-physics/detectorlib#47

By making TRestAnalysisTree::GetObservableValue<>() searching for observables, one can directly input obs names without process name prefix. It also prints message if one input observable names wrong.

Previously:

root [1] ana_tree0->GetObservableValue<double>("sAna_ThresholdIntegral")
(double) 161060.00

Now:

root [0] ana_tree0->GetObservableValue<double>("ThresholdIntegral")
TRestAnalysisTree::GetObservableID(): Find observable sAna_ThresholdIntegral for obs name: ThresholdIntegral
(double) 161060.00

root [2] ana_tree0->GetObservableValue<double>("ThresholdIntegrawwl")
-- Error : TRestAnalysisTree::GetObservableID(): No Matching observable found
-- Error : did you mean "sAna_ThresholdIntegral" ?
(double) nan

When writing processes, if one needs to access observable values, no more hardcoded process names shall be added.

@jgalan
Copy link
Member

jgalan commented Sep 5, 2022

What happens if there are several analysis processes that generated the same observable name with different process name, it takes the first one found?

@nkx111
Copy link
Member Author

nkx111 commented Sep 5, 2022

What happens if there are several analysis processes that generated the same observable name with different process name, it takes the first one found?

It will prompt warning and return the first one matched

https://github.com/rest-for-physics/framework/pull/290/files#diff-dac4ddbd262635783e441e810b53ad77e58453a25315d096cea9f8e02c4bf238R211

@jgalan jgalan self-requested a review September 5, 2022 10:20
@jgalan jgalan requested a review from a team September 8, 2022 09:34
@jgalan
Copy link
Member

jgalan commented Sep 8, 2022

Shall we merge this PR?

@nkx111 nkx111 merged commit e617be3 into master Sep 9, 2022
@nkx111 nkx111 deleted the nkx111-get-obs-value branch September 19, 2022 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants