diff --git a/macro/PWG/common/production/run_analysis_tree_maker_json_config.C b/macro/PWG/common/production/run_analysis_tree_maker_json_config.C index 4707b43c1a2f2682cb8b033e59d0f8ded1aee26e..e12b9e5508196e5f12d32e02e08a104bcd09bc21 100644 --- a/macro/PWG/common/production/run_analysis_tree_maker_json_config.C +++ b/macro/PWG/common/production/run_analysis_tree_maker_json_config.C @@ -3,11 +3,12 @@ Authors: Viktor Klochkov, Frederic Linz [committer] */ // ----- Check output file name ------------------------------------------- -bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = __builtin_FUNCTION()) +bool CheckOutFileName(TString fileName, Bool_t overwrite) { + std::string fName = "run_reco_json_config"; // --- Protect against overwriting an existing file if ((!gSystem->AccessPathName(fileName.Data())) && (!overwrite)) { - std::cout << caller << ": output file " << fileName << " already exists!" << std::endl; + std::cout << fName << ": output file " << fileName << " already exists!" << std::endl; return false; } @@ -16,12 +17,11 @@ bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = _ if (gSystem->AccessPathName(directory)) { Int_t success = gSystem->mkdir(directory, kTRUE); if (success == -1) { - std::cout << caller << ": output directory " << directory << " does not exist and cannot be created!" - << std::endl; + std::cout << fName << ": output directory " << directory << " does not exist and cannot be created!" << std::endl; return false; } else - std::cout << caller << ": created directory " << directory << std::endl; + std::cout << fName << ": created directory " << directory << std::endl; } return true; } @@ -91,7 +91,7 @@ void run_analysis_tree_maker_json_config(TString traPath = "test", TString rawPa inputSource->AddFriend(traFile); inputSource->AddFriend(rawFile); run->SetSource(inputSource); - run->SetSink(std::make_unique<FairRootFileSink>(outFile)); + run->SetSink(new FairRootFileSink(outFile)); run->SetGenerateRunInfo(kTRUE); // ------------------------------------------------------------------------ diff --git a/macro/PWG/common/production/run_reco_json_config.C b/macro/PWG/common/production/run_reco_json_config.C index d8fe9c8c52d2088ee92548ff5ff51f4b508a62b7..21fb075332a108067974868aa5099e4c32b39ebd 100644 --- a/macro/PWG/common/production/run_reco_json_config.C +++ b/macro/PWG/common/production/run_reco_json_config.C @@ -92,11 +92,12 @@ **/ // ----- Check output file name ------------------------------------------- -bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = __builtin_FUNCTION()) +bool CheckOutFileName(TString fileName, Bool_t overwrite) { + std::string fName = "run_reco_json_config"; // --- Protect against overwriting an existing file if ((!gSystem->AccessPathName(fileName.Data())) && (!overwrite)) { - std::cout << caller << ": output file " << fileName << " already exists!" << std::endl; + std::cout << fName << ": output file " << fileName << " already exists!" << std::endl; return false; } @@ -105,12 +106,11 @@ bool CheckOutFileName(TString fileName, Bool_t overwrite, const char* caller = _ if (gSystem->AccessPathName(directory)) { Int_t success = gSystem->mkdir(directory, kTRUE); if (success == -1) { - std::cout << caller << ": output directory " << directory << " does not exist and cannot be created!" - << std::endl; + std::cout << fName << ": output directory " << directory << " does not exist and cannot be created!" << std::endl; return false; } else - std::cout << caller << ": created directory " << directory << std::endl; + std::cout << fName << ": created directory " << directory << std::endl; } return true; } @@ -212,7 +212,7 @@ void run_reco_json_config(TString input = "", Int_t nTimeSlices = -1, Int_t firs inputSource->AddFriend(traFile); } run->SetSource(inputSource); - run->SetSink(std::make_unique<FairRootFileSink>(outFile)); + run->SetSink(new FairRootFileSink(outFile)); run->SetGenerateRunInfo(kTRUE); FairMonitor::GetMonitor()->EnableMonitor(kTRUE, monFile); // ------------------------------------------------------------------------ @@ -530,7 +530,7 @@ void run_reco_json_config(TString input = "", Int_t nTimeSlices = -1, Int_t firs else { - // -----Â Event building from STS tracks ----------------------------- + // ----- Event building from STS tracks ----------------------------- run->AddTask(new CbmBuildEventsFromTracksReal()); // ---------------------------------------------------------------------- diff --git a/macro/PWG/common/production/run_sim_reco_json.sh b/macro/PWG/common/production/run_sim_reco_json.sh index 3ef4184302a696b571098d0158e841a8373aac0e..b3575bbb6b8587130c15e2c0e69dfea1a82a58be 100755 --- a/macro/PWG/common/production/run_sim_reco_json.sh +++ b/macro/PWG/common/production/run_sim_reco_json.sh @@ -1,5 +1,9 @@ #!/bin/bash +export RED='\033[0;31m' +export GREEN='\033[1;32m' +export NC='\033[0m' + steps="transport digitization reconstruction AT" source ${cbmRoot} for step in ${steps}; do @@ -8,6 +12,7 @@ for step in ${steps}; do export taskId=${SLURM_ARRAY_TASK_ID} plutoShift=$(getJsonVal "['accessory']['transport']['plutoShift']") export plutoFileId=$(printf %05d $((${taskId}-${plutoShift}))) +# export plutoFileId=$(printf $((${taskId}-${plutoShift}))) config=${srcDir}/${configName} macro=${srcDir}/${macroName} outFile=$(getJsonVal "['${step}']['output']['path']") @@ -16,7 +21,7 @@ for step in ${steps}; do mkdir -pv ${outDir} cd ${outDir} - ln -sfv ${VMCWORKDIR}/macro/include/.rootrc + ln -sfv ${VMCWORKDIR}/macro/run/.rootrc ${outDir} if [ ${step} == reconstruction ]; then rawFile=$(getJsonVal "['reconstruction']['rawFile']") nTimeSlices=$(getJsonVal "['reconstruction']['nTimeSlices']") @@ -27,9 +32,15 @@ for step in ${steps}; do isL1EffQA=$(getJsonVal "['reconstruction']['isL1EffQA']") echo " " echo "Run reconstruction: ${macro}(\"${rawFile}\",${nTimeSlices},${firstTimeSlice},\"${outFile}\",\ - ${overwrite},\"${sEvBuildRaw}\",\"${config}\",\"${traFile}\",${isL1Matching},${isL1EffQA})" + ${overwrite},\"${sEvBuildRaw}\",\"${config}\",\"${traFile}\",${isL1Matching},${isL1EffQA})" root -b -l -q "${macro}(\"${rawFile}\",${nTimeSlices},${firstTimeSlice},\"${outFile}\",\ - ${overwrite},\"${sEvBuildRaw}\",\"${config}\",\"${traFile}\",${isL1Matching},${isL1EffQA})" &> ${log} + ${overwrite},\"${sEvBuildRaw}\",\"${config}\",\"${traFile}\",${isL1Matching},${isL1EffQA})" &> ${log} + if [ $? -eq 0 ]; then + echo -e "${GREEN} Reconstruction executed successfully ${NC}" + else + echo -e "${RED} Reconstruction failed ${NC}" + exit 1 + fi elif [ ${step} == AT ]; then traFile=$(getJsonVal "['AT']['traFile']") rawFile=$(getJsonVal "['AT']['rawFile']") @@ -42,41 +53,57 @@ for step in ${steps}; do fi echo " " echo "Run AT converter: ${macro}(\"${traFile}\",\"${rawFile}\",\"${recFile}\",\ - \"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\",\"${eventMode}\")" + \"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\")" root -b -l -q "${macro}(\"${traFile}\",\"${rawFile}\",\"${recFile}\",\ - \"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\",\"${eventMode}\")" &> ${log} + \"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\",\"${tslength}\")" &> ${log} + if [ $? -eq 0 ]; then + echo -e "${GREEN} AnalysisTreeConverter executed successfully ${NC}" + else + echo -e "${RED} AnalysisTreeConverter failed ${NC}" + exit 1 + fi else if [ ${step} == digitization ]; then input=$(getJsonVal "['transport']['output']['path']") if [ ! -e ${outFile}.par.root ] || [ ${overwrite} == true ]; then + echo "Copying parameter file..." cp -v ${input}.par.root ${outDir} fi - echo " " - echo "Run digitization: ${macro}(\"${config}\",${nEvents})" - elif [ ${step} == transport ]; then - echo " " - echo "Run transport: ${macro}(\"${config}\",${nEvents})" + echo " " + echo "Run digitization: ${macro}(\"${config}\",${nEvents})" + fi + + if [ ${step} == transport ]; then + echo " " + echo "Run transport: ${macro}(\"${config}\",${nEvents})" fi - root -b -l -q "${macro}(\"${config}\",${nEvents})" &> ${log} - fi # ? which step - - # clean-up + root -b -l -q "${macro}(\"${config}\",${nEvents})" &> ${log} + if [ $? -eq 0 ]; then + echo -e "${GREEN} ${step} executed successfully ${NC}" + else + echo -e "${GREEN} ${step} failed ${NC}" + exit 1 + fi + fi gzip -f ${log} + rm -v .rootrc if [ ${step} == reconstruction ]; then - if [ "${isL1EffQA}" == true ]; then + if [ "${isL1EffQA}" == true ]; then rm -v *{core,moni,CA}* all_*.par - else - rm -v *{core,moni,CA,L1,Edep}* all_*.par + else + rm -v *{core,moni,CA,L1,Edep}* all_*.par fi - elif [ ${step} == digitization ]; then - rm -v *{moni,Fair}* all_*.par - elif [ ${step} == AT ]; then - rm -v *{core,CA,L1}* + fi + if [ ${step} == digitization ]; then + rm -v *{moni,Fair}* all_*.par + fi + if [ ${step} == AT ]; then + rm -v *{core,CA,L1}* fi cd - export taskId= - fi # ? run this step + fi done