Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the depracated warning when using gconfig.C #1011

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ set(FAIRROOT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES}
)
set(PROJECT_LIBRARY_PROPERTIES ${FAIRROOT_LIBRARY_PROPERTIES})

find_package2(PUBLIC yaml-cpp)
find_package2(PUBLIC yaml-cpp REQUIRED)
# Workaround missing exported include directories
# Upstream has fixed this in https://github.com/jbeder/yaml-cpp/commit/ab5f9259a4e67d3fe0e4832bd407a9e596e2d884 (since 0.6.3)
if(yaml-cpp_FOUND)
Expand Down
5 changes: 5 additions & 0 deletions base/sim/FairGenericVMCConfig.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ FairGenericVMCConfig::FairGenericVMCConfig()
, fPostInitName("g4ConfigPostInit.C")
{}

FairGenericVMCConfig::FairGenericVMCConfig(const FairGenericVMCConfig& config)
: fPostInitFlag(config.fPostInitFlag)
, fPostInitName(config.fPostInitName)
{}

FairGenericVMCConfig::~FairGenericVMCConfig() {}

void FairGenericVMCConfig::Setup(const char* mcEngine)
Expand Down
1 change: 1 addition & 0 deletions base/sim/FairGenericVMCConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class FairGenericVMCConfig
{
public:
FairGenericVMCConfig();
FairGenericVMCConfig(const FairGenericVMCConfig& config);
virtual ~FairGenericVMCConfig();

virtual void Setup(const char* mcEngine);
Expand Down
4 changes: 1 addition & 3 deletions base/steer/FairRunSim.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ FairRunSim::FairRunSim(Bool_t isMaster)
, fUserCuts("SetCuts.C")
, fIsMT(kFALSE)
, fImportTGeoToVMC(kTRUE)
, fSimulationConfig(nullptr)

{
if (fginstance) {
Fatal("FairRun", "Singleton instance already exists.");
Expand Down Expand Up @@ -290,7 +288,7 @@ void FairRunSim::SetMCConfig()
fSimSetup();
} else {
if (fSimulationConfig == nullptr) // RKRKRK COMMENT
fSimulationConfig = new FairGenericVMCConfig();
fSimulationConfig = std::make_unique<FairGenericVMCConfig>();
fSimulationConfig->Setup(GetName());
}

Expand Down
16 changes: 8 additions & 8 deletions base/steer/FairRunSim.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
#ifndef FAIRRUNSIM_H
#define FAIRRUNSIM_H

#include "FairIon.h" // for FairIon
#include "FairMCApplication.h" // for FairMCApplication
#include "FairParticle.h" // for FairParticle
#include "FairRun.h" // for FairRun
#include "FairGenericVMCConfig.h" // for FairGenericVMCConfig
#include "FairIon.h" // for FairIon
#include "FairMCApplication.h" // for FairMCApplication
#include "FairParticle.h" // for FairParticle
#include "FairRun.h" // for FairRun

#include <Rtypes.h> // for Bool_t, Double_t, Int_t, etc
#include <TMCtls.h> // for multi-threading
Expand All @@ -24,7 +25,6 @@ class FairMCEventHeader;
class FairMesh;
class FairModule;
class FairPrimaryGenerator;
class FairGenericVMCConfig;

/**
* Configure the Simulation session
Expand Down Expand Up @@ -178,8 +178,8 @@ class FairRunSim : public FairRun
fUseSimSetupPostInitFunction = true;
}

void SetSimulationConfig(FairGenericVMCConfig* tconf) { fSimulationConfig = tconf; }
FairGenericVMCConfig* GetSimulationConfig() { return fSimulationConfig; }
void SetSimulationConfig(std::unique_ptr<FairGenericVMCConfig>&& tconf) { fSimulationConfig = std::move(tconf); }
FairGenericVMCConfig* GetSimulationConfig() { return fSimulationConfig.get(); }

void SetIsMT(Bool_t isMT) { fIsMT = isMT; }
Bool_t IsMT() const { return fIsMT; }
Expand Down Expand Up @@ -234,7 +234,7 @@ class FairRunSim : public FairRun
std::function<void()> fSimSetupPostInit; //! /** A user provided function to do sim setup
//! / instead of using macros **/
bool fUseSimSetupPostInitFunction = false;
FairGenericVMCConfig* fSimulationConfig; //! /** Simulation configuration */
std::unique_ptr<FairGenericVMCConfig> fSimulationConfig{}; //! /** Simulation configuration */

ClassDefOverride(FairRunSim, 2);
};
Expand Down
3 changes: 2 additions & 1 deletion examples/MQ/pixelDetector/macros/run_sim.C
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ 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
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions examples/MQ/pixelDetector/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ list(APPEND headers
add_library(${target} SHARED ${sources} ${no_dict_sources} ${headers} ${no_dict_headers})
add_library(FairRoot::${target} ALIAS ${target})
set_target_properties(${target} PROPERTIES ${PROJECT_LIBRARY_PROPERTIES})
set_property(TARGET ${target} PROPERTY POSITION_INDEPENDENT_CODE ON)

target_include_directories(${target} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
Expand All @@ -71,6 +72,7 @@ target_link_libraries(${target} PUBLIC
FairRoot::Gen # FairBoxGenerator
FairRoot::GeoBase
FairRoot::ParBase # FairParGenericSet
FairRoot::ExGConfig
FairRoot::ExMCStack
FairRoot::ExPassive # FairCave
FairRoot::FairMQ
Expand All @@ -84,6 +86,7 @@ target_link_libraries(${target} PUBLIC
ROOT::Physics
ROOT::Geom
ROOT::Hist

${VMCLIB}
)

Expand Down
12 changes: 7 additions & 5 deletions examples/MQ/pixelDetector/src/devices/FairMQSimDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "FairPrimaryGenerator.h"
#include "FairRunSim.h"
#include "FairRuntimeDb.h"
#include "FairVMCConfig.h"

#include <TCollection.h>
#include <TList.h>
Expand Down Expand Up @@ -59,7 +60,7 @@ void FairMQSimDevice::InitTask()
}

fRunSim->SetName(fTransportName.data());
// fRunSim->SetSimulationConfig(new FairVMCConfig());
fRunSim->SetSimulationConfig(std::make_unique<FairVMCConfig>());
fRunSim->SetIsMT(kFALSE);

if (fUserConfig.Length() > 0)
Expand Down Expand Up @@ -87,10 +88,11 @@ void FairMQSimDevice::InitializeRun()
// ----- ask the fParamMQServer ------------------------------------
// ----- receive the run number and sampler id ---------------------
std::string* askForRunNumber = new std::string("ReportSimDevice");
auto req(NewMessage(const_cast<char*>(askForRunNumber->c_str()),
askForRunNumber->length(),
[](void* /*data*/, void* object) { delete static_cast<std::string*>(object); },
askForRunNumber));
auto req(NewMessage(
const_cast<char*>(askForRunNumber->c_str()),
askForRunNumber->length(),
[](void* /*data*/, void* object) { delete static_cast<std::string*>(object); },
askForRunNumber));
auto rep(NewMessage());

unsigned int runId = 0;
Expand Down
1 change: 1 addition & 0 deletions examples/advanced/Tutorial3/macro/run_sim.C
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ void run_sim(Int_t nEvents = 100, TString mcEngine = "TGeant3")
// ------------------------

fRun->SetName(mcEngine);
fRun->SetSimulationConfig(std::make_unique<FairVMCConfig>());

TString outFile = "data/testrun_";
outFile = outFile + mcEngine + ".root";
Expand Down
1 change: 1 addition & 0 deletions examples/advanced/Tutorial3/macro/run_sim_sep.C
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void run_sim_sep(Int_t fileId, Int_t nEvents = 1000, TString mcEngine = "TGeant3
// ------------------------

fRun->SetName(mcEngine);
fRun->SetSimulationConfig(std::make_unique<FairVMCConfig>());

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
4 changes: 2 additions & 2 deletions examples/advanced/propagator/macros/runMC.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ int runMC(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
// run->SetSimulationConfig(new FairVMCConfig());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions examples/advanced/propagator/macros/runMM.C
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
// run->SetSimulationConfig(new FairVMCConfig());
run->SetSimulationConfig(make_unique<FairVMCConfig>());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(new FairRootFileSink(outFile)); // Output file
FairRuntimeDb* rtdb = run->GetRuntimeDb();
Expand Down Expand Up @@ -74,7 +74,7 @@ int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
FairBoxGenerator* pionBoxGen = new FairBoxGenerator(211, 2);

pionBoxGen->SetThetaRange(0, 30);
pionBoxGen->SetPRange(1.,3.);
pionBoxGen->SetPRange(1., 3.);

pionBoxGen->SetPhiRange(0., 360.); // 10.,10. when looking for PCA
pionBoxGen->SetDebug(kTRUE);
Expand All @@ -84,7 +84,7 @@ int runMM(Int_t nEvents = 1000, TString mcEngine = "TGeant4", Bool_t isMT = fals
FairBoxGenerator* muonBoxGen = new FairBoxGenerator(13, 2);

muonBoxGen->SetThetaRange(0, 30);
muonBoxGen->SetPRange(1.,3.);
muonBoxGen->SetPRange(1., 3.);
muonBoxGen->SetPhiRange(0., 360.); // 10.,10. when looking for PCA
muonBoxGen->SetDebug(kTRUE);

Expand Down
6 changes: 3 additions & 3 deletions examples/simulation/Tutorial1/macros/run_tutorial1.C
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ void run_tutorial1(Int_t nEvents = 10,
// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
FairGenericVMCConfig* config = new FairGenericVMCConfig();
std::unique_ptr<FairVMCConfig> config = std::make_unique<FairVMCConfig>();
if (loadPostInitConfig)
config->UsePostInitConfig();
run->SetSimulationConfig(config);
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSimulationConfig(move(config));
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
11 changes: 7 additions & 4 deletions examples/simulation/Tutorial1/macros/run_tutorial1_binary.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* copied verbatim in the file "LICENSE" *
********************************************************************************/

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <iostream>
#include "FairBoxGenerator.h"
#include "FairCave.h"
#include "FairParRootFileIo.h"
Expand All @@ -17,10 +15,14 @@
#include "FairSimConfig.h"
#include "FairSystemInfo.h"
#include "FairTutorialDet1.h"
#include "FairVMCConfig.h"

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

#if !defined(__CLING__) || defined(__ROOTCLING__)
#include <iostream>

using std::cout;
using std::endl;
#endif
Expand Down Expand Up @@ -77,8 +79,9 @@ 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)
run.SetName(config.GetEngine()); // Transport engine
run.SetSimulationConfig(std::make_unique<FairVMCConfig>());
run.SetIsMT(config.IsMultiThreaded()); // Multi-threading mode (Geant4 only)
run.SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run.GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion examples/simulation/Tutorial1/macros/run_tutorial1_fastsim.C
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ void run_tutorial1_fastsim(Int_t nEvents = 10, TString mcEngine = "TGeant3", Boo

// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
run->SetName(mcEngine); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(new FairRootFileSink(outFile)); // Output file
FairRuntimeDb* rtdb = run->GetRuntimeDb();
Expand Down
3 changes: 2 additions & 1 deletion examples/simulation/Tutorial1/macros/run_tutorial1_mesh.C
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ void run_tutorial1_mesh(Int_t nEvents = 10, TString mcEngine = "TGeant3")

// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
run->SetName(mcEngine); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
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 @@ -68,9 +68,10 @@ void run_tutorial1_pythia6(Int_t nEvents = 10, TString mcEngine = "TGeant3")

// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
run->SetName(mcEngine); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
run->SetPythiaDecayer(pythia6Config); // Define Pythia6 as decayer
run->SetPythiaDecayer(pythia6Config); // Define Pythia6 as decayer

FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
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 @@ -67,9 +67,10 @@ void run_tutorial1_pythia8(Int_t nEvents = 10, TString mcEngine = "TGeant3")

// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
run->SetName(mcEngine); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
run->SetPythiaDecayer(pythia8Config); // Define Pythia8 as decayer
run->SetPythiaDecayer(pythia8Config); // Define Pythia8 as decayer

FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion examples/simulation/Tutorial1/macros/run_tutorial1_urqmd.C
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ void run_tutorial1_urqmd(Int_t nEvents = 2, TString mcEngine = "TGeant3")

// ----- Create simulation run ----------------------------------------
FairRunSim* run = new FairRunSim();
run->SetName(mcEngine); // Transport engine
run->SetName(mcEngine); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions examples/simulation/Tutorial1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ target_link_libraries(${target} PUBLIC
FairRoot::FairTools # FairLogger
FairRoot::FairFastSim
FairRoot::ParBase
FairRoot::ExGConfig
FairRoot::ExPassive
FairRoot::ExMCStack
FairRoot::Gen
Expand Down
3 changes: 2 additions & 1 deletion examples/simulation/Tutorial2/macros/run_background.C
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ void run_background(Int_t nEvents = 130)

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName("TGeant4"); // Transport engine
run->SetName("TGeant4"); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion examples/simulation/Tutorial2/macros/run_signal.C
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ void run_signal(Int_t fileNr, Int_t nEvents = 10)

// ----- Create simulation run ----------------------------------------
auto run = std::make_unique<FairRunSim>();
run->SetName("TGeant4"); // Transport engine
run->SetName("TGeant4"); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
5 changes: 3 additions & 2 deletions examples/simulation/Tutorial2/macros/run_tutorial2.C
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ 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)
run->SetName(mcEngine); // Transport engine
run->SetSimulationConfig(std::make_unique<FairVMCConfig>());
run->SetIsMT(isMT); // Multi-threading mode (Geant4 only)
run->SetSink(std::make_unique<FairRootFileSink>(outFile));
FairRuntimeDb* rtdb = run->GetRuntimeDb();
// ------------------------------------------------------------------------
Expand Down
40 changes: 40 additions & 0 deletions examples/simulation/Tutorial4/gconfig/g3Config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
G3_TRIG: 1
G3_SWIT: [4, 100]
G3_DEBU: [0, 0, 1]
G3_RAYL: 1
G3_STRA: 1
G3_AUTO: 0 #Select automatic STMIN etc... calc. (AUTO 1) or manual (AUTO 0)
G3_ABAN: 0 #Restore 3.16 behaviour for abandoned tracks
G3_OPTI: 2 #Select optimisation level for GEANT geometry searches (0,1,2)
G3_ERAN: 5.e-7
G3_CKOV: 1 #Cerenkov photons

MonteCarlo_Process:
PAIR: 1 #pair production
COMP: 1 #Compton scattering
PHOT: 1 #photo electric effect
PFIS: 0 #photofission
DRAY: 1 #delta-ray
ANNI: 1 #annihilation
BREM: 1 #bremsstrahlung
HADR: 1 #hadronic process
MUNU: 1 #muon nuclear interaction
DCAY: 1 #decay
LOSS: 1 #energy loss
MULS: 0 #multiple scattering

MonteCarlo_Cut:
CUTGAM: 1.0E-3 #gammas (GeV)
CUTELE: 1.0E-3 #electrons (GeV)
CUTNEU: 1.0E-3 #neutral hadrons (GeV)
CUTHAD: 1.0E-3 #charged hadrons (GeV)
CUTMUO: 1.0E-3 #muons (GeV)
BCUTE: 1.0E-3 #electron bremsstrahlung (GeV)
BCUTM: 1.0E-3 #muon and hadron bremsstrahlung (GeV)
DCUTE: 1.0E-3 #delta-rays by electrons (GeV)
DCUTM: 1.0E-3 #delta-rays by muons (GeV)
PPCUTM: 1.0E-3 #direct pair production by muons (GeV)
TOFMAX: 1.E10 #time of flight cut in seconds

FairStack_StoreSecondaries: true
FairStack_MinPoints: 0
Loading