forked from zhangaw325/FNAL-Beam-Test-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRunAiwuTextFile.sh
More file actions
executable file
·153 lines (140 loc) · 4.98 KB
/
RunAiwuTextFile.sh
File metadata and controls
executable file
·153 lines (140 loc) · 4.98 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
############################################################
# To Do List
#
# 1. Add the Brian's macros for analyzing efficiency
#
#
############################################################
# Basic Info about this Macro
#
#
#
#
############################################################
source /afs/cern.ch/sw/lcg/external/gcc/4.8/x86_64-slc6/setup.sh
source /afs/cern.ch/sw/lcg/app/releases/ROOT/6.04.02/x86_64-slc6-gcc48-opt/root/bin/thisroot.sh
IRunNo=$1
FRunNo=$2
echo "Initial Run Number = $IRunNo"
echo "Final Run Number = $FRunNo"
ILat=15
FLat=30
RunCounter=$IRunNo
#PathOfInputData=/afs/cern.ch/user/r/rasharma/public/TurboSoftware/EventBuilder/OutPutData/
PathOfInputData=$PWD
#/*
# * EfficiencyType : If want to calculate efficiency of each GE11's independently
# * Using trigger from hardware only put it equal to 0
# *
# * If want to trigger it using two of the reference tracker
# * put it = 1
# *
# * if want to trigger it only when it passes from all three reference
# * tracker then put it = 2
# */
EfficiencyType=2
#/*
# * TrkOnly : If you want output text file in which there are hit iff there is
# * hit only in all three tracker then put this = 1
# *
# * If you want to get hit iff there is hit in all tracker as well
# * as in GE11's then put this = 0
# */
TrkOnly=1
if [[ $EfficiencyType == 0 ]]; then
OutputEffFileName="GE11s_Efficiency_Independent.txt"
info="Independent"
fi
if [[ $EfficiencyType == 1 ]]; then
OutputEffFileName="GE11s_Efficiency_If_Hit_2_Trk.txt"
info="HitOnly2Trk"
fi
if [[ $EfficiencyType == 2 ]]; then
OutputEffFileName="GE11s_Efficiency_Hit_all_3_Trk.txt"
info="HitAll3Trk"
fi
function make_dir
{
# ------------------------------------------------------------------------
# It Checks IF the output data directory exists or not
# No Arguments
# ------------------------------------------------------------------------
if [ -d "${1}" ]; then
echo "Directory ${1} Exists......."
else
mkdir ${1}
echo "Directory ${1} Created................."
fi
} # end of make_dir
rm GE11s_Effeciency_Info.txt
make_dir HitTxtFiles
make_dir RootFile_ClusterInfo
make_dir FirstStage_textFile
#make_dir RootFiles
#make_dir ResidualFiles
#make_dir ShiftParameterFiles
#make_dir EfficiencyTxtFiles
#echo -e "RunName\t\t\t\t\t\t\t\t GE11_IV_GIF \t GE11_IV \t GE11_V" > ${OutputEffFileName}
while [ $RunCounter -le $FRunNo ]
do
if [[(($RunCounter -le 9))]]; then
file=000$RunCounter
else
if [[(($RunCounter -le 99))]]; then
file=00$RunCounter
else
if [[(($RunCounter -le 999))]]; then
file=0$RunCounter
else
file=$RunCounter
fi
fi
fi
for dir in $PathOfInputData/Run$file*/; do # Start of dir for loop
echo -e "\n\n\E[33m======================================================\E[0m\n"
echo -e "\E[34mStarted Running: \E[0m" "\E[31m$(basename $dir)\E[0m"
echo -e "\n\E[33m======================================================\E[0m\n"
echo "Directory name : "$dir
echo "Base name : "$(basename $dir)
RunName=$(basename $dir)
for rootfile in $dir/CRC*.root;do # Start of rootfile for loop
echo "Root file name : "$rootfile
./CreateHeader.sh $rootfile rd51tbgeo
echo "=====> MakeClass Run Successfully.... :)"
if [[ $RunCounter -le 1587 ]]; then
root -l -b -q GetHitTxtFile_H2.C\(\"${rootfile}\",\"${RunName}\",${EfficiencyType},${TrkOnly}\)
else
root -l -b -q GetHitTxtFile_H4.C\(\"${rootfile}\",\"${RunName}\",${EfficiencyType},${TrkOnly}\)
fi
done # END of rootfile for loop
done # END of dir for loop
((++RunCounter)) # increment counter for while loop
done # while loop ends
#cp ${OutputEffFileName} GE11s_Effeciency_${info}_R${IRunNo}_R$FRunNo.txt
#mv GE11s_Effeciency_${info}_R${IRunNo}_R$FRunNo.txt EfficiencyTxtFiles/
#
#echo "file(s) of interest:"
#rm EfficiencyTxtFiles/FilesToAnalyze.txt
#echo "GE11s_Effeciency_${info}_R${IRunNo}_R$FRunNo.txt" >> EfficiencyTxtFiles/FilesToAnalyze.txt
#
#while [ $ILat -le $FLat ]
#do
# rm -f EfficiencyTxtFiles/GE11s_Effeciency_${info}_R${IRunNo}_R${FRunNo}_Lat${ILat}.txt
# grep "Lat$ILat" EfficiencyTxtFiles/GE11s_Effeciency_${info}_R${IRunNo}_R$FRunNo.txt >> EfficiencyTxtFiles/GE11s_Effeciency_${info}_R${IRunNo}_R${FRunNo}_Lat${ILat}.txt
# outputFile=EfficiencyTxtFiles/GE11s_Effeciency_${info}_R${IRunNo}_R${FRunNo}_Lat${ILat}.txt
# outputFile_short=EfficiencyTxtFiles/GE11s_Effeciency_${info}_R${IRunNo}_R${FRunNo}_Lat${ILat}.txt
#
# if [[ $(stat -c%s "$outputFile") -le 46 ]]; then
# rm $outputFile
# else
# echo "vim $outputFile"
# echo "GE11s_Effeciency_${info}_R${IRunNo}_R${FRunNo}_Lat${ILat}.txt" >> EfficiencyTxtFiles/FilesToAnalyze.txt
# fi
#
# ILat=$[$ILat+1]
#done # End of while loop
#
#cp EfficiencyTxtFiles/FilesToAnalyze.txt EfficiencyTxtFiles/FilesToAnalyze_R${IRunNo}_R${FRunNo}.txt
#
#echo "To Make Efficiency Curves Execute In Terminal:"
#echo "./analyzeEff.sh"