diff --git a/root/tree/CMakeLists.txt b/root/tree/CMakeLists.txt index 77301a8b96..6763cbe6c6 100644 --- a/root/tree/CMakeLists.txt +++ b/root/tree/CMakeLists.txt @@ -1,3 +1 @@ - -set(excluded_tests fastcloningeventtree) ROOTTEST_ADD_TESTDIRS(EXCLUDED_DIRS ${excluded_tests}) diff --git a/root/tree/fastcloningeventtree/CMakeLists.txt b/root/tree/fastcloningeventtree/CMakeLists.txt index 1d620c0c19..4870d116de 100644 --- a/root/tree/fastcloningeventtree/CMakeLists.txt +++ b/root/tree/fastcloningeventtree/CMakeLists.txt @@ -1,90 +1,26 @@ -if(ROOTTEST_DIR) - set(ROOT_EVENT_DIR ${ROOTTEST_DIR}/root/treeformula/event/) -else() - set(ROOT_EVENT_DIR ${ROOT_SOURCE_DIR}/roottest/root/treeformula/event/) -endif() - -# Generating dataset from roottest-treeformula-event-make test -# FIXME: it will be nice to move roottest-treeformula-event to CMake and add it as dependency -# To fix runtime_cxxmodules, we need to use already build artefacts. - if(TARGET onepcm) - set(EventDependencies "onepcm") + set(EventDependencies "onepcm") endif() -#ROOT_GENERATE_DICTIONARY(EventDict ${ROOT_EVENT_DIR}/Event.h -# LINKDEF ${ROOT_EVENT_DIR}/EventLinkDef.h) - -#ROOT_LINKER_LIBRARY(Event TEST ${ROOT_EVENT_DIR}/Event.cxx EventDict.cxx -# LIBRARIES Core Tree Hist MathCore) - -ROOTTEST_GENERATE_EXECUTABLE(EventGeneration ${ROOT_EVENT_DIR}/MainEvent.cxx - LIBRARIES Core RIO Net Tree Hist MathCore Event) - -if(NOT ClingWorkAroundMissingDynamicScope) - ROOTTEST_ADD_TEST(Event-new-split0 - COMMAND ./EventGeneration 50 0 0 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split0.root - DEPENDS EventGeneration ${EventDependencies}) - - ROOTTEST_ADD_TEST(Event-new-split1 - COMMAND ./EventGeneration 50 0 1 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split1.root - DEPENDS EventGeneration ${EventDependencies}) - - ROOTTEST_ADD_TEST(Event-new-split2 - COMMAND ./EventGeneration 50 0 2 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split2.root - DEPENDS EventGeneration ${EventDependencies}) - - ROOTTEST_ADD_TEST(Event-new-split9 - COMMAND ./EventGeneration 50 0 9 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.new.split9.root - DEPENDS EventGeneration ${EventDependencies}) - - ROOTTEST_ADD_TEST(Event-old-split - COMMAND ./EventGenerate 50 0 -2 1 600 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.old.split.root - DEPENDS EventGenerate ${EventDependencies}) - - ROOTTEST_ADD_TEST(Event-old-streamed - COMMAND ./EventGeneration 20 0 -1 1 30 > log && cp ${CMAKE_CURRENT_BINARY_DIR}/Event.root ${CMAKE_CURRENT_BINARY_DIR}/Event.old.streamed.root - DEPENDS EventGeneration ${EventDependencies}) - - ROOTTEST_ADD_TEST(Event-new-split0-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split0.root\\\"\\)" > log - DEPENDS Event-new-split0) - - ROOTTEST_ADD_TEST(Event-new-split1-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split1.root\\\"\\)" > log - DEPENDS Event-new-split1) - - ROOTTEST_ADD_TEST(Event-new-split2-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split2.root\\\"\\)" > log - DEPENDS Event-new-split2) - - ROOTTEST_ADD_TEST(Event-new-split9-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.new.split9.root\\\"\\)" > log - DEPENDS Event-new-split9) - - ROOTTEST_ADD_TEST(Event-old-split-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.old.split.root\\\"\\)" > log - DEPENDS Event-old-split) - - ROOTTEST_ADD_TEST(Event-old-streamed-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\\(\\\"Event.old.streamed.root\\\"\\)" > log - DEPENDS Event-old-streamed) - - ROOTTEST_ADD_TEST(Event-new-split9-clone - COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/dt_MakeRef.C\\(\\\"Event.new.split9.root\\\"\\)" > log - DEPENDS Event-new-split9) - - ROOTTEST_ADD_TEST(runsingle - COPY_TO_BUILDDIR dt_wrap.C dt_RunDrawTest.C dt_DrawTest.C - EXEC dt_RunDrawTest.sh - OUTREF references/runsingle.ref - WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR} - DEPENDS Event-new-split0-clone - DEPENDS Event-new-split1-clone - DEPENDS Event-new-split2-clone - DEPENDS Event-new-split9-clone - DEPENDS Event-old-split-clone - DEPENDS Event-old-streamed-clone - DEPENDS Event-new-split9-clone -) -endif() +# +# function FASTCLONINGEVENTTREE_GENERATE_TEST +# +# Generate ctrans.C tests using file generated with FASTCLONINGEVENTTREE_GENERATE_FILE +# +function(FASTCLONINGEVENTTREE_GENERATE_TEST file_name) + ROOTTEST_ADD_TEST("ctrans-${file_name}" + COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/ctrans.C\(\"${ROOTTEST_EVENTGENERATION_OUTPUT_DIR}/${file_name}.root\"\)" + DEPENDS EventGeneration + FIXTURES_REQUIRED EventGeneration-${file_name}) +endfunction() + +FASTCLONINGEVENTTREE_GENERATE_TEST(split-zero) +FASTCLONINGEVENTTREE_GENERATE_TEST(split-one) +FASTCLONINGEVENTTREE_GENERATE_TEST(split-two) +FASTCLONINGEVENTTREE_GENERATE_TEST(split-nine) +FASTCLONINGEVENTTREE_GENERATE_TEST(stream-old) + +ROOTTEST_ADD_TEST(makeref-split-nine + COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/dt_MakeRef.C\(\"${ROOTTEST_EVENTGENERATION_OUTPUT_DIR}/split-nine.root\"\)" > log + DEPENDS EventGeneration + FIXTURES_REQUIRED EventGeneration-split-nine) diff --git a/root/tree/fastcloningeventtree/Makefile b/root/tree/fastcloningeventtree/Makefile deleted file mode 100644 index 4099f560c0..0000000000 --- a/root/tree/fastcloningeventtree/Makefile +++ /dev/null @@ -1,187 +0,0 @@ -CLEAN_TARGETS += $(ALL_LIBRARIES) *.log *.clog copiedEvent* Event.h one two \ - merged/Event* merged/libEvent* merged/dt_reference.root \ - Event*.root dt_reference.root CloneTree.root cal.root Tuple_merge.root TestFile2.root \ - output.root TestMerged.root mix_merge.root mix_int.root mix_char.root execmisstop.root \ - TestFile1.root Tuple_merge.root missplit-1.root missplit-99.root missplit.fail.root - - -TEST_TARGETS += cloneChain single merge Plot SplitMismatch outoforder filemergererror badmix -ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell git rev-parse --show-toplevel)/ - ifeq ($(strip $(ROOTTEST_HOME)),) - export ROOTTEST_HOME := $(shell expr $(CURDIR) : '\(.*/roottest/\)') - endif - ifeq ($(strip $(ROOTTEST_HOME)),) - $(error The head of roottest was not found. Set ROOTTEST_HOME) - endif -endif -include $(ROOTTEST_HOME)/scripts/Rules.mk - -# Outputs a message if the FAIL variable is null -testWithFailure: -ifeq ($(FAIL),) - $(WarnFailTest) -endif - -DATAFILES = Event.new.split0.root Event.new.split1.root \ - Event.new.split2.root Event.new.split9.root \ - Event.old.streamed.root Event.old.split.root - -REFFILE=dt_reference.root -export EVENTBUFSIZE = 20 -export size = 20 - -$(REFFILE) : Event.new.split9.root copiedEvent$(ExeSuf) - $(CMDECHO) touch Event.new.split9.root # to prevent any potential re-build by -f $(EVENTDIR)/dt_Makefile - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent $@ > $@.create.log 2>&1 - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'ctrans.C("Event.new.split9.root")' > event.new.split9.root.clone.log 2>&1 && touch $@ - -#dt_MakeRef.C dt_DrawTest.C libEvent.$(DllSuf) Event.h Event.new.split9.root -# @$(CALLROOTEXE) -l -b -q 'dt_MakeRef.C("Event.new.split9.root",0);' $(OUTPUT) && \ -# echo "$@ made" - -Event.new.split0.root: copiedEvent$(ExeSuf) - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $@ > $@.create.log 2>&1 - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'ctrans.C("$@")' > $@.clone.log 2>&1 - -Event.new.split1.root: copiedEvent$(ExeSuf) - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $@ > $@.create.log 2>&1 - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'ctrans.C("$@")' > $@.clone.log 2>&1 - -Event.new.split2.root: copiedEvent$(ExeSuf) - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $@ > $@.create.log 2>&1 - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'ctrans.C("$@")' > $@.clone.log 2>&1 - -Event.new.split9.root: copiedEvent$(ExeSuf) - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $@ > $@.create.log 2>&1 - -Event.old.split.root: copiedEvent$(ExeSuf) - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $@ > $@.create.log 2>&1 -ifneq ($(FAIL),) - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'ctrans.C("$@")' > $@.clone.log 2>&1 -endif - -Event.old.streamed.root: copiedEvent$(ExeSuf) - $(CMDECHO) $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $@ > $@.create.log 2>&1 -ifneq ($(FAIL),) - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'ctrans.C("$@")' > $@.clone.log 2>&1 -endif - -single.log: $(REFFILE) $(DATAFILES) $(ROOTCORELIBS) dt_RunDrawTest_C.$(DllSuf) - $(CMDECHO) ./dt_RunDrawTest.sh > single.raw.log 2>&1 - $(CMDECHO) grep -v 'ROOTMARKS' single.raw.log | grep '^..' > single.log - -FILEDIRS=one two -EVENTDIRS=one/copiedEvent$(ExeSuf) two/copiedEvent$(ExeSuf) - -ifneq ($(FAIL),) -MDATAFILES = Event.new.split0.root Event.new.split1.root \ - Event.new.split2.root Event.new.split9.root \ - Event.old.streamed.root Event.old.split.root -else -MDATAFILES = Event.new.split0.root Event.new.split1.root \ - Event.new.split2.root Event.new.split9.root \ - Event.old.streamed.root -endif -# TChain::Merge does not currently work with old.split.root -# Event.old.split.root - -ONEFILES=$(MDATAFILES:%=one/%) -TWOFILES=$(MDATAFILES:%=two/%) -MERGEFILES=$(MDATAFILES:%=merged/%) - -$(EVENTDIRS): %/copiedEvent$(ExeSuf): copiedEvent$(ExeSuf) - $(CMDECHO) mkdir -p $* - $(CMDECHO) cp copiedEvent$(ExeSuf)* libEvent.* $* - -one/libEvent.$(DllSuf): one/copiedEvent$(ExeSuf) -two/libEvent.$(DllSuf): two/copiedEvent$(ExeSuf) - -$(ONEFILES): %: one/copiedEvent$(ExeSuf) one/libEvent.$(DllSuf) - $(CMDECHO) (cd one; $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $(@F)) > $@.create.log 2>&1 - -$(TWOFILES): %: two/copiedEvent$(ExeSuf) two/libEvent.$(DllSuf) - $(CMDECHO) (cd two; $(MAKE) size=$(size) --no-print-directory -f $(EVENTDIR)/dt_Makefile EVENT=copiedEvent$(ExeSuf) $(@F)) > $@.create.log 2>&1 - -merged/$(REFFILE) : merged/Event.new.split9.root copiedEvent$(ExeSuf) merged/libEvent.$(DllSuf) - $(CMDECHO) (cd merged; $(CALLROOTEXE) -l -b -q '../dt_MakeRef.C("Event.new.split9.root",0);' > /dev/null) -# $(CMDECHO) $(CALLROOTEXE) -q -b -l 'mtrans.C("Event.new.split9.root")' && touch $@ - -merged: - $(CMDECHO) mkdir -p merged ; cp .rootrc merged - -merged/libEvent.$(DllSuf) : merged copiedEvent$(ExeSuf) - $(CMDECHO) cp libEvent.* merged - -$(MERGEFILES): %: $(ONEFILES) $(TWOFILES) | merged - $(CMDECHO) $(CALLROOTEXE) -q -b -l 'mtrans.C("$(@F)")' > $@.create.log 2>&1 - -merge.log: merged/$(REFFILE) $(MERGEFILES) copiedEvent$(ExeSuf) dt_RunDrawTest_C.$(DllSuf) - $(CMDECHO) ./dt_RunDrawTest.sh 'merged/' > merge.raw.log 2>&1 - $(CMDECHO) grep -v 'ROOTMARKS' merge.raw.log | grep '^..' > merge.log - - -testWithDiff: testWithDiff.log testWithDiff.ref - $(TestDiff) - -ifneq ($(ClingWorkAroundMissingDynamicScope),) -single: - -merge: -else -single: single.log - $(TestDiff) - -merge: merge.log - $(TestDiff) - -endif - -CloneTree.root: make_CloneTree.C - $(CMDECHO) $(CALLROOTEXE) -q -b -l make_CloneTree.C > make_CloneTree.log 2>&1 - -cloneChain.log: CloneTree.root - -cloneChain: cloneChain.log - $(TestDiff) - -Plot.log: recon-v1r030603p6_700000811_00000-00984_calTuple.root - -Plot: Plot.log - $(TestDiff) - -SplitMismatch.clog: runSplitMismatch_C.$(DllSuf) - $(CMDECHO) $(CALLROOTEXE) -q -b -l runSplitMismatch.C+ 2>&1 | sed -e 's:file .*roottest:file .../roottest:' > SplitMismatch.clog - -SplitMismatch: SplitMismatch.clog - $(TestDiff) - -Tuple_merge.root: Tuple_1.root Tuple_2.root $(ROOTCORELIBS) - $(CMDECHO) hadd -f Tuple_merge.root Tuple_1.root Tuple_2.root > Tuple_merge.log - -outoforder.log: Tuple_merge.root - -outoforder: outoforder.log - $(TestDiff) - -filemergererror: filemergererror.log - $(TestDiff) - -badmix: badmix.log - $(TestDiff) - - -abstract.root: abstract_C.$(DllSuf) - $(CMDECHO) root.exe -b -l -q 'abstract.C+(0)' > abstract_root.log 2>&1 - -copy-abstract.root: abstract_C.$(DllSuf) abstract.root - $(CMDECHO) root.exe -b -l -q 'abstract.C+(1)' > abstract_root.log 2>&1 - -abstract.log: copy-abstract.root - -abstract: abstract.log - $(TestDiff) - -ifneq ($(ClingWorkAroundMissingAutoLoading),) -filemergererror.log: CALLROOTEXE += -e 'gSystem->Load("libTreePlayer");' -endif diff --git a/root/tree/fastcloningeventtree/ctrans.C b/root/tree/fastcloningeventtree/ctrans.C index b82d942851..35a3cf7ea7 100644 --- a/root/tree/fastcloningeventtree/ctrans.C +++ b/root/tree/fastcloningeventtree/ctrans.C @@ -1,7 +1,15 @@ void ctrans(const char *filename) { + std::string fullpath{filename}; + + // Add directory of the input file to the dynamic path so that the + // library can be loaded. + auto lastslash = fullpath.find_last_of("/"); + std::string directory{fullpath.substr(0, lastslash)}; + gSystem->AddDynamicPath(directory.c_str()); TFile *_file0 = TFile::Open(filename); - gSystem->Load("libEvent.so"); + gSystem->Load("libTreeFormulaEvent"); + TTree *from = (TTree*) _file0->Get("T"); auto f = new TFile("clone.root","RECREATE"); from->CloneTree(-1,"fast"); diff --git a/root/tree/fastcloningeventtree/dt_RunDrawTest.sh b/root/tree/fastcloningeventtree/dt_RunDrawTest.sh deleted file mode 100755 index 625c736a03..0000000000 --- a/root/tree/fastcloningeventtree/dt_RunDrawTest.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# Previous step is to do something like -# root -l -q 'MakeRef.C("Event.old.split.root");' - -ClassWarning='Warning in : no dictionary for class' -RootPrompt='root \[0\]' -EmptyLine='^$' -Streamer="Event::Streamer not available," - -subdir=$1 - -# launch replace -launch () { - (root.exe -l -b -q 'dt_wrap.C("'$subdir$1'",'$2')' 2>&1; return $?;) | \ - (eval grep -v $3 ) | \ - (if test ! "x$4" = x ; then eval grep -v $4; else cat; fi;) | \ - (if test ! "x$5" = x ; then eval grep -v $5; else cat; fi;) | \ - (if test ! "x$6" = x ; then eval grep -v $6; else cat; fi;) | \ - (if test ! "x$7" = x ; then eval grep -v $7; else cat; fi;) \ - ; -} - - -if test "x$subdir" = "x"; then - launch "Event.old.split.root" 0 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine'" && \ - launch "Event.old.split.root" 1 "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.split.root" 2 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.split.root" 3 "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.split.root" 4 "'$RootPrompt'" "'$EmptyLine' " - - launch "Event.old.streamed.root" 0 "'$Streamer'" "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.streamed.root" 1 "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.streamed.root" 2 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.streamed.root" 3 "'$RootPrompt'" "'$EmptyLine' " && \ - launch "Event.old.streamed.root" 4 "'$RootPrompt'" "'$EmptyLine' " -fi - -launch "Event.new.split9.root" 0 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split9.root" 1 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split9.root" 2 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split9.root" 3 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split9.root" 4 "'$RootPrompt'" "'$EmptyLine' " - -launch "Event.new.split2.root" 0 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split2.root" 1 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split2.root" 2 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split2.root" 3 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split2.root" 4 "'$RootPrompt'" "'$EmptyLine' " - -launch "Event.new.split1.root" 0 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split1.root" 1 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split1.root" 2 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split1.root" 3 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split1.root" 4 "'$RootPrompt'" "'$EmptyLine' " - -launch "Event.new.split0.root" 0 "'$Streamer'" "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split0.root" 1 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split0.root" 2 "'$ClassWarning'" "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split0.root" 3 "'$RootPrompt'" "'$EmptyLine' " && \ -launch "Event.new.split0.root" 4 "'$RootPrompt'" "'$EmptyLine' " diff --git a/root/tree/fastcloningeventtree/mtrans.C b/root/tree/fastcloningeventtree/mtrans.C deleted file mode 100644 index e2aeb565dd..0000000000 --- a/root/tree/fastcloningeventtree/mtrans.C +++ /dev/null @@ -1,7 +0,0 @@ -void mtrans(const char *filename) -{ - TChain *c = new TChain("T"); - c->AddFile(Form("one/%s",filename)); - c->AddFile(Form("two/%s",filename)); - c->Merge(Form("merged/%s",filename),"fast"); -} diff --git a/root/treeformula/event/CMakeLists.txt b/root/treeformula/event/CMakeLists.txt index c3107380c8..b8acb3014a 100644 --- a/root/treeformula/event/CMakeLists.txt +++ b/root/treeformula/event/CMakeLists.txt @@ -15,7 +15,8 @@ endif() ROOTTEST_GENERATE_EXECUTABLE(EventGeneration ${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaEventMain.cxx LIBRARIES Core RIO Net Tree Hist MathCore TreeFormulaEvent - DEPENDS TreeFormulaEvent) + DEPENDS TreeFormulaEvent + FIXTURES_SETUP EventGeneration) add_custom_command(TARGET G__TreeFormulaEvent COMMAND ${CMAKE_COMMAND} -E copy @@ -50,14 +51,16 @@ ROOTTEST_ADD_TEST(read # function(EVENT_GENERATE_FILE file_name size comp split action tracks) ROOTTEST_ADD_TEST("generation-${file_name}" - COMMAND ./EventGeneration "${size}" "${comp}" "${split}" "${action}" "${tracks}" - POSTCMD ${CMAKE_COMMAND} -E rename - ${CMAKE_CURRENT_BINARY_DIR}/Event.root - "${CMAKE_CURRENT_BINARY_DIR}/${file_name}.root" + COMMAND ./EventGeneration "${size}" "${comp}" "${split}" "${action}" "${tracks}" "${file_name}.root" DEPENDS EventGeneration - RUN_SERIAL) + FIXTURES_REQUIRED EventGeneration + FIXTURES_SETUP EventGeneration-${file_name}) endfunction() +# Store the output directory so that other tests that need files generated by +# the previous function can find them +set(ROOTTEST_EVENTGENERATION_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE INTERNAL "") + # # function EVENT_GENERATE_TESTS # @@ -69,7 +72,8 @@ function(EVENT_GENERATE_TESTS file_name) ROOTTEST_ADD_TEST("${file_name}-${mode}" COMMAND ${ROOT_root_CMD} -q -b -l "${CMAKE_CURRENT_SOURCE_DIR}/dt_wrap.C\(\"${file_name}.root\",${mode}\)" DEPENDS EventGeneration - RUN_SERIAL) + RUN_SERIAL + FIXTURES_REQUIRED EventGeneration-${file_name}) endforeach() endfunction() @@ -84,6 +88,9 @@ EVENT_GENERATE_TESTS(split-zero) EVENT_GENERATE_FILE(split-one ${size} ${comp} 1 ${action} ${tracks}) EVENT_GENERATE_TESTS(split-one) +EVENT_GENERATE_FILE(split-two ${size} ${comp} 2 ${action} ${tracks}) +EVENT_GENERATE_TESTS(split-two) + EVENT_GENERATE_FILE(split-nine ${size} ${comp} 9 ${action} ${tracks}) EVENT_GENERATE_TESTS(split-nine) diff --git a/root/treeformula/event/TreeFormulaEventMain.cxx b/root/treeformula/event/TreeFormulaEventMain.cxx index 57b5f7ea22..890a780d9f 100644 --- a/root/treeformula/event/TreeFormulaEventMain.cxx +++ b/root/treeformula/event/TreeFormulaEventMain.cxx @@ -110,12 +110,14 @@ int main(int argc, char **argv) Int_t arg4 = 1; Int_t arg5 = 600; //default number of tracks per event Int_t netf = 0; + std::string outputFileName{"Event.root"}; if (argc > 1) nevent = atoi(argv[1]); if (argc > 2) comp = atoi(argv[2]); if (argc > 3) split = atoi(argv[3]); if (argc > 4) arg4 = atoi(argv[4]); if (argc > 5) arg5 = atoi(argv[5]); + if (argc > 6) outputFileName = std::string(argv[6]); if (arg4 == 0) { write = 0; hfill = 0; read = 1;} if (arg4 == 1) { write = 1; hfill = 0;} if (arg4 == 2) { write = 0; hfill = 0;} @@ -155,7 +157,7 @@ int main(int argc, char **argv) if (netf) { hfile = new TNetFile("root://localhost/root/test/EventNet.root"); } else - hfile = new TFile("Event.root"); + hfile = new TFile(outputFileName.c_str()); tree = (TTree*)hfile->Get("T"); TBranch *branch = tree->GetBranch("event"); branch->SetAddress(&event); @@ -188,7 +190,7 @@ int main(int argc, char **argv) if (netf) { hfile = new TNetFile("root://localhost/root/test/EventNet.root","RECREATE","TTree benchmark ROOT file"); } else - hfile = new TFile("Event.root","RECREATE","TTree benchmark ROOT file"); + hfile = new TFile(outputFileName.c_str(),"RECREATE","TTree benchmark ROOT file"); hfile->SetCompressionLevel(comp); // Create histogram to show write_time in function of time