@@ -35,9 +35,9 @@ class FileRAII {
3535 std::string GetPath () const { return fPath ; }
3636};
3737
38- TEST (RDFSnapshotRNTuple, FromScratchTemplated )
38+ TEST (RDFSnapshotRNTuple, FromScratch )
3939{
40- FileRAII fileGuard{" RDFSnapshotRNTuple_from_scratch_templated .root" };
40+ FileRAII fileGuard{" RDFSnapshotRNTuple_from_scratch .root" };
4141 const std::vector<std::string> columns = {" x" };
4242
4343 auto df = ROOT::RDataFrame (25ull ).Define (" x" , [] { return 10 ; });
@@ -59,30 +59,6 @@ TEST(RDFSnapshotRNTuple, FromScratchTemplated)
5959 }
6060}
6161
62- TEST (RDFSnapshotRNTuple, FromScratchJITted)
63- {
64- FileRAII fileGuard{" RDFSnapshotRNTuple_from_scratch_jitted.root" };
65- const std::vector<std::string> columns = {" x" };
66-
67- auto df = ROOT::RDataFrame (25ull ).Define (" x" , [] { return 10 ; });
68-
69- RSnapshotOptions opts;
70- opts.fOutputFormat = ROOT::RDF::ESnapshotOutputFormat::kRNTuple ;
71-
72- auto sdf = df.Snapshot (" ntuple" , fileGuard.GetPath (), " x" , opts);
73-
74- EXPECT_EQ (columns, sdf->GetColumnNames ());
75-
76- // Verify we actually snapshotted to an RNTuple.
77- auto ntuple = RNTupleReader::Open (" ntuple" , fileGuard.GetPath ());
78- EXPECT_EQ (25ull , ntuple->GetNEntries ());
79-
80- auto x = ntuple->GetView <int >(" x" );
81- for (const auto i : ntuple->GetEntryRange ()) {
82- EXPECT_EQ (10 , x (i));
83- }
84- }
85-
8662void BookLazySnapshot (std::string_view filename)
8763{
8864 auto d = ROOT::RDataFrame (1 );
@@ -172,26 +148,9 @@ TEST_F(RDFSnapshotRNTupleTest, DefaultFormatWarning)
172148 " in RSnapshotOptions. Note that this current default behaviour might change in the future." );
173149}
174150
175- TEST_F (RDFSnapshotRNTupleTest, DefaultToRNTupleTemplated)
176- {
177- FileRAII fileGuard{" RDFSnapshotRNTuple_snap_templated.root" };
178-
179- auto df = ROOT::RDataFrame (fNtplName , fFileName );
180- auto sdf = df.Define (" x" , [] { return 10 ; }).Snapshot (" ntuple" , fileGuard.GetPath (), {" pt" , " x" }, fSnapshotOpts );
181-
182- auto ntuple = RNTupleReader::Open (" ntuple" , fileGuard.GetPath ());
183- EXPECT_EQ (1ull , ntuple->GetNEntries ());
184-
185- auto pt = ntuple->GetView <float >(" pt" );
186- auto x = ntuple->GetView <int >(" x" );
187-
188- EXPECT_FLOAT_EQ (42.0 , pt (0 ));
189- EXPECT_EQ (10 , x (0 ));
190- }
191-
192- TEST_F (RDFSnapshotRNTupleTest, DefaultToRNTupleJITted)
151+ TEST_F (RDFSnapshotRNTupleTest, DefaultToRNTuple)
193152{
194- FileRAII fileGuard{" RDFSnapshotRNTuple_snap_jitted .root" };
153+ FileRAII fileGuard{" RDFSnapshotRNTuple_snap .root" };
195154
196155 auto df = ROOT::RDataFrame (fNtplName , fFileName );
197156 auto sdf = df.Define (" x" , [] { return 10 ; }).Snapshot (" ntuple" , fileGuard.GetPath (), {" pt" , " x" }, fSnapshotOpts );
@@ -206,35 +165,9 @@ TEST_F(RDFSnapshotRNTupleTest, DefaultToRNTupleJITted)
206165 EXPECT_EQ (10 , x (0 ));
207166}
208167
209- TEST_F (RDFSnapshotRNTupleTest, ToTTreeTemplated)
210- {
211- FileRAII fileGuard{" RDFSnapshotRNTuple_to_ttree_templated.root" };
212-
213- auto df = ROOT::RDataFrame (fNtplName , fFileName );
214-
215- fSnapshotOpts .fOutputFormat = ROOT::RDF::ESnapshotOutputFormat::kTTree ;
216-
217- auto sdf = df.Define (" x" , [] { return 10 ; }).Snapshot (" tree" , fileGuard.GetPath (), {" pt" , " x" }, fSnapshotOpts );
218-
219- TFile file (fileGuard.GetPath ().c_str ());
220- auto tree = file.Get <TTree>(" tree" );
221- EXPECT_EQ (1ull , tree->GetEntries ());
222-
223- float pt;
224- int x;
225-
226- tree->SetBranchAddress (" pt" , &pt);
227- tree->SetBranchAddress (" x" , &x);
228-
229- tree->GetEntry (0 );
230-
231- EXPECT_FLOAT_EQ (42.0 , pt);
232- EXPECT_EQ (10 , x);
233- }
234-
235- TEST_F (RDFSnapshotRNTupleTest, ToTTreeJITted)
168+ TEST_F (RDFSnapshotRNTupleTest, ToTTree)
236169{
237- FileRAII fileGuard{" RDFSnapshotRNTuple_to_ttree_jitted .root" };
170+ FileRAII fileGuard{" RDFSnapshotRNTuple_to_ttree .root" };
238171
239172 auto df = ROOT::RDataFrame (fNtplName , fFileName );
240173
@@ -520,31 +453,10 @@ void WriteTestTree(const std::string &tname, const std::string &fname)
520453 t.Write ();
521454}
522455
523- TEST (RDFSnapshotRNTuple, DisallowFromTTreeTemplated)
524- {
525- const auto treename = " tree" ;
526- FileRAII fileGuard{" RDFSnapshotRNTuple_disallow_from_ttree_templated.root" };
527-
528- WriteTestTree (treename, fileGuard.GetPath ());
529-
530- auto df = ROOT::RDataFrame (treename, fileGuard.GetPath ());
531-
532- RSnapshotOptions opts;
533- opts.fOutputFormat = ROOT::RDF::ESnapshotOutputFormat::kRNTuple ;
534-
535- try {
536- auto sdf = df.Define (" x" , [] { return 10 ; }).Snapshot (" ntuple" , fileGuard.GetPath (), {" pt" , " x" }, opts);
537- FAIL () << " snapshotting from RNTuple to TTree is not (yet) possible" ;
538- } catch (const std::runtime_error &err) {
539- EXPECT_STREQ (err.what (), " Snapshotting from TTree to RNTuple is not yet supported. The current recommended way "
540- " to convert TTrees to RNTuple is through the RNTupleImporter." );
541- }
542- }
543-
544- TEST (RDFSnapshotRNTuple, DisallowFromTTreeJITted)
456+ TEST (RDFSnapshotRNTuple, DisallowFromTTree)
545457{
546458 const auto treename = " tree" ;
547- FileRAII fileGuard{" RDFSnapshotRNTuple_disallow_from_ttree_jitted .root" };
459+ FileRAII fileGuard{" RDFSnapshotRNTuple_disallow_from_ttree .root" };
548460
549461 WriteTestTree (treename, fileGuard.GetPath ());
550462
0 commit comments