#!/bin/sh

# HistFactory workplace setup script

if [ -z $ROOTSYS ]
then
  echo "Please set up ROOT before running this script."
  exit
fi

if [ $# -eq 1 ]
then
  DIR=$1
  echo "HistFactory workplace will be created in: " $DIR
else
  DIR=.
  echo "HistFactory workplace will be created in the current directory"
fi

echo "Creating directory structure..."
mkdir -p $DIR/config
mkdir -p $DIR/data
mkdir -p $DIR/results

echo "Copying skeleton configuration files..."
cp $ROOTSYS/etc/HistFactorySchema.dtd $DIR/config/
cp $ROOTSYS/tutorials/histfactory/example.xml $DIR/config/
cp $ROOTSYS/tutorials/histfactory/example_channel.xml $DIR/config/

#echo "Making skeleton data files..."
root -b -q $ROOTSYS/tutorials/histfactory/makeExample.C
mv example.root $DIR/data

echo "Done!"
#echo "You can run the example with: hist2workspace $DIR/config/example.xml"

exit
