Commit ec88aff0 authored by Sergey Gorbunov's avatar Sergey Gorbunov
Browse files

add random seed as a parameter to transport macros, fix it for the CI tests

parent 1e7554f2
......@@ -21,10 +21,12 @@ if($ENV{ctest_model} MATCHES Weekly)
Set(nEvents 100)
Set(uploadHistJPG 1)
Set(pullDevAllowed .2)
Set(randomSeed 1)
else()
Set(nEvents 3)
Set(uploadHistJPG 0)
Set(pullDevAllowed .5)
Set(randomSeed 1)
endIf()
math(EXPR timeOutTime "${nEvents} * 200")
......@@ -73,7 +75,7 @@ foreach(setup IN LISTS cbm_setup)
# --- Test run_transport_json_config
# --- Transport run using run_transport_json_config.C
set(testname run_transport_json_config)
add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh)
add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh \"\" 2 ${randomSeed})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
PASS_REGULAR_EXPRESSION "Macro finished successfully"
......@@ -99,7 +101,7 @@ foreach(setup IN LISTS cbm_setup)
set(testname run_${sname}_tra_coll)
set(input ${CBMROOT_SOURCE_DIR}/input/urqmd.auau.10gev.centr.root)
add_test(${testname} ${MACRO_DIR}/run_tra_file.sh
\"${input}\" ${nEvents} \"data/${sname}_coll\" \"${setup}\")
\"${input}\" ${nEvents} \"data/${sname}_coll\" \"${setup}\" kGeant3 ${randomSeed})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
PASS_REGULAR_EXPRESSION "Macro finished successfully"
......@@ -113,7 +115,7 @@ foreach(setup IN LISTS cbm_setup)
set(testname run_${sname}_tra_sign)
set(input ${CBMROOT_SOURCE_DIR}/input/pluto.auau.8gev.omega.mpmm.0001.root)
add_test(${testname} ${MACRO_DIR}/run_tra_file.sh
\"${input}\" ${nEvents} \"data/${sname}_sign\" \"${setup}\")
\"${input}\" ${nEvents} \"data/${sname}_sign\" \"${setup}\" kGeant3 ${randomSeed})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
PASS_REGULAR_EXPRESSION "Macro finished successfully"
......@@ -126,7 +128,7 @@ foreach(setup IN LISTS cbm_setup)
# --- Transport run with beam events, using run_tra_beam.C
set(testname run_${sname}_tra_beam)
add_test(${testname} ${MACRO_DIR}/run_tra_beam.sh
${nBeam} \"Au\" 10 -1 \"data/${sname}_beam\" \"${setup}\")
${nBeam} \"Au\" 10 -1 \"data/${sname}_beam\" \"${setup}\" kGeant3 ${randomSeed})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
PASS_REGULAR_EXPRESSION "Macro finished successfully"
......@@ -257,7 +259,7 @@ foreach(setup IN LISTS cbm_setup)
# --- Test run_transport_json_config
# --- Transport run using run_transport_json_config.C
set(testname run_transport_json_config)
add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh)
add_test(${testname} ${MACRO_DIR}/run_transport_json_config.sh \"\" 2 ${randomSeed})
set_tests_properties(${testname} PROPERTIES
TIMEOUT ${timeOutTime}
PASS_REGULAR_EXPRESSION "Macro finished successfully"
......
......@@ -58,7 +58,8 @@
** http://computing.gitpages.cbm.gsi.de/cbmroot/classCbmTransport.html
**/
void run_tra_beam(Int_t nEvents = 1, const char* species = "Au", Double_t beamP = 12., Double_t beamStartZ = -1.,
const char* output = "beam", const char* setup = "sis100_electron", ECbmEngine engine = kGeant3)
const char* output = "beam", const char* setup = "sis100_electron", ECbmEngine engine = kGeant3,
int randomSeed = 0)
{
// --- Logger settings ----------------------------------------------------
......@@ -154,6 +155,7 @@ void run_tra_beam(Int_t nEvents = 1, const char* species = "Au", Double_t beamP
run.SetBeamPosition(beamMeanX, beamMeanY, beamSigmaX, beamSigmaY, beamFocusZ);
run.SetBeamAngle(beamMeanTx, beamMeanTy, beamSigmaTx, beamSigmaTy);
run.AddInput(new CbmBeamGenerator(beamZ, beamA, beamQ, beamP, beamStartZ));
run.SetRandomSeed(randomSeed);
run.Run(nEvents);
// ------------------------------------------------------------------------
......
......@@ -67,7 +67,7 @@
** http://computing.gitpages.cbm.gsi.de/cbmroot/classCbmTransport.html
**/
void run_tra_file(const char* input = "", Int_t nEvents = 1, const char* output = "",
const char* setup = "sis100_electron", ECbmEngine engine = kGeant3)
const char* setup = "sis100_electron", ECbmEngine engine = kGeant3, int randomSeed = 0)
{
// --- Logger settings ----------------------------------------------------
......@@ -75,7 +75,6 @@ void run_tra_file(const char* input = "", Int_t nEvents = 1, const char* output
FairLogger::GetLogger()->SetLogVerbosityLevel("LOW");
// ------------------------------------------------------------------------
// ----- Environment --------------------------------------------------
TString myName = "run_tra_file"; // this macro's name for screen output
TString srcDir = gSystem->Getenv("VMCWORKDIR"); // top source directory
......@@ -153,6 +152,7 @@ void run_tra_file(const char* input = "", Int_t nEvents = 1, const char* output
run.SetTarget(targetMedium, targetThickness, targetDiameter);
run.SetBeamPosition(beamPosX, beamPosY, beamSigmaX, beamSigmaY);
if (rotateEvents) run.SetRandomEventPlane();
run.SetRandomSeed(randomSeed);
run.Run(nEvents);
// ------------------------------------------------------------------------
......
......@@ -44,7 +44,7 @@
** CbmTransport.
**/
void run_transport(Int_t nEvents = 2, const char* setupName = "sis100_electron", const char* output = "test",
const char* inputFile = "")
const char* inputFile = "", Int_t randomSeed = 0)
{
// --- Logger settings ----------------------------------------------------
......@@ -91,6 +91,7 @@ void run_transport(Int_t nEvents = 2, const char* setupName = "sis100_electron",
run.SetBeamPosition(0., 0., 0.1, 0.1);
run.SetRandomEventPlane();
// run.StoreTrajectories();
run.SetRandomSeed(randomSeed);
run.Run(nEvents);
// ------------------------------------------------------------------------
......
......@@ -29,7 +29,7 @@
** the main config is applied.
**/
void run_transport_json_config(std::string config = "", int nEvents = 2)
void run_transport_json_config(std::string config = "", int nEvents = 2, int randomSeed = 0)
{
if (config == "") config = Form("%s/macro/run/config.json", gSystem->Getenv("VMCWORKDIR"));
......@@ -39,6 +39,7 @@ void run_transport_json_config(std::string config = "", int nEvents = 2)
// ------------------------------------------------------------------------
CbmTransport run;
run.SetRandomSeed(randomSeed);
if (CbmTransportConfig::Load(run, config)) run.Run(nEvents);
else
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment