#!/bin/tcsh # script to copy coin Ntuple locally, OPTIONALLY unzip it, # process it, and then delete the ntuple file; # since in general there may be multiple segments per run # we need to keep track of the segment number from which # the data came -- thus we give the "slaughterer" the file # name of the Ntuple rather than just the run number; # the part we're interested in is output to standard-out so # we redirect it to our output log file # be sure to delete (or comment out) ONE of the two loops # doing the actual butchering -- either the one for gzip'd # Ntuples or the one for NOT compressed files! # update these as needed!!! set sourcedir = "/work/hallc/e93026/Gen01/Q2=1pass4/ntup" set slaughterer = "/home/frw/Gen/butcher/theButcher.exe" # these are the input file with run numbers and the output # file with the counts # they can be anywhere if you make them explicit or, if # you use the btch systems features, they can be local with # a fixed name # the script doesn't care... set runlistfile = "list.file" set resultsfile = "out.file" # name of ntuple file except for run no and segment no set filepre = "coin" set filepost = ".hbook" echo " " echo " " echo " butcher command is:" echo " <$slaughterer ${sourcedir}/(ntuplefile)>" echo " " echo " if all runs result in 0 events, make sure path" echo " to Ntuples is in small letters only -- no CAPS!" echo " " echo "starting..." echo " " echo " " # process all runs listed in file foreach runno (`cat $runlistfile`) echo " -- processing run $runno (${filepre}${runno}*${filepost})" # process all ntuple file segments! USE THIS IF NTUPLES not GZIP'd foreach nf (`cd ${sourcedir} ; ls ${filepre}${runno}*${filepost}`) $slaughterer ${sourcedir}/${nf} $nf >>! $resultsfile end # process all ntuple file segments! USE THIS IF NTUPLES are GZIP'd foreach nf (`cd ${sourcedir} ; ls ${filepre}${runno}*${filepost}.gz`) cp ${sourcedir}/${nf} ./working.hbook.gz gunzip working.hbook.gz $slaughterer working.hbook $nf >>! $resultsfile rm working.hbook end end echo " " echo " " echo "...done"