Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
Root
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
为了安全,强烈建议开启2FA双因子认证:User Settings -> Account -> Enable two-factor authentication!!!
Show more breadcrumbs
cxwx
Root
Commits
96eaf3f8
Commit
96eaf3f8
authored
2 years ago
by
Carsten Burgard
Committed by
Jonas Rembser
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[RF][HS3] Improved attribute handling, caught some typecast-errors
parent
3d1783cf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
roofit/hs3/src/RooJSONFactoryWSTool.cxx
+17
-20
17 additions, 20 deletions
roofit/hs3/src/RooJSONFactoryWSTool.cxx
with
17 additions
and
20 deletions
roofit/hs3/src/RooJSONFactoryWSTool.cxx
+
17
−
20
View file @
96eaf3f8
...
@@ -307,25 +307,15 @@ void genIndicesHelper(std::vector<std::vector<int>> &combinations, std::vector<i
...
@@ -307,25 +307,15 @@ void genIndicesHelper(std::vector<std::vector<int>> &combinations, std::vector<i
}
}
}
}
void
importAttributes
(
RooAbsArg
*
arg
,
JSONNode
const
&
root
node
)
void
importAttributes
(
RooAbsArg
*
arg
,
JSONNode
const
&
node
)
{
{
JSONNode
const
&
attributesNode
=
dereference
(
rootnode
,
{
"misc"
,
"ROOT_internal"
,
"attributes"
},
rootnode
);
if
(
node
.
has_child
(
"dict"
))
{
for
(
const
auto
&
attr
:
(
node
)[
"dict"
].
children
())
{
// If the attributes node was not found, it will not be a sequence node
if
(
!
attributesNode
.
is_seq
())
return
;
JSONNode
const
*
node
=
RooJSONFactoryWSTool
::
findNamedChild
(
attributesNode
,
arg
->
GetName
());
if
(
node
==
nullptr
)
return
;
if
(
node
->
has_child
(
"dict"
))
{
for
(
const
auto
&
attr
:
(
*
node
)[
"dict"
].
children
())
{
arg
->
setStringAttribute
(
RooJSONFactoryWSTool
::
name
(
attr
).
c_str
(),
attr
.
val
().
c_str
());
arg
->
setStringAttribute
(
RooJSONFactoryWSTool
::
name
(
attr
).
c_str
(),
attr
.
val
().
c_str
());
}
}
}
}
if
(
node
->
has_child
(
"tags"
))
{
if
(
node
.
has_child
(
"tags"
))
{
for
(
const
auto
&
attr
:
(
*
node
)[
"tags"
].
children
())
{
for
(
const
auto
&
attr
:
(
node
)[
"tags"
].
children
())
{
arg
->
setAttribute
(
attr
.
val
().
c_str
());
arg
->
setAttribute
(
attr
.
val
().
c_str
());
}
}
}
}
...
@@ -628,7 +618,7 @@ JSONNode *RooJSONFactoryWSTool::exportObject(const RooAbsArg *func)
...
@@ -628,7 +618,7 @@ JSONNode *RooJSONFactoryWSTool::exportObject(const RooAbsArg *func)
// Exporting the dependants will invalidate the iterator in "elem". So
// Exporting the dependants will invalidate the iterator in "elem". So
// instead of returning elem, we have to find again the element with
// instead of returning elem, we have to find again the element with
// the right name.
// the right name.
return
const_cast
<
JSONNode
*>
(
findNamedChild
(
collectionNode
,
name
));
return
const_cast
<
JSONNode
*>
(
findNamedChild
(
collectionNode
,
name
));
}
}
}
}
...
@@ -682,7 +672,7 @@ JSONNode *RooJSONFactoryWSTool::exportObject(const RooAbsArg *func)
...
@@ -682,7 +672,7 @@ JSONNode *RooJSONFactoryWSTool::exportObject(const RooAbsArg *func)
// Exporting the dependants will invalidate the iterator in "elem". So
// Exporting the dependants will invalidate the iterator in "elem". So
// instead of returning elem, we have to find again the element with the
// instead of returning elem, we have to find again the element with the
// right name.
// right name.
return
const_cast
<
JSONNode
*>
(
findNamedChild
(
collectionNode
,
name
));
return
const_cast
<
JSONNode
*>
(
findNamedChild
(
collectionNode
,
name
));
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
...
@@ -1388,7 +1378,9 @@ void RooJSONFactoryWSTool::importAnalysis(const RooFit::Detail::JSONNode &analys
...
@@ -1388,7 +1378,9 @@ void RooJSONFactoryWSTool::importAnalysis(const RooFit::Detail::JSONNode &analys
RooArgSet
nps
;
RooArgSet
nps
;
RooArgSet
pois
;
RooArgSet
pois
;
for
(
auto
const
&
child
:
analysisNode
[
"pois"
].
children
())
{
for
(
auto
const
&
child
:
analysisNode
[
"pois"
].
children
())
{
pois
.
add
(
*
_workspace
.
var
(
child
.
val
()));
if
(
auto
var
=
_workspace
.
var
(
child
.
val
()))
{
pois
.
add
(
*
var
);
}
}
}
RooArgSet
globs
;
RooArgSet
globs
;
std
::
unique_ptr
<
RooArgSet
>
pdfVars
{
pdf
->
getVariables
()};
std
::
unique_ptr
<
RooArgSet
>
pdfVars
{
pdf
->
getVariables
()};
...
@@ -1461,8 +1453,13 @@ void RooJSONFactoryWSTool::importAllNodes(const RooFit::Detail::JSONNode &n)
...
@@ -1461,8 +1453,13 @@ void RooJSONFactoryWSTool::importAllNodes(const RooFit::Detail::JSONNode &n)
_workspace
.
loadSnapshot
(
"fromJSON"
);
_workspace
.
loadSnapshot
(
"fromJSON"
);
// Import attributes
// Import attributes
for
(
RooAbsArg
*
arg
:
_workspace
.
components
())
{
JSONNode
const
&
attributesNode
=
importAttributes
(
arg
,
*
_rootnodeInput
);
dereference
(
*
_rootnodeInput
,
{
"misc"
,
"ROOT_internal"
,
"attributes"
},
*
_rootnodeInput
);
if
(
attributesNode
.
is_seq
())
{
for
(
const
auto
&
elem
:
attributesNode
.
children
())
{
if
(
RooAbsArg
*
arg
=
_workspace
.
arg
(
elem
[
"name"
].
val
()))
importAttributes
(
arg
,
elem
);
}
}
}
_rootnodeInput
=
nullptr
;
_rootnodeInput
=
nullptr
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment