Skip to content
Snippets Groups Projects
Commit c2f65f9a authored by Lukas Chlad's avatar Lukas Chlad Committed by Florian Uhlig
Browse files

Improvements to PWG_common_production

parent dcaf4d39
No related branches found
No related tags found
1 merge request!1295Improvements to PWG_common_production
Pipeline #23880 passed
......@@ -46,6 +46,7 @@ Install(FILES ${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_json.sh
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_reco_json_config.C
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_analysis_tree_maker_json_config.C
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/config.json
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/.rootrc
DESTINATION share/cbmroot/macro/PWG/common/production
)
Install(CODE "FILE(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/cbmroot/macro/PWG/common/production)")
......
../../../include/.rootrc
......@@ -19,7 +19,7 @@ if (Python_FOUND)
@ONLY
)
File(COPY ${CBMROOT_SOURCE_DIR}/macro/include/.rootrc DESTINATION ${CBMROOT_BINARY_DIR}/macro/PWG/common/production)
file(COPY ${CBMROOT_SOURCE_DIR}/macro/include/.rootrc DESTINATION ${CBMROOT_BINARY_DIR}/macro/PWG/common/production)
Set(testname PWG_common_production_run_json)
......
......@@ -3,12 +3,11 @@
Authors: Viktor Klochkov, Frederic Linz [committer] */
// ----- Check output file name -------------------------------------------
bool CheckOutFileName(TString fileName, Bool_t overwrite)
bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = __builtin_FUNCTION())
{
string fName = "run_reco_json_config";
// --- Protect against overwriting an existing file
if ((!gSystem->AccessPathName(fileName.Data())) && (!overwrite)) {
cout << fName << ": output file " << fileName << " already exists!";
std::cout << caller << ": output file " << fileName << " already exists!" << std::endl;
return false;
}
......@@ -17,22 +16,23 @@ bool CheckOutFileName(TString fileName, Bool_t overwrite)
if (gSystem->AccessPathName(directory)) {
Int_t success = gSystem->mkdir(directory, kTRUE);
if (success == -1) {
cout << fName << ": output directory " << directory << " does not exist and cannot be created!";
std::cout << caller << ": output directory " << directory << " does not exist and cannot be created!"
<< std::endl;
return false;
}
else
cout << fName << ": created directory " << directory;
std::cout << caller << ": created directory " << directory << std::endl;
}
return true;
}
void run_analysis_tree_maker_json_config(TString traPath = "test", TString rawPath = "", TString recPath = "",
TString unigenFile = "", TString outPath = "", bool overwrite = true,
std::string config = "", std::string tslength = "", int nEvents = 0)
std::string config = "", std::string tslength = "-1",
bool is_event_base = false, int nEvents = 0)
{
const std::string system = "Au+Au"; // TODO can we read it automatically?
const float beam_mom = 12.;
const bool is_event_base = false;
const float ts_length = std::stof(tslength);
// --- Logger settings ----------------------------------------------------
......@@ -91,12 +91,12 @@ void run_analysis_tree_maker_json_config(TString traPath = "test", TString rawPa
inputSource->AddFriend(traFile);
inputSource->AddFriend(rawFile);
run->SetSource(inputSource);
run->SetOutputFile(outFile);
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
run->SetGenerateRunInfo(kTRUE);
// ------------------------------------------------------------------------
// ----- Mc Data Manager ------------------------------------------------
auto* mcManager = new CbmMCDataManager("MCManager", is_event_base);
auto* mcManager = new CbmMCDataManager();
mcManager->AddFile(traFile);
run->AddTask(mcManager);
// ------------------------------------------------------------------------
......@@ -184,7 +184,7 @@ void run_analysis_tree_maker_json_config(TString traPath = "test", TString rawPa
timer.Stop();
const Double_t rtime = timer.RealTime();
const Double_t ctime = timer.CpuTime();
std::cout << "Macro finished succesfully." << std::endl;
std::cout << "Macro finished successfully." << std::endl;
std::cout << "Output file is " << outFile << std::endl;
std::cout << "Parameter file is " << parFile << std::endl;
......
......@@ -54,10 +54,10 @@ for step in ${steps}; do
readStepInfo
if [ ${run} == true ]; then
mkdir -pv ${srcDir}
cp -v ${macro} ${srcDir}
cp -v ${config} ${srcDir}
cp -v ${submitScript} ${srcDir}
cp -v ${jobScript} ${srcDir}
rsync -uv ${macro} ${srcDir}
rsync -uv ${config} ${srcDir}
rsync -uv ${submitScript} ${srcDir}
rsync -uv ${jobScript} ${srcDir}
fi
done
......@@ -83,6 +83,18 @@ if [ ${batch} == true ];then
--exclude=${excludeNodes} -- ${jobScript}
else
echo "Jobscript: ${jobScript}"
if [[ ${jobRange} =~ "-" ]]
then
# specified range > 1 for non-batch mode
start=$(echo ${jobRange} | cut -d '-' -f 1)
stop=$(echo ${jobRange} | cut -d '-' -f 2)
for (( ijob=${start}; ijob<=${stop}; ijob++ ))
do
nohup bash -c 'export SLURM_ARRAY_TASK_ID="$0" && "$1"' "${ijob}" "${jobScript}" > ${logDir}/${ijob}.log 2>&1 &
done
else
# single non-batch execution
export SLURM_ARRAY_TASK_ID=${jobRange}
${jobScript} &> ${logDir}/${jobRange}.log
fi
fi
......@@ -50,6 +50,8 @@
#include <FairSystemInfo.h>
#include <TStopwatch.h>
#include "rootalias.C"
#endif
......@@ -90,12 +92,11 @@
**/
// ----- Check output file name -------------------------------------------
bool CheckOutFileName(TString fileName, Bool_t overwrite)
bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = __builtin_FUNCTION())
{
string fName = "run_reco_json_config";
// --- Protect against overwriting an existing file
if ((!gSystem->AccessPathName(fileName.Data())) && (!overwrite)) {
cout << fName << ": output file " << fileName << " already exists!";
std::cout << caller << ": output file " << fileName << " already exists!" << std::endl;
return false;
}
......@@ -104,11 +105,12 @@ bool CheckOutFileName(TString fileName, Bool_t overwrite)
if (gSystem->AccessPathName(directory)) {
Int_t success = gSystem->mkdir(directory, kTRUE);
if (success == -1) {
cout << fName << ": output directory " << directory << " does not exist and cannot be created!";
std::cout << caller << ": output directory " << directory << " does not exist and cannot be created!"
<< std::endl;
return false;
}
else
cout << fName << ": created directory " << directory;
std::cout << caller << ": created directory " << directory << std::endl;
}
return true;
}
......@@ -207,7 +209,7 @@ void run_reco_json_config(TString input = "", Int_t nTimeSlices = -1, Int_t firs
FairFileSource* inputSource = new FairFileSource(rawFile);
if (isL1Matching) { inputSource->AddFriend(traFile); }
run->SetSource(inputSource);
run->SetOutputFile(outFile);
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
run->SetGenerateRunInfo(kTRUE);
FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monFile);
// ------------------------------------------------------------------------
......
......@@ -16,7 +16,7 @@ for step in ${steps}; do
mkdir -pv ${outDir}
cd ${outDir}
ln -sfv ${VMCWORKDIR}/macro/run/.rootrc ${outDir}
ln -sfv ${VMCWORKDIR}/macro/include/.rootrc
if [ ${step} == reconstruction ]; then
rawFile=$(getJsonVal "['reconstruction']['rawFile']")
nTimeSlices=$(getJsonVal "['reconstruction']['nTimeSlices']")
......@@ -42,9 +42,9 @@ for step in ${steps}; do
fi
echo " "
echo "Run AT converter: ${macro}(\"${traFile}\",\"${rawFile}\",\"${recFile}\",\
\"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\")"
\"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\",\"${eventMode}\")"
root -b -l -q "${macro}(\"${traFile}\",\"${rawFile}\",\"${recFile}\",\
\"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\")" &> ${log}
\"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\",\"${eventMode}\")" &> ${log}
else
if [ ${step} == digitization ]; then
input=$(getJsonVal "['transport']['output']['path']")
......@@ -53,17 +53,16 @@ for step in ${steps}; do
fi
echo " "
echo "Run digitization: ${macro}(\"${config}\",${nEvents})"
fi
if [ ${step} == transport ]; then
elif [ ${step} == transport ]; then
echo " "
echo "Run transport: ${macro}(\"${config}\",${nEvents})"
fi
root -b -l -q "${macro}(\"${config}\",${nEvents})" &> ${log}
fi
gzip -f ${log}
fi # ? which step
# clean-up
gzip -f ${log}
rm -v .rootrc
if [ ${step} == reconstruction ]; then
if [ "${isL1EffQA}" == true ]; then
......@@ -71,15 +70,13 @@ for step in ${steps}; do
else
rm -v *{core,moni,CA,L1,Edep}* all_*.par
fi
fi
if [ ${step} == digitization ]; then
elif [ ${step} == digitization ]; then
rm -v *{moni,Fair}* all_*.par
fi
if [ ${step} == AT ]; then
elif [ ${step} == AT ]; then
rm -v *{core,CA,L1}*
fi
cd -
export taskId=
fi
fi # ? run this step
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment