Skip to content

Commit

Permalink
Introduce FairExampleRunSim
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianTackeGSI committed Jul 21, 2023
1 parent 141968e commit 97e8761
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 10 deletions.
4 changes: 2 additions & 2 deletions examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "FairMQSimDevice.h"

#include "FairExampleRunSim.h"
#include "FairModule.h"
#include "FairParSet.h"
#include "FairPrimaryGenerator.h"
Expand Down Expand Up @@ -44,7 +45,7 @@ FairMQSimDevice::FairMQSimDevice()

void FairMQSimDevice::InitTask()
{
fRunSim = std::make_unique<FairRunSim>();
fRunSim = std::make_unique<FairExampleRunSim>(fTransportName.c_str());

SetupRunSink(*fRunSim);

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "FairMQTransportDevice.h"

#include "FairExampleRunSim.h"
#include "FairGenericStack.h"
#include "FairMCApplication.h"
#include "FairMCSplitEventHeader.h"
Expand Down Expand Up @@ -65,7 +66,7 @@ void FairMQTransportDevice::Init()

void FairMQTransportDevice::InitTask()
{
fRunSim = std::make_unique<FairRunSim>();
fRunSim = std::make_unique<FairExampleRunSim>(fTransportName.c_str());

fMCSplitEventHeader = new FairMCSplitEventHeader(fRunId, 0, 0, 0);
fRunSim->SetMCEventHeader(fMCSplitEventHeader);
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions examples/common/mcstack/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
set(target ExMCStack)

set(sources
FairExampleRunSim.cxx
FairMCTrack.cxx
FairStack.cxx
)
Expand Down
15 changes: 15 additions & 0 deletions examples/common/mcstack/FairExampleRunSim.cxx
Original file line number Diff line number Diff line change
@@ -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);
}
28 changes: 28 additions & 0 deletions examples/common/mcstack/FairExampleRunSim.h
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions examples/common/mcstack/LinkDef.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

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

0 comments on commit 97e8761

Please sign in to comment.