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
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
16 importfile=$MRB_SOURCE"/duneprototypes/duneprototypes/3x1x1dp/DataImport/ImportFullFile/ImportFull311File.fcl"
18 path_to_output="/eos/user/a/ascarpel/3x1x1/data"
21 for file in $path_to_data/*.dat;
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