Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JPrintK40Rates.sh
Go to the documentation of this file.
1 #!/bin/zsh
2 #
3 # \author mdejong
4 #
5 version=1.0
6 script=${0##*/}
7 
8 # ------------------------------------------------------------------------------------------
9 #
10 # Utility script to evaluate rates due to K40 decays.
11 #
12 # ------------------------------------------------------------------------------------------
13 
14 
15 if [ -z $JPP_DIR ]; then
16  echo "Variable JPP_DIR undefined."
17  exit
18 fi
19 
20 
21 source $JPP_DIR/setenv.sh $JPP_DIR
22 
23 
24 set_variable DIR $JPP_DIR/examples/JPhysics/
26 
27 set_variable darkcount_Hz 700.0
28 set_variable rateL0_Hz 4500.0
29 
30 # https://elog.km3net.de/Analysis/597
31 
32 set_array rateL1_Hz 568 49.1 5.48 0.479 # 0.0613 0.000781 0.000133
33 
34 if do_usage $*; then
35  usage "$script [working directory]"
36 fi
37 
38 
39 function typeout()
40 {
41  printf "(%4.0f, " $(( $rateL0_Hz + $darkcount_Hz ))
42  printf "{ %6.1f" $rateL1_Hz[1]
43  printf ", %6.2f" $rateL1_Hz[2,-1]
44  printf "})\n"
45 }
46 
47 
48 # https://git.km3net.de/common/jpp/-/issues/351
49 
51 
52 mkdir -p $WORKDIR
53 
54 cp $DIR/JRateK40.cc $WORKDIR/rateL0.cc
55 cp $DIR/JMultiplicityK40.cc $WORKDIR/rateL1.cc
56 
57 cat>$WORKDIR/Makefile<<EOF
58 include \$(JPP_DIR)/make/JMakefile
59 EOF
60 
61 for TARGET in KM3NeT KM3NeT_highQE; do
62  if (( 1 )); then
63  make -C $WORKDIR clean
64  make -C $WORKDIR $TARGET
65 
66  $WORKDIR/rateL0 \
67  -d 0 >& $WORKDIR/rateL0_${TARGET}.txt
68 
69  $WORKDIR/rateL1 \
70  -n 100000000 \
71  -F 4 \
72  -G 2 \
73  -D "0.216 5" \
74  -A 1 \
75  -U \
76  -o /dev/null \
77  -d 0 >& $WORKDIR/rateL1_${TARGET}.txt
78  fi
79  eval set_variable rateL0_${TARGET}_Hz `awk '/Rate *1Dx1D/ { print $4 }' $WORKDIR/rateL0_${TARGET}.txt`
80  eval set_array rateL1_${TARGET}_Hz `awk '/Rate\[.*\] *=/ { print $3 }' $WORKDIR/rateL1_${TARGET}.txt`
81 
82 done
83 
84 #rm -rf $WORKDIR
85 
86 
87 typeout
88 
89 # correct rates
90 
91 rateL0_Hz=$(( $rateL0_Hz * $rateL0_KM3NeT_highQE_Hz / $rateL0_KM3NeT_Hz ))
92 
93 darkcount_Hz=$(( $darkcount_Hz * 3 ))
94 
95 for (( i = 1; i <= ${#rateL1_Hz}; ++i )); do
96  rateL1_Hz[$i]=$(( $rateL1_Hz[$i] * $rateL1_KM3NeT_highQE_Hz[$i] / $rateL1_KM3NeT_Hz[$i] ))
97 done
98 
99 typeout
version
Definition: JEditTuneHV.sh:5
then make C $WORKDIR clean make C $WORKDIR $TARGET $WORKDIR rateL0 d &$WORKDIR rateL0_
then JLigier sh continue fi cat
Definition: JDAQDriver.sh:51
exit
Definition: JPizza.sh:36
then
Definition: datalogs.sh:34
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable DETECTOR_ID set_array RUNS if do_usage *then usage $script< source directory > nThe source directory corresponds to a pre calibrated D0ARCA009 detector fi case set_variable DIR
then fatal Wrong number of arguments fi JConvertDetectorFormat a o
static const double C
Physics constants.
const int n
Definition: JPolint.hh:786
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR set_variable DIR $JPP_DIR examples JPhysics set_variable DEBUG set_variable darkcount_Hz set_variable rateL0_Hz set_array rateL1_Hz if do_usage *then usage $script[working directory] fi function typeout()
case $OPTION in clean clean
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR if do_usage *then usage $script[(input file)+] fi set_variable DEBUG set_variable WORKDIR TMPDIR
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR &dev null set_variable
do set_variable STRING_TXT awk
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
then awk F
* usage
then fatal Timeout at user input fi set_variable SERVER JServerDB wget no check certificate q https
Definition: JCookie.sh:58
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonStart.sh:47
then usage $script[energy[distance[z of PMT]]] fi case set_variable z
Definition: JDrawPDF.sh:45
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
then cp
then echo
Definition: JQAQC.sh:92
source $JPP_DIR setenv csh $JPP_DIR &dev null eval JShellParser o a A
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
then getFile sh $JPP_ARCHIVE $DETECTOR_ID $RUNS[1] $KEY $VERSION $WORKDIR
esac $JPP_BIN JLogger sh $LOGGER until pgrep JGetMessage</dev/null > dev null
esac done
Definition: JAddHDE.sh:21
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
do alias $i