Newer
Older

Pierre-Alain Loizeau
committed
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
#!/bin/bash
#SBATCH -J MQevb
#SBATCH -D /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/topologies
#SBATCH --time=6-00:00:00
#SBATCH --mem=4000
#SBATCH --partition=long
X=$((${SLURM_ARRAY_TASK_ID} - 0))
XXX=$(printf "%03d" "$X")
#$FAIRROOTPATH/bin/shmmonitor --cleanup
node=`hostname`
nodeStatus=`ps uaxwww | grep parmq`
nodeOK=`echo $nodeStatus | grep ParServ`
if [[ $nodeOK != "" ]]; then
echo parmq already running on node $node: $nodeOK, exiting ...
exit 0
fi
echo node check on $node passed, stop eventually relict processes
./stop_MQ.sh
#exit 0 ## debug exit
if [ -z "$1" ]; then
_runname="359"
else
_runname=$1
fi
if [ -z "$2" ]; then
_reqmod=-193
else
_reqmod=$2
fi
if [ -z "$3" ]; then
_pulmode=1
else
_pulmode=$3
fi
if [ -z "$4" ]; then
_reqtint=100
else
_reqtint=$4
fi
_Opt=$5
#_ntimeslices=-1
_ntimeslices=10000
_iUnp=4
_batch=1
_pulmulmin=5
_pultotmin=50
_pultotmax=500
#_puldetref=12 # TSR=022
#_puldetref=16 # TSR=032
_puldetref=16 # TSR=031
#_tofftof=0.
_tofftof=-35.
if [[ $_reqmod -eq 1 ]]; then
_iUnp=1
fi
#_dirname=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2018/input/$_runname/
_outdir=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/data/
#_datapath=~/KRONOS/CBM/cbmroot/trunk
#_dirname=$_datapath/macro/beamtime/mcbm2018/input/$_runname/
#_outdir=$_datapath/macro/beamtime/mcbm2018/data/
#_filename="./tsaData/${_runname}_pn05_*.tsa;./tsaData/${_runname}_pn06_*.tsa;./tsaData/${_runname}_pn07_*.tsa"
#_filename="./tsaData2020/${_runname}_pn02_*.tsa;./tsaData2020/${_runname}_pn04_*.tsa;./tsaData2020/${_runname}_pn05_*.tsa;./tsaData2020/${_runname}_pn06_*.tsa;./tsaData2020/${_runname}_pn08_*.tsa;./tsaData2020/${_runname}_pn10_*.tsa;./tsaData2020/${_runname}_pn11_*.tsa;./tsaData2020/${_runname}_pn12_*.tsa;./tsaData2020/${_runname}_pn13_*.tsa;./tsaData2020/${_runname}_pn15_*.tsa"
if [ $_runname -lt 1400 ]; then
_dirname=""
_filename="./tsaData2021/${_runname}_node8_*.tsa;./tsaData2021/${_runname}_node9_*.tsa"
_digibdffile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/parameters/tof/tof_v21b_mcbm.digibdf.par
else
if [ $_runname -lt 1384 ]; then
_dirname=`ls -d /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/input06/r${_runname}*` # double stack AFCK
else
_dirname=`ls -d /lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/inp07/r${_runname}*` # triple stack AFCK
fi
_filename="r${_runname}*.tsa"
_digibdffile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/parameters/tof/tof_v21c_mcbm.digibdf.par
echo dir: $_dirname
echo file: $_filename
fi
_digifile=$_runname.$_reqtint.$_reqmod.${_pulmode}${_Opt}.root
# ASCII files
#_mapfile=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/MQ/hitbuilder/MapTofGbtx.par
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/mTofPar.par
if [ $_runname -ge 707 ] && [ $_runname -lt 754 ]; then
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/mTofPar_2Stack.par
else
if [ $_runname -ge 754 ] && [ $_runname -lt 900 ]; then
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2020/mTofPar_3Stack.par
_puldetref=12 # TSR=022
else
if [ $_runname -ge 1079 ] && [ $_runname -lt 1086 ]; then
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/mTofPar2Stack.par
else
if [ $_runname -lt 1172 ]; then
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/mTofPar_20210524_DirectBeam.par
else
if [ $_runname -lt 1600 ]; then
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/mTofPar_20210524.par
else
_mapfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/mTofPar_20210524.par
fi
fi
fi
fi
fi
#_mapfile=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2018/etofPar.par
#_digibdffile=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/parameters/tof/v18j_cosmicHD.digibdf.par
#_digiparfile=/lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/parameters/tof/tof_v18j_cosmicHD.digi.par
#_digibdffile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/parameters/tof/tof_v21a_mcbm.digibdf.par
#_digiparfile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/parameters/tof/tof_v19b_mcbm.digi.par
# ROOT files
#_geofile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2018/tof_v18l_mCbm.par.root
#_geofile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/tof_mcbm_beam_2021_01.par.root
_geofile=/lustre/cbm/users/nh/CBM/cbmroot/trunk/macro/beamtime/mcbm2021/tof_mcbm_beam_2021_02.par.root
# MQ ports
_pPar=5603
_pSam=5613
_pCmd=5623
_pDig=5633
#rm -v nohup.out
#rm -v *log
rm all_*
PARAMETERSERVER="parmq-server"
echo pkill $PARAMETERSERVER
pkill -9 $PARAMETERSERVER
sleep 1
PARAMETERSERVER+=" --id parmq-server"
PARAMETERSERVER+=" --channel-name parameters"
PARAMETERSERVER+=" --channel-config name=parameters,type=rep,method=bind,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pPar"
#PARAMETERSERVER+=" --libs-to-load libCbmTof;libCbmFlibMcbm2018"
#PARAMETERSERVER+=" --first-input-name $_mapfile;$_digiparfile;$_digibdffile"
PARAMETERSERVER+=" --first-input-name $_mapfile;$_digibdffile"
PARAMETERSERVER+=" --first-input-type ASCII"
PARAMETERSERVER+=" --second-input-name $_geofile"
PARAMETERSERVER+=" --second-input-type ROOT"
PARAMETERSERVER+=" --severity INFO"
if [[ $_batch = 1 ]]; then
PARAMETERSERVER+=" --control static"
PARAMETERSERVER+=" --log-to-file ParServ_${_runname}.out"
nohup /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/parmq/$PARAMETERSERVER &
else
xterm -geometry 80x23+0+340 -hold -e /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/parmq/$PARAMETERSERVER &
#xterm -geometry 80x23+500+0 -hold -e /cvmfs/fairroot.gsi.de/fairroot/v18.0.6_fairsoft-may18/bin/$PARAMETERSERVER &
fi
echo Started ParameterServer
SAMPLER="TsaMultiSamplerTof"
SAMPLER+=" --id sampler1"
SAMPLER+=" --max-timeslices $_ntimeslices"
#SAMPLER+=" --max-timeslices 1000000"
#SAMPLER+=" --flib-port 10"
SAMPLER+=" --dirname $_dirname"
SAMPLER+=" --filename $_filename"
#SAMPLER+=" --flib-host myHost"
SAMPLER+=" --channel-config name=tofcomponent,type=push,method=bind,rateLogging=0,transport=zeromq,address=tcp://*:$_pSam"
SAMPLER+=" --channel-config name=syscmd,type=pub,method=bind,rateLogging=0,transport=zeromq,address=tcp://*:$_pCmd"
#SAMPLER+=" --transport shmem"
#SAMPLER+=" --transport zeromq"
#SAMPLER+=" --transport nanomsg"
#SAMPLER+=" --severity WARN"
SAMPLER+=" --severity INFO"
#SAMPLER+=" --severity DEBUG"
SAMPLER+=" --SelectComponents 1"
if [[ $_batch = 1 ]]; then
SAMPLER+=" --log-to-file Sampl_${_runname}.out"
SAMPLER+=" --control static"
nohup /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/source/$SAMPLER &
else
xterm -geometry 80x23+0+0 -hold -e /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/source/$SAMPLER &
fi
echo Started Sampler
while (( _iUnp > 0 )); do
UNPACKER="UnpackTofMcbm2018"
UNPACKER+=" --id unpack$_iUnp"
UNPACKER+=" --channel-config name=tofcomponent,type=pull,method=connect,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pSam"
UNPACKER+=" --channel-config name=parameters,type=req,method=connect,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pPar"
UNPACKER+=" --channel-config name=tofdigis,type=push,method=connect,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pDig"
UNPACKER+=" --channel-config name=syscmd,type=sub,method=connect,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pCmd"
#UNPACKER+=" --transport shmem"
#UNPACKER+=" --severity DEBUG"
UNPACKER+=" --severity INFO"
UNPACKER+=" --SelectComponents 1"
if [[ $_reqmod -gt 10 ]]; then
echo define ReqBeam
#UNPACKER+=" --ReqBeam 20486" # diamond -> 0x00005006 v14a
UNPACKER+=" --ReqBeam 10246" # diamond -> 0x00002806 v21a
fi
if [[ $_reqmod -lt 1 ]]; then
UNPACKER+=" --ReqMode 0"
case $_reqmod in
0)
;;
-1)
UNPACKER+=" --ReqDet0 10246" # diamond -> 0x00002806 v21a
UNPACKER+=" --ReqDet1 32822" # RPC 031 -> 0x00008036 v21a
UNPACKER+=" --ReqDet2 32838" # RPC 041 -> 0x00008046 v21a
;;
-2)
UNPACKER+=" --ReqDet0 20486" # diamond
UNPACKER+=" --ReqDet1 131126" # RPC 032
UNPACKER+=" --ReqDet2 131142" # RPC 042
;; # for ceramics
-3)
UNPACKER+=" --ReqDet0 20486" # diamond
UNPACKER+=" --ReqDet1 196662" # RPC 033
UNPACKER+=" --ReqDet2 196678" # RPC 043
;; # for BUC
-4) # v21a address mode
UNPACKER+=" --ReqDet0 10246" # diamond
UNPACKER+=" --ReqDet1 65542" # RPC 002
UNPACKER+=" --ReqDet2 65574" # RPC 022
;;
-190)
UNPACKER+=" --ReqDet0 20486" # diamond
UNPACKER+=" --ReqDet1 65606" # RPC 041
UNPACKER+=" --ReqDet2 36870" # RPC 900
UNPACKER+=" --ReqDet3 102406" # RPC 901
;; # for double stack calibration
-191)
UNPACKER+=" --ReqDet0 20486" # diamond
UNPACKER+=" --ReqDet1 65606" # RPC 041
UNPACKER+=" --ReqDet2 24582" # RPC 600
UNPACKER+=" --ReqDet3 90118" # RPC 601
;; # for USTC counter analysis
-192)
UNPACKER+=" --ReqDet0 65606" # RPC 041
UNPACKER+=" --ReqDet1 36870" # RPC 900
UNPACKER+=" --ReqDet2 102406" # RPC 901
;; # for double stack calibration
-193) BeamBeam
UNPACKER+=" --ReqDet0 65606" # RPC 041
UNPACKER+=" --ReqDet1 24582" # RPC 600
UNPACKER+=" --ReqDet2 90118" # RPC 601
;; # for USTC counter analysis
-194)
UNPACKER+=" --ReqDet0 20486" # diamond
UNPACKER+=" --ReqDet1 24582" # RPC 600
UNPACKER+=" --ReqDet2 90118" # RPC 601
;; # for USTC counter analysis
*)
echo ReqMode $_reqmod not yet defined, exiting
exit 1
;;
esac;
else
UNPACKER+=" --ReqMode $_reqmod"
fi
UNPACKER+=" --ReqTint $_reqtint"
UNPACKER+=" --PulserMode $_pulmode"
UNPACKER+=" --PulMulMin $_pulmulmin"
UNPACKER+=" --PulTotMin $_pultotmin"
UNPACKER+=" --PulTotMax $_pultotmax"
UNPACKER+=" --ToffTof $_tofftof"
UNPACKER+=" --RefModType 5"
UNPACKER+=" --RefModId 0"
UNPACKER+=" --RefCtrType 0"
UNPACKER+=" --RefCtrId 0"
if [[ $_batch = 1 ]]; then
UNPACKER+=" --control static"
UNPACKER+=" --log-to-file Unp${_iUnp}_${_runname}.out"
#echo nohup $UNPACKER
nohup /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/unpacker/$UNPACKER &
#echo execute interactively in a separate console: /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/unpacker/$UNPACKER
#read -p "Continue? (Y/N): "confirm && [[ $confirm == [yY] ]]
else
xterm -geometry 110x23+520+0 -hold -e /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/unpacker/$UNPACKER &
fi
(( _iUnp -= 1 ))
done
echo Started Unpacker
HITBUILDER="HitBuilderTof"
HITBUILDER+=" --id hitbuilder1"
HITBUILDER+=" --channel-config name=tofdigis,type=pull,method=bind,rateLogging=0,transport=zeromq,address=tcp://*:$_pDig"
HITBUILDER+=" --channel-config name=parameters,type=req,method=connect,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pPar"
HITBUILDER+=" --channel-config name=syscmd,type=sub,method=connect,rateLogging=0,transport=zeromq,address=tcp://127.0.0.1:$_pCmd"
#HITBUILDER+=" --channel-config name=tofhits,type=push,method=bind,transport=shmem,address=tcp://127.0.0.1:5557"
#HITBUILDER+=" --channel-config name=tofcalib,type=push,method=bind,transport=shmem,address=tcp://127.0.0.1:5558"
#HITBUILDER+=" --transport shmem"
#HITBUILDER+=" --severity DEBUG"
HITBUILDER+=" --severity INFO"
#HITBUILDER+=" --severity WARN"
HITBUILDER+=" --OutRootFile $_outdir$_digifile"
#HITBUILDER+=" --MaxEvent 10000000"
#HITBUILDER+=" --RunId 1552883952"
#HITBUILDER+=" --RunId 1614415472" # tof_mcbm_beam_2021_01.par.root
HITBUILDER+=" --RunId 1621902311" # tof_mcbm_beam_2021_02.par.root
HITBUILDER+=" --PulserMode $_pulmode"
HITBUILDER+=" --PulMulMin $_pulmulmin"
HITBUILDER+=" --PulTotMin $_pultotmin"
HITBUILDER+=" --PulTotMax $_pultotmax"
HITBUILDER+=" --PulDetRef $_puldetref"
HITBUILDER+=" --ReqTint $_reqtint"
#HITBUILDER+=" --ReqBeam 20486" # diamond -> 0x00005006
HITBUILDER+=" --BRefType 0"
HITBUILDER+=" --BRefSm 4"
HITBUILDER+=" --BRefDet 1"
HITBUILDER+=" --DutType 0"
HITBUILDER+=" --DutSm 3"
HITBUILDER+=" --DutRpc 1"
HITBUILDER+=" --SelType 0"
HITBUILDER+=" --SelSm 4"
HITBUILDER+=" --SelRpc 1"
HITBUILDER+=" --Sel2Type 5"
HITBUILDER+=" --Sel2Sm 0"
HITBUILDER+=" --Sel2Rpc 0"
if [[ $_reqmod -eq 1 ]]; then
HITBUILDER+=" --Mode 1"
fi
if [[ $_batch = 1 ]]; then
HITBUILDER+=" --control static"
HITBUILDER+=" --log-to-file HitBuild_${_runname}.out"
nohup /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/hitbuilder/$HITBUILDER &
else
xterm -geometry 120x23+1400+0 -hold -e /lustre/nyx/cbm/users/nh/CBM/cbmroot/trunk/build/bin/MQ/hitbuilder/$HITBUILDER &
fi
echo Started HitBuilder
# show daughter processes
ps
# wait for completion
RUNTIMEMAX=28000
DeltaTime=120
RunTime=0
while [ $RunTime -lt $RUNTIMEMAX ]; do
PROC=`ps uaxww | grep Hit`
ProcRunning=`echo $PROC | grep Builder`
if [[ $ProcRunning != "" ]]; then
(( Runtime += DeltaTime ))
sleep $DeltaTime
else
echo No HitBuilder in $PROC
break;
fi
done
#sleep 14400 # 4h
#sleep 28000 # 8h
echo kill all MQ processes
./stop_MQ.sh
echo done