#!/bin/bash # Usage check if [ $# -ne 2 ]; then echo "Usage: $0 " exit 1 fi INPUT_DIR="$1" PARAM_FILE="$2" # Check inputs if [ ! -d "$INPUT_DIR" ]; then echo "Error: Directory '$INPUT_DIR' not found" exit 1 fi if [ ! -f "$PARAM_FILE" ]; then echo "Error: Parameter file '$PARAM_FILE' not found" exit 1 fi # Loop over ROOT files shopt -s nullglob for rootfile in "$INPUT_DIR"/*.root; do echo "==============================================" echo "Processing file: $rootfile" echo "==============================================" # Export so runJericho.sh can see it export inputDataFile="$rootfile" ./runJericho.sh "$PARAM_FILE" if [ $? -ne 0 ]; then echo "❌ Error processing $rootfile" exit 1 fi done echo "✅ All files processed successfully" source "$PARAM_FILE" baseName1=$(basename "$inputDataFile" .root) outPutFileName="${baseName1}_total.root" echo "Summing outputs to $outPutFileName" ./sumOutputs $outPutDirectory $outPutFileName