Int_t trdStatus = (procesTRD) ? procesTRD->GetStatus():0;
Int_t tofStatus = (procesTOF) ? procesTOF->GetStatus():0;
Int_t t0Status = (procesT0) ? procesT0->GetStatus():0;
- Int_t tpcStatus = (procesTPC) ? ((procesTPC.ValidateTimeDrift() || procesTPC.ValidateTimeGain())==kFALSE):0;
+ Int_t tpcStatus = (procesTPC) ? ((procesTPC->ValidateTimeDrift() || procesTPC->ValidateTimeGain())==kFALSE):0;
//
printf("\n\n\n\n");
printf("CPass0 calibration status\n");
//
//
//
+ gSystem->Exec("sed -i 's|\t| |g;s|[[:space:]]*$||' syswatch*.log");
TFile * fout= new TFile(fname,"update");
TTree * treeRec = AliSysInfo::MakeTree("syswatch_rec.log");
TTree * treeCalib = AliSysInfo::MakeTree("syswatch_calib.log");
partialAlienFileListPrefix=${alienFileList}_
runningMergeByComponentLockFile="runningMergeByComponent.lock"
+makeAbsolutePathsInList()
+{
+ #make sure the files in the list have absolute paths
+ rm -f $2
+ while read file; do
+ readlink -f $file >> $2
+ done < $1
+}
+
mergeByComponent()
{
# process by component
#lock
touch $runningMergeByComponentLockFile
+ # run inside a dedicated running directory
+ # whic means copy the file list to process and prefic each line with ../
+ # since the file names have no absolute paths!
+ runningDirectory="${runningMergeByComponentLockFile}.${1}.dir"
+ parentDirectory=$PWD
+ fileList="$1.local"
+ mkdir -p $runningDirectory
+ makeAbsolutePathsInList $1 $runningDirectory/$fileList
+ cd $runningDirectory
+
+ #copy the macro from $parentDirectory
+ [[ -f $parentDirectory/mergeByComponent.C ]] && cp $parentDirectory/mergeByComponent.C $PWD
+
previousResults=PREVIOUS_ITERATION_CalibObjects.root
- if [[ -f CalibObjects.root ]]; then
- mv CalibObjects.root $previousResults
- echo "$previousResults" >> $1
+ if [[ -f $parentDirectory/CalibObjects.root ]]; then
+ mv -f $parentDirectory/CalibObjects.root $previousResults
+ echo "$previousResults" >> $fileList
fi
- echo "####DEBUG" | tee -a merge.log
- echo "####processed list $1" | tee -a merge.log
- cat $1
-
for det in $components; do
# merge
- echo "***********************" 2>&1 | tee -a merge.log
- echo merging $det data 2>&1 | tee -a merge.log
- echo "***********************" 2>&1 | tee -a merge.log
- echo aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
+ echo "***********************"
+ echo merging $det data
+ echo "***********************"
+ echo aliroot -b -q "mergeByComponent.C(\"$det\", \"$fileList\")"
+ aliroot -b -q "mergeByComponent.C(\"$det\", \"$fileList\")"
mv syswatch.log syswatch_merge_$det.log
mv CalibObjects.root CalibObjects_$det.root
done
- rm -f $previousResults
-
# global merge
- echo "***********************" 2>&1 | tee -a merge.log
- echo merging ALL data 2>&1 | tee -a merge.log
- echo "***********************" 2>&1 | tee -a merge.log
+ echo "***********************"
+ echo merging ALL data
+ echo "***********************"
partialCalibObjectsList="objects.list.${1}"
ls -1 CalibObjects_*.root > $partialCalibObjectsList
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")" 2>&1 | tee -a merge.log
+ echo aliroot -b -q "mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")"
+ aliroot -b -q "mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")"
mv syswatch.log syswatch_ALL.log
+ rm $partialCalibObjectsList
- #cleanup
+ #cleanup of the merged files
if [[ "$2" == "doCleanup" ]]; then
while read filename; do
- echo rm -f $filename | tee -a merge.log
+ echo rm -f $filename
rm -f $filename
- done < $1
+ done < $fileList
fi
+ rm -f $fileList
rm -f CalibObjects_*.root
+ #move stuff back to the parent dir and clean up
+ #merge the syswatch logs
+ for x in syswatch*log; do
+ if [[ -f $parentDirectory/$x ]]
+ then
+ echo "sed '1d' $x >> $parentDirectory/$x"
+ sed '1d' $x >> $parentDirectory/$x
+ rm -f $x
+ else
+ echo mv -f $x $parentDirectory/$x
+ mv -f $x $parentDirectory/$x
+ fi
+ done
+ #merge the other logs
+ for x in *.log; do
+ if [[ -f $parentDirectory/$x ]]
+ then
+ echo "cat $x >> $parentDirectory/$x"
+ cat $x >> $parentDirectory/$x
+ else
+ echo mv -f $x $parentDirectory/$x
+ mv -f $x $parentDirectory/$x
+ fi
+ done
+ #move the CalibObjects
+ echo mv -f CalibObjects.root $parentDirectory
+ mv -f CalibObjects.root $parentDirectory
+
+ #final cleanup
+ cd $parentDirectory
+ rm -rf $runningDirectory
+
#unlock
rm -f $runningMergeByComponentLockFile
+ echo "***mergeByComponent() DONE"
}
waitIfLocked()
done
}
+copyScripts()
+{
+ [[ ! -f mergeByComponent.C ]] && \
+ cp -f $ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C $PWD && \
+ echo "taking the default scripts from $ALICE_ROOT"
+ [[ ! -f makeOCDB.C ]] && \
+ cp -f $ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C $PWD && \
+ echo "taking the default scripts from $ALICE_ROOT"
+}
+
if [ $isLocal -eq 0 ]; then
+ #first, make sure we have the scripts
+ copyScripts | tee -a copy.log
+ ls
#with alien files copy them first to local
- echo "***********************" 2>&1 | tee -a merge.log
- echo copying files for run $run 2>&1 | tee -a merge.log
- echo from $path 2>&1 | tee -a merge.log
- echo "***********************" 2>&1 | tee -a merge.log
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a merge.log
- split --numeric-suffixes --suffix-length=4 --lines=100 ${alienFileList} ${partialAlienFileListPrefix}
- counter=0
+ echo "***********************" 2>&1 | tee -a copy.log
+ echo copying files for run $run 2>&1 | tee -a copy.log
+ echo from $path 2>&1 | tee -a copy.log
+ echo "***********************" 2>&1 | tee -a copy.log
+ echo aliroot -b -q "mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a copy.log
+ aliroot -b -q "mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a copy.log
+ echo split --numeric-suffixes --suffix-length=4 --lines=20 ${alienFileList} ${partialAlienFileListPrefix} | tee -a copy.log
+ split --numeric-suffixes --suffix-length=4 --lines=20 ${alienFileList} ${partialAlienFileListPrefix}
rm -f $runningMergeByComponentLockFile
for partialAlienFileList in ${partialAlienFileListPrefix}*
do
#copy the alien files to local
partialAlienFileListPostfix=${partialAlienFileList#$partialAlienFileListPrefix}
partialLocalFileList=${partialLocalFileListPrefix}${partialAlienFileListPostfix}
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a merge.log
- [[ $counter -ne 0 ]] && sed -i '1d' syswatch.log && $(( $counter++ ))
- cat syswatch.log >> syswatch_copy.log
- rm syswatch.log
+ echo aliroot -b -q "mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a copy.log
+ aliroot -b -q "mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a copy.log
+
+ #handle syswatch
+ if [[ -f syswatch_copy.log ]]
+ then
+ sed '1d' syswatch.log >> syswatch_copy.log
+ rm -f syswatch.log
+ else
+ mv syswatch.log syswatch_copy.log
+ fi
#merge in parallel, use a simple lockfile
+ echo "waitIfLocked $runningMergeByComponentLockFile" | tee -a merge.log
waitIfLocked $runningMergeByComponentLockFile
- mergeByComponent $partialLocalFileList "doCleanup" &
+ mergeByComponent $partialLocalFileList "doCleanup" 2>&1 | tee -a merge.log &
done
else
#locally just use the list directly
fi;
#cleanup
-cat ${partialAlienFileListPrefix}* >> ${localFileList}
rm -f ${partialAlienFileListPrefix}*
rm -f ${partialLocalFileListPrefix}*
echo "***********************" 2>&1 | tee -a ocdb.log
echo making $det OCDB 2>&1 | tee -a ocdb.log
echo "***********************" 2>&1 | tee -a ocdb.log
-aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+echo aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+aliroot -b -q "makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
mv syswatch.log syswatch_makeOCDB.log
# summary
defaultOCDB="raw://"
[[ -n $4 ]] && defaultOCDB=$4
-# if fifth argument given it is a runnuber, otherwise guess from path (when ran on alien)
-runNumber=$(echo $1 | cut -d "/" -f 6 | sed 's/^0*//')
-[[ -n $5 ]] && runNumber=$5
-
if [ -f Run0_999999999_v3_s0.root ]; then
mkdir -p TPC/Calib/Correction
mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
fi
echo ">>>>>>> Running AliRoot to merge calib objects found in $path with pattern AliESDfriends_v1.root"
-aliroot -l -b -q merge.C\(\"$path\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
+aliroot -l -b -q "merge.C(\"$path\",\"AliESDfriends_v1.root\")" 2>&1 | tee merge.log
mv syswatch.log syswatch_merge.log
echo ">>>>>>> Extract OCDB entries for run = $runNumber, to be stored in $outputOCDB"
-aliroot -l -b -q makeOCDB.C\($runNumber,\"$outputOCDB\",\"$defaultOCDB\"\) 2>&1 | tee ocdb.log
+aliroot -l -b -q "makeOCDB.C($runNumber,\"$outputOCDB\",\"$defaultOCDB\")" 2>&1 | tee ocdb.log
mv syswatch.log syswatch_makeOCDB.log
aliroot -l -b -q "recCPass0.C(\"$fileName\", $nEvents, \"$ocdbPath\", \"$triggerOption\")" 2>&1 | tee rec.log
mv syswatch.log syswatch_rec.log
+echo "directory contents:"
+ls
echo ">>>>>>> Running AliRoot to make calibration..."
-aliroot -l -b -q runCalibTrain.C\(\""$runNum\",\"AliESDs.root\",\"$ocdbPath"\"\) 2>&1 | tee calib.log
+echo "aliroot -l -b -q runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")"
+aliroot -l -b -q "runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")" 2>&1 | tee calib.log
mv syswatch.log syswatch_calib.log
echo ">>>>>>> Extracting system information..."
runCalibTrain("104892");
*/
-void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
+void runCalibTrain(Int_t runNumber, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
{
//
// macro to run TPC calibration train
// config calibration train
// setting geometry and B-field from GRP
- Int_t runNumber = runNumberString.Atoi();
printf("runNumber from runCalibTrain = %d\n",runNumber);
printf("ocdb from runCalibTrain = %s\n",ocdb);
ConfigCalibTrain(runNumber, ocdb);
Int_t trdStatus = (procesTRD) ? procesTRD->GetStatus():0;
Int_t tofStatus = (procesTOF) ? procesTOF->GetStatus():0;
Int_t t0Status = (procesT0) ? procesT0->GetStatus():0;
- Int_t tpcStatus = (procesTPC) ? ((procesTPC.ValidateTimeDrift() || procesTPC.ValidateTimeGain())==kFALSE):0;
+ Int_t tpcStatus = (procesTPC) ? ((procesTPC->ValidateTimeDrift() || procesTPC->ValidateTimeGain())==kFALSE):0;
//
printf("\n\n\n\n");
printf("CPass1 calibration status\n");
partialAlienFileListPrefix=${alienFileList}_
runningMergeByComponentLockFile="runningMergeByComponent.lock"
+makeAbsolutePathsInList()
+{
+ #make sure the files in the list have absolute paths
+ rm -f $2
+ while read file; do
+ readlink -f $file >> $2
+ done < $1
+}
+
mergeByComponent()
{
# process by component
#lock
touch $runningMergeByComponentLockFile
+ # run inside a dedicated running directory
+ # whic means copy the file list to process and prefic each line with ../
+ # since the file names have no absolute paths!
+ runningDirectory="${runningMergeByComponentLockFile}.${1}.dir"
+ parentDirectory=$PWD
+ fileList="$1.local"
+ mkdir -p $runningDirectory
+ makeAbsolutePathsInList $1 $runningDirectory/$fileList
+ cd $runningDirectory
+
previousResults=PREVIOUS_ITERATION_CalibObjects.root
- if [[ -f CalibObjects.root ]]; then
- mv CalibObjects.root $previousResults
- echo "$previousResults" >> $1
+ if [[ -f $parentDirectory/CalibObjects.root ]]; then
+ mv $parentDirectory/CalibObjects.root $previousResults
+ echo "$previousResults" >> $fileList
fi
echo "####DEBUG" | tee -a merge.log
- echo "####processed list $1" | tee -a merge.log
- cat $1
+ echo "####processed list $fileList" | tee -a merge.log
+ cat $fileList | tee -a merge.log
for det in $components; do
# merge
echo "***********************" 2>&1 | tee -a merge.log
echo merging $det data 2>&1 | tee -a merge.log
echo "***********************" 2>&1 | tee -a merge.log
- echo aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"$det\", \"$1\")" 2>&1 | tee -a merge.log
+ echo aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"$det\", \"$fileList\")" 2>&1 | tee -a merge.log
+ aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"$det\", \"$fileList\")" 2>&1 | tee -a merge.log
mv syswatch.log syswatch_merge_$det.log
mv CalibObjects.root CalibObjects_$det.root
done
echo "***********************" 2>&1 | tee -a merge.log
partialCalibObjectsList="objects.list.${1}"
ls -1 CalibObjects_*.root > $partialCalibObjectsList
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")" 2>&1 | tee -a merge.log
+ aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"ALL\", \"$partialCalibObjectsList\")" 2>&1 | tee -a merge.log
mv syswatch.log syswatch_ALL.log
#cleanup
while read filename; do
echo rm -f $filename | tee -a merge.log
rm -f $filename
- done < $1
+ done < $fileList
fi
rm -f CalibObjects_*.root
+ rm -f $fileList
+
+ #move stuff back to the parent dir and clean up
+ #merge the syswatch logs
+ for x in syswatch*log; do
+ if [[ -f $parentDirectory/$x ]]
+ then
+ sed '1d' >> $parentDirectory/$x
+ rm -f $x
+ else
+ mv $x $parentDirectory/$x
+ fi
+ done
+ mv * $parentDirectory
+ cd $parentDirectory
+ rm -rf $runningDirectory
#unlock
rm -f $runningMergeByComponentLockFile
echo copying files for run $run 2>&1 | tee -a merge.log
echo from $path 2>&1 | tee -a merge.log
echo "***********************" 2>&1 | tee -a merge.log
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a merge.log
- split --numeric-suffixes --suffix-length=4 --lines=100 ${alienFileList} ${partialAlienFileListPrefix}
- counter=0
+ aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"MAKEALIENLIST\",\"$alienFileList\", \"$path\", \"AliESDfriends_v1.root\")" 2>&1 | tee -a merge.log
+ split --numeric-suffixes --suffix-length=4 --lines=20 ${alienFileList} ${partialAlienFileListPrefix}
rm -f $runningMergeByComponentLockFile
for partialAlienFileList in ${partialAlienFileListPrefix}*
do
#copy the alien files to local
partialAlienFileListPostfix=${partialAlienFileList#$partialAlienFileListPrefix}
partialLocalFileList=${partialLocalFileListPrefix}${partialAlienFileListPostfix}
- aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a merge.log
- [[ $counter -ne 0 ]] && sed -i '1d' syswatch.log && $(( $counter++ ))
- cat syswatch.log >> syswatch_copy.log
- rm syswatch.log
+ aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/mergeByComponent.C(\"COPY\",\"$partialAlienFileList\",\"noPath\",\"noPattern\",10,\"$partialLocalFileList\")" 2>&1 | tee -a merge.log
+
+ #handle syswatch
+ if [[ -f syswatch_copy.log ]]
+ then
+ sed '1d' syswatch.log >> syswatch_copy.log
+ rm -f syswatch.log
+ else
+ mv syswatch.log syswatch_copy.log
+ fi
#merge in parallel, use a simple lockfile
waitIfLocked $runningMergeByComponentLockFile
echo "***********************" 2>&1 | tee -a ocdb.log
echo making $det OCDB 2>&1 | tee -a ocdb.log
echo "***********************" 2>&1 | tee -a ocdb.log
-aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
+aliroot -b -q "$ALICE_ROOT/PWGPP/CalibMacros/CPass1/makeOCDB.C($run, \"$ocdb\", \"$defaultOCDB\")" 2>&1 | tee -a ocdb.log
mv syswatch.log syswatch_makeOCDB.log
# summary
# Script to merge objects coming out of the calibration train:
# Arguments:
# 1 - directory on which to look for the files to be merged
-# 2 - pattern
+# 2 - runNumber
# 3 - OCDB output path
+# [4 - default OCDB]
# example:
-# mergeMakeOCDB.sh /alice/cern.ch/user/a/aliprod/CPass1/output/ 000120691 alien://folder=/alice/cern.ch/user/a/aliprod/CPass0/output
+# mergeMakeOCDB.sh /alice/cern.ch/user/a/aliprod/CPass0/output/ 120691 alien://folder=/alice/cern.ch/user/a/aliprod/CPass0/output
#ALIEN setting
# $1 = directory where to perform the find
-# $2 = pattern
+# $2 = runNumber
# $3 = OCDB path
+path=$1
+runNumber=$2
+outputOCDB=$3
+
+# if fourth argument given, its the default OCDB, otherwise use the default raw://
+defaultOCDB="raw://"
+[[ -n $4 ]] && defaultOCDB=$4
+
if [ -f Run0_999999999_v3_s0.root ]; then
mkdir -p TPC/Calib/Correction
mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
fi
-echo ">>>>>>> Running AliRoot to merge calib objects found in $1 with pattern AliESDfriends_v1.root"
-aliroot -l -b -q merge.C\(\"$1\",\"AliESDfriends_v1.root\"\) 2>&1 | tee merge.log
+echo ">>>>>>> Running AliRoot to merge calib objects found in $path with pattern AliESDfriends_v1.root"
+aliroot -l -b -q "merge.C(\"$path\",\"AliESDfriends_v1.root\")" 2>&1 | tee merge.log
mv syswatch.log syswatch_merge.log
-echo ">>>>>>> Extract OCDB entries for run = $2, to be stored in $3"
-aliroot -l -b -q makeOCDB.C\(\"$2\",\"$3\"\) 2>&1 | tee ocdb.log
+echo ">>>>>>> Extract OCDB entries for run = $runNumber, to be stored in $outputOCDB"
+aliroot -l -b -q "makeOCDB.C($runNumber,\"$outputOCDB\",\"$defaultOCDB\")" 2>&1 | tee ocdb.log
mv syswatch.log syswatch_makeOCDB.log
mv syswatch.log syswatch_rec_Barrel.log
echo ">>>>>>> Running AliRoot to make calibration..."
-time aliroot -l -b -q ../runCalibTrain.C\(\""$runNum\",\"AliESDs.root\",\"$ocdbPath"\"\) 2>&1 | tee calib.log
+time aliroot -l -b -q "../runCalibTrain.C($runNum,\"AliESDs.root\",\"$ocdbPath\")" 2>&1 | tee calib.log
mv syswatch.log syswatch_calib.log
echo ">>>>>>> Doing ls -l"
ls -l
runCalibTrain("104892");
*/
-void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
+void runCalibTrain(Int_t runNumber, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
{
//
// macro to run TPC calibration train
// config calibration train
// setting geometry and B-field from GRP
- Int_t runNumber = runNumberString.Atoi();
printf("runNumber from runCalibTrain = %d\n",runNumber);
printf("ocdb from runCalibTrain = %s\n",ocdb);
ConfigCalibTrain(runNumber, ocdb);