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
356fd9e6
Commit
356fd9e6
authored
4 years ago
by
Enrico Guiraud
Browse files
Options
Downloads
Patches
Plain Diff
[DF][NFC] Move helper functions to anonymous namespace
parent
50931aa5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tree/dataframe/src/RLoopManager.cxx
+27
-30
27 additions, 30 deletions
tree/dataframe/src/RLoopManager.cxx
with
27 additions
and
30 deletions
tree/dataframe/src/RLoopManager.cxx
+
27
−
30
View file @
356fd9e6
...
...
@@ -43,10 +43,8 @@ static std::string &GetCodeToJit()
static
std
::
string
code
;
return
code
;
}
}
// anonymous namespace
// FIXME move all of these helper functions to anonymous namespace, declare static
bool
ContainsLeaf
(
const
std
::
set
<
TLeaf
*>
&
leaves
,
TLeaf
*
leaf
)
static
bool
ContainsLeaf
(
const
std
::
set
<
TLeaf
*>
&
leaves
,
TLeaf
*
leaf
)
{
return
(
leaves
.
find
(
leaf
)
!=
leaves
.
end
());
}
...
...
@@ -54,8 +52,8 @@ bool ContainsLeaf(const std::set<TLeaf *> &leaves, TLeaf *leaf)
///////////////////////////////////////////////////////////////////////////////
/// This overload does not perform any check on the duplicates.
/// It is used for TBranch objects.
void
UpdateList
(
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
const
std
::
string
&
branchName
,
const
std
::
string
&
friendName
)
static
void
UpdateList
(
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
const
std
::
string
&
branchName
,
const
std
::
string
&
friendName
)
{
if
(
!
friendName
.
empty
())
{
...
...
@@ -71,8 +69,8 @@ void UpdateList(std::set<std::string> &bNamesReg, ColumnNames_t &bNames, const s
///////////////////////////////////////////////////////////////////////////////
/// This overloads makes sure that the TLeaf has not been already inserted.
void
UpdateList
(
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
const
std
::
string
&
branchName
,
const
std
::
string
&
friendName
,
std
::
set
<
TLeaf
*>
&
foundLeaves
,
TLeaf
*
leaf
,
bool
allowDuplicates
)
static
void
UpdateList
(
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
const
std
::
string
&
branchName
,
const
std
::
string
&
friendName
,
std
::
set
<
TLeaf
*>
&
foundLeaves
,
TLeaf
*
leaf
,
bool
allowDuplicates
)
{
const
bool
canAdd
=
allowDuplicates
?
true
:
!
ContainsLeaf
(
foundLeaves
,
leaf
);
if
(
!
canAdd
)
{
...
...
@@ -84,8 +82,8 @@ void UpdateList(std::set<std::string> &bNamesReg, ColumnNames_t &bNames, const s
foundLeaves
.
insert
(
leaf
);
}
void
ExploreBranch
(
TTree
&
t
,
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
TBranch
*
b
,
std
::
string
prefix
,
std
::
string
&
friendName
)
static
void
ExploreBranch
(
TTree
&
t
,
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
TBranch
*
b
,
std
::
string
prefix
,
std
::
string
&
friendName
)
{
for
(
auto
sb
:
*
b
->
GetListOfBranches
())
{
TBranch
*
subBranch
=
static_cast
<
TBranch
*>
(
sb
);
...
...
@@ -107,8 +105,8 @@ void ExploreBranch(TTree &t, std::set<std::string> &bNamesReg, ColumnNames_t &bN
}
}
void
GetBranchNamesImpl
(
TTree
&
t
,
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
std
::
set
<
TTree
*>
&
analysedTrees
,
std
::
string
&
friendName
,
bool
allowDuplicates
)
static
void
GetBranchNamesImpl
(
TTree
&
t
,
std
::
set
<
std
::
string
>
&
bNamesReg
,
ColumnNames_t
&
bNames
,
std
::
set
<
TTree
*>
&
analysedTrees
,
std
::
string
&
friendName
,
bool
allowDuplicates
)
{
std
::
set
<
TLeaf
*>
foundLeaves
;
if
(
!
analysedTrees
.
insert
(
&
t
).
second
)
{
...
...
@@ -190,6 +188,24 @@ void GetBranchNamesImpl(TTree &t, std::set<std::string> &bNamesReg, ColumnNames_
}
}
static
void
ThrowIfPoolSizeChanged
(
unsigned
int
nSlots
)
{
const
auto
poolSize
=
ROOT
::
GetThreadPoolSize
();
const
bool
isSingleThreadRun
=
(
poolSize
==
0
&&
nSlots
==
1
);
if
(
!
isSingleThreadRun
&&
poolSize
!=
nSlots
)
{
std
::
string
msg
=
"RLoopManager::Run: when the RDataFrame was constructed the size of the thread pool was "
+
std
::
to_string
(
nSlots
)
+
", but when starting the event loop it was "
+
std
::
to_string
(
poolSize
)
+
"."
;
if
(
poolSize
>
nSlots
)
msg
+=
" Maybe EnableImplicitMT() was called after the RDataFrame was constructed?"
;
else
msg
+=
" Maybe DisableImplicitMT() was called after the RDataFrame was constructed?"
;
throw
std
::
runtime_error
(
msg
);
}
}
}
// anonymous namespace
///////////////////////////////////////////////////////////////////////////////
/// Get all the branches names, including the ones of the friend trees
ColumnNames_t
ROOT
::
Internal
::
RDF
::
GetBranchNames
(
TTree
&
t
,
bool
allowDuplicates
)
...
...
@@ -202,7 +218,6 @@ ColumnNames_t ROOT::Internal::RDF::GetBranchNames(TTree &t, bool allowDuplicates
return
bNames
;
}
RLoopManager
::
RLoopManager
(
TTree
*
tree
,
const
ColumnNames_t
&
defaultBranches
)
:
fTree
(
std
::
shared_ptr
<
TTree
>
(
tree
,
[](
TTree
*
)
{})),
fDefaultColumns
(
defaultBranches
),
fNSlots
(
RDFInternal
::
GetNSlots
()),
...
...
@@ -537,24 +552,6 @@ void RLoopManager::EvalChildrenCounts()
namedFilterPtr
->
TriggerChildrenCount
();
}
namespace
{
static
void
ThrowIfPoolSizeChanged
(
unsigned
int
nSlots
)
{
const
auto
poolSize
=
ROOT
::
GetThreadPoolSize
();
const
bool
isSingleThreadRun
=
(
poolSize
==
0
&&
nSlots
==
1
);
if
(
!
isSingleThreadRun
&&
poolSize
!=
nSlots
)
{
std
::
string
msg
=
"RLoopManager::Run: when the RDataFrame was constructed the size of the thread pool was "
+
std
::
to_string
(
nSlots
)
+
", but when starting the event loop it was "
+
std
::
to_string
(
poolSize
)
+
"."
;
if
(
poolSize
>
nSlots
)
msg
+=
" Maybe EnableImplicitMT() was called after the RDataFrame was constructed?"
;
else
msg
+=
" Maybe DisableImplicitMT() was called after the RDataFrame was constructed?"
;
throw
std
::
runtime_error
(
msg
);
}
}
}
// namespace
/// Start the event loop with a different mechanism depending on IMT/no IMT, data source/no data source.
/// Also perform a few setup and clean-up operations (jit actions if necessary, clear booked actions after the loop...).
void
RLoopManager
::
Run
()
...
...
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