-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAliSetup.sh
213 lines (191 loc) · 5.87 KB
/
AliSetup.sh
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/bin/bash
# Settings
DATE=`date +%y%m%d`
DAUGHTER=0
collsys="$1"
energy="$2"
ANALYSISNAME="$3"
ANALYSISNAME=${ANALYSISNAME:-"NoNamed"}
WORKDIRNAME="${DATE}_${DAUGHTER}_${ANALYSISNAME}"
LATEST="NULL"
if [ ${energy} = "5TeV" ]
then
energy="5.023TeVRun2"
fi
# Directory path
INITDIR=`pwd`
LATESTWORKDIR="${INITDIR}/${LATEST}"
WORKDIR="${INITDIR}/${WORKDIRNAME}"
PCGDIR="$HOME/alice/work/PCGSOFT"
SCRDIR="${PCGDIR}/Script/${collsys}/${ANALYSISNAME}"
ANSDIR="${PCGDIR}/Script/${collsys}/ANSWER"
RESDIR="${PCGDIR}/Result/${collsys}"
CERNBOX="NULL" #cernbox directory path
CERNBOXLATEST="NULL"
# Flags
OWNGIT="NO"
LOCAL="$4"
PCGINIT="$5"
# Load cernbox local path
if [ -e ${HOME}/.local/share/data/CERNBox/cernbox.cfg ]
then
TMP=`grep localPath ${HOME}/.local/share/data/CERNBox/cernbox.cfg`
CERNBOX="${TMP:22}Main_Analysis"
echo ${CERNBOX}
fi
# Look for the latest working directory to take over analysis codes
LATEST=`ls | grep ${ANALYSISNAME} | tail -1`
if [ "${LATEST}" != "NULL" ]
then
echo /////////////////////////////////////////////////////////////////
echo /////////////////////////////////////////////////////////////////
echo ///////Latest working directory for ${ANALYSISNAME} = ${LATEST}/
echo ///////Files will be taken over to today\'s//////////////////////
echo /////////////////////////////////////////////////////////////////
echo /////////////////////////////////////////////////////////////////
LATESTWORKDIR="${INITDIR}/${LATEST}"
fi
while : # Search working directory and make daughter
do
if [ -e $WORKDIRNAME ]
then
echo ${WORKDIRNAME} found.
#DAUGHTER=`expr $DAUGHTER + 1`
DAUGHTER=$((DAUGHTER + 1))
WORKDIRNAME="${DATE}_${DAUGHTER}_${ANALYSISNAME}"
else
# echo Generating new working directory ${WORKDIRNAME}
# cd ${INITDIR}
# mkdir $WORKDIRNAME
WORKDIR="${INITDIR}/${WORKDIRNAME}" # Renew working directory full path
break
fi
done
# Look for the latest working directory to take over analysis codes in CERNBOX directory
if [ "${CERNBOX}" != "NULL" ]
then
cd ${CERNBOX}
CERNBOXLATEST=`ls | grep ${ANALYSISNAME} | tail -1`
CERNBOXLATEST="${CERNBOX}/${CERNBOXLATEST}"
echo ${CERNBOXLATEST}
else
echo Couldn\'t access to ${CERNBOX}. Is the path correct\?
fi
# Generate new working directory in initial directory
cd ${INITDIR}
mkdir ${WORKDIRNAME}
## Clone analysiscodes from git repository
#git clone [email protected]:hanseopark/MyAliceAnalysis.git
#mv MyAliceAnalysis ${WORKDIRNAME}
#cd ${WORKDIRNAME}
#git checkout ${ANALYSISNAME}
# Clone from scripts and andswers in latest directory to PCGSOFT
# Take over analysis codes
if [ "${LOCAL}" = "y" ]
then
cd ${WORKDIR}
if [ "${CERNBOXLATEST}" = "NULL" ]
then
if [ "${LATEST}" != "NULL" ]
then
echo Files copied from ${LATESTWORKDIR} clone to PCGSOT
# /////////////////////////////////////////
# // Add file type you want to take over //
# /////////////////////////////////////////
#cp ${LATESTWORKDIR}/*.cxx ./
#cp ${LATESTWORKDIR}/*.h ./
#cp ${LATESTWORKDIR}/*.C ./
#cp ${LATESTWORKDIR}/* ./
#cp ${LATESTWORKDIR}/*.sh ./
#cp ${LATESTWORKDIR}/*.txt ./
cp -i ${LATESTWORKDIR}/0_Script/*.sh ${SCRDIR}/.
cp -i ${LATESTWORKDIR}/0_Answers/*.txt ${ANSDIR}/.
fi
else
echo Files are copied from ${CERNBOXLATEST}
# /////////////////////////////////////////
# // Add file type you want to take over //
# /////////////////////////////////////////
#cp ${CERNBOXLATEST}/*.cxx ./
#cp ${CERNBOXLATEST}/*.h ./
#cp ${CERNBOXLATEST}/*.C ./
cp ${CERNBOXLATEST}/*.sh ./
cp ${CERNBOXLATEST}/*.txt ./
#cp ${CERNBOXLATEST}/* ./
fi
else
echo File are not taken over.
fi
if [ "${PCGINIT}" = "y" ]
then
cd ${WORKDIR}
bash /Users/hanseopark/alice/pcg/AnalysisSoftware/prepareResultsDirectory.sh park
echo "prepareResultDirectory.sh Execute"
echo "Pull script for ${ANALYSISNAME}"
mkdir 0_Script # Run script files
mkdir 0_Answers # answer files for run script
if [ -d "$SCRDIR" ]; then
#cp ${SCRDIR}/*.sh .
ln -s ${SCRDIR}/*.sh 0_Script/.
ln -s ${ANSDIR}/*.txt 0_Answers/.
echo "Complete pull linked ALL script and txt for ${ANALYSISNAME}"
else
echo ${SCRDIR} is not exists.
fi
if [ "${ANALYSISNAME}" = "Comb" ]; then
echo "Combination of all method"
ln -s ${PCGDIR}/Script/0_CombineMeasurement.sh .
fi
if [ -d "$RESDIR" ]; then
#cp ${RESDIR}/*.root .
cp ${RESDIR}/Jet_Unfolding_Corrections_${energy}_4.root RooUnfold/.
cp ${RESDIR}/Jet_Unfolding_Corrections_${energy}_4_Default.root RooUnfold/.
echo "To copy for Unfolding file with latest analysis"
else
echo ${RESDIR} is not exists.
fi
else
echo prepareResultsDirectory.sh won\'t be executed.
fi
# Check if take over PCGSOFT
echo "Do you want to set the directory in working directory as MyPCGSOFT(git)? (y/n)"
read OWNGIT
if [ "${OWNGIT}" = "y" ]
then
cd ${WORKDIR}
#git init
#git remote add origin https://github.com/hanseopark/PCGSOFT.git
#git remote add origin [email protected]:hanseopark/PCGSOFT.git
#git add 0_Unfold.sh
#git commit -m "New File1"
#git status
#git remote add origin https://github.com/hanseopark/PCGSOFT
#git push -u origin master
#git fetch origin
git clone [email protected]:hanseopark/PCGSOFT.git
echo "git test"
fi
## Check if take over MyAnalysisCode
#echo "Do you want to set the derectory My AnalysisCode for Result directory? (y/n)"
#read OWNRESULT
#
#if [ "${OWNRESULT}" = "y" ]
#then
# cd ${WORKDIR}
# mkdir MyResults
# cp ../Result/Jet_Unfolding_Corrections_13TeV_4.root RooUnfold/./
# cp ../Result/Jet_Unfolding_Corrections_13TeV_4_Default.root RooUnfold/./
# cp ../MyCode/MyAnalysis.C ./
# cp ../MyCode/MyAnalysisCutStudies.C ./
# cp ../MyCode/MyAnalysisSystematicError.C ./
# cp ../MyCode/MyUnfold.C ./
# cp ../MyCode/Jet_Unfolding_Macro.C ./
# cp ../MyCode/Jet_Unfolding_Macro_INT7.C ./
# cp ../MyCode/Jet_Unfolding_Macro_EG1.C ./
# cp ../MyCode/Jet_Unfolding_Macro_EG2.C ./
# cp ../MyCode/TriggerCombination_PFR.dat ./
# cp ../Result/MyRejectionFactor.root MyResults/./
#
# echo "coping my code is done."
#
#fi