run_RED35_evd.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 args=("$@")
4 argssize=${#args[*]}
5 if [ $argssize -ne 1 ];then
6  echo ""
7  echo ""
8  echo ""
9  echo "Usage: ./run_RED35_evd.sh {run number - in 6 digit format please!}"
10  echo ""
11  echo "To get the most recent run, use run number 0."
12  echo ""
13  echo ""
14  exit
15 fi
16 
17 run=${args[0]}
18 
19 ORIGINAL_PWD=$PWD
20 
21 # Setup necessary pathways:
22 export version=v04_35_00
23 export comp=e9
24 export RelDir=/dune/app/home/duneana/35t_EventDisplay/larsoft_${version}
25 export LPDir=${RelDir}/localProducts_larsoft_${version}_${comp}_prof
26 export RED35Dir=/dune/app/home/duneana/35t_EventDisplay/RED35
27 export InputPath=/dune/data2/users/lbnedaq/nearline_evd/${version}
28 export FileSearch='/dune/data2/users/lbnedaq/nearline_evd/*/*/*/sample_done.root'
29 export filepos=9
30 
31 
32 # Set up the LArSoft environment
33 echo ""
34 echo ""
35 echo "Using ROOT provided by LArSoft and DUNETPC (we don't actually use these two):"
36 echo "=========================="
37 echo ""
38 source /grid/fermiapp/products/dune/setup_dune.sh
39 cd $LPDir
40 source ./setup
41 cd ..
42 mrbslp
43 echo ""
44 echo ""
45 
46 
47 
48 
49 # Find the most recent file
50 for file in $( find ${FileSearch} -mmin +1 | sort -t "/" -k$filepos -r )
51 do {
52  # This is a sloppy way of getting only the most recent file but I don't
53  # know how else to do it... ...don't judge me...
54  break
55  } done
56 
57 
58 if [ $run -ne 0 ];then
59  bigRun=${run:0:3}
60  file=${InputPath}/${bigRun}/${run}_01/sample_done.root
61 fi
62 
63 echo "Opening file:"
64 echo $file
65 
66 
67 
68 # Run the evd!
69 cd $RED35Dir/scripts
70 root -l run2d.C\(\"$file\"\)
71 
72 
73 
74 echo ""
75 echo ""
76 echo "Finished running the RED35 EVD..."
77 echo ""
78 echo ""