livereco.sh 2.34 KB
Newer Older
positron cool guys's avatar
positron cool guys 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
#!/bin/bash

#define parameters
export TIMEWAIT=300 #second

#daq parameters
export DAQEXE="" #to be set
export DAQDIR=""
export DAQOUTDIR="/home/positron/LymanAlpha/MuMass/data"

#reconstruction
export RECOMULTEXE="/home/positron/LymanAlpha/MuMass/mumass-mm-analysis/map_multiplex" #to be set
export RECOEXE="/home/positron/LymanAlpha/MuMass/mumass-mm-analysis/analyze_PositionData"
export RECODIR=$DAQOUTDIR"/reconstructed"

#plotting and fitting
export ANALEXE="/home/positron/LymanAlpha/MuMass/mumass-mm-analysis/reconstructAndPlot"
export ANALDIR=$DAQOUTDIR"/analysed"

while [ true ]
do
    echo "CHECK DAQ IS COMPILED"
    cd $DAQDIR
    make
    $DAQEXE

    echo "CHECK IF NEW FILES ARE THERE"
    for file in $DAQOUTDIR/*root
    do
	#check if file was already mapped to multiplexing
	export newfile=$(basename $file)
	export multiplexedfile=$DAQOUTDIR"/mapped/${newfile%.*}_mapped.root"
	echo "multiplexed file is: $multiplexedfile"
	if [ ! -f $multiplexedfile ]; then
	    #run the reco
	    echo "$file not yet mapped, running multiplexing"
	    #WARNING: bad hack!! dumping filename to txt to read
	    echo $file > /home/positron/LymanAlpha/MuMass/mumass-mm-analysis/filename.txt
	    echo "converting file: $file"
	    cd /home/positron/LymanAlpha/MuMass/mumass-mm-analysis/
	    root -l -q /home/positron/LymanAlpha/MuMass/mumass-mm-analysis/domultiplexing.C
	    cd -

	    #check if reconstructed file exist
	    export recofileout=$DAQOUTDIR/"reconstructed/Reco_"$(basename $multiplexedfile)
	    #run the reco
	    echo "$multiplexedfile not yet reconstructed, running reco"
	    $RECOEXE $multiplexedfile $recofileout
	    
	    #analysed data
	    export analfileout=$DAQOUTDIR/"analysed/Analysed_"$(basename $recofileout)
	    #run the reco
	    echo "$multiplexedfile not yet reconstructed, running reco"
Emilio Depero's avatar
Emilio Depero committed
54
55
	    #$ANALEXE $recofileout $analfileout
	    #$ANALEXE $recofileout $analfileout 45
Emilio Depero's avatar
Emilio Depero committed
56
	    $ANALEXE $recofileout $analfileout 90
Emilio Depero's avatar
Emilio Depero committed
57
	    #$ANALEXE $recofileout $analfileout 135
positron cool guys's avatar
positron cool guys committed
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	fi

	echo "FILE $file SCANNED"
    done

    echo "ALL FINISHED, WAITING FOR $TIMEWAIT SECONDS"
    sleep $TIMEWAIT

    #for now blocking it here
    continue
    #run the python script for plotting
    echo "RUNNING PLOTTING SCRIPT"
    python --directory $ANALDIR --log --histoname decayPositions_z_10deg --fitoption ML --normalize --drawline --targetz 0 --fitrange -30 -5 --nfiles 3   
done