Jpp  15.0.0
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 # 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 DAQ_TIMESLICE JDAQTimesliceL0
34 set_variable: FACTOR RANDOMEVENT_FACTOR ${FACTOR:-1.0}
35 set_variable: SEED RANDOMEVENT_SEED 0
36 
37 
38 if do_usage $*; then
39  usage "$script [daq file [detector file [pipe [output file [trigger file [PMT parameters file]]]]]]"\
40  "\nAuxiliary script to produce random event data."
41 fi
42 
43 case $# in
50 esac
51 
52 
53 print_variable DETECTOR TRIGGER OUTPUT_FILE BACKGROUND_HZ PMT_FILE
54 check_input_file $DETECTOR $TRIGGER $PMT_FILE
55 check_output_file $OUTPUT_FILE
56 
57 #################################################################################################
58 #
59 # The sampler values correspond to N_on N_off, respectively (note that sampler calls JSampler),
60 # where:
61 # N_on = number of time slices to read;
62 # N_off = number of time slices to skip.
63 #
64 # The sampler option works as follows.
65 # It will
66 # read -on average- N_on consecutive time slices and
67 # skip -on average- N_off time slices
68 # modulo the number of time slices in the file.
69 #
70 # The larger N_on, the faster the reading, because this reduces the random accesses
71 # of the data taking file to pick up a next time slice.
72 # The smaller N_off, the less time slices are skipped.
73 # So, N_on = 0 guarantees that all time slices are sampled.
74 # Note that if the number of time slices to be produced is small, then too small a value of N_off
75 # could create a bias because only the first time slices of the data taking file are then sampled.
76 #################################################################################################
77 
78 RUNBYRUN="file=$DAQ_FILE; sampler=1 1000; range_Hz=1e3 1e5"
79 
80 rm -f $PIPE
81 mkfifo $PIPE
82 
83 if [[ -p $PIPE ]]; then
84 
86 
87  JRandomTimesliceWriter \
88  -a ${DETECTOR} \
89  -o ${PIPE} \
90  -n ${NUMBER_OF_SLICES} \
91  -P ${PMT_FILE} \
92  -P "QE=${FACTOR}" \
93  -d ${DEBUG} \
94  -S ${SEED} \
95  -B "$BACKGROUND_HZ" \
96  -N "$RECYCLING" \
97  -r "${RUNBYRUN}" \
98  --! &
99 
100  JTriggerProcessor \
101  -a ${DETECTOR} \
102  -f ${PIPE} \
103  -@ ${TRIGGER} \
104  -C ${DAQ_TIMESLICE} \
105  -o ${OUTPUT_FILE} \
106  -d ${DEBUG} \
107  --!
108 
109  rm -f $PIPE
110 
111  timer_stop
112  timer_print
113 
114  JPrintTree \
115  -f ${OUTPUT_FILE}
116 
117 else
118 
119  fatal "Error opening $PIPE."
120 fi
121 
122 JTriggerMonitor -f ${OUTPUT_FILE} -o ${OUTPUT_FILE}.monitor.root --!
&set_variable DAQ_TIMESLICE
Definition: JLegolas.sh:32
then JMuonPostfit f
then usage $script< detector file >< inputfile > nUtility script to create PDF and CDF of transition time distribution fi case set_variable WORKDIR
Definition: JLegolas.sh:31
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
exit
Definition: JPizza.sh:36
&set_variable PIPE
Definition: JRandomEvent.sh:44
data_type r[M+1]
Definition: JPolint.hh:742
then echo
static const double C
Physics constants.
const int n
Definition: JPolint.hh:660
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 $
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
Definition: JAcoustics.sh:20
esac print_variable DETECTOR TRIGGER OUTPUT_FILE BACKGROUND_HZ PMT_FILE check_input_file $DETECTOR $TRIGGER $PMT_FILE check_output_file $OUTPUT_FILE RUNBYRUN
do $DIR JTransitTime o
Definition: JTransitTime.sh:44
* 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: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 set_variable MODULE getModule a $DETECTOR L $STRING $FLOOR JEditDetector a $DETECTOR M $MODULE add $X o $DETECTOR else echo No update of detector $DETECTOR
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
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
version
Definition: JCalibratePMT.sh:7
then $DIR JPlotNPE PDG P
Definition: JPlotNPE-PDG.sh:62
&set_variable TRIGGER