Skip to content

Commit d1b570f

Browse files
Introduce FairExampleRunSim
1 parent 98ce522 commit d1b570f

27 files changed

+83
-64
lines changed

examples/MQ/pixelDetector/macros/run_sim.C

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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, *
@@ -59,8 +59,7 @@ void run_sim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Int_t fileId = 0,
5959
// ------------------------------------------------------------------------
6060

6161
// ----- Create simulation run ----------------------------------------
62-
auto run = std::make_unique<FairRunSim>();
63-
run->SetName(mcEngine); // Transport engine
62+
auto run = std::make_unique<FairExampleRunSim>(mcEngine);
6463
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
6564
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
6665
FairRuntimeDb* rtdb = run->GetRuntimeDb();

examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "FairMQSimDevice.h"
1616

17+
#include "FairExampleRunSim.h"
1718
#include "FairModule.h"
1819
#include "FairParSet.h"
1920
#include "FairPrimaryGenerator.h"
@@ -44,7 +45,7 @@ FairMQSimDevice::FairMQSimDevice()
4445

4546
void FairMQSimDevice::InitTask()
4647
{
47-
fRunSim = std::make_unique<FairRunSim>();
48+
fRunSim = std::make_unique<FairExampleRunSim>(fTransportName.c_str());
4849

4950
SetupRunSink(*fRunSim);
5051

@@ -56,7 +57,6 @@ void FairMQSimDevice::InitTask()
5657
rtdb->setSecondInput(fSecondParameter);
5758
}
5859

59-
fRunSim->SetName(fTransportName.c_str());
6060
// fRunSim->SetSimulationConfig(new FairVMCConfig());
6161
fRunSim->SetIsMT(kFALSE);
6262

examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "FairMQTransportDevice.h"
1616

17+
#include "FairExampleRunSim.h"
1718
#include "FairGenericStack.h"
1819
#include "FairMCApplication.h"
1920
#include "FairMCSplitEventHeader.h"
@@ -65,7 +66,7 @@ void FairMQTransportDevice::Init()
6566

6667
void FairMQTransportDevice::InitTask()
6768
{
68-
fRunSim = std::make_unique<FairRunSim>();
69+
fRunSim = std::make_unique<FairExampleRunSim>(fTransportName.c_str());
6970

7071
fMCSplitEventHeader = new FairMCSplitEventHeader(fRunId, 0, 0, 0);
7172
fRunSim->SetMCEventHeader(fMCSplitEventHeader);
@@ -81,8 +82,6 @@ void FairMQTransportDevice::InitTask()
8182
rtdb->setSecondInput(fSecondParameter);
8283
}
8384

84-
fRunSim->SetName(fTransportName.c_str());
85-
8685
if (fUserConfig.Length() > 0)
8786
fRunSim->SetUserConfig(fUserConfig);
8887
if (fUserCuts.Length() > 0)

examples/advanced/Tutorial3/macro/run_sim.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@ void run_sim(Int_t nEvents = 100, TString mcEngine = "TGeant4")
3232
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());
3333

3434
// create Instance of Run Manager class
35-
FairRunSim run{};
35+
FairExampleRunSim run{mcEngine};
3636
run.SetUseFairLinks(kTRUE);
3737
// FairLinkManager::Instance()->AddIncludeType(0);
3838
// set the MC version used
3939
// ------------------------
4040

41-
run.SetName(mcEngine);
42-
4341
TString outFile = "data/testrun_";
4442
outFile = outFile + mcEngine + ".root";
4543

examples/advanced/Tutorial3/macro/run_sim_sep.C

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@ void run_sim_sep(Int_t fileId, Int_t nEvents = 1000, TString mcEngine = "TGeant3
3030
gSystem->Setenv("CONFIG_DIR", tut_configdir.Data());
3131

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

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

examples/advanced/propagator/macros/runMC.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ int runMC(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
5555
// ------------------------------------------------------------------------
5656

5757
// ----- Create simulation run ----------------------------------------
58-
FairRunSim run{};
59-
run.SetName(mcEngine); // Transport engine
58+
FairExampleRunSim run{mcEngine};
6059
// run.SetSimulationConfig(new FairVMCConfig());
6160
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
6261
run.SetSink(std::make_unique<FairRootFileSink>(outFile));

examples/advanced/propagator/macros/runMM.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
4747
// ------------------------------------------------------------------------
4848

4949
// ----- Create simulation run ----------------------------------------
50-
FairRunSim run{};
51-
run.SetName(mcEngine); // Transport engine
50+
FairExampleRunSim run{mcEngine};
5251
// run.SetSimulationConfig(new FairVMCConfig());
5352
run.SetIsMT(isMT); // Multi-threading mode (Geant4 only)
5453
run.SetSink(new FairRootFileSink(outFile)); // Output file

examples/common/mcstack/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
set(target ExMCStack)
1010

1111
set(sources
12+
FairExampleRunSim.cxx
1213
FairMCTrack.cxx
1314
FairStack.cxx
1415
)
@@ -45,7 +46,7 @@ target_link_libraries(${target}
4546

4647
fairroot_target_root_dictionary(${target}
4748
HEADERS ${headers}
48-
LINKDEF MCStackLinkDef.h
49+
LINKDEF LinkDef.h
4950
EXTRA_INCLUDE_DIRS ${CMAKE_INSTALL_FULL_INCLUDEDIR}
5051
)
5152

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/********************************************************************************
2+
* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3+
* *
4+
* This software is distributed under the terms of the *
5+
* GNU Lesser General Public Licence (LGPL) version 3, *
6+
* copied verbatim in the file "LICENSE" *
7+
********************************************************************************/
8+
9+
#include "FairExampleRunSim.h"
10+
11+
FairExampleRunSim::FairExampleRunSim(const char* mcEngine)
12+
: FairRunSim()
13+
{
14+
SetName(mcEngine);
15+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/********************************************************************************
2+
* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3+
* *
4+
* This software is distributed under the terms of the *
5+
* GNU Lesser General Public Licence (LGPL) version 3, *
6+
* copied verbatim in the file "LICENSE" *
7+
********************************************************************************/
8+
#ifndef FAIREXAMPLERUNSIM_H
9+
#define FAIREXAMPLERUNSIM_H
10+
11+
#include "FairRunSim.h"
12+
13+
/**
14+
* \brief RunSim with specific behaviour for an experiment
15+
*
16+
* One can derive from the FairRun classes.
17+
* But please only call public APIs from inside any member
18+
* functions.
19+
*/
20+
class FairExampleRunSim : public FairRunSim
21+
{
22+
public:
23+
explicit FairExampleRunSim(const char* mcEngine);
24+
~FairExampleRunSim() override = default;
25+
ClassDefOverride(FairExampleRunSim, 0);
26+
};
27+
28+
#endif

0 commit comments

Comments
 (0)