Jpp
 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 # set environment for Jpp
20 source $JPP_DIR/setenv.sh $JPP_DIR
21 
22 
23 set_variable DEBUG ${RANDOMEVENT_DEBUG:-1}
25 set_variable PIPE $WORKDIR/pipe.dat
26 set_variable OUTPUT_FILE $WORKDIR/trigger_processor.root
27 set_variable DETECTOR $JPP_DATA/km3net_reference.detx
28 set_variable TRIGGER $JPP_DATA/trigger_parameters_arca.txt
29 set_variable PMT_FILE $JPP_DATA/PMT_parameters.txt
30 set_variable BACKGROUND_HZ ${RANDOMEVENT_BACKGROUND_HZ:-${BACKGROUND_HZ:-0.0 600 60 6 0.6}}
31 set_variable NUMBER_OF_SLICES ${RANDOMEVENT_SLICES:-10}
32 set_variable RECYCLING ${RANDOMEVENT_RECYCLING:-"0 0"}
33 set_variable JDAQ_TIMESLICE JDAQTimesliceL0
34 set_variable SEED ${RANDOMEVENT_SEED:-0}
35 
36 
37 if ( do_usage $* ); then
38  usage "$script [daq file [detector file [pipe [output file [trigger file [PMT parameters file]]]]]]"
39 fi
40 
41 case $# in
48 esac
49 
50 
52 check_input_file $DETECTOR $TRIGGER $PMT_FILE
53 check_output_file $OUTPUT_FILE
54 
55 #################################################################################################
56 #
57 # The sampler values correspond to N_on N_off, respectively (note that sampler calls JSampler),
58 # where:
59 # N_on = number of time slices to read;
60 # N_off = number of time slices to skip.
61 #
62 # The sampler option works as follows.
63 # It will
64 # read -on average- N_on consecutive time slices and
65 # skip -on average- N_off time slices
66 # modulo the number of time slices in the file.
67 #
68 # The larger N_on, the faster the reading, because this reduces the random accesses
69 # of the data taking file to pick up a next time slice.
70 # The smaller N_off, the less time slices are skipped.
71 # So, N_on = 0 guarantees that all time slices are sampled.
72 # Note that if the number of time slices to be produced is small, then too small a value of N_off
73 # could create a bias because only the first time slices of the data taking file are then sampled.
74 #################################################################################################
75 
76 RUNBYRUN="file=$DAQ_FILE; sampler=1 1000; range_Hz=1e3 1e5"
77 
78 rm -f $PIPE
79 mkfifo $PIPE
80 
81 if [[ -p $PIPE ]]; then
82 
84 
85  JRandomTimesliceWriter \
86  -a ${DETECTOR} \
87  -o ${PIPE} \
88  -n ${NUMBER_OF_SLICES} \
89  -P ${PMT_FILE} \
90  -d ${DEBUG} \
91  -S ${SEED} \
92  -B "$BACKGROUND_HZ" \
93  -N "$RECYCLING" \
94  -r "${RUNBYRUN}" \
95  --! &
96 
97  JTriggerProcessor \
98  -a ${DETECTOR} \
99  -f ${PIPE} \
100  -@ ${TRIGGER} \
101  -C ${JDAQ_TIMESLICE} \
102  -o ${OUTPUT_FILE} \
103  -d ${DEBUG} \
104  --!
105 
106  rm -f $PIPE
107 
108  timer_stop
109  timer_print
110 
111  JPrintTree \
112  -f ${OUTPUT_FILE}
113 
114 else
115 
116  fatal "Error opening $PIPE."
117 fi
118 
119 JTriggerMonitor -f ${OUTPUT_FILE} -o ${OUTPUT_FILE}.monitor.root --!
void set_variable(const std::string &name, const std::string &value)
Set environment variable.
set_variable DETECTOR
Definition: JLegolas.sh:31
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
exit
Definition: JPizza.sh:36
&set_variable PIPE
Definition: JRandomEvent.sh:42
data_type r[M+1]
Definition: JPolint.hh:709
fi JEventTimesliceWriter a
&set_variable JDAQ_TIMESLICE
Definition: JLegolas.sh:29
then JPizza f
Definition: JPizza.sh:46
then echo
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 $
esac print_variable DETECTOR TRIGGER OUTPUT_FILE BACKGROUND_HZ PMT_FILE check_input_file $DETECTOR $TRIGGER $PMT_FILE check_output_file $OUTPUT_FILE RUNBYRUN
then print_variable DETECTOR INPUT_FILE INTERMEDIATE_FILE check_input_file $DETECTOR $INPUT_FILE check_output_file $INTERMEDIATE_FILE $OUTPUT_FILE JMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JPath.sh:52
* usage
&set_variable DETECTOR_FILE set_variable DAQ_FILE
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:56
alias put_queue eval echo n
Definition: qlib.csh:19
then display $WORKDIR
Definition: plot-Domino.sh:142
static const double C
Speed of light in vacuum [m/ns].
Definition: JConstants.hh:22
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR set_variable DEBUG set_variable WORKDIR set_variable PIPE $WORKDIR pipe dat set_variable OUTPUT_FILE $WORKDIR timeslice root set_variable DETECTOR $JPP_DATA km3net_reference detx set_variable TRIGGER $JPP_DATA trigger_parameters_arca txt set_variable PMT_FILE $JPP_DATA PMT_parameters txt set_variable BACKGROUND_HZ
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
version
Definition: JCalibratePMT.sh:7
then usage $script< detector file >< inputfile > fi case set_variable WORKDIR
Definition: JLegolas.sh:28
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:60
&set_variable TRIGGER
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62