Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions roottest/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -844,10 +844,6 @@ root/tree/addresses/converterIssues/ExtHit/ExtHitProjectDict.cxx
/root/tree/selector/lhef_*_gen.C
/root/tree/selector/lhef_*_gen.h


# /root/tree/selectorreader/
/root/tree/selectorreader/generated_selectors/

# /root/tree/split/
/root/tree/split/abstract.root
/root/tree/split/customClassTree.root
Expand Down
2 changes: 0 additions & 2 deletions roottest/root/tree/selector/.rootrc

This file was deleted.

45 changes: 38 additions & 7 deletions roottest/root/tree/selector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,38 @@
#-------------------------------------------------------------------------------
#
# Placeholder file to translate the tests to the new CTest system. Meanwhile we
# define a CTest test that calls 'make' in ${CMAKE_CURRENT_SOURCE_DIR}
#
#-------------------------------------------------------------------------------
ROOTTEST_ADD_OLDTEST()
ROOTTEST_ADD_TEST(copyfiles
COMMAND ${CMAKE_COMMAND} -E echo "copy files"
COPY_TO_BUILDDIR Event1.root Event2.root Event3.root
FIXTURES_SETUP root-tree-selector-copyfiles-fixture)

ROOTTEST_ADD_TEST(selector
MACRO run.C
OUTREF selector.ref
OUTCNVCMD grep -v reloading
FIXTURES_REQUIRED root-tree-selector-copyfiles-fixture)

ROOTTEST_COMPILE_MACRO(sel01.C
FIXTURES_SETUP root-tree-selector-sel01-fixture)

ROOTTEST_ADD_TEST(SelectorCintTest
MACRO runSelectorCintTest.C
OUTREF SelectorCintTest.ref
OUTCNVCMD grep -v unloading
FIXTURES_REQUIRED root-tree-selector-sel01-fixture root-tree-selector-copyfiles-fixture)

ROOTTEST_COMPILE_MACRO(emptysel.C
FIXTURES_SETUP root-tree-selector-emptysel-fixture)

ROOTTEST_ADD_TEST(GetSelector
MACRO execGetSelector.C
OUTREF execGetSelector.ref
FIXTURES_REQUIRED root-tree-selector-emptysel-fixture)

ROOTTEST_ADD_TEST(LHEF
MACRO execLHEF.C
OUTREF execLHEF.ref
COPY_TO_BUILDDIR unweighted.root)

ROOTTEST_ADD_TEST(WithAbort
MACRO execWithAbort.C
OUTREF execWithAbort.ref
OUTCNVCMD grep -v reloading
FIXTURES_REQUIRED root-tree-selector-copyfiles-fixture)
36 changes: 0 additions & 36 deletions roottest/root/tree/selector/Makefile

This file was deleted.

1 change: 0 additions & 1 deletion roottest/root/tree/selector/SelectorCintTest.ref
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Running Interpreted Process 7
Running Interpreted Process 8
Running Interpreted Process 9
Info in <ACLiC>: script has already been loaded in interpreted mode
Info in <ACLiC>: unloading sel01.C and compiling it
Running Compiled Process 0
Running Compiled Process 1
Running Compiled Process 2
Expand Down
6 changes: 3 additions & 3 deletions roottest/root/tree/selector/execWithAbort.ref
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

Processing execWithAbort.C...
Warning in <TClass::TClass>: no dictionary for class Event is available
Warning in <TClass::TClass>: no dictionary for class EventHeader is available
Warning in <TClass::TClass>: no dictionary for class Track is available
Warning in <TClass::Init>: no dictionary for class Event is available
Warning in <TClass::Init>: no dictionary for class EventHeader is available
Warning in <TClass::Init>: no dictionary for class Track is available
My option are thefirstoption
My name is T
tree number: 0 T1
Expand Down
14 changes: 7 additions & 7 deletions roottest/root/tree/selector/run.C
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
void run()
{
// Avoid loading the library
gInterpreter->UnloadLibraryMap("sel_C");
new TFile("Event1.root");
tree1 = T1;
new TFile("Event2.root");
tree2 = T2;
new TFile("Event3.root");
tree3 = T3;
TFile::Open("Event1.root");
auto tree1 = (TTree*) gFile->Get("T1");
TFile::Open("Event2.root");
auto tree2 = (TTree*) gFile->Get("T2");
TFile::Open("Event3.root");
auto tree3 = (TTree*) gFile->Get("T3");
tree1->Process("sel.C","T1");
tree2->Process("sel.C","T2");
tree3->Process("sel.C","T3");
Expand All @@ -15,5 +16,4 @@ TSelector *sel = TSelector::GetSelector("sel.C");
tree1->Process(sel,"T1");
tree2->Process(sel,"T2");
tree3->Process(sel,"T3");
return 0;
}
2 changes: 1 addition & 1 deletion roottest/root/tree/selector/runSelectorCintTest.C
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
tree->Process(&csel);
# endif

auto c = new TChain("T1");
c = new TChain("T1");
c->Add("Event1.root");
# ifdef ClingWorkAroundMissingDynamicScope
c->Process(csel);
Expand Down
6 changes: 3 additions & 3 deletions roottest/root/tree/selector/selector.ref
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

Processing run.C...
Warning in <TClass::TClass>: no dictionary for class Event is available
Warning in <TClass::TClass>: no dictionary for class EventHeader is available
Warning in <TClass::TClass>: no dictionary for class Track is available
Warning in <TClass::Init>: no dictionary for class Event is available
Warning in <TClass::Init>: no dictionary for class EventHeader is available
Warning in <TClass::Init>: no dictionary for class Track is available
My option are T1
My name is T1
My option are T2
Expand Down
1 change: 0 additions & 1 deletion roottest/root/tree/selectorreader/.rootrc

This file was deleted.

46 changes: 35 additions & 11 deletions roottest/root/tree/selectorreader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
#execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated_selectors)
#execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_CURRENT_SOURCE_DIR}/trees ${CMAKE_CURRENT_BINARY_DIR}/trees)
ROOTTEST_ADD_TEST(mkdir
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/generated_selectors
FIXTURES_SETUP root-tree-selectorreader-mkdir-fixture)

#ROOTTEST_COMPILE_MACRO(SampleClasses.h)
#ROOTTEST_ADD_TEST(Classes
# COPY_TO_BUILDDIR SampleClasses.h
# MACRO runClasses.C
# OUTREF Classes.ref
# DEPENDS ${COMPILE_MACRO_TEST})
ROOTTEST_COMPILE_MACRO(SampleClasses.h
FIXTURES_SETUP root-tree-selectorreader-SampleClasses-fixture)

ROOTTEST_ADD_TEST(Classes
MACRO runClasses.C
MACROARG "\"${CMAKE_CURRENT_SOURCE_DIR}\""
OUTREF Classes.ref
FIXTURES_REQUIRED root-tree-selectorreader-mkdir-fixture root-tree-selectorreader-SampleClasses-fixture)

ROOTTEST_ADD_TEST(CollectionClasses
MACRO runCollectionClasses.C
MACROARG "\"${CMAKE_CURRENT_SOURCE_DIR}\""
OUTREF CollectionClasses.ref
FIXTURES_REQUIRED root-tree-selectorreader-mkdir-fixture root-tree-selectorreader-SampleClasses-fixture)

ROOTTEST_ADD_TEST(Collections
MACRO runCollections.C
MACROARG "\"${CMAKE_CURRENT_SOURCE_DIR}\""
OUTREF Collections.ref
FIXTURES_REQUIRED root-tree-selectorreader-mkdir-fixture root-tree-selectorreader-SampleClasses-fixture)

ROOTTEST_ADD_TEST(Options
MACRO runOptions.C
MACROARG "\"${CMAKE_CURRENT_SOURCE_DIR}\""
OUTREF Options.ref
FIXTURES_REQUIRED root-tree-selectorreader-mkdir-fixture root-tree-selectorreader-SampleClasses-fixture)

ROOTTEST_ADD_TEST(Simple
MACRO runSimple.C
MACROARG "\"${CMAKE_CURRENT_SOURCE_DIR}\""
OUTREF Simple.ref
FIXTURES_REQUIRED root-tree-selectorreader-mkdir-fixture)

# It relies very heavily that these tests are run in the source directory
# so using the old method....

ROOTTEST_ADD_OLDTEST()
98 changes: 0 additions & 98 deletions roottest/root/tree/selectorreader/Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions roottest/root/tree/selectorreader/SampleClass.ref

This file was deleted.

9 changes: 3 additions & 6 deletions roottest/root/tree/selectorreader/runClasses.C
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ void generateAll() {
// 'test_selectors/NameOfTree.C'), which has been already filled with code accessing
// the data. (Regarding the header file, it needs no modification, so the newly
// generated one is used.)
void runClasses() {
const char *dirSaved = gSystem->pwd(); // Save working directory

void runClasses(const std::string &srcdir = ".") {
// Loop through test trees
std::vector<std::string> trees = {"TreeClass0",
"TreeClass2",
Expand All @@ -130,13 +128,12 @@ void runClasses() {
{
fprintf(stderr, "Testing tree %s\n", treeName.c_str());

TFile f(("./trees/" + treeName + ".root").c_str()); // Load file
TFile f((srcdir + "/trees/" + treeName + ".root").c_str()); // Load file
TTree *t = (TTree*)f.Get(treeName.c_str()); // Load tree
gSystem->cd("./generated_selectors"); // Go to gen. folder
t->MakeSelector(); // Generate selector
gSystem->cd(".."); // Go back
t->Process(("./test_selectors/" + treeName + ".C").c_str()); // Run (pre-filled) selector
t->Process((srcdir + "/test_selectors/" + treeName + ".C").c_str()); // Run (pre-filled) selector
}
gSystem->cd(dirSaved); // Restore working directory
}

12 changes: 5 additions & 7 deletions roottest/root/tree/selectorreader/runCollectionClasses.C
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,8 @@ void generateAll() {
// 'test_selectors/NameOfTree.C'), which has been already filled with code accessing
// the data. (Regarding the header file, it needs no modification, so the newly
// generated one is used.)
void runCollectionClasses() {
const char *dirSaved = gSystem->pwd(); // Save working directory

void runCollectionClasses(const std::string &srcdir = ".")
{
// Loop through test trees
std::vector<std::string> trees = {"TreeVectorClass0",
"TreeVectorClass2",
Expand All @@ -229,13 +228,12 @@ void runCollectionClasses() {
{
fprintf(stderr, "Testing tree %s\n", treeName.c_str());

TFile f(("./trees/" + treeName + ".root").c_str()); // Load file
TTree *t = (TTree*)f.Get(treeName.c_str()); // Load tree
TFile f((srcdir + "/trees/" + treeName + ".root").c_str()); // Load file
TTree *t = (TTree*) f.Get(treeName.c_str()); // Load tree
gSystem->cd("./generated_selectors"); // Go to gen. folder
t->MakeSelector(); // Generate selector
gSystem->cd(".."); // Go back
t->Process(("./test_selectors/" + treeName + ".C").c_str()); // Run (pre-filled) selector
t->Process((srcdir + "/test_selectors/" + treeName + ".C").c_str()); // Run (pre-filled) selector
}
gSystem->cd(dirSaved); // Restore working directory
}

Loading
Loading