# Presentation: 175974

## ROOT Framework Testing and Database Access

- Jorge L. Suarez Jr.
- Supervisor: Philippe Canal
- Fermi National Accelerator Laboratory
- University of Miami
- M.S. Computer and Electrical Engineering

## Old ROOT Test Framework

- Made use of Makefiles to build and execute several tests with one command.
- gmake utility called recursively on subdirectories.
- Use of diff utility to compare given output with expected output.
- Correct output can fail because of time dependent output.
- Time consuming to add tests with global template.
- Create new folder
- Copy global template.
- Modify path to Rules.mk file
- Add current directory to parent Makefile subdirectories list.
- Create test

## Researched Solutions

- CPPUNIT
- Supports unit tests.
- Gives detailed test failure information.
- Oval
- Similar to CPPUNIT, but has poor documentation.
- QMTest
- Create and run many tests with multiple configurations.
- Web based interface with email notifications.
- NICOS
- Supports nightly builds and test runs.
- Email based notification system.

## Proposed Solutions

- Modify existing framework to include helper scripts and dynamic file finding algorithm for global template to eliminate re-entering path for Rules.mk.

## Solution Implemented

- CPPUNIT
- Sample tests created and ran.
- QMTest
- Integration of CPPUNIT tests.
- Integration of existing ROOT tests (60).
- Added script to setup test folder.
- Creates relevant files and customizes global template to new test.
- Path to find include files made dynamic
- No need to specify static relative path.
- Subdirectories list generated automatically using script.

## Subdirectory Generating Script

- #!/bin/sh
- filelist="”
- #echo `ls $1`
- for file in `ls $1`
- do
-         #echo $file
-        if [ -d $file ] && [ -f $file/Makefile ]
-         then
- 			filelist="$filelist$file ”
-         fi
- done
- echo $filelist

## Makefile Fragment

- ifeq ($(strip $(ROOTTEST_HOME)),)
-    export ROOTTEST_HOME=$(shell expr $(PWD):'\(.*/roottest/\)')
- endif
- SUBDIRS = $(shell $(ROOTTEST_HOME)/scripts/subdirectories .)
- include $(ROOTTEST_HOME)/scripts/Rules.mk

## TTree

- ROOT data structure designed to store complex data, such as collision events, in an organized manner.
- Makes viewing and graphing data simple.
- Use tree viewer to histogram data

## Making TTree Database Accessible

- RDBC Database connection framework already written.
- Requires prerequisite to install RDBC.
- Unix-ODBC drivers
- MySQL drivers
- Connection to database easy to establish and read from.

## Integration with TTree

- Object oriented programming allows a derived class to inherit its parents functionality and expand on it.

- TTree
- Basic
- Functionality

- TSQLTree
- Database Functionality

## Integration with TTree

- TSQLTree class created which adds database connectivity.
- Polymorphism allows correct functions to be called without the rest of the ROOT framework knowing about databases.
- Required slight modification of existing classes to achieve database integration.

## Database Reading

- Connection to existing database established and branches created according to column types and names.
- Calling GetEntry sequentially loads one row of the database into the tree.  (Sequential access limitation of driver).
- Use tree viewer to display tree data.
- Required deriving database aware classes for data buffers.  Makes loading a tree independent of where the data is coming from.