#!/bin/bash # Step 1: Search for all the DECLARE_DETELEMENT statements and list the detector factories echo "Searching for detector factories..." declare -a factories while IFS= read -r line; do # Extract the factory name from the DECLARE_DETELEMENT line factory_name=$(echo "$line" | grep -oP 'DECLARE_DETELEMENT\(\K[^,]+') # Check if factory_name is not empty if [ -n "$factory_name" ]; then factories+=("$factory_name") fi done < <(grep -r 'DECLARE_DETELEMENT' .) # Step 2: For each detector factory, search for compact files that use the factory for factory in "${factories[@]}"; do echo "Factory: $factory" # Search for compact files that reference the factory compact_files=$(grep -rl --include \*.xml "$factory" .) if [ -z "$compact_files" ]; then echo " No compact files found using this factory." else echo " Compact files:" for file in $compact_files; do echo " $file" done fi echo "" done