Skip to content

Commit

Permalink
[DO-NOT-MERGE] Try FairExampleRunSim in macros
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianTackeGSI committed Aug 14, 2023
1 parent f959e28 commit 0deb051
Show file tree
Hide file tree
Showing 22 changed files with 95 additions and 60 deletions.
17 changes: 14 additions & 3 deletions examples/MQ/pixelDetector/macros/run_sim.C
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
/********************************************************************************
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairBoxGenerator.h"
#include "FairCave.h"
#include "FairParRootFileIo.h"
#include "FairPrimaryGenerator.h"
#include "FairRootFileSink.h"
#include "FairSystemInfo.h"
#include "Pixel.h"
#endif

#include <TFile.h>
#include <TH1F.h>
#include <TStopwatch.h>
Expand Down Expand Up @@ -59,8 +71,7 @@ void run_sim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Int_t fileId = 0,
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName(mcEngine); // Transport engine
auto run = std::make_unique<FairExampleRunSim>(mcEngine.Data());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
Expand Down
20 changes: 15 additions & 5 deletions examples/advanced/Tutorial3/macro/run_sim.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairBoxGenerator.h"
#include "FairCave.h"
#include "FairConstField.h"
#include "FairMagnet.h"
#include "FairParRootFileIo.h"
#include "FairPrimaryGenerator.h"
#include "FairRootFileSink.h"
#include "FairSystemInfo.h"
#include "FairTestDetector.h"
#endif

#include <TStopwatch.h>
#include <TString.h>
#include <TSystem.h>
Expand All @@ -32,13 +46,9 @@ void run_sim(Int_t nEvents = 100, TString mcEngine = "TGeant4")
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());

// create Instance of Run Manager class
FairRunSim run{};
FairExampleRunSim run{mcEngine.Data()};
run.SetUseFairLinks(kTRUE);
// FairLinkManager::Instance()->AddIncludeType(0);
// set the MC version used
// ------------------------

run.SetName(mcEngine);

TString outFile = "data/testrun_";
outFile = outFile + mcEngine + ".root";
Expand Down
9 changes: 3 additions & 6 deletions examples/advanced/Tutorial3/macro/run_sim_sep.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TRandom.h>
#include <TStopwatch.h>
#include <TString.h>
Expand All @@ -30,12 +32,7 @@ void run_sim_sep(Int_t fileId, Int_t nEvents = 1000, TString mcEngine = "TGeant3
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());

// create Instance of Run Manager class
FairRunSim run{};

// set the MC version used
// ------------------------

run.SetName(mcEngine);
FairExampleRunSim run{mcEngine};

TString outfile = Form("data/testrun_%s_f%d.root", mcEngine.Data(), fileId);
TString outparam = Form("data/testpar_%s_f%d.root", mcEngine.Data(), fileId);
Expand Down
5 changes: 3 additions & 2 deletions examples/advanced/propagator/macros/runMC.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TRandom.h>
#include <TStopwatch.h>
#include <TString.h>
Expand Down Expand Up @@ -55,8 +57,7 @@ int runMC(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine.Data()};
// run.SetSimulationConfig(new FairVMCConfig());
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
Expand Down
5 changes: 3 additions & 2 deletions examples/advanced/propagator/macros/runMM.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TRandom.h>
#include <TStopwatch.h>
#include <TString.h>
Expand Down Expand Up @@ -47,8 +49,7 @@ int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine};
// run.SetSimulationConfig(new FairVMCConfig());
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run.SetSink(new FairRootFileSink(outFile)); // Output file
Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial1/macros/run_tutorial1.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TChain.h>
#include <TRandom3.h>
#include <TStopwatch.h>
Expand Down Expand Up @@ -68,8 +70,7 @@ int run_tutorial1(int nEvents = 10, string mcEngine = "TGeant3", bool isMT = tru
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName(mcEngine.c_str()); // Transport engine
auto run = std::make_unique<FairExampleRunSim>(mcEngine.c_str());
auto config = std::make_unique<FairGenericVMCConfig>();
if (loadPostInitConfig)
config->UsePostInitConfig();
Expand Down
14 changes: 7 additions & 7 deletions examples/simulation/Tutorial1/macros/run_tutorial1_binary.C
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
/********************************************************************************
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <iostream>
#include "FairBoxGenerator.h"
#include "FairCave.h"
#include "FairParRootFileIo.h"
#include "FairPrimaryGenerator.h"
#include "FairRootFileSink.h"
#include "FairRunSim.h"
#include "FairSimConfig.h"
#include "FairSystemInfo.h"
#include "FairTutorialDet1.h"
#endif

#include <TRandom3.h>
#include <TStopwatch.h>
#include <iostream>

using std::cout;
using std::endl;
#endif

void run_tutorial1_main(const FairSimConfig& config);

Expand Down Expand Up @@ -76,9 +77,8 @@ void run_tutorial1_main(const FairSimConfig& config)
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run;
run.SetName(config.GetEngine()); // Transport engine
run.SetIsMT(config.IsMultiThreaded()); // Multi-threading mode (Geant4 only)
FairExampleRunSim run{config.GetEngine()};
run.SetIsMT(config.IsMultiThreaded()); // Multi-threading mode (Geant4 only)
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run.GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial1/macros/run_tutorial1_fastsim.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TStopwatch.h>
#include <TString.h>
#include <TSystem.h>
Expand Down Expand Up @@ -64,8 +66,7 @@ void run_tutorial1_fastsim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Boo
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine};
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run.SetSink(new FairRootFileSink(outFile)); // Output file
FairRuntimeDb* rtdb = run.GetRuntimeDb();
Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial1/macros/run_tutorial1_mesh.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TStopwatch.h>
#include <TString.h>
#include <TSystem.h>
Expand Down Expand Up @@ -63,8 +65,7 @@ void run_tutorial1_mesh(Int_t nEvents = 10, TString mcEngine = "TGeant3")
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine};
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run.GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial1/macros/run_tutorial1_pythia6.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TStopwatch.h>
#include <TString.h>
#include <TSystem.h>
Expand Down Expand Up @@ -67,8 +69,7 @@ void run_tutorial1_pythia6(Int_t nEvents = 10, TString mcEngine = "TGeant3")
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine};
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
run.SetPythiaDecayer(pythia6Config); // Define Pythia6 as decayer

Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial1/macros/run_tutorial1_pythia8.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TStopwatch.h>
#include <TString.h>
#include <TSystem.h>
Expand Down Expand Up @@ -67,8 +69,7 @@ void run_tutorial1_pythia8(Int_t nEvents = 10, TString mcEngine = "TGeant3")
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine};
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
run.SetPythiaDecayer(pythia8Config); // Define Pythia8 as decayer

Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial1/macros/run_tutorial1_urqmd.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#include <TStopwatch.h>
#include <TString.h>
#include <TSystem.h>
Expand Down Expand Up @@ -53,8 +55,7 @@ void run_tutorial1_urqmd(Int_t nEvents = 2, TString mcEngine = "TGeant3")
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
FairRunSim run{};
run.SetName(mcEngine); // Transport engine
FairExampleRunSim run{mcEngine};
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run.GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
5 changes: 4 additions & 1 deletion examples/simulation/Tutorial1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ install(TARGETS ${target} LIBRARY DESTINATION ${PROJECT_INSTALL_LIBDIR})
install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

add_executable(tut1 runTutorial1.cxx)
target_link_libraries(tut1 PRIVATE ExSimulation1)
target_link_libraries(tut1
PRIVATE
ExSimulation1
FairRoot::ExMCStack)

install(TARGETS tut1
RUNTIME DESTINATION ${PROJECT_INSTALL_DATADIR}/examples/simulation/Tutorial1/bin
Expand Down
1 change: 1 addition & 0 deletions examples/simulation/Tutorial2/macros/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ endforeach()
add_library(${prefix}_check_compile OBJECT ${macrofiles})
target_link_libraries(${prefix}_check_compile PRIVATE
FairRoot::ExSimulation2
FairRoot::ExMCStack
FairRoot::ExPassive
FairRoot::Generators)

Expand Down
6 changes: 3 additions & 3 deletions examples/simulation/Tutorial2/macros/run_background.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairBoxGenerator.h"
#include "FairCave.h"
Expand All @@ -14,7 +16,6 @@
#include "FairParRootFileIo.h"
#include "FairPrimaryGenerator.h"
#include "FairRootFileSink.h"
#include "FairRunSim.h"
#include "FairRuntimeDb.h"
#include "FairSystemInfo.h"
#include "FairTutorialDet2.h"
Expand Down Expand Up @@ -79,8 +80,7 @@ void run_background(Int_t nEvents = 130)
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName("TGeant4"); // Transport engine
auto run = std::make_unique<FairExampleRunSim>("TGeant4");
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions examples/simulation/Tutorial2/macros/run_signal.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairBoxGenerator.h"
#include "FairCave.h"
Expand All @@ -14,7 +16,6 @@
#include "FairParRootFileIo.h"
#include "FairPrimaryGenerator.h"
#include "FairRootFileSink.h"
#include "FairRunSim.h"
#include "FairRuntimeDb.h"
#include "FairSystemInfo.h"
#include "FairTutorialDet2.h"
Expand Down Expand Up @@ -80,8 +81,7 @@ void run_signal(Int_t fileNr, Int_t nEvents = 10)
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName("TGeant4"); // Transport engine
auto run = std::make_unique<FairExampleRunSim>("TGeant4");
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions examples/simulation/Tutorial2/macros/run_tutorial2.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#include "FairExampleRunSim.h"

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairBoxGenerator.h"
#include "FairCave.h"
Expand All @@ -14,7 +16,6 @@
#include "FairParRootFileIo.h"
#include "FairPrimaryGenerator.h"
#include "FairRootFileSink.h"
#include "FairRunSim.h"
#include "FairRuntimeDb.h"
#include "FairSystemInfo.h"
#include "FairTutorialDet2.h"
Expand Down Expand Up @@ -79,9 +80,8 @@ void run_tutorial2(Int_t nEvents = 10, TString mcEngine = "TGeant4", Bool_t isMT
// ------------------------------------------------------------------------

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName(mcEngine); // Transport engine
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
auto run = std::make_unique<FairExampleRunSim>(mcEngine);
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 0deb051

Please sign in to comment.