Skip to content

Commit 0deb051

Browse files
[DO-NOT-MERGE] Try FairExampleRunSim in macros
1 parent f959e28 commit 0deb051

22 files changed

Lines changed: 95 additions & 60 deletions

examples/MQ/pixelDetector/macros/run_sim.C

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
11+
#if !defined(__CLING__) || defined(__ROOTCLING__)
12+
#include "FairBoxGenerator.h"
13+
#include "FairCave.h"
14+
#include "FairParRootFileIo.h"
15+
#include "FairPrimaryGenerator.h"
16+
#include "FairRootFileSink.h"
17+
#include "FairSystemInfo.h"
18+
#include "Pixel.h"
19+
#endif
20+
921
#include <TFile.h>
1022
#include <TH1F.h>
1123
#include <TStopwatch.h>
@@ -59,8 +71,7 @@ void run_sim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Int_t fileId = 0,
5971
// ------------------------------------------------------------------------
6072

6173
// ----- Create simulation run ----------------------------------------
62-
auto run = std::make_unique<FairRunSim>();
63-
run->SetName(mcEngine); // Transport engine
74+
auto run = std::make_unique<FairExampleRunSim>(mcEngine.Data());
6475
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
6576
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
6677
FairRuntimeDb* rtdb = run->GetRuntimeDb();

examples/advanced/Tutorial3/macro/run_sim.C

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
11+
#if !defined(__CLING__) || defined(__ROOTCLING__)
12+
#include "FairBoxGenerator.h"
13+
#include "FairCave.h"
14+
#include "FairConstField.h"
15+
#include "FairMagnet.h"
16+
#include "FairParRootFileIo.h"
17+
#include "FairPrimaryGenerator.h"
18+
#include "FairRootFileSink.h"
19+
#include "FairSystemInfo.h"
20+
#include "FairTestDetector.h"
21+
#endif
22+
923
#include <TStopwatch.h>
1024
#include <TString.h>
1125
#include <TSystem.h>
@@ -32,13 +46,9 @@ void run_sim(Int_t nEvents = 100, TString mcEngine = "TGeant4")
3246
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());
3347

3448
// create Instance of Run Manager class
35-
FairRunSim run{};
49+
FairExampleRunSim run{mcEngine.Data()};
3650
run.SetUseFairLinks(kTRUE);
3751
// FairLinkManager::Instance()->AddIncludeType(0);
38-
// set the MC version used
39-
// ------------------------
40-
41-
run.SetName(mcEngine);
4252

4353
TString outFile = "data/testrun_";
4454
outFile = outFile + mcEngine + ".root";

examples/advanced/Tutorial3/macro/run_sim_sep.C

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TRandom.h>
1012
#include <TStopwatch.h>
1113
#include <TString.h>
@@ -30,12 +32,7 @@ void run_sim_sep(Int_t fileId, Int_t nEvents = 1000, TString mcEngine = "TGeant3
3032
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());
3133

3234
// create Instance of Run Manager class
33-
FairRunSim run{};
34-
35-
// set the MC version used
36-
// ------------------------
37-
38-
run.SetName(mcEngine);
35+
FairExampleRunSim run{mcEngine};
3936

4037
TString outfile = Form("data/testrun_%s_f%d.root", mcEngine.Data(), fileId);
4138
TString outparam = Form("data/testpar_%s_f%d.root", mcEngine.Data(), fileId);

examples/advanced/propagator/macros/runMC.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TRandom.h>
1012
#include <TStopwatch.h>
1113
#include <TString.h>
@@ -55,8 +57,7 @@ int runMC(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
5557
// ------------------------------------------------------------------------
5658

5759
// ----- Create simulation run ----------------------------------------
58-
FairRunSim run{};
59-
run.SetName(mcEngine); // Transport engine
60+
FairExampleRunSim run{mcEngine.Data()};
6061
// run.SetSimulationConfig(new FairVMCConfig());
6162
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
6263
run.SetSink(std::make_unique<FairRootFileSink>(outFile));

examples/advanced/propagator/macros/runMM.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TRandom.h>
1012
#include <TStopwatch.h>
1113
#include <TString.h>
@@ -47,8 +49,7 @@ int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
4749
// ------------------------------------------------------------------------
4850

4951
// ----- Create simulation run ----------------------------------------
50-
FairRunSim run{};
51-
run.SetName(mcEngine); // Transport engine
52+
FairExampleRunSim run{mcEngine};
5253
// run.SetSimulationConfig(new FairVMCConfig());
5354
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
5455
run.SetSink(new FairRootFileSink(outFile)); // Output file

examples/simulation/Tutorial1/macros/run_tutorial1.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TChain.h>
1012
#include <TRandom3.h>
1113
#include <TStopwatch.h>
@@ -68,8 +70,7 @@ int run_tutorial1(int nEvents = 10, string mcEngine = "TGeant3", bool isMT = tru
6870
// ------------------------------------------------------------------------
6971

7072
// ----- Create simulation run ----------------------------------------
71-
auto run = std::make_unique<FairRunSim>();
72-
run->SetName(mcEngine.c_str()); // Transport engine
73+
auto run = std::make_unique<FairExampleRunSim>(mcEngine.c_str());
7374
auto config = std::make_unique<FairGenericVMCConfig>();
7475
if (loadPostInitConfig)
7576
config->UsePostInitConfig();

examples/simulation/Tutorial1/macros/run_tutorial1_binary.C

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,30 @@
11
/********************************************************************************
2-
* Copyright (C) 2014-2022 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
2+
* Copyright (C) 2014-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
33
* *
44
* This software is distributed under the terms of the *
55
* GNU Lesser General Public Licence (LGPL) version 3, *
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#if !defined(__CLING__) || defined(__ROOTCLING__)
10-
#include <iostream>
1112
#include "FairBoxGenerator.h"
1213
#include "FairCave.h"
1314
#include "FairParRootFileIo.h"
1415
#include "FairPrimaryGenerator.h"
1516
#include "FairRootFileSink.h"
16-
#include "FairRunSim.h"
1717
#include "FairSimConfig.h"
1818
#include "FairSystemInfo.h"
1919
#include "FairTutorialDet1.h"
20+
#endif
2021

2122
#include <TRandom3.h>
2223
#include <TStopwatch.h>
24+
#include <iostream>
2325

2426
using std::cout;
2527
using std::endl;
26-
#endif
2728

2829
void run_tutorial1_main(const FairSimConfig& config);
2930

@@ -76,9 +77,8 @@ void run_tutorial1_main(const FairSimConfig& config)
7677
// ------------------------------------------------------------------------
7778

7879
// ----- Create simulation run ----------------------------------------
79-
FairRunSim run;
80-
run.SetName(config.GetEngine()); // Transport engine
81-
run.SetIsMT(config.IsMultiThreaded()); // Multi-threading mode (Geant4 only)
80+
FairExampleRunSim run{config.GetEngine()};
81+
run.SetIsMT(config.IsMultiThreaded()); // Multi-threading mode (Geant4 only)
8282
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
8383
FairRuntimeDb* rtdb = run.GetRuntimeDb();
8484
// ------------------------------------------------------------------------

examples/simulation/Tutorial1/macros/run_tutorial1_fastsim.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TStopwatch.h>
1012
#include <TString.h>
1113
#include <TSystem.h>
@@ -64,8 +66,7 @@ void run_tutorial1_fastsim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Boo
6466
// ------------------------------------------------------------------------
6567

6668
// ----- Create simulation run ----------------------------------------
67-
FairRunSim run{};
68-
run.SetName(mcEngine); // Transport engine
69+
FairExampleRunSim run{mcEngine};
6970
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
7071
run.SetSink(new FairRootFileSink(outFile)); // Output file
7172
FairRuntimeDb* rtdb = run.GetRuntimeDb();

examples/simulation/Tutorial1/macros/run_tutorial1_mesh.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TStopwatch.h>
1012
#include <TString.h>
1113
#include <TSystem.h>
@@ -63,8 +65,7 @@ void run_tutorial1_mesh(Int_t nEvents = 10, TString mcEngine = "TGeant3")
6365
// ------------------------------------------------------------------------
6466

6567
// ----- Create simulation run ----------------------------------------
66-
FairRunSim run{};
67-
run.SetName(mcEngine); // Transport engine
68+
FairExampleRunSim run{mcEngine};
6869
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
6970
FairRuntimeDb* rtdb = run.GetRuntimeDb();
7071
// ------------------------------------------------------------------------

examples/simulation/Tutorial1/macros/run_tutorial1_pythia6.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* copied verbatim in the file "LICENSE" *
77
********************************************************************************/
88

9+
#include "FairExampleRunSim.h"
10+
911
#include <TStopwatch.h>
1012
#include <TString.h>
1113
#include <TSystem.h>
@@ -67,8 +69,7 @@ void run_tutorial1_pythia6(Int_t nEvents = 10, TString mcEngine = "TGeant3")
6769
// ------------------------------------------------------------------------
6870

6971
// ----- Create simulation run ----------------------------------------
70-
FairRunSim run{};
71-
run.SetName(mcEngine); // Transport engine
72+
FairExampleRunSim run{mcEngine};
7273
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
7374
run.SetPythiaDecayer(pythia6Config); // Define Pythia6 as decayer
7475

0 commit comments

Comments
 (0)