From 9f2ebfafdab6c20e3d8f3719c301cb383f955ca6 Mon Sep 17 00:00:00 2001 From: "P.-A. Loizeau" <p.-a.loizeau@gsi.de> Date: Fri, 6 May 2022 12:49:31 +0200 Subject: [PATCH] [MQ] In startBuildRawEvents2022.sh, various improvement + add Add selection with min nb of fired TOF RPC - allow setting the minimum number of fired layers for TOF - allow using trigger parameter sets as arguments, matching the one of the NH version - always require the run ID as argument - have time offsets matching those of the NH version --- MQ/mcbm/startBuildRawEvents2022.sh.in | 252 ++++++++++++++++++-------- 1 file changed, 173 insertions(+), 79 deletions(-) diff --git a/MQ/mcbm/startBuildRawEvents2022.sh.in b/MQ/mcbm/startBuildRawEvents2022.sh.in index 5903684368..a2f910cef3 100755 --- a/MQ/mcbm/startBuildRawEvents2022.sh.in +++ b/MQ/mcbm/startBuildRawEvents2022.sh.in @@ -4,75 +4,65 @@ if [ -e @SIMPATH@/bin/fairmq-shmmonitor ]; then @SIMPATH@/bin/fairmq-shmmonitor --cleanup fi -if [ $# -ge 1 ]; then - _nbmoni=$1 - ((_pubfreqts = $_nbmoni*100 )) +if [ $# -ge 3 ]; then + _nbbranch=$1 + _TriggSet=$2 + _run_id=$3 + ((_pubfreqts = $_nbbranch*100 )) _pubminsec=1.0 _pubmaxsec=10.0 - if [ $# -ge 4 ]; then + if [ $# -ge 6 ]; then _filename="" _dirname="" - _hostname=$4 + _hostname=$6 - if [ $# -ge 5 ]; then - _pubfreqts=$5 + if [ $# -ge 7 ]; then + _pubfreqts=$7 - if [ $# -ge 6 ]; then - _pubminsec=$6 + if [ $# -ge 8 ]; then + _pubminsec=$8 - if [ $# -ge 7 ]; then - _pubmaxsec=$7 + if [ $# -ge 9 ]; then + _pubmaxsec=$9 fi fi fi - elif [ $# -ge 2 ]; then - _filename=$2 + elif [ $# -ge 4 ]; then + _filename=$4 _hostname="" - if [ $# -eq 3 ]; then - _dirname=$3 + if [ $# -eq 5 ]; then + _dirname=$5 else _dirname="" fi else - echo 'Starting connection to local stream' - echo ' for other usages, please supply at least a filename.' + echo 'Missing parameters or wrong number of parameters.' echo 'Possible usages are:' - echo 'startBuildRawEvents2022.sh' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> <full filename pattern list>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> <filename pattern> <folder_path>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>' - _filename="" - _dirname="" - _hostname="localhost" + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> <full filename pattern list>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> <filename pattern> <folder_path>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list> <Hist publish freq. in TS>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>' + + return -1 fi else - echo 'Starting connection to local stream with 1 monitor process' - echo ' for other usages, please supply at least a filename.' + echo 'Missing parameters. At least the number of branches and the trigger set are required' echo 'Possible usages are:' - echo 'startBuildRawEvents2022.sh' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> <full filename pattern list>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> <filename pattern> <folder_path>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>' - echo 'startBuildRawEvents2022.sh <Nb Unp & Moni processes> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>' - _filename="" - _dirname="" - _hostname="localhost" - _nbmoni=1 - _pubfreqts=100 - _pubminsec=1.0 - _pubmaxsec=10.0 + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> <full filename pattern list>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> <filename pattern> <folder_path>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list> <Hist publish freq. in TS>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s>' + echo 'startBuildRawEvents2022.sh <Nb // branches> <Trigger set> <Run Id> "" "" <hostname(s) list> <Hist publish freq. in TS> <Min Hist pub. in s> <Max Hist pub. in s>' + + return -1 fi _parfileSts=@VMCWORKDIR@/macro/beamtime/mcbm2022/mStsPar.par -_parfileMuch=@VMCWORKDIR@/macro/beamtime/mcbm2022/mMuchPar.par +_parfileMuch=@VMCWORKDIR@/macro/beamtime/mcbm2022/mMuchPar.par # Valid from 2163 _parfileTrdAsic=@VMCWORKDIR@/parameters/trd/trd_v22d_mcbm.asic.par _parfileTrdDigi=@VMCWORKDIR@/parameters/trd/trd_v22d_mcbm.digi.par _parfileTrdGas=@VMCWORKDIR@/parameters/trd/trd_v22d_mcbm.gas.par @@ -82,14 +72,15 @@ _parfileBmon=@VMCWORKDIR@/macro/beamtime/mcbm2022/mBmonCriPar.par _parfileRich=@VMCWORKDIR@/macro/beamtime/mcbm2021/mRichPar_70.par _parfilePsd=@VMCWORKDIR@/macro/beamtime/mcbm2021/mPsdPar.par _setup_name=mcbm_beam_2022_03_22_iron -_run_id=2160 -if [ _run_id -ge 2060 ]; then - if [ _run_id -le 2065 ]; then +if [ $_run_id -ge 2060 ]; then + if [ $_run_id -le 2065 ]; then _setup_name=mcbm_beam_2022_03_09_carbon - elif [ _run_id -le 2160 ]; then # Potentially wrong setup between 2065 and 2150 but not official runs + _parfileMuch=@VMCWORKDIR@/macro/beamtime/mcbm2022/mMuchParUpto26032022.par # Valid for runs 2060-2162 + elif [ $_run_id -le 2160 ]; then # Potentially wrong setup between 2065 and 2150 but not official runs _setup_name=mcbm_beam_2022_03_22_iron - elif [ _run_id -le 2310 ]; then # Potentially wrong setup between 2160 and 2176 but not official runs + _parfileMuch=@VMCWORKDIR@/macro/beamtime/mcbm2022/mMuchParUpto26032022.par # Valid for runs 2060-2162 + elif [ $_run_id -le 2310 ]; then # Potentially wrong setup between 2160 and 2176 but not official runs _setup_name=mcbm_beam_2022_03_28_uranium fi fi @@ -103,10 +94,110 @@ LOGFILETAG+="_" LOGFILETAG+=`date +%Y_%m_%d_%H_%M_%S` LOGFILETAG+=".log" +# Apply sets of settings for different triggers +case $_TriggSet in + 0) # default, any Tof hit + _TofMean=20 + _TofWin=100 + _TofMin=1 + _T0Min=0 + _StsMin=0 + _MuchMin=0 + _Trd1dMin=0 + _Trd2dMin=0 + _RichMin=0 + ;; + + 1) # default, Tof - T0 concidences (pulser) + _TofMean=20 + _TofWin=200 + _TofMin=2 + _TofMinLay=1 + _T0Min=1 + _StsMin=0 + _MuchMin=0 + _Trd1dMin=0 + _Trd2dMin=0 + _RichMin=0 + ;; + + 2) # Tof standalone track trigger (cosmic) + _TofMean=20 + _TofWin=50 + _TofMin=8 + _TofMinLay=4 + _T0Min=0 + _StsMin=0 + _MuchMin=0 + _Trd1dMin=0 + _Trd2dMin=0 + _RichMin=0 + ;; + + 3) # Tof track trigger with T0 + _TofMean=20 + _TofWin=50 + _TofMin=8 + _TofMinLay=4 + _T0Min=1 + _StsMin=0 + _MuchMin=0 + _Trd1dMin=0 + _Trd2dMin=0 + _RichMin=0 + ;; + + 4) # mCbm track trigger Tof, T0 & STS + _TofMean=20 + _TofWin=50 + _TofMin=8 + _TofMinLay=4 + _T0Min=1 + _StsMin=2 + _MuchMin=0 + _Trd1dMin=0 + _Trd2dMin=0 + _RichMin=0 + ;; + + 5) # mCbm lambda trigger + _TofMean=20 + _TofWin=40 + _TofMin=16 + _TofMinLay=8 # PAL 07/04/2022: Not sure here if it should be 4 or 8 (2 tracks in same det. stack excluded?) + _T0Min=1 + _StsMin=8 + _MuchMin=0 + _Trd1dMin=0 + _Trd2dMin=0 + _RichMin=0 + ;; + + 6) # One hit per detector system w/ big acceptance = mCbm full track trigger + _TofMean=20 + _TofWin=50 + _TofMin=8 + _TofMinLay=4 + _T0Min=1 + _StsMin=4 + _MuchMin=2 + _Trd1dMin=2 + _Trd2dMin=0 + _RichMin=0 +esac +echo Using MQ trigger par set: $_TriggSet + +# Compute limits of TOF selection/trigger window +_TofL=$_TofMean +_TofH=$_TofMean +(( _TofL -= _TofWin)) +(( _TofH += _TofWin)) +echo Tof window $_TofL - $_TofH + LIST_OF_PIDS="" (( _paraBuffSz=100 )) -(( _singBuffSz=_paraBuffSz*_nbmoni )) +(( _singBuffSz=_paraBuffSz*_nbbranch )) echo "Buffer size for parallel devices $_paraBuffSz" echo "Buffer size for singleton devices $_singBuffSz" @@ -117,9 +208,11 @@ SAMPLER+=" --control static" SAMPLER+=" --id sampler1" #SAMPLER+=" --max-timeslices 0" #SAMPLER+=" --max-timeslices 10" +#SAMPLER+=" --max-timeslices 30" #SAMPLER+=" --max-timeslices 100" #SAMPLER+=" --max-timeslices 300" #SAMPLER+=" --max-timeslices 1000" +SAMPLER+=" --max-timeslices -1" #SAMPLER+=" --severity info" #SAMPLER+=" --flib-port 10" if [ "$_hostname" != "" ]; then @@ -191,15 +284,15 @@ LIST_OF_PIDS+=" " sleep 1 -_iMoni=0 -while (( _iMoni < _nbmoni )); do - (( _yOffset=200*_iMoni )) - (( _iMoni += 1 )) - (( _iPort = 11680 + _iMoni )) +_iBranch=0 +while (( _iBranch < _nbbranch )); do + (( _yOffset=200*_iBranch )) + (( _iBranch += 1 )) + (( _iPort = 11680 + _iBranch )) UNPACKER="MqUnpack" UNPACKER+=" --control static" - UNPACKER+=" --id unp$_iMoni" + UNPACKER+=" --id unp$_iBranch" #UNPACKER+=" --severity error" UNPACKER+=" --severity info" #UNPACKER+=" --severity debug" @@ -209,26 +302,26 @@ while (( _iMoni < _nbmoni )); do UNPACKER+=" --UnpBmon true" UNPACKER+=" --UnpMuch true" UNPACKER+=" --UnpPsd false" - UNPACKER+=" --SetTimeOffs kT0,-40" - UNPACKER+=" --SetTimeOffs kSTS,-1025" - UNPACKER+=" --SetTimeOffs kMUCH,-1020" - UNPACKER+=" --SetTimeOffs kTRD,1190" - UNPACKER+=" --SetTimeOffs kTRD2D,-540" - UNPACKER+=" --SetTimeOffs kTOF,0" - UNPACKER+=" --SetTimeOffs kRICH,50" + UNPACKER+=" --SetTimeOffs kT0,0" + UNPACKER+=" --SetTimeOffs kSTS,-980" + UNPACKER+=" --SetTimeOffs kMUCH,-980" + UNPACKER+=" --SetTimeOffs kTRD,1300" + UNPACKER+=" --SetTimeOffs kTRD2D,-510" + UNPACKER+=" --SetTimeOffs kTOF,40" + UNPACKER+=" --SetTimeOffs kRICH,130" UNPACKER+=" --PubFreqTs $_pubfreqts" UNPACKER+=" --PubTimeMin $_pubminsec" UNPACKER+=" --PubTimeMax $_pubmaxsec" - UNPACKER+=" --TsNameOut unpts$_iMoni" + UNPACKER+=" --TsNameOut unpts$_iBranch" UNPACKER+=" --channel-config name=ts-request,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11555,rateLogging=$_ratelog" UNPACKER+=" --channel-config name=parameters,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0" - UNPACKER+=" --channel-config name=unpts$_iMoni,type=push,method=bind,transport=zeromq,sndBufSize=2,address=tcp://127.0.0.1:$_iPort,rateLogging=$_ratelog" + UNPACKER+=" --channel-config name=unpts$_iBranch,type=push,method=bind,transport=zeromq,sndBufSize=2,address=tcp://127.0.0.1:$_iPort,rateLogging=$_ratelog" # UNPACKER+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007" UNPACKER+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666,rateLogging=$_ratelog" UNPACKER+=" --transport zeromq" # Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX # with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log - UNPACKER_LOG="unp$_iMoni" + UNPACKER_LOG="unp$_iBranch" UNPACKER_LOG+="_$LOGFILETAG" # xterm -l -lf $UNPACKER_LOG -geometry 132x23+400+$_yOffset -hold -e @CMAKE_BINARY_DIR@/bin/MQ/mcbm/$UNPACKER & nohup @CMAKE_BINARY_DIR@/bin/MQ/mcbm/$UNPACKER &> $UNPACKER_LOG & @@ -238,7 +331,7 @@ while (( _iMoni < _nbmoni )); do EVTBUILDER="BuildDigiEvents" EVTBUILDER+=" --control static" - EVTBUILDER+=" --id build$_iMoni" + EVTBUILDER+=" --id build$_iBranch" EVTBUILDER+=" --severity info" #EVTBUILDER+=" --severity debug" EVTBUILDER+=" --PubFreqTs $_pubfreqts" @@ -257,19 +350,19 @@ while (( _iMoni < _nbmoni )); do EVTBUILDER+=" --SetTrigWin kMuch,-400,400" EVTBUILDER+=" --SetTrigWin kTrd,-300,300" EVTBUILDER+=" --SetTrigWin kTrd2D,-300,300" - EVTBUILDER+=" --SetTrigWin kTof,-100,100" - EVTBUILDER+=" --SetTrigWin kRich,0,80" - EVTBUILDER+=" --SetTrigMinNb kT0,0" - EVTBUILDER+=" --SetTrigMinNb kSts,0" + EVTBUILDER+=" --SetTrigWin kTof,$_TofL,$_TofH" + EVTBUILDER+=" --SetTrigWin kRich,-60,60" + EVTBUILDER+=" --SetTrigMinNb kT0,$_T0Min" + EVTBUILDER+=" --SetTrigMinNb kSts,$_StsMin" EVTBUILDER+=" --SetTrigMinNb kMuch,0" EVTBUILDER+=" --SetTrigMinNb kTrd,0" EVTBUILDER+=" --SetTrigMinNb kTrd2D,0" - EVTBUILDER+=" --SetTrigMinNb kTof,8" # Beam -# EVTBUILDER+=" --SetTrigMinNb kTof,40" #Pulser + EVTBUILDER+=" --SetTrigMinNb kTof,$_TofMin" EVTBUILDER+=" --SetTrigMinNb kRich,0" - EVTBUILDER+=" --TsNameIn unpts$_iMoni" + EVTBUILDER+=" --SetTrigMinLayersNb kTof,$_TofMinLay" + EVTBUILDER+=" --TsNameIn unpts$_iBranch" EVTBUILDER+=" --EvtNameOut events" - EVTBUILDER+=" --channel-config name=unpts$_iMoni,type=pull,method=connect,transport=zeromq,rcvBufSize=2,address=tcp://127.0.0.1:$_iPort,rateLogging=$_ratelog" + EVTBUILDER+=" --channel-config name=unpts$_iBranch,type=pull,method=connect,transport=zeromq,rcvBufSize=2,address=tcp://127.0.0.1:$_iPort,rateLogging=$_ratelog" EVTBUILDER+=" --channel-config name=events,type=push,method=connect,transport=zeromq,sndBufSize=2,address=tcp://127.0.0.1:11556,rateLogging=$_ratelog" # EVTBUILDER+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007" EVTBUILDER+=" --channel-config name=parameters,type=req,method=connect,transport=zeromq,address=tcp://127.0.0.1:11005,rateLogging=0" @@ -277,7 +370,7 @@ while (( _iMoni < _nbmoni )); do EVTBUILDER+=" --transport zeromq" # Replaces log filename Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX # with ProcessName_hostname_yyyy_mm_dd_hh_mm_ss.log - EVTBUILDER_LOG="build$_iMoni" + EVTBUILDER_LOG="build$_iBranch" EVTBUILDER_LOG+="_$LOGFILETAG" # xterm -l -lf $EVTBUILDER_LOG -geometry 80x23+800+$_yOffset -hold -e @CMAKE_BINARY_DIR@/bin/MQ/mcbm/$EVTBUILDER & nohup @CMAKE_BINARY_DIR@/bin/MQ/mcbm/$EVTBUILDER &> $EVTBUILDER_LOG & @@ -299,11 +392,12 @@ EVTSINK+=" --severity info" #EVTSINK+=" --BypassConsecutiveTs 1" EVTSINK+=" --OutFileName mcbm_digis_events.root" EVTSINK+=" --FillHistos true" +#EVTSINK+=" --BypassConsecutiveTs true" EVTSINK+=" --PubFreqTs $_pubfreqts" EVTSINK+=" --PubTimeMin $_pubminsec" EVTSINK+=" --PubTimeMax $_pubmaxsec" EVTSINK+=" --EvtNameIn events" -EVTSINK+=" --channel-config name=events,type=pull,method=bind,transport=zeromq,rcvBufSize=$_nbmoni,address=tcp://127.0.0.1:11556,rateLogging=$_ratelog" +EVTSINK+=" --channel-config name=events,type=pull,method=bind,transport=zeromq,rcvBufSize=$_nbbranch,address=tcp://127.0.0.1:11556,rateLogging=$_ratelog" EVTSINK+=" --channel-config name=missedts,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11006,rateLogging=$_ratelog" EVTSINK+=" --channel-config name=commands,type=sub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11007,rateLogging=$_ratelog" EVTSINK+=" --channel-config name=histogram-in,type=pub,method=connect,transport=zeromq,address=tcp://127.0.0.1:11666,rateLogging=$_ratelog" -- GitLab