diff --git a/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx b/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx index 0d7a54ec09..4882b2e9e6 100644 --- a/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx +++ b/examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx @@ -14,6 +14,7 @@ #include "FairMQSimDevice.h" +#include "FairExampleRunSim.h" #include "FairModule.h" #include "FairParSet.h" #include "FairPrimaryGenerator.h" @@ -44,7 +45,7 @@ FairMQSimDevice::FairMQSimDevice() void FairMQSimDevice::InitTask() { - fRunSim = std::make_unique(); + fRunSim = std::make_unique(fTransportName.c_str()); SetupRunSink(*fRunSim); @@ -56,7 +57,6 @@ void FairMQSimDevice::InitTask() rtdb->setSecondInput(fSecondParameter); } - fRunSim->SetName(fTransportName.c_str()); // fRunSim->SetSimulationConfig(new FairVMCConfig()); fRunSim->SetIsMT(kFALSE); diff --git a/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx b/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx index 50dad46f94..173324f79f 100644 --- a/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx +++ b/examples/MQ/pixelSimSplit/src/devices/FairMQTransportDevice.cxx @@ -14,6 +14,7 @@ #include "FairMQTransportDevice.h" +#include "FairExampleRunSim.h" #include "FairGenericStack.h" #include "FairMCApplication.h" #include "FairMCSplitEventHeader.h" @@ -65,7 +66,7 @@ void FairMQTransportDevice::Init() void FairMQTransportDevice::InitTask() { - fRunSim = std::make_unique(); + fRunSim = std::make_unique(fTransportName.c_str()); fMCSplitEventHeader = new FairMCSplitEventHeader(fRunId, 0, 0, 0); fRunSim->SetMCEventHeader(fMCSplitEventHeader); @@ -81,8 +82,6 @@ void FairMQTransportDevice::InitTask() rtdb->setSecondInput(fSecondParameter); } - fRunSim->SetName(fTransportName.c_str()); - if (fUserConfig.Length() > 0) fRunSim->SetUserConfig(fUserConfig); if (fUserCuts.Length() > 0) diff --git a/examples/common/mcstack/CMakeLists.txt b/examples/common/mcstack/CMakeLists.txt index 9cebc30630..0fe55e593f 100644 --- a/examples/common/mcstack/CMakeLists.txt +++ b/examples/common/mcstack/CMakeLists.txt @@ -9,6 +9,7 @@ set(target ExMCStack) set(sources + FairExampleRunSim.cxx FairMCTrack.cxx FairStack.cxx ) diff --git a/examples/common/mcstack/FairExampleRunSim.cxx b/examples/common/mcstack/FairExampleRunSim.cxx new file mode 100644 index 0000000000..381b91a1ec --- /dev/null +++ b/examples/common/mcstack/FairExampleRunSim.cxx @@ -0,0 +1,15 @@ +/******************************************************************************** + * Copyright (C) 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" + +FairExampleRunSim::FairExampleRunSim(const char* mcEngine) + : FairRunSim() +{ + SetName(mcEngine); +} diff --git a/examples/common/mcstack/FairExampleRunSim.h b/examples/common/mcstack/FairExampleRunSim.h new file mode 100644 index 0000000000..fd11b43357 --- /dev/null +++ b/examples/common/mcstack/FairExampleRunSim.h @@ -0,0 +1,28 @@ +/******************************************************************************** + * Copyright (C) 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" * + ********************************************************************************/ +#ifndef FAIREXAMPLERUNSIM_H +#define FAIREXAMPLERUNSIM_H + +#include "FairRunSim.h" + +/** + * \brief RunSim with specific behaviour for an experiment + * + * One can derive from the FairRun classes. + * But please only call public APIs from inside any member + * functions. + */ +class FairExampleRunSim : public FairRunSim +{ + public: + explicit FairExampleRunSim(const char* mcEngine); + ~FairExampleRunSim() override = default; + ClassDefOverride(FairExampleRunSim, 0); +}; + +#endif diff --git a/examples/common/mcstack/LinkDef.h b/examples/common/mcstack/LinkDef.h index bece7e043d..dc9b2f13df 100644 --- a/examples/common/mcstack/LinkDef.h +++ b/examples/common/mcstack/LinkDef.h @@ -1,8 +1,8 @@ /******************************************************************************** - * Copyright (C) 2014 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, * + * This software is distributed under the terms of the * + * GNU Lesser General Public Licence (LGPL) version 3, * * copied verbatim in the file "LICENSE" * ********************************************************************************/ // $Id: ZdcLinkDef.h,v 1.1.1.1 @@ -14,8 +14,8 @@ #pragma link off all classes; #pragma link off all functions; +#pragma link C++ class FairExampleRunSim+; #pragma link C++ class FairStack+; #pragma link C++ class FairMCTrack+; #endif - diff --git a/examples/simulation/Tutorial1/src/CMakeLists.txt b/examples/simulation/Tutorial1/src/CMakeLists.txt index c92cb469fe..76e88e8c2e 100644 --- a/examples/simulation/Tutorial1/src/CMakeLists.txt +++ b/examples/simulation/Tutorial1/src/CMakeLists.txt @@ -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 diff --git a/examples/simulation/Tutorial2/macros/CMakeLists.txt b/examples/simulation/Tutorial2/macros/CMakeLists.txt index 8873b91e40..df1e211938 100644 --- a/examples/simulation/Tutorial2/macros/CMakeLists.txt +++ b/examples/simulation/Tutorial2/macros/CMakeLists.txt @@ -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)