importdata.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 #Model for a bash script to import .dat files into larsoft rawdata
4 #Intended use is to set the correct path_to_data and to pedestal (for the moment standard paths on eos @ CERN are selected)
5 #The script runs iteratively on all the files in the folder and change the import file accordingly
6 #the imput path points at the correct import file in the dunetpc repository. A file with the same model could be copied elsewhere and a different path cofigured
7 # A larsoft root file will be created as outout for any input file created
8 #Runs are arranged in subruns of 335 events each. The last subrun might have less events
9 #To report any problem: andrea.scarpelli@cern.ch
10 
11 run=840
12 
13 path_to_data="/eos/experiment/wa105/data/311/rawdata/$run"
14 path_to_pedestal="/eos/experiment/wa105/data/311/datafiles/pedestals/pedestals" #can be made an iterative subtraction of the pedestal if is took a pedestal for every run
15 
16 importfile=$MRB_SOURCE"/duneprototypes/duneprototypes/3x1x1dp/DataImport/ImportFullFile/ImportFull311File.fcl"
17 
18 path_to_output="/eos/user/a/ascarpel/3x1x1/data"
19 
20 
21 for file in $path_to_data/*.dat;
22 do
23  tmp=${file#*-}
24  num=${tmp%.*}
25  sed -i -e 12c'fileNames: [ "'$file'" ]' $importfile
26  sed -i -e 32c'source.PedestalFile: “ ‘$path_to_pedestal’ “ ' $importfile
27  lar -c $importfile -o $path_to_output/raw_$run-$num.root
28 
29 done
30 echo "All done"