Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JRandomEventRunByRun.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author zaly
4 #
5 version=1.0
6 script=${0##*/}
7 
8 # ------------------------------------------------------------------------------------------
9 #
10 # Script to jointly run JRandomTimesliceWriter and JTriggerProcessor in run-by-run mode.
11 #
12 # ------------------------------------------------------------------------------------------
13 
14 if [ -z $JPP_DIR ]; then
15  echo "Variable JPP_DIR undefined."
16  exit
17 fi
18 
19 source $JPP_DIR/setenv.sh $JPP_DIR
20 
21 set_variable: DEBUG RANDOMEVENT_DEBUG 1
22 set_variable: WORKDIR RANDOMEVENT_WORKDIR ./
23 set_variable: BACKGROUND_HZ RANDOMEVENT_BACKGROUND_HZ `getK40Rates`
24 set_variable: SEED RANDOMEVENT_SEED 0
25 set_variable: NUMBER_OF_SLICES RANDOMEVENT_SLICES 10
26 set_variable: RECYCLING RANDOMEVENT_RECYCLING "0 0"
27 set_variable: FACTOR RANDOMEVENT_FACTOR 1.0
28 set_variable: SAMPLER RANDOMEVENT_SAMPLER "1 1000"
29 
30 set_variable DAQ_TIMESLICE JDAQTimesliceL0
31 
32 if do_usage $*; then
33  usage "$script <detector file> <output file> <DAQ file> <PMT parameters file>"\
34  "\nAuxiliary script to produce random event data."
35 fi
36 
37 if (( $# == 4 )); then
42 else
43  fatal "Wrong number of arguments."
44 fi
45 
46 set_variable RUNBYRUN "file=$DAQ_FILE; sampler=$SAMPLER"
47 
48 #################################################################################################
49 #
50 # The sampler values correspond to N_on N_off, respectively (note that sampler calls JSampler),
51 # where:
52 # N_on = number of time slices to read;
53 # N_off = number of time slices to skip.
54 #
55 # The sampler option works as follows.
56 # It will
57 # read -on average- N_on consecutive time slices and
58 # skip -on average- N_off time slices
59 # modulo the number of time slices in the file.
60 #
61 # The larger N_on, the faster the reading, because this reduces the random accesses
62 # of the data taking file to pick up a next time slice.
63 # The smaller N_off, the less time slices are skipped.
64 # So, N_on = 0 guarantees that all time slices are sampled.
65 # Note that if the number of time slices to be produced is small, then too small a value of N_off
66 # could create a bias because only the first time slices of the data taking file are then sampled.
67 #################################################################################################
68 
69 set_variable PIPE `mktemp -d $WORKDIR/XXXXXX`/pipe.dat
70 set_variable TRIGGER `mktemp $WORKDIR/trigger_XXXXXX.txt`
71 
72 mkfifo $PIPE
73 
74 if [[ -p $PIPE ]]; then
75 
77 
78  JRandomTimesliceWriter \
79  -a ${DETECTOR} \
80  -o ${PIPE} \
81  -n ${NUMBER_OF_SLICES} \
82  -P ${PMT_FILE} \
83  -P "QE=${FACTOR}" \
84  -S ${SEED} \
85  -B "$BACKGROUND_HZ" \
86  -N "$RECYCLING" \
87  -r "${RUNBYRUN}" \
88  -d ${DEBUG} \
89  --! &
90 
91  JPrintTriggerParameters \
92  -f ${DAQ_FILE} > $TRIGGER
93 
94  JTriggerProcessor \
95  -a ${DETECTOR} \
96  -f ${PIPE} \
97  -@ ${TRIGGER} \
98  -C ${DAQ_TIMESLICE} \
99  -o ${OUTPUT_FILE} \
100  -d ${DEBUG} \
101  --!
102 
103  rm -rf ${PIPE:h}
104  rm -f ${TRIGGER}
105 
106  timer_stop
107  timer_print
108 
109  JPrintTree \
110  -f ${OUTPUT_FILE}
111 
112  JTriggerMonitor \
113  -f ${OUTPUT_FILE} \
114  -o /dev/null
115 
116 else
117 
118  fatal "Error opening $PIPE."
119 fi
&set_variable DAQ_TIMESLICE
Definition: JLegolas.sh:32
o $QUALITY_ROOT d $DEBUG!JPlot1D f
Definition: JDataQuality.sh:66
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
exit
Definition: JPizza.sh:36
data_type r[M+1]
Definition: JPolint.hh:758
then echo
static const double C
Physics constants.
const int n
Definition: JPolint.hh:676
then timer_start(JRandomTimesliceWriter-a ${DETECTOR}-o ${PIPE}-n ${NUMBER_OF_SLICES}-P ${PMT_FILE}-d ${DEBUG}-S ${SEED}-B"$BACKGROUND_HZ"-N"$RECYCLING"--!&&for((i=0;$i!=10;++i));do;echo 'EOF' > $PIPE;usleep 100000;done &&rm-f $PIPE)&JTimesliceReprocessor-a $
&set_variable PIPE
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
const JK40Rates & getK40Rates()
Get K40 rates.
Definition: Antares.hh:27
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DEBUG set_variable WORKDIR
Definition: JLegolas.sh:20
* usage
then JConvertDetectorFormat a $DETECTOR[1] o
&set_variable DETECTOR_FILE set_variable DAQ_FILE
then usage $script[detector file[output file[PMT parameters file[number of slices]]]] nAuxiliary script to produce random time slice data fi case set_variable NUMBER_OF_SLICES
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:58
&set_variable OUTPUT_FILE
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
then JCalibrateToT a
Definition: JTuneHV.sh:116
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
then display $WORKDIR
Definition: plot-Domino.sh:128
set_variable DETECTOR
version
Definition: JCalibratePMT.sh:7
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
&set_variable TRIGGER