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 deleted file mode 100644 index 1d620c0c19..0000000000 --- a/root/tree/fastcloningeventtree/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -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") -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() 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 deleted file mode 100644 index b82d942851..0000000000 --- a/root/tree/fastcloningeventtree/ctrans.C +++ /dev/null @@ -1,12 +0,0 @@ -void ctrans(const char *filename) -{ - TFile *_file0 = TFile::Open(filename); - gSystem->Load("libEvent.so"); - TTree *from = (TTree*) _file0->Get("T"); - auto f = new TFile("clone.root","RECREATE"); - from->CloneTree(-1,"fast"); - //to->Import(from); - f->Write(); - delete _file0; delete f; - gSystem->Exec(Form("mv clone.root %s",filename)); -} 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 227297c240..9195b1b698 100644 --- a/root/treeformula/event/CMakeLists.txt +++ b/root/treeformula/event/CMakeLists.txt @@ -1,7 +1,97 @@ -#------------------------------------------------------------------------------- +ROOT_GENERATE_DICTIONARY(G__TreeFormulaEvent ${CMAKE_CURRENT_SOURCE_DIR}/Event.h LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/EventLinkDef.h) + +ROOT_LINKER_LIBRARY(TreeFormulaEvent + ${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaEvent.cxx G__TreeFormulaEvent.cxx + LIBRARIES Core Tree Hist MathCore) + +if(MSVC) + add_custom_command(TARGET TreeFormulaEvent POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$/libTreeFormulaEvent.dll + ${CMAKE_CURRENT_BINARY_DIR}/libTreeFormulaEvent.dll + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/$/libTreeFormulaEvent.lib + ${CMAKE_CURRENT_BINARY_DIR}/libTreeFormulaEvent.lib) +endif() + +ROOTTEST_GENERATE_EXECUTABLE(EventGeneration + ${CMAKE_CURRENT_SOURCE_DIR}/TreeFormulaEventMain.cxx + LIBRARIES Core RIO Net Tree Hist MathCore TreeFormulaEvent + DEPENDS TreeFormulaEvent + FIXTURES_SETUP EventGeneration) + +add_custom_command(TARGET G__TreeFormulaEvent + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/dt_wrap.C + ${CMAKE_CURRENT_BINARY_DIR}/dt_wrap.C + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/dt_DrawTest.C + ${CMAKE_CURRENT_BINARY_DIR}/dt_DrawTest.C + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/dt_RunDrawTest.C + ${CMAKE_CURRENT_BINARY_DIR}/dt_RunDrawTest.C) + +if(TARGET onepcm) + set(EventDependencies "onepcm") +endif() + +ROOTTEST_ADD_TEST(write + COMMAND ./EventGeneration 10 1 1 1 + DEPENDS EventGeneration ${EventDependencies} + RUN_SERIAL) + +ROOTTEST_ADD_TEST(read + COMMAND ./EventGeneration 10 1 1 20 + DEPENDS EventGeneration ${EventDependencies} + RUN_SERIAL) + # -# 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} +# function EVENT_GENERATE_FILE # -#------------------------------------------------------------------------------- -ROOTTEST_ADD_OLDTEST() +# Run a file generation using EventGeneration with provided +# parameters. Considered a test. +# +function(EVENT_GENERATE_FILE file_name size comp split action tracks) + ROOTTEST_ADD_TEST("generation-${file_name}" + COMMAND ./EventGeneration "${size}" "${comp}" "${split}" "${action}" "${tracks}" "${file_name}.root" + DEPENDS EventGeneration + FIXTURES_REQUIRED EventGeneration + FIXTURES_SETUP EventGeneration-${file_name}) +endfunction() + +# +# function EVENT_GENERATE_TESTS +# +# Generate tests using file generated with EVENT_GENERATE_FILE. dt_wrap.C +# is run with differing modes (0, 1, 2, 3, 4) +# +function(EVENT_GENERATE_TESTS file_name) + foreach(mode 0;1;2;3;4) + 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 + FIXTURES_REQUIRED EventGeneration-${file_name}) + endforeach() +endfunction() + +set(size 50) +set(comp 0) +set(action 1) +set(tracks 600) + +EVENT_GENERATE_FILE(split-zero ${size} ${comp} 0 ${action} ${tracks}) +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) + +EVENT_GENERATE_FILE(stream-old ${size} ${comp} -1 ${action} ${tracks}) +EVENT_GENERATE_TESTS(stream-old) + +EVENT_GENERATE_FILE(split-old ${size} ${comp} -2 ${action} ${tracks}) +EVENT_GENERATE_TESTS(split-old) diff --git a/root/treeformula/event/DrawTest.sh b/root/treeformula/event/DrawTest.sh deleted file mode 100755 index 5c0db17bc0..0000000000 --- a/root/treeformula/event/DrawTest.sh +++ /dev/null @@ -1,11 +0,0 @@ -#! /bin/sh - -#dt_MakeFiles.sh -#root -b -q 'dt_MakeRef.C("Event.new.split9.root");' -if [ "x`which gmake 2>/dev/null | awk '{if ($1~/gmake/) print $1;}'`" != "x" ] -then - gmake -f dt_Makefile drawtest -else - make -f dt_Makefile drawtest -fi -./dt_RunDrawTest.sh diff --git a/root/treeformula/event/Makefile b/root/treeformula/event/Makefile deleted file mode 100644 index 74c8fd9f9c..0000000000 --- a/root/treeformula/event/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -local_clean = Event$(ExeSuf) libEvent.$(DllSuf) *.o EventDict.cxx EventDict.h *~ *.log *.$(DllSuf) *.root $(ALL_LIBRARIES) - -CLEAN_TARGETS += $(local_clean) -TEST_TARGETS += bigeventTest - -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 -include $(ROOTTEST_HOME)/scripts/Event.mk - -#.SUFFIXES: .cxx .o .so - -LOPT:=-g3 - -#all: bigeventTest - -bigeventTest: ./Event$(ExeSuf) ./libEvent.$(DllSuf) - $(CMDECHO)./Event 10 1 1 1 > Event.write.log - $(CMDECHO)./Event 10 1 1 20 > Event.read.log -ifeq ($(FAIL),) - $(WarnFailTest) -# $(CMDECHO)echo Warning this is due to the problem with loading libraries with stl containers after opening a file -else - $(CMDECHO)./DrawTest.sh -endif - - - diff --git a/root/treeformula/event/Event.cxx b/root/treeformula/event/TreeFormulaEvent.cxx similarity index 99% rename from root/treeformula/event/Event.cxx rename to root/treeformula/event/TreeFormulaEvent.cxx index d6fd1aa2b0..38512decf0 100644 --- a/root/treeformula/event/Event.cxx +++ b/root/treeformula/event/TreeFormulaEvent.cxx @@ -143,8 +143,8 @@ void Event::Build(Int_t ev, Int_t arg5, Float_t ptmin) { if (ev >= 10000) nch += 3; if (fEventName) delete [] fEventName; fEventName = new char[nch]; - sprintf(fEventName,"Event%d_Run%d",ev,200); - sprintf(etype,"type%d",ev%5); + snprintf(fEventName,nch,"Event%d_Run%d",ev,200); + snprintf(etype,20,"type%d",ev%5); SetType(etype); SetHeader(ev, 200, 960312, random); SetNseg(Int_t(10*ntrack+20*sigmas)); diff --git a/root/treeformula/event/MainEvent.cxx b/root/treeformula/event/TreeFormulaEventMain.cxx similarity index 97% rename from root/treeformula/event/MainEvent.cxx rename to root/treeformula/event/TreeFormulaEventMain.cxx index 57b5f7ea22..890a780d9f 100644 --- a/root/treeformula/event/MainEvent.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 diff --git a/root/treeformula/event/dt_MakeFiles.sh b/root/treeformula/event/dt_MakeFiles.sh deleted file mode 100755 index 56eead9b71..0000000000 --- a/root/treeformula/event/dt_MakeFiles.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -size=50 -tracks=600 -comp=0 -action=1 - -if test $# -gt 0 ; then - echo ajusting size to $1 - size=$1 -fi - - -./Event $size $comp 0 $action $tracks -mv Event.root Event.new.split0.root - -./Event $size $comp 1 $action $tracks -mv Event.root Event.new.split1.root - -./Event $size $comp 9 $action $tracks -mv Event.root Event.new.split9.root - -./Event $size $comp -1 $action $tracks -mv Event.root Event.old.streamed.root - -./Event $size $comp -2 $action $tracks -mv Event.root Event.old.split.root - -# Next step is to do something like -# root -q 'dt_MakeRef.C("Event.old.split.root");' diff --git a/root/treeformula/event/dt_Makefile b/root/treeformula/event/dt_Makefile deleted file mode 100644 index 4809ec8def..0000000000 --- a/root/treeformula/event/dt_Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# General indication for the size of the files -size=6 -tracks=30 -# Use compression or not -comp=0 -# For writing of the files -action=1 - -include ./Makefile - -DATAFILES = Event.new.split0.root Event.new.split1.root \ - Event.new.split2.root Event.new.split9.root - -REFFILE=dt_reference.root - -OUTPUT=>/dev/null - -files: $(DATAFILES) - -drawtest : $(DATAFILES) $(REFFILE) dt_RunDrawTest_C.$(DllSuf) - -Event.new.split0.root : Event$(ExeSuf) libEvent.$(DllSuf) - @./Event $(size) $(comp) 0 $(action) $(tracks) $(OUTPUT) && \ - mv Event.root Event.new.split0.root && \ - echo "$@ made" - -Event.new.split1.root : Event$(ExeSuf) libEvent.$(DllSuf) - @./Event $(size) $(comp) 1 $(action) $(tracks) $(OUTPUT) && \ - mv Event.root Event.new.split1.root && \ - echo "$@ made" - -Event.new.split2.root : Event$(ExeSuf) libEvent.$(DllSuf) - @./Event $(size) $(comp) 2 $(action) $(tracks) $(OUTPUT) && \ - mv Event.root Event.new.split2.root && \ - echo "$@ made" - -Event.new.split9.root : Event$(ExeSuf) libEvent.$(DllSuf) - @./Event $(size) $(comp) 9 $(action) $(tracks) $(OUTPUT) && \ - mv Event.root Event.new.split9.root && \ - echo "$@ made" - -Event.old.streamed.root : Event$(ExeSuf) libEvent.$(DllSuf) - @./Event $(size) $(comp) -1 $(action) $(tracks) $(OUTPUT) && \ - mv Event.root Event.old.streamed.root && \ - echo "$@ made" - -Event.old.split.root : Event$(ExeSuf) libEvent.$(DllSuf) - @./Event $(size) $(comp) -2 $(action) $(tracks) $(OUTPUT) && \ - mv Event.root Event.old.split.root && \ - echo "$@ made" - -$(REFFILE) : dt_MakeRef.C dt_DrawTest.C libEvent.$(DllSuf) Event.h Event.new.split9.root - @root -b -q 'dt_MakeRef.C("Event.new.split9.root",0);' $(OUTPUT) && \ - echo "$@ made" - -ClassWarning='Warning in : no dictionary for class' -RootPrompt='root \[0\]' -Streamer="Event::Streamer not available," - - -dt_RunDrawTest_C.$(DllSuf) : dt_RunDrawTest.C dt_DrawTest.C - @root -l -b -q dt_build.C $(OUTPUT) && \ - echo "$@ made" - -#Windows does not like piping -# @echo 'gSystem->Exit(!gSystem->CompileMacro("dt_RunDrawTest.C","kf"))' | root -l -b $(OUTPUT) && \ - diff --git a/root/treeformula/event/dt_RunDrawTest.C b/root/treeformula/event/dt_RunDrawTest.C index 16bef0dddf..258debb5d8 100644 --- a/root/treeformula/event/dt_RunDrawTest.C +++ b/root/treeformula/event/dt_RunDrawTest.C @@ -1,3 +1,4 @@ +#include "TROOT.h" #include "TCanvas.h" #include "TClassTable.h" #include "TFile.h" diff --git a/root/treeformula/event/dt_RunDrawTest.sh b/root/treeformula/event/dt_RunDrawTest.sh deleted file mode 100755 index acfb7dfc0a..0000000000 --- a/root/treeformula/event/dt_RunDrawTest.sh +++ /dev/null @@ -1,56 +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," - -# launch replace -launch () { - ($(CALLROOTEXE) -l -b -q 'dt_wrap.C("'$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;) \ - ; -} - -#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' " - -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/treeformula/event/dt_wrap.C b/root/treeformula/event/dt_wrap.C index 7f165e7aa1..c0667b2c1a 100644 --- a/root/treeformula/event/dt_wrap.C +++ b/root/treeformula/event/dt_wrap.C @@ -1,5 +1,11 @@ void dt_wrap(const char* from, Int_t mode = 0, Int_t verboseLevel = 0) { + int status; + stringstream ss{"dt_RunDrawTest"}; + + ss << "(\"" << from << "\","; + ss << to_string(mode) << ","; + ss << to_string(verboseLevel) << ")"; gROOT->ProcessLine(".L dt_RunDrawTest.C+"); - int status = !dt_RunDrawTest(from,mode,verboseLevel); + gROOT->ProcessLine(ss.str().c_str(), &status); if (verboseLevel==0) gSystem->Exit(status); } diff --git a/root/treeformula/fastcloningeventtree/CMakeLists.txt b/root/treeformula/fastcloningeventtree/CMakeLists.txt new file mode 100644 index 0000000000..3eadc363a7 --- /dev/null +++ b/root/treeformula/fastcloningeventtree/CMakeLists.txt @@ -0,0 +1,31 @@ +if(TARGET onepcm) + set(EventDependencies "onepcm") +endif() + +# Populate a string with the path to the folder where the generation of the +# Event library together with all the input files happened +get_filename_component(PARENT_DIR ${CMAKE_CURRENT_BINARY_DIR} DIRECTORY) +set(EVENT_DIR ${PARENT_DIR}/event) + +# +# 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\(\"${EVENT_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\(\"${EVENT_DIR}/split-nine.root\"\)" > log + DEPENDS EventGeneration + FIXTURES_REQUIRED EventGeneration-split-nine) diff --git a/root/treeformula/fastcloningeventtree/ctrans.C b/root/treeformula/fastcloningeventtree/ctrans.C new file mode 100644 index 0000000000..35a3cf7ea7 --- /dev/null +++ b/root/treeformula/fastcloningeventtree/ctrans.C @@ -0,0 +1,20 @@ +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("libTreeFormulaEvent"); + + TTree *from = (TTree*) _file0->Get("T"); + auto f = new TFile("clone.root","RECREATE"); + from->CloneTree(-1,"fast"); + //to->Import(from); + f->Write(); + delete _file0; delete f; + gSystem->Exec(Form("mv clone.root %s",filename)); +} diff --git a/root/tree/fastcloningeventtree/dt_DrawTest.C b/root/treeformula/fastcloningeventtree/dt_DrawTest.C similarity index 100% rename from root/tree/fastcloningeventtree/dt_DrawTest.C rename to root/treeformula/fastcloningeventtree/dt_DrawTest.C diff --git a/root/tree/fastcloningeventtree/dt_MakeRef.C b/root/treeformula/fastcloningeventtree/dt_MakeRef.C similarity index 100% rename from root/tree/fastcloningeventtree/dt_MakeRef.C rename to root/treeformula/fastcloningeventtree/dt_MakeRef.C diff --git a/root/tree/fastcloningeventtree/dt_RunDrawTest.C b/root/treeformula/fastcloningeventtree/dt_RunDrawTest.C similarity index 100% rename from root/tree/fastcloningeventtree/dt_RunDrawTest.C rename to root/treeformula/fastcloningeventtree/dt_RunDrawTest.C diff --git a/root/tree/fastcloningeventtree/dt_wrap.C b/root/treeformula/fastcloningeventtree/dt_wrap.C similarity index 100% rename from root/tree/fastcloningeventtree/dt_wrap.C rename to root/treeformula/fastcloningeventtree/dt_wrap.C