Skip to content
Snippets Groups Projects
Commit 98c73a16 authored by Frederic Julian Linz's avatar Frederic Julian Linz Committed by Florian Uhlig
Browse files

Introduction of full config.json sim chain including shell scripts

New folder created: macro/PWG/common/production. 
All files related to config.json chain moved there.
run_reco_config_json.C and run_analysis_tree_maker_json_config.C added. 
run_json.sh and run_sim_json.sh added.
Full chain currently runs during CI.
parent 4d96e6ae
No related branches found
No related tags found
1 merge request!1084Introduction of full config.json sim chain including shell scripts
Pipeline #20918 passed
Showing
with 1330 additions and 47 deletions
......@@ -14,9 +14,12 @@ If(NOT ${CBM_TEST_MODEL} MATCHES Experimental)
Message("Additional Nightly tests")
EndIf()
add_subdirectory(PWG)
#--- Additional tests for weekly builds
If(${CBM_TEST_MODEL} MATCHES Weekly)
add_subdirectory(KF)
add_subdirectory(PWG)
Message("Additional long running Weekly tests")
EndIf()
......@@ -35,6 +38,17 @@ Install(FILES ${CBMROOT_SOURCE_DIR}/scripts/loadlib.C
DESTINATION share/cbmroot/macro/
)
Install(FILES ${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_json.sh
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_sim_reco_json.sh
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_transport_json_config.C
${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_digi_json_config.C
${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
DESTINATION share/cbmroot/macro/PWG/common/production
)
Install(CODE "FILE(MAKE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/cbmroot/macro/PWG/common/production)")
Install(FILES KF/DecayConfig.C KF/registerGeantDecays.C KF/registerLightIons.C KF/registerPythiaDecays.C
KF/kf_kfparticle.C KF/kf_thermal_signal_generator.C KF/kf_transport.C
DESTINATION share/cbmroot/macro/KF
......
add_subdirectory(common)
add_subdirectory(production)
# Check if Python is installed and excute test only if python is available
find_package(Python)
if (Python_FOUND)
set(production_macro_events 2)
GENERATE_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/run_json.sh)
# copy the configuration to the build directory and replace variables
configure_file(${CBMROOT_SOURCE_DIR}/macro/PWG/common/production/config_ci.json.in
${CBMROOT_BINARY_DIR}/macro/PWG/common/production/config_ci.json
@ONLY
)
File(COPY ${CBMROOT_SOURCE_DIR}/macro/include/.rootrc DESTINATION ${CBMROOT_BINARY_DIR}/macro/PWG/common/production)
Set(testname PWG_common_production_run_json)
Add_Test(${testname} ${CMAKE_CURRENT_BINARY_DIR}/run_json.sh ${CMAKE_CURRENT_BINARY_DIR}/config_ci.json)
Set_Tests_Properties(${testname} PROPERTIES TIMEOUT 600)
endif()
{
"accessory": {
"batch": true,
"nEvents": 10,
"jobName": "cbmsim",
"jobRange": "1-10",
"account": "cbm",
"ram": "4G",
"partition": "main",
"time": "3:00:00",
"excludeNodes": "",
"logDir": "/lustre/cbm/users/${USER}/mc/out/log",
"cbmRoot": "/lustre/cbm/users/fkornas/soft/cbmroot/MR_master22_fr_v18.6.7_fs_apr21p2/bin/CbmRootConfig.sh",
"jobScript": "${PWD}/run_sim_reco.sh",
"transport": {
"run": true,
"plutoShift": 0,
"macro": "${VMCWORKDIR}/macro/PWG/common/production/run_transport_json_config.C"},
"digitization": {
"run": true,
"macro": "${VMCWORKDIR}/macro/PWG/common/production/run_digi_json_config.C"},
"reconstruction": {
"run": true,
"macro": "${VMCWORKDIR}/macro/PWG/common/production/run_reco_json_config.C"},
"AT": {
"run": true,
"macro": "${VMCWORKDIR}/macro/PWG/common/production/run_analysis_tree_maker_json_config.C"}
},
"logScreenLevel": "INFO",
"logVerbosityLevel": "LOW",
"transport": {
"input": [
{"generator": "unigen",
"file": "${VMCWORKDIR}/input/urqmd.auau.10gev.centr.root"},
"file": "/lustre/cbm/users/ogolosov/mc/generators/dcmqgsm_smm/auau/pbeam12agev/mbias/root/dcmqgsm_${taskId}.root"},
{"generator": "pluto",
"file": "${VMCWORKDIR}/input/pluto.auau.8gev.omega.mpmm.0001.root",
"file": "/lustre/cbm/users/ogolosov/mc/generators/pluto/auau/pbeam12agev/w/w.zip#w_${plutoFileId}.root",
"plutoPdg": 0},
{"generator": "beam",
{"#generator": "beam",
"beamA": 197,
"beamZ": 79,
"beamQ": 79,
"beamP": 12.0,
"beamStartZ": -1.0}
"beamStartZ": -45.0}
],
"output": {
"path": "test",
"output": {
"path": "/lustre/cbm/users/${USER}/mc/out/tra/${taskId}/${taskId}",
"overwrite": false
},
"target": {
......@@ -26,7 +53,7 @@
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
"z": -44.0
},
"rotation.y": 0.0
},
......@@ -34,7 +61,7 @@
"position": {
"x": 0.0,
"y": 0.0,
"zFocus": 0.0,
"zFocus": -44.0,
"sigmaX": 0.1,
"sigmaY": 0.1
},
......@@ -55,25 +82,25 @@
},
"geometry": {
"baseSetup": "sis100_electron",
"magneticField": {
"#magneticField": {
"tag": "v18a",
"scale": 1.0,
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
"z": 40.0
}
},
"subsystems": {
"magnet": "v21a",
"pipe": "v16e_1e",
"mvd": "v20c_tr",
"sts": "v20a",
"pipe": "v21d",
"mvd": "v20d_tr",
"sts": "v21e",
"rich": "v21a",
"trd": "v20c_1e",
"tof": "v20c_1e",
"psd": "v20c",
"platform": "v13a"
"trd": "v20b_1e",
"tof": "v21a_1e",
"psd": "v22a",
"platform": "v22b"
}
},
"stackFilter": {
......@@ -86,16 +113,16 @@
"digitization": {
"generateRunInfo": false,
"eventMode": false,
"timeSliceLength": -1.0,
"timeSliceLength": 1e5,
"storeAllTimeSlices": false,
"startTime": 1000,
"produceNoise": true,
"produceNoise": false,
"input": [
{"id": 0,
"path": "test",
"rate": "1.e7",
"path": "/lustre/cbm/users/${USER}/mc/out/tra/${taskId}/${taskId}",
"rate": "1.e3",
"treeAccessMode": "regular",
"parameterSource": true},
"parameterSource": false},
{"id": -1,
"path": "test_emb",
"embedToId": 0,
......@@ -103,15 +130,39 @@
{"id": -1,
"path": "test_beam",
"rate": "1.e9",
"treeAccessMode": "regular"}
"treeAccessMode": "random"}
],
"output": {
"path": "data/test_json",
"path": "/lustre/cbm/users/${USER}/mc/out/raw/${taskId}/${taskId}",
"overwrite": false
},
"geometry": {
"deactivate": ["", ""],
"#deactivateAllBut": ""
}
}
},
"reconstruction": {
"rawFile": "/lustre/cbm/users/${USER}/mc/out/raw/${taskId}/${taskId}",
"nTimeSlices": -1,
"firstTimeSlice": 0,
"output": {
"path": "/lustre/cbm/users/${USER}/mc/out/reco/${taskId}/${taskId}",
"overwrite": false
},
"sEvBuildRaw": "Ideal",
"traFile": "/lustre/cbm/users/${USER}/mc/out/tra/${taskId}/${taskId}",
"isL1Matching": true,
"isL1EffQA": false
},
"AT": {
"traFile": "/lustre/cbm/users/${USER}/mc/out/tra/${taskId}/${taskId}",
"rawFile": "/lustre/cbm/users/${USER}/mc/out/raw/${taskId}/${taskId}",
"recFile": "/lustre/cbm/users/${USER}/mc/out/reco/${taskId}/${taskId}",
"unigenFile": "/lustre/cbm/users/ogolosov/mc/generators/dcmqgsm_smm/auau/pbeam12agev/mbias/root/dcmqgsm_${taskId}.root",
"output": {
"path": "/lustre/cbm/users/${USER}/mc/out/AT/${taskId}/${taskId}",
"overwrite": false}
}
}
{
"accessory": {
"batch": false,
"nEvents": "@production_macro_events@",
"jobName": "cbmsim",
"jobRange": "1",
"account": "cbm",
"ram": "4G",
"partition": "debug",
"time": "0:20:00",
"excludeNodes": "",
"logDir": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/log",
"cbmRoot": "@CMAKE_BINARY_DIR@/config.sh",
"jobScript": "@VMCWORKDIR@/macro/PWG/common/production/run_sim_reco_json.sh",
"transport": {
"run": true,
"plutoShift": 0,
"macro": "@VMCWORKDIR@/macro/PWG/common/production/run_transport_json_config.C"},
"digitization": {
"run": true,
"macro": "@VMCWORKDIR@/macro/PWG/common/production/run_digi_json_config.C"},
"reconstruction": {
"run": true,
"macro": "@VMCWORKDIR@/macro/PWG/common/production/run_reco_json_config.C"},
"AT": {
"run": true,
"macro": "@VMCWORKDIR@/macro/PWG/common/production/run_analysis_tree_maker_json_config.C"}
},
"logScreenLevel": "INFO",
"logVerbosityLevel": "LOW",
"transport": {
"input": [
{"generator": "unigen",
"file": "${VMCWORKDIR}/input/urqmd.auau.10gev.centr.root"},
"file": "@VMCWORKDIR@/input/urqmd.auau.10gev.centr.root"},
{"generator": "pluto",
"file": "${VMCWORKDIR}/input/pluto.auau.8gev.omega.mpmm.0001.root",
"file": "@VMCWORKDIR@/input/pluto.auau.8gev.omega.mpmm.0001.root",
"plutoPdg": 0},
{"generator": "beam",
{"#generator": "beam",
"beamA": 197,
"beamZ": 79,
"beamQ": 79,
"beamP": 12.0,
"beamStartZ": -1.0}
"beamStartZ": -45.0}
],
"output": {
"path": "data/test",
"output": {
"path": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/tra/${taskId}/${taskId}",
"overwrite": true
},
"target": {
......@@ -26,7 +53,7 @@
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
"z": -44.0
},
"rotation.y": 0.0
},
......@@ -34,7 +61,7 @@
"position": {
"x": 0.0,
"y": 0.0,
"zFocus": 0.0,
"zFocus": -44.0,
"sigmaX": 0.1,
"sigmaY": 0.1
},
......@@ -55,25 +82,25 @@
},
"geometry": {
"baseSetup": "sis100_electron",
"magneticField": {
"#magneticField": {
"tag": "v18a",
"scale": 1.0,
"position": {
"x": 0.0,
"y": 0.0,
"z": 0.0
"z": 40.0
}
},
"subsystems": {
"magnet": "v21a",
"pipe": "v16e_1e",
"mvd": "v20c_tr",
"sts": "v20a",
"pipe": "v21d",
"mvd": "v20d_tr",
"sts": "v21e",
"rich": "v21a",
"trd": "v20c_1e",
"tof": "v20c_1e",
"psd": "v20c",
"platform": "v13a"
"trd": "v20b_1e",
"tof": "v21a_1e",
"psd": "v22a",
"platform": "v22b"
}
},
"stackFilter": {
......@@ -86,16 +113,16 @@
"digitization": {
"generateRunInfo": false,
"eventMode": false,
"timeSliceLength": -1.0,
"timeSliceLength": 1e5,
"storeAllTimeSlices": false,
"startTime": 1000,
"produceNoise": true,
"produceNoise": false,
"input": [
{"id": 0,
"path": "data/test",
"path": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/tra/${taskId}/${taskId}",
"rate": "1.e7",
"treeAccessMode": "regular",
"parameterSource": true},
"parameterSource": false},
{"id": -1,
"path": "test_emb",
"embedToId": 0,
......@@ -103,15 +130,39 @@
{"id": -1,
"path": "test_beam",
"rate": "1.e9",
"treeAccessMode": "regular"}
"treeAccessMode": "random"}
],
"output": {
"path": "data/test_json",
"path": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/raw/${taskId}/${taskId}",
"overwrite": true
},
"geometry": {
"deactivate": ["", ""],
"#deactivateAllBut": ""
}
}
},
"reconstruction": {
"rawFile": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/raw/${taskId}/${taskId}",
"nTimeSlices": -1,
"firstTimeSlice": 0,
"output": {
"path": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/reco/${taskId}/${taskId}",
"overwrite": true
},
"sEvBuildRaw": "Ideal",
"traFile": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/tra/${taskId}/${taskId}",
"isL1Matching": true,
"isL1EffQA": true
},
"AT": {
"traFile": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/tra/${taskId}/${taskId}",
"rawFile": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/raw/${taskId}/${taskId}",
"recFile": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/reco/${taskId}/${taskId}",
"unigenFile": "@VMCWORKDIR@/input/urqmd.auau.10gev.centr.root",
"output": {
"path": "@CMAKE_BINARY_DIR@/macro/PWG/common/production/data/AT/${taskId}/${taskId}",
"overwrite": true}
}
}
/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
SPDX-License-Identifier: GPL-3.0-only
Authors: Viktor Klochkov, Frederic Linz [committer] */
// ----- Check output file name -------------------------------------------
bool CheckOutFileName(TString fileName, Bool_t overwrite)
{
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!";
return false;
}
// --- If the directory does not yet exist, create it
const char* directory = gSystem->DirName(fileName.Data());
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!";
return false;
}
else
cout << fName << ": created directory " << directory;
}
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 = "", 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;
// --- Logger settings ----------------------------------------------------
const TString logLevel = "INFO";
const TString logVerbosity = "LOW";
// ------------------------------------------------------------------------
// ----- Environment --------------------------------------------------
const TString myName = "run_analysis_tree_maker";
const TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory
// ------------------------------------------------------------------------
// ----- In- and output file names ------------------------------------
if (rawPath == "") rawPath = traPath;
if (recPath == "") recPath = traPath;
if (outPath == "") outPath = traPath;
TString traFile = traPath + ".tra.root";
TString geoFile = traPath + ".geo.root";
TString rawFile = rawPath + ".raw.root";
TString recFile = recPath + ".reco.root";
TString parFile = rawPath + ".par.root";
TString outFile = outPath + ".analysistree.root";
// ------------------------------------------------------------------------
// ----- Remove old CTest runtime dependency file ----------------------
const TString dataDir = gSystem->DirName(outPath);
const TString dataName = gSystem->BaseName(outPath);
const TString testName = ("run_treemaker");
// ------------------------------------------------------------------------
// ----- Load the geometry setup -------------------------------------
CbmSetup* setup = CbmSetup::Instance();
if (config == "") config = Form("%s/macro/run/config.json", gSystem->Getenv("VMCWORKDIR"));
boost::property_tree::ptree pt;
CbmTransportConfig::LoadFromFile(config, pt);
CbmTransportConfig::SetGeometry(setup, pt.get_child(CbmTransportConfig::GetModuleTag()));
// ------------------------------------------------------------------------
// ----- Timer --------------------------------------------------------
TStopwatch timer;
timer.Start();
// ------------------------------------------------------------------------
TString geoTag;
auto* parFileList = new TList();
if (!CheckOutFileName(outFile, overwrite)) return;
std::cout << "-I- " << myName << ": Using raw file " << rawFile << std::endl;
std::cout << "-I- " << myName << ": Using parameter file " << parFile << std::endl;
std::cout << "-I- " << myName << ": Using reco file " << recFile << std::endl;
if (unigenFile.Length() > 0) std::cout << "-I- " << myName << ": Using unigen file " << unigenFile << std::endl;
// ----- Reconstruction run -------------------------------------------
auto* run = new FairRunAna();
auto* inputSource = new FairFileSource(recFile);
inputSource->AddFriend(traFile);
inputSource->AddFriend(rawFile);
run->SetSource(inputSource);
run->SetOutputFile(outFile);
run->SetGenerateRunInfo(kTRUE);
// ------------------------------------------------------------------------
// ----- Mc Data Manager ------------------------------------------------
auto* mcManager = new CbmMCDataManager("MCManager", is_event_base);
mcManager->AddFile(traFile);
run->AddTask(mcManager);
// ------------------------------------------------------------------------
// --- STS track matching ----------------------------------------------
// auto* matchTask = new CbmMatchRecoToMC();
// run->AddTask(matchTask);
// ------------------------------------------------------------------------
run->AddTask(new CbmTrackingDetectorInterfaceInit());
auto* KF = new CbmKF();
run->AddTask(KF);
// needed for tracks extrapolation
auto* l1 = new CbmL1("CbmL1", 1, 3);
if (setup->IsActive(ECbmModuleId::kMvd)) {
setup->GetGeoTag(ECbmModuleId::kMvd, geoTag);
const TString mvdMatBudgetFileName = srcDir + "/parameters/mvd/mvd_matbudget_" + geoTag + ".root";
l1->SetMvdMaterialBudgetFileName(mvdMatBudgetFileName.Data());
}
if (setup->IsActive(ECbmModuleId::kSts)) {
setup->GetGeoTag(ECbmModuleId::kSts, geoTag);
const TString stsMatBudgetFileName = srcDir + "/parameters/sts/sts_matbudget_" + geoTag + ".root";
l1->SetStsMaterialBudgetFileName(stsMatBudgetFileName.Data());
}
run->AddTask(l1);
// --- TRD pid tasks
if (setup->IsActive(ECbmModuleId::kTrd)) {
CbmTrdSetTracksPidLike* trdLI = new CbmTrdSetTracksPidLike("TRDLikelihood", "TRDLikelihood");
trdLI->SetUseMCInfo(kTRUE);
trdLI->SetUseMomDependence(kTRUE);
run->AddTask(trdLI);
std::cout << "-I- : Added task " << trdLI->GetName() << std::endl;
// ------------------------------------------------------------------------
}
// AnalysisTree converter
auto* man = new CbmConverterManager();
man->SetSystem(system);
man->SetBeamMomentum(beam_mom);
man->SetOutputName(outFile.Data(), "rTree");
if (!is_event_base) { man->AddTask(new CbmMatchEvents()); }
man->AddTask(new CbmSimEventHeaderConverter("SimEventHeader"));
man->AddTask(new CbmRecEventHeaderConverter("RecEventHeader"));
man->AddTask(new CbmSimTracksConverter("SimParticles"));
CbmStsTracksConverter* taskCbmStsTracksConverter = new CbmStsTracksConverter("VtxTracks", "SimParticles");
taskCbmStsTracksConverter->SetIsWriteKFInfo();
taskCbmStsTracksConverter->SetIsReproduceCbmKFPF();
man->AddTask(taskCbmStsTracksConverter);
man->AddTask(new CbmRichRingsConverter("RichRings", "VtxTracks"));
man->AddTask(new CbmTofHitsConverter("TofHits", "VtxTracks"));
man->AddTask(new CbmTrdTracksConverter("TrdTracks", "VtxTracks"));
man->AddTask(new CbmPsdModulesConverter("PsdModules"));
run->AddTask(man);
// ----- Parameter database --------------------------------------------
FairRuntimeDb* rtdb = run->GetRuntimeDb();
auto* parIo1 = new FairParRootFileIo();
auto* parIo2 = new FairParAsciiFileIo();
parIo1->open(parFile.Data());
parIo2->open(parFileList, "in");
rtdb->setFirstInput(parIo1);
rtdb->setSecondInput(parIo2);
rtdb->setOutput(parIo1);
rtdb->saveOutput();
// ------------------------------------------------------------------------
// ----- Intialise and run --------------------------------------------
run->Init();
std::cout << "Starting run" << std::endl;
run->Run(nEvents);
// ------------------------------------------------------------------------
timer.Stop();
const Double_t rtime = timer.RealTime();
const Double_t ctime = timer.CpuTime();
std::cout << "Macro finished succesfully." << std::endl;
std::cout << "Output file is " << outFile << std::endl;
std::cout << "Parameter file is " << parFile << std::endl;
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime);
// ----- CTest resource monitoring ------------------------------------
FairSystemInfo sysInfo;
const Float_t maxMemory = sysInfo.GetMaxMemory();
std::cout << R"(<DartMeasurement name="MaxMemory" type="numeric/double">)";
std::cout << maxMemory;
std::cout << "</DartMeasurement>" << std::endl;
std::cout << R"(<DartMeasurement name="WallTime" type="numeric/double">)";
std::cout << rtime;
std::cout << "</DartMeasurement>" << std::endl;
const Float_t cpuUsage = ctime / rtime;
std::cout << R"(<DartMeasurement name="CpuLoad" type="numeric/double">)";
std::cout << cpuUsage;
std::cout << "</DartMeasurement>" << std::endl;
// ------------------------------------------------------------------------
// ----- Finish -------------------------------------------------------
std::cout << " Test passed" << std::endl;
std::cout << " All ok " << std::endl;
// Generate_CTest_Dependency_File(depFile);
// ------------------------------------------------------------------------
// ----- This is to prevent a malloc error when exiting ROOT ----------
// The source of the error is unknown. Related to TGeoManager.
RemoveGeoManager();
// ------------------------------------------------------------------------
}
#!/bin/bash
function getJsonVal () {
val=$(${_python} -c "import json;print(json.dumps(json.load(open('${config}'))$1))";)
eval echo ${val}
} # e.x. 'outPath=$(getJsonVal "['transport']['output']['path']")'
#function checkJsonKey () {
# python -c "import json,sys;print ('$1' in json.load(open('${config}')))";
#} # returns True if key exists, False if not, e.x. 'run_transport=$(checkJsonKey "transport")'
function readStepInfo () {
run=$(getJsonVal "['accessory']['${step}']['run']")
if [ ${run} == true ]; then
overwrite=$(getJsonVal "['${step}']['output']['overwrite']")
outDir=$(getJsonVal "['${step}']['output']['path']")
[[ ${outDir} != */ ]] && outDir=$(dirname ${outFile})
srcDir=${outDir}/macro
macro=$(getJsonVal "['accessory']['${step}']['macro']")
macroName=$(basename ${macro})
fi
}
# find the proper python executable and exit if not found
if [[ ! -z $PYHON_EXEC ]]; then
_python=$PYHON_EXEC
else
_python=$(which python)
if [[ -z $_python ]]; then
_python=$(which python2)
if [[ -z $_python ]]; then
_python=$(which python3)
if [[ -z $_python ]]; then
echo "No python interpreter found"
exit 1
fi
fi
fi
fi
export _python=${_python}
submitScript=${0}
echo "Submit script : ${submitScript}"
config=${1}
batch=$(getJsonVal "['accessory']['batch']")
jobScript=$(getJsonVal "['accessory']['jobScript']")
export cbmRoot=$(getJsonVal "['accessory']['cbmRoot']")
cbmRoot="${cbmRoot} -a"
echo "CbmRoot : ${cbmRoot}"
source ${cbmRoot}
steps="transport digitization reconstruction AT"
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}
fi
done
export -f getJsonVal
export -f readStepInfo
export configName=$(basename ${config})
export config=${srcDir}/${configName}
export nEvents=$(getJsonVal "['accessory']['nEvents']")
jobRange=$(getJsonVal "['accessory']['jobRange']")
logDir=$(getJsonVal "['accessory']['logDir']")
mkdir -pv ${logDir}
if [ ${batch} == true ];then
account=$(getJsonVal "['accessory']['account']")
ram=$(getJsonVal "['accessory']['ram']")
partition=$(getJsonVal "['accessory']['partition']")
time=$(getJsonVal "['accessory']['time']")
jobName=$(getJsonVal "['accessory']['jobName']")
excludeNodes=$(getJsonVal "['accessory']['excludeNodes']")
sbatch -A ${account} --mem=${ram} -p ${partition} -t ${time} -J ${jobName}\
-a ${jobRange} -o ${logDir}/%a_%A.log --export=ALL \
--exclude=${excludeNodes} -- ${jobScript}
else
echo "Jobscript: ${jobScript}"
export SLURM_ARRAY_TASK_ID=${jobRange}
${jobScript} &> ${logDir}/${jobRange}.log
fi
This diff is collapsed.
#!/bin/bash
steps="transport digitization reconstruction AT"
source ${cbmRoot}
for step in ${steps}; do
readStepInfo
if [ ${run} == true ]; then
export taskId=${SLURM_ARRAY_TASK_ID}
plutoShift=$(getJsonVal "['accessory']['transport']['plutoShift']")
export plutoFileId=$(printf %05d $((${taskId}-${plutoShift})))
config=${srcDir}/${configName}
macro=${srcDir}/${macroName}
outFile=$(getJsonVal "['${step}']['output']['path']")
outDir=$(dirname ${outFile})
log=${outDir}/${step}.log
mkdir -pv ${outDir}
cd ${outDir}
ln -sfv ${VMCWORKDIR}/macro/run/.rootrc ${outDir}
if [ ${step} == reconstruction ]; then
rawFile=$(getJsonVal "['reconstruction']['rawFile']")
nTimeSlices=$(getJsonVal "['reconstruction']['nTimeSlices']")
firstTimeSlice=$(getJsonVal "['reconstruction']['firstTimeSlice']")
sEvBuildRaw=$(getJsonVal "['reconstruction']['sEvBuildRaw']")
traFile=$(getJsonVal "['reconstruction']['traFile']")
isL1Matching=$(getJsonVal "['reconstruction']['isL1Matching']")
isL1EffQA=$(getJsonVal "['reconstruction']['isL1EffQA']")
echo " "
echo "Run reconstruction: ${macro}(\"${rawFile}\",${nTimeSlices},${firstTimeSlice},\"${outFile}\",\
${overwrite},\"${sEvBuildRaw}\",\"${config}\",\"${traFile}\",${isL1Matching},${isL1EffQA})"
root -b -l -q "${macro}(\"${rawFile}\",${nTimeSlices},${firstTimeSlice},\"${outFile}\",\
${overwrite},\"${sEvBuildRaw}\",\"${config}\",\"${traFile}\",${isL1Matching},${isL1EffQA})" &> ${log}
elif [ ${step} == AT ]; then
traFile=$(getJsonVal "['AT']['traFile']")
rawFile=$(getJsonVal "['AT']['rawFile']")
recFile=$(getJsonVal "['AT']['recFile']")
unigenFile=$(getJsonVal "['AT']['unigenFile']")
echo " "
echo "Run AT converter: ${macro}(\"${traFile}\",\"${rawFile}\",\"${recFile}\",\
\"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\")"
root -b -l -q "${macro}(\"${traFile}\",\"${rawFile}\",\"${recFile}\",\
\"${unigenFile}\",\"${outFile}\",${overwrite},\"${config}\")" &> ${log}
else
if [ ${step} == digitization ]; then
input=$(getJsonVal "['transport']['output']['path']")
if [ ! -e ${outFile}.par.root ] || [ ${overwrite} == true ]; then
cp -v ${input}.par.root ${outDir}
fi
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
gzip -f ${log}
rm -v .rootrc
if [ ${step} == reconstruction ]; then
if [ "${isL1EffQA}" == true ]; then
rm -v *{moni,CA}* all_*.par
else
rm -v *{core,moni,CA,L1,Edep}* all_*.par
fi
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
done
# ===== Generate the needed shell scripts ================================
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_tra_file.C)
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_transport_json_config.C)
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_digi_json_config.C)
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_tra_beam.C)
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_digi.C)
GENERATE_ROOT_TEST_SCRIPT(${CBMROOT_SOURCE_DIR}/macro/run/run_reco.C)
......@@ -79,33 +77,6 @@ foreach(setup IN LISTS cbm_setup)
set(sname test)
endif()
# --- Test run_transport_json_config
# --- Transport run using run_transport_json_config.C
set(json_config_file ${CBMROOT_SOURCE_DIR}/macro/run/config_ci.json)
set(testname run_transport_json_config)
add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh \"${json_config_file}\" 2 ${randomSeed})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
FAIL_REGULAR_EXPRESSION "segmentation violation"
PASS_REGULAR_EXPRESSION "Macro finished successfully"
FIXTURES_REQUIRED run_cleanup
FIXTURES_SETUP fixt_tra_json_config
RESOURCE_LOCK json_config_ParDb
)
# --- Test run_digi_json_config
# --- Digitization run with using run_digi_json_config.C
set(testname run_digi_json_config)
add_test(${testname} ${MACRO_DIR}/run_digi_json_config.sh \"${json_config_file}\")
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
FAIL_REGULAR_EXPRESSION "segmentation violation"
PASS_REGULAR_EXPRESSION "Macro finished successfully"
FIXTURES_REQUIRED fixt_tra_json_config
FIXTURES_SETUP fixt_digi_json_config
RESOURCE_LOCK json_config_ParDb
)
# --- Test run_tra_coll
# --- Transport run with collision events, using run_tra_file.C
set(testname run_${sname}_tra_coll)
......@@ -505,8 +476,7 @@ EndIf() # If(DEFINED ENV{RAW_DATA_PATH} )
#####################
# ============================================================================
Install(FILES .rootrc run_tra_file.C run_tra_beam.C run_transport_json_config.C run_digi_json_config.C config.json
run_digi.C run_reco.C run_unpack_online.C run_unpack_tsa.C config_ci.json
Install(FILES .rootrc run_tra_file.C run_tra_beam.C run_digi.C run_reco.C run_unpack_online.C run_unpack_tsa.C
DESTINATION share/cbmroot/macro/run
)
Install(PROGRAMS run_tests.sh
......
......@@ -45,22 +45,6 @@ main () {
$log_file_name \
$check_string
log_file_name=data/run_tra_json.log
check_string="Macro finished successfully"
execute_macro "run_transport_json_config.C(\"config_ci.json\")" \
$log_file_name \
$check_string
# Testing the digitization macros
log_file_name=data/run_digi_json.log
check_string="Macro finished successfully"
execute_macro "run_digi_json_config.C(\"config_ci.json\")" \
$log_file_name \
$check_string
log_file_name=data/run_digi_eb.log
check_string="Macro finished successfully"
execute_macro "run_digi.C(\"data/${sname}_coll\", -1, \"data/${sname}_ev\", -1.)" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment