Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
#!/bin/tcsh

### Make list of files: LED, pedestal, laser
#set DAT=`date '+%Y-%m-%d_%H_%M_%S'`
if( ${1} != "LED" && ${1} != "laser" && ${1} != "pedestal" ) then
echo " Please select run type ./parce_newsql_valdas.csh LED `date '+%Y-%m-%d_%H_%M_%S'`"
exit
endif

set runorigped=286893
set runorigled=286946
set runoriglas=286766

if( ${3} == "era2019" ) then
set runorigled=328157
endif

# ATTENTION:
# for laser and pedestal we put runorig = run current
#
set RELEASE=CMSSW_10_4_0
set WD=/afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/${RELEASE}/src/RecoHcal/HcalPromptAnalysis/test/RDM

set LAST=0
set OUTLAST=lasttmp
set runref=0
set outfile=tmp

echo "Here"  ${1}

if( ${1} == "LED" ) then
set LAST=`cat ${WD}/LED_LIST/LASTRUN`
set OUTLAST=${WD}/LED_LIST/LASTRUN

echo ${LAST}

python /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/${RELEASE}/src/RecoHcal/HcalPromptAnalysis/test/RDM/hcal_runs_valdas.py ${LAST} - | grep ${1} | sed 's/"//g' > tmp.list 
cat tmp.list | sed s/" "/_/g > tmp.list.${1}
###rm tmp.list
set runref=${runorigled}
touch ${WD}/LED_LIST/runlist.tmp.${2}
set outfile=${WD}/LED_LIST/runlist.tmp.${2}
endif

if( ${1} == "laser" ) then
echo "Laser"
set runref=${runoriglas}
set LAST=`cat ${WD}/LASER_LIST/LASTRUN`
set OUTLAST=${WD}/LASER_LIST/LASTRUN
python /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/${RELEASE}/src/RecoHcal/HcalPromptAnalysis/test/RDM/hcal_runs_valdas.py ${LAST} - | grep ${1} | sed 's/"//g'  > tmp.list
cat tmp.list | sed s/" "/_/g > tmp.list.${1}
rm tmp.list
touch ${WD}/LASER_LIST/runlist.tmp.${2}
set outfile=${WD}/LASER_LIST/runlist.tmp.${2}
endif

if( ${1} == "pedestal" ) then
set runref=${runorigped}
set LAST=`cat ${WD}/PEDESTAL_LIST/LASTRUN`
set OUTLAST=${WD}/PEDESTAL_LIST/LASTRUN
python /afs/cern.ch/cms/CAF/CMSALCA/ALCA_HCALCALIB/HCALMONITORING/RDMScript/${RELEASE}/src/RecoHcal/HcalPromptAnalysis/test/RDM/hcal_runs_valdas.py ${LAST} - | grep ${1} | sed 's/"//g' > tmp.list
cat tmp.list | sed s/" "/_/g > tmp.list.${1}
rm tmp.list
touch ${WD}/PEDESTAL_LIST/runlist.tmp.${2}
set outfile=${WD}/PEDESTAL_LIST/runlist.tmp.${2}
endif

echo "Here 1"
foreach i (`cat tmp.list.${1}`)
set run=`echo ${i} | awk -F_ '{print $1}'`
set mydate=`echo ${i} | awk -F_ '{print $3}'`
set mytime=`echo ${i} | awk -F_ '{print $4}'`
set nevent=`echo ${i} | awk -F_ '{print $5}'`
if( ${run} > ${LAST} ) then
if( ${1} == "LED" ) then
echo ${run}"_"${runref}"_"${mydate}"_"${mytime}"_"${nevent} >> ${outfile}
else
echo ${run}"_"${run}"_"${mydate}"_"${mytime}"_"${nevent} >> ${outfile}
endif
rm ${OUTLAST}
echo ${run} > ${OUTLAST}
endif
end
if( ${1} == "LED" ) then
eos ls /eos/cms/store/group/dpg_hcal/comm_hcal/USC > ${WD}/LED_LIST/fullSrc0_list_${2}
endif
if( ${1} == "laser" ) then
eos ls /eos/cms/store/group/dpg_hcal/comm_hcal/USC > ${WD}/LASER_LIST/fullSrc0_list_${2}
endif
if( ${1} == "pedestal" ) then
eos ls /eos/cms/store/group/dpg_hcal/comm_hcal/USC > ${WD}/PEDESTAL_LIST/fullSrc0_list_${2}
endif