Extended/TestEM3

Geant4 Version: geant4.11.2.1
Operating System: linux

Trying to use extended/electromagnetic/TestEm3 and creating a .mac input deck to run various run options and output in root.

When trying to run different physics the run errors out
→ ***** Illegal application state </testem/phys/addPhysics emstandard_opt3> *****

below the input deck to run ./TestEM3 ebeam3.mac as well as the root input deck to run root plot.c

ebeam3.mac:

Macro file for “TestEm3.cc”

1 layer;

/control/verbose 2
/control/cout/ignoreThreadsExcept 0
/run/verbose 2

/testem/det/setNbOfLayers 100
/testem/det/setNbOfAbsor 1
/testem/det/setAbsor 1 Aluminium 0.01 mm
/testem/det/setSizeYZ 10 cm

/run/setCut 0.005 mm
/testem/phys/addPhysics local
#/testem/phys/addPhysics emstandard_opt3
/run/initialize

/gun/particle e-
/gun/energy 521 keV

/analysis/setFileName ebeam3a
/analysis/h1/set 11 100 0. 100. none

/run/printProgress 200
/run/beamOn 10000

/run/setCut 0.01 mm
/run/initialize

/analysis/setFileName ebeam3b
/analysis/h1/set 11 100 0. 100. none

/run/beamOn 10000

the next line is causing the problem?

/testem/phys/addPhysics emstandard_opt3
#/testem/phys/addPhysics local
/run/physicsModified
/run/initialize

/analysis/setFileName ebeam3c
/analysis/h1/set 11 100 0. 100. none

/run/beamOn 10000

plot.c:
void plot()
{
TFile* file1 = new TFile(“ebeam3a.root”,“READ”);
TH1F* hist1 = (TH1F*)file1->Get(“11”);
TFile* file2 = new TFile(“ebeam3b.root”,“READ”);
TH1F* hist2 = (TH1F*)file2->Get(“11”);
TFile* file3 = new TFile(“ebeam3c.root”,“READ”);
TH1F* hist3 = (TH1F*)file3->Get(“11”);
hist1->SetStats(0);
hist1->SetLineColor(kGreen);
hist1->Draw();
hist2->SetLineColor(kRed);
hist2->Draw(“same”);
hist3->SetLineColor(kBlue);
hist3->Draw(“same”);
}

You can only modify the physics list before the very first /run/initialize (more technically, at the Preinit state). Once that has happened, the physics list is “frozen.” You can enable/disable processes, but you can’t change what processes were instantiated in the first place.

Thank you for the confirmation - I was afraid that might be the answer