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
a3fc6147
Commit
a3fc6147
authored
2 years ago
by
Florine de Geus
Committed by
Jakob Blomer
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[ntuple] Re-add fSourceTree and reduce duplication in Create()
parent
c8a56793
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx
+3
-0
3 additions, 0 deletions
tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx
tree/ntupleutil/v7/src/RNTupleImporter.cxx
+17
-15
17 additions, 15 deletions
tree/ntupleutil/v7/src/RNTupleImporter.cxx
with
20 additions
and
15 deletions
tree/ntupleutil/v7/inc/ROOT/RNTupleImporter.hxx
+
3
−
0
View file @
a3fc6147
...
...
@@ -208,6 +208,7 @@ private:
RNTupleImporter
()
=
default
;
std
::
unique_ptr
<
TFile
>
fSourceFile
;
std
::
unique_ptr
<
TTree
>
fSourceTree
;
std
::
string
fDestFileName
;
...
...
@@ -231,6 +232,8 @@ private:
std
::
unique_ptr
<
RNTupleModel
>
fModel
;
std
::
unique_ptr
<
REntry
>
fEntry
;
ROOT
::
Experimental
::
RResult
<
void
>
SetupDestination
(
std
::
string_view
destFileName
);
void
ResetSchema
();
/// Sets up the connection from TTree branches to RNTuple fields, including initialization of the memory
/// buffers used for reading and writing.
...
...
This diff is collapsed.
Click to expand it.
tree/ntupleutil/v7/src/RNTupleImporter.cxx
+
17
−
15
View file @
a3fc6147
...
...
@@ -86,23 +86,18 @@ ROOT::Experimental::RNTupleImporter::Create(std::string_view sourceFileName, std
{
auto
importer
=
std
::
unique_ptr
<
RNTupleImporter
>
(
new
RNTupleImporter
());
importer
->
fNTupleName
=
treeName
;
auto
sourceFile
=
TFile
::
Open
(
std
::
string
(
sourceFileName
).
c_str
());
if
(
!
s
ourceFile
||
s
ourceFile
->
IsZombie
())
{
importer
->
fSourceFile
=
std
::
unique_ptr
<
TFile
>
(
TFile
::
Open
(
std
::
string
(
sourceFileName
).
c_str
())
)
;
if
(
!
importer
->
fS
ourceFile
||
importer
->
fS
ourceFile
->
IsZombie
())
{
return
R__FAIL
(
"cannot open source file "
+
std
::
string
(
sourceFileName
));
}
importer
->
fSourceTree
=
std
::
unique_ptr
<
TTree
>
(
s
ourceFile
->
Get
<
TTree
>
(
std
::
string
(
treeName
).
c_str
()));
importer
->
fSourceTree
=
std
::
unique_ptr
<
TTree
>
(
importer
->
fS
ourceFile
->
Get
<
TTree
>
(
std
::
string
(
treeName
).
c_str
()));
if
(
!
importer
->
fSourceTree
)
{
return
R__FAIL
(
"cannot read TTree "
+
std
::
string
(
treeName
)
+
" from "
+
std
::
string
(
sourceFileName
));
}
// If we have IMT enabled, its best use is for parallel page compression
importer
->
fSourceTree
->
SetImplicitMT
(
false
);
importer
->
fDestFileName
=
destFileName
;
importer
->
fWriteOptions
.
SetCompression
(
kDefaultCompressionSettings
);
importer
->
fDestFile
=
std
::
unique_ptr
<
TFile
>
(
TFile
::
Open
(
importer
->
fDestFileName
.
c_str
(),
"UPDATE"
));
if
(
!
importer
->
fDestFile
||
importer
->
fDestFile
->
IsZombie
())
{
return
R__FAIL
(
"cannot open dest file "
+
std
::
string
(
importer
->
fDestFileName
));
}
importer
->
SetupDestination
(
destFileName
);
return
importer
;
}
...
...
@@ -117,16 +112,23 @@ ROOT::Experimental::RNTupleImporter::Create(TTree *sourceTree, std::string_view
// If we have IMT enabled, its best use is for parallel page compression
importer
->
fSourceTree
->
SetImplicitMT
(
false
);
importer
->
fDestFileName
=
destFileName
;
importer
->
fWriteOptions
.
SetCompression
(
kDefaultCompressionSettings
);
importer
->
fDestFile
=
std
::
unique_ptr
<
TFile
>
(
TFile
::
Open
(
importer
->
fDestFileName
.
c_str
(),
"UPDATE"
));
if
(
!
importer
->
fDestFile
||
importer
->
fDestFile
->
IsZombie
())
{
return
R__FAIL
(
"cannot open dest file "
+
std
::
string
(
importer
->
fDestFileName
));
}
importer
->
SetupDestination
(
destFileName
);
return
importer
;
}
ROOT
::
Experimental
::
RResult
<
void
>
ROOT
::
Experimental
::
RNTupleImporter
::
SetupDestination
(
std
::
string_view
destFileName
)
{
fDestFileName
=
destFileName
;
fWriteOptions
.
SetCompression
(
kDefaultCompressionSettings
);
fDestFile
=
std
::
unique_ptr
<
TFile
>
(
TFile
::
Open
(
fDestFileName
.
c_str
(),
"UPDATE"
));
if
(
!
fDestFile
||
fDestFile
->
IsZombie
())
{
return
R__FAIL
(
"cannot open dest file "
+
std
::
string
(
fDestFileName
));
}
return
RResult
<
void
>::
Success
();
}
void
ROOT
::
Experimental
::
RNTupleImporter
::
ReportSchema
()
{
for
(
const
auto
&
f
:
fImportFields
)
{
...
...
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